[CLI] Exclude producer-owned outputs from fileIndex — the artifact indexed itself - #12
Merged
Merged
Conversation
buildFileIndex indexed the artifact the producer was about to write. Run 1 emitted N keys; run 2 emitted N+1, because .agents/workspace.json now existed on disk and the scanner reported it. The material projection therefore changed with no repository change. Consequences: - `generate --check` fails on every repository's first CI run after adoption: generate, commit, then check reports drift on an unchanged tree. - The artifact is self-referential — it indexes its own output, which is not repository evidence. - It converges from run 3 onward, so running generate twice locally hides it entirely. Only generate-then-check exposes it, and that is the CI path. Caught by the META-198 four-path conformance suite on its first run against this producer — exactly the class of defect that suite exists to find. The exclusion covers producer-owned outputs generally: the artifact itself and the configured reportDir, matched exactly or as a directory prefix. A bare substring test would be wrong — `.agents/audit-history-notes.md` is a real repository file that merely shares a prefix, and dropping it would remove evidence a consumer needs. Covered by a test. The parameter is optional, so existing callers are unaffected.
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.
Found by the new four-path producer conformance suite in
workspacejson/standard(META-198) on its first run against this producer.The defect
buildFileIndexindexed the artifact the producer was about to write:The material projection therefore changed with no repository change.
Why it matters more than it looks
generate --checkfails on every repository's first CI run after adoption. Generate, commit, then check → drift reported on an unchanged tree, non-zero exit.generatetwice locally hides it completely. Only generate-then-check exposes it, and that is precisely the CI path.This is exactly the class of defect META-195's own determinism constraint warned about: "any non-determinism makes every run report drift, rewrite the artifact, and break
generate --checkas a CI gate."The fix
buildFileIndextakes an optional list of producer-owned outputs and excludes them — the artifact itself and the configuredreportDir.Matching is exact or directory-prefix, not substring. A bare
includes()would drop.agents/audit-history-notes.md, a real repository file that merely shares a prefix, silently removing evidence a consumer needs. Covered by a test.The parameter is optional, so existing callers are unaffected.
Verification
Conformance suite against this branch: 28/28 green (was 24/28 with 3 failures before the fix — the watched-red receipt).
Note for reviewers
The
hygiene.scannedAtmovement I initially suspected as a second defect was a consequence of this one. Once the index converges, the projection is unchanged, carry-forward works correctly, and runs 3+ are byte-identical. One bug, not two.