Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(artifacts): keep a member's own name when its logical path is NFC
The inventory stores each member under its NFC spelling for lookup, so
a ZIP member named "café.txt" (decomposed) showed up only as
"café.txt", with nothing in the Evidence that recovers the name the
archive holds. Record that spelling as an occurrence limitation when
NFC changes it, next to the existing note for a stripped "./" prefix.
The check sits where occurrences are built, so it covers every reader.

Fixes #5108
  • Loading branch information
bercedev committed Oct 18, 2026
commit 6a965d117eb95204ab39f0f3b35b02a7cd0c6021
11 changes: 10 additions & 1 deletion src/artifacts/inventory/ArtifactGraphConstruction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import {
artifactEdgeId,
artifactIdForContent,
logicalPathNfc,
occurrenceIdForLocation,
} from "../../domain/artifactIdentity.js";
import type { ArtifactEntry } from "../ArtifactReader.js";
Expand Down Expand Up @@ -108,7 +109,15 @@ export const createOccurrence = (
entry.byteOffset === null || entry.declaredSize === null
? null
: { offset: entry.byteOffset, length: entry.declaredSize },
limitations: [...entry.limitations],
limitations: [
...entry.limitations,
// The logical path is NFC for lookup; keep the member's own spelling.
...(logicalPathNfc(entry.path) === entry.path
? []
: [
`Member name ${JSON.stringify(entry.path)} is not in Unicode NFC; its logical path uses the NFC spelling.`,
]),
],
};
};

Expand Down
20 changes: 20 additions & 0 deletions tests/boundary/filesystem/artifactZipRelativePaths.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ it("retains distinct occurrences when ZIP paths normalize to the same child", as
);
});

it("keeps a decomposed ZIP member name beside its NFC logical path", async () => {
// #5108: lookup uses NFC, but the source spelling must stay recoverable.
const root = await createTestTempDirectory("rea-zip-nfc-name-");
const path = join(root, "decomposed.zip");
await writeOrderedZip(path, ["café.txt", "plain.txt"]);

const inventory = await inventoryArtifact(path);
expect(inventory.occurrences).toContainEqual(
expect.objectContaining({
logical_path: "café.txt",
limitations: [
'Member name "café.txt" is not in Unicode NFC; its logical path uses the NFC spelling.',
],
}),
);
expect(inventory.occurrences).toContainEqual(
expect.objectContaining({ logical_path: "plain.txt", limitations: [] }),
);
});

it.each([".", "././."])(
"rejects a non-directory ZIP entry spelled %s instead of skipping it as a root marker",
async (name) => {
Expand Down
Loading