[PR #580] [MERGED] fix(artifacts): retain relative paths in directory identities #2080

Closed
opened 2026-10-16 21:14:01 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/580
Author: @kaoru0822-kitauji
Created: 10/5/2026
Status: ✅ Merged
Merged: 10/5/2026
Merged by: @morluto

Base: main ← Head: fix/artifact-directory-relative-paths


📝 Commits (1)

  • 39322fd fix(artifacts): retain relative paths in directory identities

📊 Changes

2 files changed (+180 additions, -1 deletions)

View changed files

📝 src/application/ArtifactGraphConstruction.ts (+2 -1)
➕ tests/boundary/filesystem/artifactDirectoryIdentity.test.ts (+178 -0)

📄 Description

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/580 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/5/2026 **Status:** ✅ Merged **Merged:** 10/5/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/artifact-directory-relative-paths` --- ### 📝 Commits (1) - [`39322fd`](https://github.com/morluto/rea/commit/39322fd15b63dd5e03d1446835fa7e57f09d861b) fix(artifacts): retain relative paths in directory identities ### 📊 Changes **2 files changed** (+180 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/application/ArtifactGraphConstruction.ts` (+2 -1) ➕ `tests/boundary/filesystem/artifactDirectoryIdentity.test.ts` (+178 -0) </details> ### 📄 Description ## 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. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] 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 - [x] One focused outcome with a Conventional Commit title. - [x] Reason for no linked issue stated. - [x] Regression and compatibility controls included. - [x] Owning contracts/docs remain accurate; generated checks run. - [x] Representative CLI/comparison behavior executed. - [x] Final diff checked for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:14:01 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2080
No description provided.