Skip to content

fix(artifacts): retain relative paths in directory identities - #580

Merged
morluto merged 1 commit into
morluto:mainfrom
kaoru0822-kitauji:fix/artifact-directory-relative-paths
Oct 5, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
kaoru0822-kitauji:fix/artifact-directory-relative-paths

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Summary

Preserve the complete child path relative to its represented directory when computing virtual-directory identities.

No tracking issue: found during real ZIP inventory/comparison testing; no matching open issue or PR was found.

Problem and expected behavior

A ZIP containing pkg/ and pkg/a/data.txt, without an explicit pkg/a/ entry, attaches the file to the nearest represented directory pkg. The directory hash previously retained only data.txt:

  • Renaming the implicit component a to b with identical file bytes left pkg's verified artifact ID unchanged. compare_artifacts still reported the file removed/added and archive root changed, but incorrectly counted pkg unchanged.
  • With a/data.txt=A and b/data.txt=B, reversing the two file entries changed pkg's identity and produced a spurious directory change.

Change and scope

Use the observed path relative to the represented directory as the existing child-name hash/sort key. This retains missing intermediate path components without synthesizing directory occurrences.

The hash shape and immediate-child names are unchanged. Empty and fully represented directory trees retain their exact existing identities; moving a directory and its contents together remains identity-neutral. Affected directory identities and ancestors change where omitted path components were previously lost.

This is not a general archive-ordering or collation overhaul: the existing localeCompare comparator is retained, including pre-existing equal-collation behavior for distinct unusual names. Late-directory parenting is handled separately in #578. Nested-ASAR parent selection is also unchanged.

Contract and boundary impact

  • Semantic owner and earliest changed stage: application artifact graph construction, virtual-directory hash materialization.
  • CLI and MCP/tool-catalog contract: unchanged schemas/tools; corrected directory artifact IDs and comparison classifications flow through shared inventory.
  • Provider, bridge, target-format, or platform compatibility: real ZIP fixtures tested on Linux; no reader/protocol changes.
  • Evidence, artifact, provenance, or reconstruction contract: preserve observed relative child paths in content-addressed virtual-directory identity; file content digests and occurrences remain unchanged.
  • Process execution, authorization, cleanup, or containment impact: none; no extraction or new execution, and no path-validation change.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

Six real ZIP cases cover implicit-path rename, reversed equal-basename entries, direct/implicit directory relocation, exact pre-fix IDs for ordinary immediate children and empty directories, and nested explicit-directory compatibility.

On unchanged main b225b0f, the two defect regressions fail and four compatibility controls pass. The fixed branch passes all six.

Executed the built inspect-artifact <zip> --format json CLI for four fixtures and passed its unmodified inventory Evidence into the production comparison:

  • implicit-path rename: pkg is changed;
  • reversed equal-basename members: only the raw archive root changes, while pkg and both files remain unchanged.

Independent review found no blocker within this bounded scope.

  • 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

  • Final branch rebased onto main b225b0f; focused regressions also reproduced on that unchanged base.
  • npm run check:pr: static checks passed; 1,851 tests passed, 1 skipped, 40 failed across seven native bridge/lease suites due to sandbox Unix-domain socket listen EPERM. The same seven suites on unchanged b225b0f reproduce 40 failures / 22 passes. This is not a full local test-suite pass.
  • npm run docs:check: passed separately because full-test failures short-circuit this step.
  • npm run check:ci: passed.
  • npm_config_cache=/tmp/rea-npm-cache npm run verify:package: passed, including packaged CLI/MCP checks.
  • npm pack --dry-run --cache /tmp/rea-npm-cache: passed.
  • Four real CLI inventory/comparison probes: passed on the final build.
  • git diff --check: passed.

Compatibility, safety, and release

No schema, hash-envelope, dependency, or release-metadata changes. Exact legacy identity controls guard unaffected directories. Corrected IDs for omitted-path cases are intentional; no migration command is required.

Real Hopper/Ghidra and native macOS/Windows verification was not run locally. No archive safety, process, authorization, or containment policy is weakened.

Review checklist

  • One focused outcome with a Conventional Commit title.
  • Reason for no linked issue stated.
  • Regression and compatibility controls included.
  • Owning contracts/docs remain accurate; generated checks run.
  • Representative CLI/comparison behavior executed.
  • Final diff checked for secrets, unrelated cleanup, and unsupported claims.

Copy link
Copy Markdown
Collaborator Author

@codex review

@morluto
morluto merged commit 348323d into morluto:main Oct 5, 2026
19 checks passed
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
@morluto morluto added bug Something isn't working area: evidence Evidence, artifacts, and reconstruction labels Oct 14, 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.

2 participants