Repository navigation
Built-in extractors report their subject's presence - #414
Open
agorischek wants to merge 9 commits into
Open
agorischek wants to merge 9 commits into
agorischek wants to merge 9 commits into
Conversation
Refs #373 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Refs #373 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Refs #373 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Refs #373 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Refs #373 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Refs #373 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Refs #373 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
agorischek
force-pushed
the
extractors/subject-presence-sweep
branch
from
December 5, 2026 02:57
e2e8472 to
7c30fef
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved subject-presence bugs can cause extraction failures, incorrect presence reports, and unknown states across several extractors.
7 open issues
Handle empty asset and project selections explicitly · New Handle empty route selections without unknown presence · New Normalize patterns before selecting matching alternatives · New Skip auxiliary enrichment when the subject is absent · New Handle empty path selections without unknown presence · New Do not fall back to default globs for missing render sources · New Handle empty project lists without unknown presence · New
What changed in this PR
Implements Phase 2 of subject presence, building on #409 so comparisons can distinguish missing subjects from present-but-empty results.
Changes:
- Adds explicit presence reporting across built-in extractors, separating subject anchors from auxiliary inputs.
- Adds SDK discovery/testing helpers, regression coverage, and updated golden fixtures.
- Documents discovery behavior and the one-time extraction digest change.
| File | Description |
|---|---|
| packages/renderers/graph/fixtures/terraform-modules-before.json | Records present Terraform modules. |
| packages/renderers/graph/fixtures/terraform-modules-after.json | Records present Terraform modules. |
| packages/renderers/graph/fixtures/terraform-before.json | Records present infrastructure. |
| packages/renderers/graph/fixtures/terraform-after.json | Records present infrastructure. |
| packages/renderers/graph/fixtures/azure-before.json | Records present Azure resources. |
| packages/renderers/graph/fixtures/azure-after.json | Records present Azure resources. |
| packages/extractors/xcode-modules/tests/project.rs | Tests finalized extraction output. |
| packages/extractors/xcode-modules/tests/fixtures/harbor-app.expected.json | Updates presence golden. |
| packages/extractors/xcode-modules/src/lib.rs | Anchors declared and discovered projects. |
| packages/extractors/workspace-dependencies/tests/managers.rs | Tests finalized extraction output. |
| packages/extractors/workspace-dependencies/tests/fixtures/yarn-classic.expected.json | Updates presence golden. |
| packages/extractors/workspace-dependencies/tests/fixtures/yarn-berry.expected.json | Updates presence golden. |
| packages/extractors/workspace-dependencies/tests/fixtures/pnpm.expected.json | Updates presence golden. |
| packages/extractors/workspace-dependencies/tests/fixtures/pnpm-catalog.expected.json | Updates presence golden. |
| packages/extractors/workspace-dependencies/tests/fixtures/npm.expected.json | Updates presence golden. |
| packages/extractors/workspace-dependencies/tests/fixtures/bun.expected.json | Updates presence golden. |
| packages/extractors/workspace-dependencies/src/lib.rs | Anchors the workspace manifest. |
| packages/extractors/typescript-support/src/lib.rs | Anchors declared TypeScript inputs. |
| packages/extractors/typescript-public-api/src/lib.rs | Marks successful helper output present. |
| packages/extractors/tetragon-policies/tests/fixtures/skipped/expected.json | Updates presence golden. |
| packages/extractors/tetragon-policies/tests/fixtures/library/expected.json | Updates presence golden. |
| packages/extractors/tetragon-policies/tests/fixtures/deployment/before.expected.json | Updates presence golden. |
| packages/extractors/tetragon-policies/tests/fixtures/deployment/after.expected.json | Updates presence golden. |
| packages/extractors/tetragon-policies/tests/fixtures/credentials/monitor.expected.json | Updates presence golden. |
| packages/extractors/tetragon-policies/tests/fixtures/credentials/before.expected.json | Updates presence golden. |
| packages/extractors/tetragon-policies/tests/fixtures/credentials/after.expected.json | Updates presence golden. |
| packages/extractors/tetragon-policies/tests/extractions.rs | Covers subject and auxiliary presence. |
| packages/extractors/tetragon-policies/src/sources.rs | Anchors policy sources and discovery. |
| packages/extractors/tetragon-policies/src/lib.rs | Keeps workload inputs auxiliary. |
| packages/extractors/terraform-modules/tests/modules.rs | Tests finalized extraction output. |
| packages/extractors/terraform-modules/tests/fixtures/network/before.expected.json | Updates presence golden. |
| packages/extractors/terraform-modules/tests/fixtures/network/after.expected.json | Updates presence golden. |
| packages/extractors/terraform-modules/src/lib.rs | Marks repository-wide output present. |
| packages/extractors/terraform-infrastructure/tests/terraform.rs | Tests finalized extraction output. |
| packages/extractors/terraform-infrastructure/tests/fixtures/aws/head.expected.json | Updates presence golden. |
| packages/extractors/terraform-infrastructure/tests/fixtures/aws/base.expected.json | Updates presence golden. |
| packages/extractors/terraform-infrastructure/src/native.rs | Anchors native plans and directories. |
| packages/extractors/terraform-infrastructure/src/lib.rs | Anchors imported plan JSON. |
| packages/extractors/swift-public-api/tests/fixtures/constrained-extensions/package.expected.json | Updates presence golden. |
| packages/extractors/swift-public-api/tests/fixtures/compatibility/after.expected.json | Updates presence golden. |
| packages/extractors/swift-public-api/src/tests.rs | Tests finalized extraction output. |
| packages/extractors/swift-public-api/src/lib.rs | Anchors packages or symbol graphs. |
| packages/extractors/swift-package-dependencies/tests/package.rs | Tests finalized extraction output. |
| packages/extractors/swift-package-dependencies/tests/fixtures/harbor.expected.json | Updates presence golden. |
| packages/extractors/swift-package-dependencies/src/lib.rs | Anchors the declared package input. |
| packages/extractors/spring-di/src/lib.rs | Anchors snapshots and projects. |
| packages/extractors/sdk/tests/source.rs | Tests alternative discovery anchors. |
| packages/extractors/sdk/src/values.rs | Anchors pre-exported database snapshots. |
| packages/extractors/sdk/src/testing.rs | Finalizes test output and checks goldens. |
| packages/extractors/sdk/src/context.rs | Adds alternative-glob presence helper. |
| packages/extractors/sdk/README.md | Documents subject-anchor helpers. |
| packages/extractors/scip-file-references/src/lib.rs | Reports index and indexer presence. |
| packages/extractors/rust-public-api/src/lib.rs | Reports missing manifests and packages. |
| packages/extractors/repository-map/src/lib.rs | Marks repository-wide output present. |
| packages/extractors/renderer-scenarios/src/lib.rs | Marks repository-wide output present. |
| packages/extractors/rails-schema/tests/schema.rs | Checks discovered-schema presence. |
| packages/extractors/rails-schema/src/lib.rs | Anchors declared and discovered schemas. |
| packages/extractors/rails-routes/tests/routes.rs | Covers route-file presence cases. |
| packages/extractors/rails-routes/src/lib.rs | Anchors declared and discovered routes. |
| packages/extractors/prisma-schema/tests/prisma.rs | Covers absent and partial schemas. |
| packages/extractors/prisma-schema/src/lib.rs | Reports absent schema discovery. |
| packages/extractors/openrewrite-data-tables/tests/migration.rs | Tests finalized extraction output. |
| packages/extractors/openrewrite-data-tables/tests/fixtures/junit5-migration/before.expected.json | Updates presence golden. |
| packages/extractors/openrewrite-data-tables/tests/fixtures/junit5-migration/after.expected.json | Updates presence golden. |
| packages/extractors/openrewrite-data-tables/src/lib.rs | Reports declared and discovered table presence. |
| packages/extractors/nuget-dependencies/src/lib.rs | Anchors assets and project discovery. |
| packages/extractors/nestjs-di/src/lib.rs | Reports missing application inputs. |
| packages/extractors/go-public-api/src/lib.rs | Reports module and package-pattern presence. |
| packages/extractors/go-public-api/README.md | Documents absent Go API behavior. |
| packages/extractors/github-agentic-workflows/tests/fixtures/repo-ask/before.expected.json | Updates presence golden. |
| packages/extractors/github-agentic-workflows/tests/fixtures/repo-ask/after.expected.json | Updates presence golden. |
| packages/extractors/github-agentic-workflows/tests/fixtures/public/expected.json | Updates presence golden. |
| packages/extractors/github-agentic-workflows/tests/fixtures/docs-bot/before.expected.json | Updates presence golden. |
| packages/extractors/github-agentic-workflows/tests/fixtures/docs-bot/after.expected.json | Updates presence golden. |
| packages/extractors/github-agentic-workflows/tests/extractions.rs | Covers absent and partial selections. |
| packages/extractors/github-agentic-workflows/src/lib.rs | Anchors workflow globs; rejects empty selections. |
| packages/extractors/github-actions-jobs/tests/fixtures/wide/before.expected.json | Updates presence golden. |
| packages/extractors/github-actions-jobs/tests/fixtures/wide/after.expected.json | Updates presence golden. |
| packages/extractors/github-actions-jobs/tests/fixtures/release/before.expected.json | Updates presence golden. |
| packages/extractors/github-actions-jobs/tests/fixtures/release/after.expected.json | Updates presence golden. |
| packages/extractors/github-actions-jobs/tests/fixtures/pipeline/before.expected.json | Updates presence golden. |
| packages/extractors/github-actions-jobs/tests/fixtures/pipeline/after.expected.json | Updates presence golden. |
| packages/extractors/github-actions-jobs/tests/fixtures/matrix/before.expected.json | Updates presence golden. |
| packages/extractors/github-actions-jobs/tests/fixtures/matrix/after.expected.json | Updates presence golden. |
| packages/extractors/github-actions-jobs/tests/fixtures/many/before.expected.json | Updates presence golden. |
| packages/extractors/github-actions-jobs/tests/fixtures/many/after.expected.json | Updates presence golden. |
| packages/extractors/github-actions-jobs/tests/fixtures/delivery/before.expected.json | Updates presence golden. |
| packages/extractors/github-actions-jobs/tests/fixtures/delivery/after.expected.json | Updates presence golden. |
| packages/extractors/github-actions-jobs/tests/fixtures/delivery/absent.expected.json | Adds absent-workflow golden. |
| packages/extractors/github-actions-jobs/tests/extractions.rs | Tests finalized and absent workflow output. |
| packages/extractors/github-actions-jobs/src/lib.rs | Anchors the workflow file. |
| packages/extractors/dotnet-support/src/lib.rs | Anchors snapshots, projects, and assemblies. |
| packages/extractors/django-schema/src/lib.rs | Checks settings-module presence before Python. |
| packages/extractors/django-schema/Cargo.toml | Adds presence-test dependencies. |
| packages/extractors/command-output/src/lib.rs | Marks command output present. |
| packages/extractors/code-statistics/tests/golden.rs | Tests finalized extraction output. |
| packages/extractors/code-statistics/tests/fixtures/polyglot/expected.json | Updates presence golden. |
| packages/extractors/code-statistics/tests/fixtures/options/expected.json | Updates presence golden. |
| packages/extractors/code-statistics/src/lib.rs | Marks repository-wide output present. |
| packages/extractors/catalog/tests/presence.rs | Checks catalog-wide presence and goldens. |
| packages/extractors/catalog/Cargo.toml | Adds catalog-test dependencies. |
| packages/extractors/cargo-dependencies/src/lib.rs | Anchors metadata or manifests. |
| packages/extractors/azure-what-if/tests/what_if.rs | Tests finalized extraction output. |
| packages/extractors/azure-what-if/tests/fixtures/head/expected.json | Updates presence golden. |
| packages/extractors/azure-what-if/tests/fixtures/base/expected.json | Updates presence golden. |
| packages/extractors/azure-what-if/src/native.rs | Anchors native deployment templates. |
| packages/extractors/azure-what-if/src/lib.rs | Anchors imported what-if results. |
| docs/design/proposals/subject-presence.md | Records Phase 2 implementation. |
| docs/contracts/extractions.md | Documents built-in presence guarantees. |
| docs/builtins/extractors/go-public-api.md | Clarifies absent-module output. |
| changelog.d/414.md | Records behavior and digest changes. |
| Cargo.lock | Locks added test dependencies. |
Review effort: Balanced
- subject_matches_any normalizes alternatives as subject_matches anchors them. - nuget, rails-routes, xcode and tetragon reject an empty selection, which checked no anchor. - tetragon carries presence out of its sources: an absent policy set gains no agent, kernel or workload enrichment, and a missing chart or kustomization no longer falls through to the default globs. Refs #373 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What changed
Stacked on #409 (base
schema/subject-presence). It will be retargeted tomainafter #409 merges. This is Phase 2 of the subject-presence design. Refs #373.Every built-in extractor now writes
presenceexplicitly on every path, with both values:subject_exists/subject_matches: github-actions-jobs, cargo-dependencies, rust/swift/go public API, swift-package-dependencies, workspace-dependencies, nestjs-di, spring-di, dotnet-support (dotnet-public-api, dotnet-di, efcore-schema), terraform-infrastructure, azure-what-if, scip-file-references, the SDK's pre-exported database snapshot (prisma, rails-schema and django snapshots), prisma-schema, rails-routes, rails-schema, nuget-dependencies, openrewrite-data-tables, xcode-modules, typescript-support/typescript-public-api, tetragon-policies (paths,renderedManifestsPath, helmchart, kustomizepath), github-agentic-workflows and django-schema.input_exists: azuretemplateJsonPath, tetragonagentValuesPath/kernelProfilesPath/workloadPaths/crdPath/helmvalues, rails-schema inflections.present: the repository-wide extractors (code-statistics, repository-map, terraform-modules, renderer-scenarios) and command-output. terraform-modules reads every.tffile through include/exclude globs, so it's repository-wide. There is no python-dependencies built-in on this base.presentwhere no anchor is checked: for example, typescript-public-api with no declared paths, a SCIP indexer run at the root, openrewrite tables it discovers itself, go import-path patterns and nestjs's default entry.Context::subject_matches_anyanchors whichever alternative discovery globs match (**/*.csproj/**/*.fsproj/**/*.vbproj,**/*.yaml/**/*.yml), or all of them when none match. A revision that uses only one alternative therefore isn't told the others are missing.testing::extractrunscollectand thenfinish, asservedoes.testing::goldennow rejects an extraction golden withoutpresence.Built-in digests change once, because every extraction gains
presence. The changelog records this under behaviour changes.Behaviour decisions
Each decision picks the least surprising option. An absent subject should never fail a comparison (#326), and a present one should never be reported absent.
pathsglobs, whether declared or the default.github/workflows/*.md, are nowsubject_matchesanchors. They match against candidate workflow files (.mdfiles that aren't a README and aren't excluded).missingInputs, as tetragon already does.paths: []is now an error. It selects nothing, so it's a definition mistake rather than an absence..prismafiles: absent (missingInputs: ["**/*.prisma"]) instead of an error. An error fails every comparison against a revision from before Prisma was adopted, which is the main case this design exists for. A declared folder with no.prismafiles stays an error: the folder exists, so that's a misconfiguration.**/<module path>.pyor**/<module path>/__init__.py) anywhere in the revision. The extraction is absent only when there is none. Matching anywhere in the tree avoids false absences insrc/ormanage.py-relative layouts. The only revisions that change are ones where Python could not have imported the module anyway.**/config/routes.rb), rails-schema (**/db/*schema.rb,**/db/*structure.sql), nuget-dependencies (project files), xcode-modules (**/*.xcodeproj/project.pbxproj) and tetragon's default globs silently returned an empty extraction when they found nothing. They are now absent. openrewrite-data-tables discovery keeps its existing error, because that error deliberately tells you to commit the exported CSVs.packagethat noCargo.tomldeclares is now absent, with the package named inmissingInputs(it was a silent empty extraction).go.modexists. Import-path patterns can't be checked, so they count as present.Evidence
All Rust runs used
CARGO_TARGET_DIR=/tmp/cargo-target. I unset the session's injected git signing configuration for tests that create commits.cargo test -p <crate>for the SDK, the catalog and all 32 changed extractor crates, first withPROJECTIONS_UPDATE_GOLDEN=1(regenerating the goldens and the graph renderer's azure/terraform fixtures) and then without it: passed, 286 tests and 0 failures. After thesubject_matches_anyrefactor, I reran the 7 affected crates: passed, 88 tests and 0 failures.New catalog test,
catalog/tests/presence.rs:absent(orpresentfor the repository-wide ones). Every built-in must have a case.tests/carriespresence: passed.Tests extended with
presenceassertions:tests/prisma.rs, including discovery that finds nothingtests/extractions.rs, including default globstests/managers.rs, through its goldenstests/migration.rs, through its goldensNew tests:
delivery/absent.expected.json, the same test name and path as Absent subjects show as not added yet or removed, not as empty #411's)agentValuesPathstayspresentsubject_matches_anycargo test -p projections-cli --test first_party, with renderer-scenarios skipped locally because it needs the built default comparator: passed. Every other built-in runs identically as a built-in and as a custom__extractcommand.cargo test -p projections-clifor--test artifact --test execution --test extractors --test native: the failure set matches the base branch, run in the same environment. Those failures come from "default comparator module not embedded" (no JS build here) andHOMEbeing unset. The one extra failure,artifact_readers_reject_symlinks_and_special_files, comes frommkfifoon this session's FUSE-mounted worktree; it passes on the same base in/tmp.cargo fmt --all --check: passed. Edited Markdown was formatted withoxfmt0.75.0.cargo clippy --all-targets -- -D warningson the changed crates: clean apart from twounnecessary_to_ownedlints insdk/tests/source.rs(subject_matches(..., &cx.files().unwrap().to_vec())). They come from Extractions report whether their subject is present #409 and are left for that PR.Not run:
tools checkand the JS or browser suites. This session has nonode_modules, and installing them was ruled out to save disk space.Documentation that this change affects is updated, and generated reference
pages are regenerated (
npm run docs:generate). Updated:docs/contracts/extractions.md, the subject-presence proposal (Phase 2 implemented), the SDK and go-public-api READMEs, and the hand-written part ofdocs/builtins/extractors/go-public-api.md. No descriptor changed, so the generated regions are unchanged.Fixes include a regression test.
A changelog fragment at
changelog.d/<this PR's number>.mddescribes whatusers will notice, or the PR has the
no changeloglabel (seechangelog.d/README.md).
No credentials, private source or machine-specific paths are included.