Repository navigation
fix(artifacts): never count occurrences on an unknown duplicate path as unchanged - #4100
Merged
Merged
Conversation
…as unchanged Artifact comparison subtracted change rows from the left occurrence count to derive summary.unchanged. A duplicate logical path produces one unknown row that stands for every occurrence on that path, so the extra occurrences were reported as affirmatively unchanged. The summary now counts only left occurrences on paths without a left-side change row. Fixes #3956 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryFixes
Reviews (1) · Last reviewed commit: "fix(artifacts): never count occurrences ..." · Reviewed by Greptile |
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.
Summary
Fixes #3956. Artifact comparison over-reported
summary.unchangedwhen an inventory contained duplicate logical paths. Oneunknownchange row stands for every occurrence on a duplicate path, but the summary subtracted only one per row. The remaining duplicate occurrences were reported as affirmatively unchanged. Now only occurrences on paths with no left-side change count as unchanged.Problem and expected behavior
summarize(src/domain/artifactComparison.ts) computedunchangedas left occurrence count − removed − changed − contradiction − unknown, counting change rows. Change rows are keyed bylogical_path, and duplicate paths cannot be paired, so they produce a singleunknownrow with null occurrence IDs.I reproduced this with the issue's script: a CLI inventory of a ZIP whose central directory repeats
x.txt, compared with itself over stdio MCP:.,neighbor.txt,x.txt,x.txt(duplicate)unchanged: 3,unknown: 1unchanged: 2,unknown: 1.,neighbor.txt,x.txt,y.txt(control)unchanged: 4,unknown: 0Only
.andneighbor.txtare affirmatively unchanged, as the issue expects.summary.unknownkeeps its existing per-path aggregation; the issue does not require a policy change there.Change and scope
summarizenow counts left occurrences whoselogical_pathhas no change row other thanadded(addedrows have no left occurrence).Math.max(0, …)clamp is gone: the new count cannot go negative.Contract and boundary impact
Semantic owner and earliest changed stage: the comparison summary, in
summarize.Contribution scope fit and linked maintainer decision: a bug fix within existing behavior; not applicable.
CLI and MCP/tool-catalog contract: schema unchanged.
Provider, bridge, target-format, or platform compatibility: provider-independent.
Evidence, artifact, provenance, or reconstruction contract:
unchangedno longer counts occurrences whose pairing is unknown.Target selection, authority, upstream behavior, and cleanup details: not applicable.
Generated metadata, package, or installation impact: none.
Read existing files or captured data.
Evidence and regression coverage
tests/boundary/filesystem/artifactComparison.test.ts, in the existing duplicate-ZIP pages test, now asserts exact summaries.unchanged: 1, unknown: 1.unchanged: 2, unknown: 1.unchanged: 2where 1 is expected) and passes with the fix.compare_artifacts, main vs this PR:KeepingYouAwake.appvs itselfunchanged 404, unknown 6, 47 ms, 9,041-byte replyKeepingYouAwake.appvsXLD.appunchanged 1, added 616, removed 401, changed 8, 68 ms, 1,118,237 bytesThe summaries agree on real bundles without duplicate paths, and timing is unchanged. The new count is a single pass over the left occurrences.
Validation performed
npx vitest run tests/boundary/filesystem/artifactComparison.test.ts tests/boundary/filesystem/artifactComparisonSummary.test.ts tests/boundary/filesystem/artifactDirectoryIdentity.test.ts tests/boundary/mcp/artifactMcp.test.ts src/application/artifacts src/domain/reconstructionVerification.test.ts src/domain/analysisView src/domain/artifactInventoryEvidence.test.ts src/artifacts/inventory— 16 files, 216 passed.npm run check:fast— passed.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.🤖 Generated with Claude Code