Repository navigation
Conversation
Reject duplicate normalized destinations before the selected-occurrence map can replace one member with another. Preserve inventory multiplicity and no-overwrite behavior. Fixes morluto#4271
morluto
added a commit
that referenced
this pull request
Oct 15, 2026
Preserve duplicate archive occurrences in inventory and reject an ambiguous materialization before acquiring readers or output resources. Keep path collisions distinct from integrity failures. Refs #4271, #4273 Co-authored-by: Liu Jie <[email protected]>
2 tasks done
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 #4271. Report colliding extraction paths instead of falsely claiming valid ZIP bytes failed integrity verification.
Problem and expected behavior
NFC/NFD-equivalent member names or repeated identical names can be valid ZIP entries with different bytes. Inventory retains both occurrences, but extraction's path-keyed Map silently replaced one with the other and verified the first member against the second member's digest. Both integrity policies then failed with an ineffective
record-and-continueretry suggestion.Extraction should refuse the shared destination path without declaring the archive corrupt or overwriting either entry.
Change and scope
Check uniqueness while constructing the selected-path Map, before acquiring the materialization reader or output root. Reuse
ArtifactReaderFailure("path", ...)with the normalized path and an explanation that multiple occurrences cannot occupy one destination.The inventory registry still permits repeated occurrences. Nested active-entry filtering, exact byte/hash verification, cancellation, cleanup and exclusive output creation are unchanged. No suffixing, overwrite option or new schema is introduced.
Contract and boundary impact
ArtifactExtraction.materializeSelection.reason: "path"with a useful message.Expected effects:
The checked write effect is the existing extraction of files; this change adds no execution or network authority.
Evidence and regression coverage
Executed on Linux with Node 24.18.0 / npm 11.16.0, base
6183544e8b42b65feaf4f674f860b1fb3b0c95eb:testzip()andunzip -t. Public CLI extraction originally reports falsereason: "integrity"under both policies; after the fix both reportreason: "path", no integrity-policy retry, and no residual output.Artifact extraction path collision: "café.txt". Multiple selected occurrences share this normalized logical path; they cannot be materialized at the same destination path, even when the archive is valid. Inventory retains each occurrence.reason: "format"/ZIP archive is malformed: Invalid CRC32refusal under both policies.For evidence-bearing changes:
Validation performed
npm run test:focused -- tests/acceptance/artifactZipExtractionPaths.test.ts tests/acceptance/artifactZipCurrentDirectory.test.ts tests/boundary/filesystem/artifactZipIntegrity.test.ts tests/boundary/providers/native/artifactProvider.extraction.test.ts tests/boundary/providers/native/artifactProvider.extractionCompleteness.test.ts tests/boundary/providers/native/artifactProvider.cleanupRetry.test.ts tests/boundary/providers/native/artifactProvider.archiveSafety.test.ts— 41 passed across 7 files, including no-overwrite, cancellation, nested-content and cleanup controls.npm run check:fastandnpm run check— passed; lint reports zero errors and existing warnings.npm run verify:test-discovery— all 1,377 files discovered exactly once.git diff --checkand normal pre-commit formatting/lint hooks — passed.Compatibility, safety, and release
Author readiness
Human owner: @maxazure