[PR #583] [MERGED] fix(artifacts): retain expanded ASAR container parents #2084

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

📋 Pull Request Information

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

Base: main ← Head: fix/artifact-expanded-container-parents


📝 Commits (1)

  • 6d251db fix(artifacts): retain expanded ASAR container parents

📊 Changes

3 files changed (+236 additions, -3 deletions)

View changed files

📝 src/application/ArtifactGraphConstruction.ts (+7 -1)
📝 src/application/ArtifactInventory/scanReader.ts (+9 -2)
➕ tests/boundary/filesystem/asarInventoryContainment.test.ts (+220 -0)

📄 Description

Summary

Attach expanded ASAR members to their actual archive occurrence, preserving the archive's file kind and byte-derived identity.

No tracking issue: found during real nested-ASAR inventory testing; no matching dedicated issue or PR was found.

Problem and expected behavior

Inventorying a filesystem application containing resources/app.asar/main.js previously attached main.js and the archive's top-level directories to resources. The expanded ASAR had no child edges. Opening the same ASAR directly produced the correct hierarchy.

The nearest-parent helper accepted directories only, while expanded archives correctly retain entry_kind: "file". This affected occurrence parents, containment edges, enclosing virtual-directory identities, and the parent artifact identified by record-and-continue integrity evidence.

Change and scope

Track the occurrence IDs of containers whose nested reader is actually entered, and admit those IDs alongside real directories when resolving nearest parents against the completed index.

Archive occurrences remain files with byte-derived artifact IDs. A filename, node kind, or format alone does not make an opaque archive a parent. No additional container formats or recursive expansion behavior is introduced.

Built on the now-merged #578 completed-index parent pass. #580 relative-directory hash behavior is retained. No JavaScript resolver/container regression is claimed: that workflow independently preserves the reader's container digest.

Contract and boundary impact

  • Semantic owner and earliest changed stage: application inventory expansion tracking and nearest-parent resolution, before directory identities, occurrence rekeying, edges, and integrity evidence.
  • CLI and MCP/tool-catalog contract: unchanged schemas/tools; corrected containment and integrity-parent references.
  • Provider, bridge, target-format, or platform compatibility: real ASAR/ZIP and filesystem fixtures on Linux; no provider wire changes.
  • Evidence, artifact, provenance, or reconstruction contract: archive/member byte identities remain unchanged; affected virtual-directory/root identities and graph commitments intentionally reflect corrected containment. Integrity mismatch evidence retains its untrusted state and names the actual archive.
  • Process execution, authorization, cleanup, or containment impact: no new execution or expansion permissions; existing reader cleanup, path registration, and fail/record integrity policies remain.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

Eight real boundary tests cover:

  • Expanded ASAR child parents and contains edges, unchanged archive/member byte identities, repeated scans, and direct-root ASAR compatibility.
  • Corrupted packed-member strict rejection and record-and-continue integrity evidence referencing its archive.
  • Valid ASAR bytes, ordinary ASAR-named data, and encrypted ASAR-named ZIP members remaining opaque.
  • Ordinary ASAR-named members inside ASAR remaining opaque.
  • Real directories named .asar, both filesystem and ZIP.
  • Opaque file/child-prefix conflicts in both entry orders.
  • Malformed filesystem archive rejection and unfollowed ASAR symlinks (symlink control skips Windows).

On unchanged baseline f73bb0f, the two defect regressions fail and six controls pass. The fixed combined matrix passes 42/42 (new containment, ASAR freshness, ZIP parenting, relative-directory identity, and JavaScript reconstruction tests).

Executed the built CLI and a real stdio MCP client on an application-bundle fixture: both return Contents/Resources/app.asar/main.js → Contents/Resources/app.asar and the corresponding corrected containment relationships. Native-addon loading was explicitly blocked during these probes; this does not claim native macOS/provider execution.

Independent review found no blocking issues. Additional cancellation-after-hash, rescan, malformed-scan isolation, occurrence-rekey, and corrupted-evidence probes passed.

  • 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 standalone commit based on main 28e0f4e, including #578/#580, upstream setup-fixture corrections, and #581’s ASAR host-path refinements.
  • npm run check:pr: static checks passed; 1,931 tests passed, 1 skipped, 40 failed in seven native bridge/lease suites due to this sandbox's Unix-domain socket listen EPERM. Those unchanged native suites reproduce 40 failures / 22 passes on the base implementation. This is not a full local test-suite pass.
  • npm run docs:check: passed separately because native test failures short-circuit that step.
  • npm run check:ci: passed.
  • npm_config_cache=/tmp/rea-npm-cache npm run verify:package: fails at the unrelated setup-verifier assertion packaged setup did not reject an unsupported host on this Debian host. Reproduced identically on untouched baseline f73bb0f; #581 does not change that verifier or setup classification. Packaged artifact checks before that assertion and direct built CLI/MCP probes ran, but this is not a full package-verifier pass. The setup-verifier classification issue is being handled separately.
  • npm pack --dry-run --cache /tmp/rea-npm-cache: passed.
  • Real built CLI and stdio MCP application-bundle probes: passed, with native-addon loading blocked.
  • git diff --check: passed.
  • Upstream #581's four Windows-lane failures were subsequently corrected by merged #582 while this PR was being published. This PR targets that newer base. Its GitHub merge tree exactly matches a local integration tested with 21 passing ASAR containment/freshness and JavaScript reconstruction tests. All 18 CI jobs subsequently passed, including the actual hosted Windows capability/package lane. The maintainer merged this PR after those checks.

Compatibility, safety, and release

No public schema, dependency, or release-metadata changes. Corrected containment changes affected virtual-directory/root IDs and graph commitments; archive and member content digests are unchanged.

Real Hopper/Ghidra and native Windows/macOS execution were not run locally. No bulk extraction, extension-based parent eligibility, path-validation relaxation, or unrelated cleanup.

Review checklist

  • One focused outcome with a Conventional Commit title.
  • Reason for no linked issue stated.
  • Regression, negative-path, and identity compatibility controls included.
  • Existing contracts/docs remain accurate; generated metadata checks run.
  • Representative real CLI/MCP 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/583 **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-expanded-container-parents` --- ### 📝 Commits (1) - [`6d251db`](https://github.com/morluto/rea/commit/6d251db3e4bcf337e4a680f03c79c483495e0b8c) fix(artifacts): retain expanded ASAR container parents ### 📊 Changes **3 files changed** (+236 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/application/ArtifactGraphConstruction.ts` (+7 -1) 📝 `src/application/ArtifactInventory/scanReader.ts` (+9 -2) ➕ `tests/boundary/filesystem/asarInventoryContainment.test.ts` (+220 -0) </details> ### 📄 Description ## Summary Attach expanded ASAR members to their actual archive occurrence, preserving the archive's file kind and byte-derived identity. No tracking issue: found during real nested-ASAR inventory testing; no matching dedicated issue or PR was found. ## Problem and expected behavior Inventorying a filesystem application containing `resources/app.asar/main.js` previously attached `main.js` and the archive's top-level directories to `resources`. The expanded ASAR had no child edges. Opening the same ASAR directly produced the correct hierarchy. The nearest-parent helper accepted directories only, while expanded archives correctly retain `entry_kind: "file"`. This affected occurrence parents, containment edges, enclosing virtual-directory identities, and the parent artifact identified by record-and-continue integrity evidence. ## Change and scope Track the occurrence IDs of containers whose nested reader is actually entered, and admit those IDs alongside real directories when resolving nearest parents against the completed index. Archive occurrences remain files with byte-derived artifact IDs. A filename, node kind, or format alone does not make an opaque archive a parent. No additional container formats or recursive expansion behavior is introduced. Built on the now-merged #578 completed-index parent pass. #580 relative-directory hash behavior is retained. No JavaScript resolver/container regression is claimed: that workflow independently preserves the reader's container digest. ## Contract and boundary impact - Semantic owner and earliest changed stage: application inventory expansion tracking and nearest-parent resolution, before directory identities, occurrence rekeying, edges, and integrity evidence. - CLI and MCP/tool-catalog contract: unchanged schemas/tools; corrected containment and integrity-parent references. - Provider, bridge, target-format, or platform compatibility: real ASAR/ZIP and filesystem fixtures on Linux; no provider wire changes. - Evidence, artifact, provenance, or reconstruction contract: archive/member byte identities remain unchanged; affected virtual-directory/root identities and graph commitments intentionally reflect corrected containment. Integrity mismatch evidence retains its untrusted state and names the actual archive. - Process execution, authorization, cleanup, or containment impact: no new execution or expansion permissions; existing reader cleanup, path registration, and fail/record integrity policies remain. - Generated metadata, package, or installation impact: none. ## Evidence and regression coverage Eight real boundary tests cover: - Expanded ASAR child parents and contains edges, unchanged archive/member byte identities, repeated scans, and direct-root ASAR compatibility. - Corrupted packed-member strict rejection and record-and-continue integrity evidence referencing its archive. - Valid ASAR bytes, ordinary ASAR-named data, and encrypted ASAR-named ZIP members remaining opaque. - Ordinary ASAR-named members inside ASAR remaining opaque. - Real directories named `.asar`, both filesystem and ZIP. - Opaque file/child-prefix conflicts in both entry orders. - Malformed filesystem archive rejection and unfollowed ASAR symlinks (symlink control skips Windows). On unchanged baseline `f73bb0f`, the two defect regressions fail and six controls pass. The fixed combined matrix passes **42/42** (new containment, ASAR freshness, ZIP parenting, relative-directory identity, and JavaScript reconstruction tests). Executed the built CLI and a real stdio MCP client on an application-bundle fixture: both return `Contents/Resources/app.asar/main.js → Contents/Resources/app.asar` and the corresponding corrected containment relationships. Native-addon loading was explicitly blocked during these probes; this does not claim native macOS/provider execution. Independent review found no blocking issues. Additional cancellation-after-hash, rescan, malformed-scan isolation, occurrence-rekey, and corrupted-evidence probes passed. - [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 standalone commit based on main `28e0f4e`, including #578/#580, upstream setup-fixture corrections, and #581’s ASAR host-path refinements. - `npm run check:pr`: static checks passed; **1,931 tests passed, 1 skipped, 40 failed in seven native bridge/lease suites** due to this sandbox's Unix-domain socket `listen EPERM`. Those unchanged native suites reproduce **40 failures / 22 passes** on the base implementation. This is not a full local test-suite pass. - `npm run docs:check`: passed separately because native test failures short-circuit that step. - `npm run check:ci`: passed. - `npm_config_cache=/tmp/rea-npm-cache npm run verify:package`: fails at the unrelated setup-verifier assertion `packaged setup did not reject an unsupported host` on this Debian host. Reproduced identically on untouched baseline `f73bb0f`; #581 does not change that verifier or setup classification. Packaged artifact checks before that assertion and direct built CLI/MCP probes ran, but this is not a full package-verifier pass. The setup-verifier classification issue is being handled separately. - `npm pack --dry-run --cache /tmp/rea-npm-cache`: passed. - Real built CLI and stdio MCP application-bundle probes: passed, with native-addon loading blocked. - `git diff --check`: passed. - Upstream #581's four [Windows-lane failures](https://github.com/morluto/rea/actions/runs/37332059875/job/111837454985) were subsequently corrected by merged #582 while this PR was being published. This PR targets that newer base. Its GitHub merge tree exactly matches a local integration tested with **21 passing ASAR containment/freshness and JavaScript reconstruction tests**. All 18 CI jobs subsequently passed, including the actual [hosted Windows capability/package lane](https://github.com/morluto/rea/actions/runs/37333999383/job/111844101935). The maintainer merged this PR after those checks. ## Compatibility, safety, and release No public schema, dependency, or release-metadata changes. Corrected containment changes affected virtual-directory/root IDs and graph commitments; archive and member content digests are unchanged. Real Hopper/Ghidra and native Windows/macOS execution were not run locally. No bulk extraction, extension-based parent eligibility, path-validation relaxation, or unrelated cleanup. ## Review checklist - [x] One focused outcome with a Conventional Commit title. - [x] Reason for no linked issue stated. - [x] Regression, negative-path, and identity compatibility controls included. - [x] Existing contracts/docs remain accurate; generated metadata checks run. - [x] Representative real CLI/MCP 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:02 +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#2084
No description provided.