Skip to content

fix(artifacts): resolve parents after archive enumeration - #578

Merged
morluto merged 1 commit into
morluto:mainfrom
kaoru0822-kitauji:fix/artifact-parent-entry-order
Oct 5, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
kaoru0822-kitauji:fix/artifact-parent-entry-order

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Summary

Resolve artifact containment after reader enumeration so ZIP members can precede their directory entries without corrupting parent relationships or virtual-directory identities.

No tracking issue: found with a valid three-entry ZIP during boundary testing; no matching open issue or PR was found.

Problem and expected behavior

A ZIP ordered pkg/sub/data.txt, pkg/sub/, pkg/ previously attached all three occurrences to the archive root. Both nonempty directories received the empty-directory identity, and inspect-artifact exposed incorrect contains relationships while reporting complete substep coverage.

Archive member order must not determine the nearest represented directory parent. With the fix, the same bytes produce root → pkg → pkg/sub → data.txt.

Change and scope

Resolve occurrence parents against the complete path index after enumeration, before virtual-directory materialization. Per-entry path registration, hashing, safety limits, archive validation, and reader cleanup remain in place.

Missing directory entries are not synthesized. The existing nearest-directory policy and nested-ASAR containment semantics are unchanged. Separate implicit-path identity behavior is outside this fix.

Contract and boundary impact

  • Semantic owner and earliest changed stage: application artifact inventory, after reader enumeration and before directory identities/edges are constructed.
  • CLI and MCP/tool-catalog contract: existing shapes and tools; corrected parent IDs and derived containment relationships.
  • Provider, bridge, target-format, or platform compatibility: real ZIP, filesystem directory, and ASAR fixtures exercised on Linux; no provider protocol changes.
  • Evidence, artifact, provenance, or reconstruction contract: affected directory identities now incorporate their actual represented children; observed entry paths, content digests, and source locations remain intact.
  • Process execution, authorization, cleanup, or containment impact: no new execution or authority; path-validation and archive-safety regressions retained.
  • Generated metadata, package, or installation impact: none; generated-document checks pass.

Evidence and regression coverage

  • Six permutations of parent/subdirectory/file entries, with an explicit empty-directory control.
  • Stable directory identities, sorted occurrence paths, containment edges, and repeat-inventory equality.
  • Implicit-directory cases retain the nearest existing directory or root without synthesizing entries.
  • Duplicate file/directory paths in both orders, case-fold collisions, prefix conflicts, and traversal rejection.
  • Filesystem-directory and real-ASAR compatibility controls; MCP boundary regression.
  • On unchanged main bb91abd, the two new regression files produce 8 failures and 8 passing controls. The focused fixed matrix including existing archive safety and ASAR freshness tests passes 25/25.
  • Executed the built CLI and a real stdio MCP client against the child-first ZIP: both return the corrected parent chain. Independent review found no blocking issues, including supplemental cancellation, limits, encrypted-member, symlink, and collision probes.

Evidence review:

  • 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

  • Rebased and tested on current main bb91abd, including fix(javascript): prefer package entrypoints over directory indexes #575 and fix(javascript): preserve literal CommonJS path punctuation #576.
  • npm run check:pr: static checks passed; 1,855 tests passed, 1 skipped, 40 failed in seven native bridge/lease suites because this sandbox denies Unix-domain socket listening (EPERM). The same seven suites on unchanged bb91abd reproduce 40 failures / 22 passes. This is not a full local test-suite pass.
  • npm run docs:check: passed separately because the full-test failure short-circuits this step in check:pr.
  • npm run check:ci: passed.
  • npm_config_cache=/tmp/rea-npm-cache npm run verify:package: passed, including packaged CLI/MCP checks; cache override was needed for this environment.
  • npm pack --dry-run --cache /tmp/rea-npm-cache: passed.
  • Real CLI inspect-artifact <child-first.zip> --format json and stdio MCP open_binary + inspect_artifact: passed.
  • git diff --check: passed.

Compatibility, safety, and release

  • No schema changes or migration steps. Corrected containment and virtual-directory IDs are intentional for previously misparented entries.
  • Real Hopper/Ghidra and native Windows/macOS execution were not run locally; no such support claim is made.
  • Package/release metadata unchanged.
  • No archive extraction, path-validation relaxation, dependency changes, or unrelated cleanup.

Review checklist

  • One focused outcome with a Conventional Commit title.
  • Reason for no linked issue stated.
  • Regression and meaningful failure-path coverage included.
  • Existing docs/contracts remain accurate; generated metadata checks pass.
  • Representative CLI/MCP behavior executed.
  • Final diff checked for secrets, unrelated changes, and unsupported claims.

Copy link
Copy Markdown
Collaborator Author

@codex review

@morluto
morluto merged commit 8eac290 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