Skip to content

fix(artifacts): keep a member's own name when its logical path is NFC - #5125

Closed
bercedev wants to merge 3 commits into
morluto:mainfrom
bercedev:fix/zip-nfc-member-name
Closed

bercedev wants to merge 3 commits into
morluto:mainfrom
bercedev:fix/zip-nfc-member-name

Conversation

@bercedev

@bercedev bercedev commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #5108.

A ZIP member named café.txt (decomposed) appeared in the inventory only as café.txt, and nothing in the Evidence kept the spelling the archive stores. The NFC logical path stays as it is; the member's own name is now recorded as an occurrence limitation when NFC changes it.

Problem and expected behavior

normalizeArtifactPath applies NFC to every member name when the inventory builds logical paths. That is intended, for lookup, but the source spelling was dropped. The ZIP reader already keeps the original name in a limitation when it strips a leading ./; the NFC change had no equivalent. Expected (from the issue): keep the NFC logical_path and retain the decoded member spelling when normalization changes it.

Change and scope

createOccurrence adds Member name "<name>" is not in Unicode NFC; its logical path uses the NFC spelling. when entry.path differs from its NFC form. It is the one place occurrences are built from reader entries, so the note covers every archive reader, not only ZIP. Names already in NFC get no new limitation. Extraction output names are unchanged.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Ordinary fix within existing boundaries: not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: occurrence construction (createOccurrence in src/artifacts/inventory/ArtifactGraphConstruction.ts), right after normalizeArtifactPath.
  • Contribution scope fit and linked maintainer decision: ordinary fix, not applicable.
  • CLI and MCP/tool-catalog contract: no schema change; one more limitation string on affected occurrences.
  • Provider, bridge, target-format, or platform compatibility: all archive readers that feed the inventory.
  • Evidence, artifact, provenance, or reconstruction contract: the source member spelling is recoverable from Evidence; logical identity is unchanged.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: artifactZipRelativePaths.test.ts, a ZIP with café.txt and plain.txt: the first has logical path café.txt and the new limitation, the second has no limitation.
  • Base reproduction or other evidence: on main the new test fails (no limitation on the decomposed member).
  • User-visible CLI/MCP output (if applicable): not captured; the change is in the inventory Evidence the CLI returns.
  • Remaining proof gaps: the compiled CLI (inspect-artifact --json) was not run; checked through the inventory fixture. Other archive formats were not exercised separately.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

In a Node 24.18.0 container (with procps) and no network, after npm ci:

  • npx vitest run tests/boundary/filesystem src/artifacts src/domain: 6933 passed, 108 failed, 303 skipped. On main, with the new test, 109 failed; the extra failure is the new test, and the other 108 are the same in both runs (release/CI tooling tests that need git, zip and similar tools absent from the container).
  • npx tsc --noEmit: no errors.
  • oxlint on the changed files: 4 warnings, 0 errors, the same 4 as on main.
  • oxfmt --check on the changed files: clean.
  • npm run verify:module-boundaries: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none needed; inventory only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: the limitation repeats a member name the inventory already read; nothing new is read or written.

Author readiness

Human owner: @bercedev

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

Note: I used Claude Code while working on this.

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 morluto#5108
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-18T22:26:54.524404Z 6a965d1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issue was found.

Summary

Adds a note to limitations when a member name differs from its NFC spelling. The existing logical_path and source_path behavior stays unchanged.

  • Inventory occurrences keep member names that NFC changes.

Reviews (4) · Last reviewed commit: "Merge origin/main into fix/zip-nfc-membe..." · Reviewed by Greptile

@x1mm4nu3l

Copy link
Copy Markdown

Verified inspect-artifact ZIP --json on Linux/Node 24.18.0 with both cafe\u0301.txt and caf\u00e9.txt plus plain.txt. Main 4eaf3a1 loses the decomposed spelling; 6a965d1 retains it in nested inventory Evidence. Both normalized names still have distinct occurrence IDs, and only the decomposed member gets the new limitation. All 7 ZIP path tests pass.

Keep this branch's non-NFC member-name limitation beside main's new declared_integrity and format_metadata occurrence fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Merged latest main into this branch (9189099) to clear the merge conflict. No force-push; your commit is untouched.

What changed and why

  • src/artifacts/inventory/ArtifactGraphConstruction.ts: main added optional declared_integrity and format_metadata fields right after limitations in createOccurrence (PyInstaller/Godot PCK work). I kept those fields and your non-NFC member-name limitation exactly as written.

Validation (local macOS, merged head)

  • tsc --noEmit: clean
  • npm run test:focused on artifactZipRelativePaths plus src/artifacts/inventory tests: 43 passed
  • check:fast, format:check: pass

@bercedev

Copy link
Copy Markdown
Contributor Author

Thanks for resolving the conflict and keeping the new declared_integrity / format_metadata fields next to the limitation.

@CassieFox23

CassieFox23 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: The PR's new ZIP test passes on Node 22, 24 and 26 at head 9189099, and it fails on main's code, so it does test the fix. The new case is one test. Main fails it because the member's note is missing. #5127's test for the same issue fails on this head. It fails since it looks for #5127's own wording. That does not mean the spelling is lost.

Results

Check Node 22.23.4 Node 24.22.1 Node 26.12.1
PR's test file artifactZipRelativePaths.test.ts on the PR head (7 tests) 7 passed 7 passed 7 passed
Same file against main's code (6b56ba2) not run 1 failed, 6 passed not run
#5127's test file on this head (2 tests) not run 1 failed, 1 passed not run

Against main. I copied only this PR's test file into a tree of main. The one new test, "keeps a decomposed ZIP member name beside its NFC logical path", fails. The other six tests in the file pass. The failing check is the first one:

AssertionError: expected [ { …(14) }, { …(14) }, { …(14) } ] to deep equally contain ObjectContaining{…}
 ❯ tests/boundary/filesystem/artifactZipRelativePaths.test.ts:43:33

The printout shows main's occurrence for café.txt with "limitations": []. The test expects one note there. So main drops the member's own spelling, and this PR's change adds it. The second check in that test (the plain name keeps an empty limitations list) was not reached, because the first one throws.

#5127's test on this head. This is #5127's test, not this PR's. I took tests/boundary/filesystem/artifactInventoryUnicodeNormalization.test.ts from #5127's head 41cd0eb and ran it on this head, Node 24 only. Its NFC-name test passes. Its NFD-name test fails here:

AssertionError: expected undefined to be defined
 ❯ tests/boundary/filesystem/artifactInventoryUnicodeNormalization.test.ts:40:24

Line 40 is expect(limitation).toBeDefined(). The test looks for a note containing the text "Unicode-normalized to NFC". That text is #5127's wording. This PR's note reads "is not in Unicode NFC", so the search finds nothing. The check before it, that logical_path is the NFC spelling, passed. So this run shows only that the two PRs word the note differently. It does not show whether this fix keeps the spelling in cases that test does not build. This PR's own test shows that it keeps the original spelling, quoted inside the note, for one ZIP member.

My earlier notes on #5127 are here. Which of the two PRs goes in is the maintainers' call.

Not run

  • No mutation check (reverting the source change in the head tree). The fail-on-main run above covers the same question.
  • This PR's test against main's code on Node 22 and 26 (main was run on Node 24 only).
  • fix(artifacts): preserve original Unicode spelling when NFC normalization changes a logical path #5127's test on Node 22 and 26, and on main.
  • Any other test file, or the full test run.
  • No inspect-artifact on a real archive, no folder or ASAR case, and no output size measurement.
  • Main moved to 9bea4d1 during the job. I checked that src/artifacts, src/domain and tests/boundary/filesystem did not change between the two main shas, but I did not rerun on the new main.
Commands

Each run used a fake HOME and npm cache under /tmp/rt-5125-t1 and HUSKY=0. Installs used npm ci --ignore-scripts, then the repo's own npm run prepare, npm run build:cached and npm run test:prepare (all exit 0 in both trees, on Node 24.22.1).

npm run test:focused -- tests/boundary/filesystem/artifactZipRelativePaths.test.ts

Run in the head tree on Node 22.23.4, 24.22.1 and 26.12.1 (each exit 0), then in the main tree on Node 24.22.1 (exit 1). The main tree had only that test file replaced with the PR's copy. ArtifactGraphConstruction.ts in the main tree is identical to main's.

npm run test:focused -- tests/boundary/filesystem/artifactInventoryUnicodeNormalization.test.ts

Run in the head tree on Node 24.22.1 (exit 1) with #5127's file copied in, then removed.

Test setup

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

@CassieFox23 CassieFox23 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TL;DR: Main still drops the spelling of a ZIP member name that NFC normalization changes (issue #5108). This PR adds one note to that occurrence's limitations, and the ZIP test covers it. No test has run on GitHub for this head. Another open PR, #5127, fixes the same issue, and I tested that one.

Edit: This review is out of date at head d8b8f8c. The template parts are back, GitHub's CI has run, and main now keeps the original spelling in source_path. The newer notes are here.

Findings

Should fix

  • The body does not keep the repo template as written. Please restore these parts:
    • The "Follow the contribution scope" paragraph is cut short. The sentence about linking a maintainer scope decision for new providers is gone. So is the sentence about draft PRs.
    • One part lost a line and its three boxes. The part is "Evidence and regression coverage". The line is "For evidence-bearing changes:".
    • The text in parentheses on the "Generated metadata" label is dropped.
    • Every other heading, label and box is there. The author readiness boxes are checked and the text is unchanged. The body adds a closing note about using Claude Code, which is fine.

Worth a look

  • Another open PR fixes the same issue: #5127 by Varshith-Kali. They said on #5108 that they would take it (2026-10-18T22:13:11Z). This PR opened first (22:25:02Z, against 22:40:16Z for #5127). I tested #5127 on 20 Oct and re-read it on 23 Oct. Two points stayed open there: wording for folders and ZIP directory entries, and output size. Both are worth checking here too.
    • Wording. The note says "Member name". DirectoryArtifactReader is also an artifact reader, and every reader's entries go through createOccurrence. A folder on disk is not an archive member. I did not read what names that reader hands over, or run it.
    • Size. The note repeats the member's own path once, escaped. It does this on each occurrence that NFC changes (the new lines). #5127 repeated two paths. This one should add less, but I did not measure it. A long NFD folder name inside a big ASAR would show it.
    • Which of the two PRs goes in is the maintainers' call. The two fixes differ in where they hook in and what the note says.
  • No test has run on GitHub for this head. The CI and PR title runs are action_required, so they never started. The checks that did run are green: Validate author declaration, Greptile Review and PR readiness. A maintainer has to approve the workflow run. I did not confirm why it is waiting. The body says 108 tests also fail in its container, on main and on the PR alike (release tooling that needs git and zip). I did not check that. Thanks, kaoru0822-kitauji, for the focused run (43 passed on macOS, after the merge of main).
  • The new test checks only a top-level ZIP file. The body says the note "covers every archive reader, not only ZIP". That is true of where the code sits: scanReader.ts line 212 hands every reader's entry to createOccurrence. But no test covers a ZIP directory entry, a member inside a nested container, or another reader. ArtifactGraphConstruction.test.ts already builds entries for createOccurrence directly (main lines 78 to 95), so one more case there would be cheap.

Nits

  • The note quotes only the raw member name. It does not say what the NFC spelling is. That is fine, since logical_path carries it. The text "its logical path uses the NFC spelling" is the only pointer.

Looks good

  • Main still has the bug. createOccurrence builds limitations: [...entry.limitations] and nothing else (main line 120). A search for "Unicode NFC" across src found nothing on main.
  • The check compares like with like. scanReader passes the raw entry and the normalized logicalPath (main lines 195 to 215). So entry.path is the spelling the reader gave, and the PR tests it against its NFC form.
  • Identity does not change. The occurrence id still comes from the NFC path, and a name already in NFC gets no new note. The test checks that plain.txt has an empty limitations list.
  • The test's fixture is genuinely decomposed. I checked the code points. The ZIP member has e then U+0301. The expected logical_path has U+00E9. The quoted name in the note has e then U+0301.
  • It is a small diff: 2 files and 31 changed lines (compare API). Thanks to x1mm4nu3l for checking inspect-artifact on Linux with both spellings in one ZIP. That was on the first commit, 6a965d1. They found distinct occurrence ids and a note only on the decomposed member.
  • Greptile scored the head 5/5 (last reviewed 9189099). Codex's review of the first commit failed, so no Codex findings exist for this PR.

Not run

  • No checkout, build, tests or formatter.
  • I did not run inspect-artifact on any archive, and I did not measure output size.
  • I did not read DirectoryArtifactReader beyond confirming that it is an artifact reader.
  • I did not apply the patch to today's main. GitHub reports it as mergeable.

Thanks, bercedev, for the small, careful fix and the clear body.

Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.11
  • Head / base: 9189099 / dcdab56 (merge base); main was 592c46b

🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

@bercedev

Copy link
Copy Markdown
Contributor Author

thanks for testing it on three Node versions and for the detailed read. I restored the template parts you listed: the full contribution scope paragraph, the full "Generated metadata" label, and the "For evidence-bearing changes" line with its boxes. on #5127: agreed, picking between the two is up to the maintainers. if this one is kept, I can add a createOccurrence case in ArtifactGraphConstruction.test.ts for an entry that is not an archive member, and change "Member name" to "Entry name" so the note also reads right for folders.

@baron baron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integration with current main needs correction before this can move forward.

Merging this head into recorded main d361c53c504590b5ec90e9c690b5a2d6ae67cc38 succeeds textually but duplicates the logicalPathNfc import in src/artifacts/inventory/ArtifactGraphConstruction.ts (integration lines 15 and 17). On Node 24.22.1, both artifactZipRelativePaths.test.ts and ArtifactGraphConstruction.test.ts fail to transform with “Identifier logicalPathNfc has already been declared”; no tests execute. The same suites pass on the PR head (35 tests) and main (39 tests). Please reconcile the import against current main and rerun the affected suites on the combined tree.

Main also now retains original NFC-changed names in structured source_path; its existing retention regression passes. Please clarify whether the additional prose limitation is still wanted, or consider this superseded.

Required Static checks, Portable tests, and CI required are currently missing at this head. No real-provider or cross-platform verification was performed. This review is not merge permission.

@bercedev bercedev closed this Oct 24, 2026
@bercedev bercedev reopened this Oct 24, 2026
@bercedev

Copy link
Copy Markdown
Contributor Author

sorry, closed this by accident, reopened. fixing the import conflict now.

Drop the second logicalPathNfc import that the merge brought in.
@bercedev

Copy link
Copy Markdown
Contributor Author

merged current main (d361c53) in d8b8f8c and dropped the duplicate logicalPathNfc import. on the combined tree artifactZipRelativePaths.test.ts and ArtifactGraphConstruction.test.ts pass (40 tests), tsc --noEmit is clean, oxlint shows the same 4 warnings as main.

on the limitation: source_path now keeps what the archive stores, the limitation only says why logical_path differs from it (NFC), like the ./ case already does. if source_path is enough for you I'm fine dropping it and closing this.

@CassieFox23

CassieFox23 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: The PR is the same as before, except one import line, and that fixes baron's duplicate-import point. But main now keeps the original spelling in source_path, and issue #5108 is closed. I did not run any test on my box this time; GitHub's CI is green on this head.

Results

Check At d8b8f8c
Template parts I asked for Restored. I checked the body line by line against the repo template.
baron's duplicate import Fixed. One logicalPathNfc import is left.
baron's two suites on the merged tree Not run by me. GitHub's CI (Linux, Node 24.22.1) passed artifactZipRelativePaths.test.ts (7 tests) and ArtifactGraphConstruction.test.ts (33 tests).
CI on this head It ran: 12 checks passed, 18 were skipped, none failed. On 9189099 it never started.
The patch on today's main (835904e) Applies cleanly in a dry run. No tests ran there.
"Member name" wording for folders Unchanged. bercedev offered "Entry name" only if the PR is kept. The folder reader hands over the name on disk, so a folder would get "Member name". Read, not run.
Output size The name now appears three times on an affected entry: logical_path, source_path and the note. The note is about 75 characters plus the name, 86 for café.txt. Worked out from the message text, not measured.
A test for another reader Not added.

Main already keeps the name. Main's commit bbc7554 adds source_path. It holds the archive's own spelling when NFC changes it. That commit is in this PR's base d361c53 (#6897). It landed after the main I checked on 23 Oct (9bea4d1), so my line "Main still has the bug" no longer holds. Issue #5108 was closed as completed on 24 Oct. Main's test for it is artifactZipIntegrity.test.ts, and GitHub's CI passed it (28 tests) on this head.

The PR's note now repeats the same name in words, plus the reason. baron asked whether the note is still wanted. bercedev answered that dropping it and closing is fine. I found no maintainer reply yet. Which way it goes is the maintainers' call.

Not run

Thanks, bercedev, for the quick fix and the clear answers.

What I checked (no tests)

I read the PR's change and its base with git diff on a read-only mirror. I also compared the PR's own lines at 9189099 and at d8b8f8c. The only difference is the import position.

patch -p1 --dry-run     # the PR's two-file diff against a tree of main 835904e4e
grep -n logicalPathNfc src/artifacts/inventory/ArtifactGraphConstruction.ts

A script compared the PR body with the template at .github/pull_request_template.md. Another script worked out the note length. The CI numbers come from the check runs and job logs on GitHub for d8b8f8c, read through the API. They are GitHub's runs, not mine.

Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.11 (reads and the patch dry run only)
  • Head / base: d8b8f8c / d361c53; main read at 835904e
  • Other: GitHub's CI ran on Ubuntu 26.04 with Node 24.22.1

🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

@morluto

morluto commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Thank you for identifying the lost archive-member spelling. Main now retains the original spelling in the structured source_path field while keeping the NFC logical path, and the ZIP regression covers decomposed, prefixed and unchanged names. That supplies the requested source fact without encoding it in limitation text, so I’m closing this PR as superseded. The #5108 closure records the focused checks; I did not rerun them in this pass.

@morluto morluto closed this Oct 26, 2026
@morluto morluto added area: evidence Evidence, artifacts, and reconstruction bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] inspect-artifact loses original decomposed Unicode member names

6 participants