[PR #7452] [MERGED] fix(artifacts): report required bytes for ASAR header limits #7846

Closed
opened 2026-11-05 01:48:05 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7452
Author: @Ha1baraA11
Created: 10/27/2026
Status: ✅ Merged
Merged: 11/3/2026
Merged by: @morluto

Base: main ← Head: pr/rea-7347


📝 Commits (2)

  • 561513a fix(artifacts): report required bytes for ASAR header limits
  • 3de897a Merge remote-tracking branch 'origin/main' into codex/pr-7452-main-sync

📊 Changes

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

View changed files

📝 src/artifacts/inventory/ArtifactGraphConstruction.test.ts (+41 -0)
📝 src/artifacts/inventory/ArtifactGraphConstruction.ts (+4 -1)

📄 Description

Summary

Inventory errors for an ASAR header over the configured limit now include its parsed byte count in details.limit.required_value.
Related to #7347

Problem and expected behavior

  • When the ASAR probe reports state: "limit", inventory still has the parsed extents.headerBytes but calls asarHeaderAdmissionFailure with only admission metadata, so the projected error omits the known required size.
  • The existing limit contract exposes details.limit.required_value when the size is known; include the parsed byte count while continuing to refuse the oversized archive.

Change and scope

  • Pass asarHeader.extents?.headerBytes to asarHeaderAdmissionFailure when inventory classification rejects an ASAR header for exceeding its admission.
  • Add a regression that carries a synthetic header through the signature probe, inventory classification, typed failure translation, and public error projection.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/artifacts/inventory/ArtifactGraphConstruction.ts, after the ASAR probe has parsed header extents and before the typed failure is projected.
  • Contribution scope fit and linked maintainer decision: routine bug fix inside the existing read-only ASAR inspection boundary; no new provider or target-execution capability, so a separate scope decision is not applicable.
  • CLI and MCP/tool-catalog contract: no schema change. The existing optional details.limit.required_value is now populated for this inventory limit when the parsed size is known. The CLI JSON was exercised; no separate MCP client journey was run.
  • Provider, bridge, target-format, or platform compatibility: no provider or format recognition change; the same archive remains refused when its header exceeds the configured admission.
  • Evidence, artifact, provenance, or reconstruction contract: no stored Evidence, identity, or provenance changes. The error retains its existing truncated code and limit facts while adding the known required bytes.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): no target process, external engine, or network service is selected or started; the CLI reads the synthetic archive only.
  • 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.
  • Expected effects:
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Evidence and regression coverage

  • Tests added or updated: src/artifacts/inventory/ArtifactGraphConstruction.test.ts, projects the parsed ASAR header size when admission rejects an archive. It asserts the probe's parsed headerBytes and the projected details.limit.required_value.
  • Base reproduction or other evidence: the Issue's six CLI invocations were reproduced at the source revision reported by the Issue; the two below-limit cases omitted the field while four default/exact-limit controls succeeded. The same regression failed on the exact validated base at the required_value assertion.
  • User-visible CLI/MCP output (if applicable): post-patch CLI returned code: "truncated", details.reason: "limit", effective_value: 19, and required_value: 20 for a 20-byte header at limit 19; the 24-byte/23-byte case returned required_value: 24.
  • Remaining proof gaps: no separate MCP client journey, Windows/Linux run, or real application archive above the configured limit was executed. These do not change the observed synthetic CLI contract.
  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
  • For evidence-bearing changes: not applicable; this PR changes an admission diagnostic and does not add or alter persisted artifact Evidence.
  • Boundary regressions: the source test checks producer extents through the affected error projection, and the built CLI smoke checks public JSON delivery. No resource ownership or finalization changes; lifecycle regression is not applicable.

Validation performed

  • node scripts/run-exact-tests.mjs -t '^projects the parsed ASAR header size when admission rejects an archive$' --reporter verbose src/artifacts/inventory/ArtifactGraphConstruction.test.ts — 1 passed, 39 skipped.
  • npx --yes --package=node@24.22.1 --package=npm@11.16.0 -- npm ci — passed.
  • npx --yes --package=node@24.22.1 --package=npm@11.16.0 -- npm run test:focused -- src/ghidra/GhidraInstallation.test.ts — 113 passed.
  • npx --yes --package=node@24.22.1 --package=npm@11.16.0 -- npm run check:fast — passed.

Compatibility, safety, and release

  • No migration or package changes are required. The regression and CLI smoke used synthetic ASAR bytes on macOS arm64 with Node 24.22.1; no provider, installed application, or target process was involved.

Author readiness

  • 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.
    Human owner: @Ha1baraA11

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.

🔄 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/7452 **Author:** [@Ha1baraA11](https://github.com/Ha1baraA11) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 11/3/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `pr/rea-7347` --- ### 📝 Commits (2) - [`561513a`](https://github.com/morluto/rea/commit/561513a4941dc96b502d48727c41217cdd92fb6f) fix(artifacts): report required bytes for ASAR header limits - [`3de897a`](https://github.com/morluto/rea/commit/3de897a1ceb88176832f61978c4112dd3387b9f9) Merge remote-tracking branch 'origin/main' into codex/pr-7452-main-sync ### 📊 Changes **2 files changed** (+45 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/artifacts/inventory/ArtifactGraphConstruction.test.ts` (+41 -0) 📝 `src/artifacts/inventory/ArtifactGraphConstruction.ts` (+4 -1) </details> ### 📄 Description ## Summary Inventory errors for an ASAR header over the configured limit now include its parsed byte count in `details.limit.required_value`. Related to #7347 ## Problem and expected behavior - When the ASAR probe reports `state: "limit"`, inventory still has the parsed `extents.headerBytes` but calls `asarHeaderAdmissionFailure` with only admission metadata, so the projected error omits the known required size. - The existing limit contract exposes `details.limit.required_value` when the size is known; include the parsed byte count while continuing to refuse the oversized archive. ## Change and scope - Pass `asarHeader.extents?.headerBytes` to `asarHeaderAdmissionFailure` when inventory classification rejects an ASAR header for exceeding its admission. - Add a regression that carries a synthetic header through the signature probe, inventory classification, typed failure translation, and public error projection. ## Contract and boundary impact - Semantic owner and earliest changed stage: `src/artifacts/inventory/ArtifactGraphConstruction.ts`, after the ASAR probe has parsed header extents and before the typed failure is projected. - Contribution scope fit and linked maintainer decision: routine bug fix inside the existing read-only ASAR inspection boundary; no new provider or target-execution capability, so a separate scope decision is not applicable. - CLI and MCP/tool-catalog contract: no schema change. The existing optional `details.limit.required_value` is now populated for this inventory limit when the parsed size is known. The CLI JSON was exercised; no separate MCP client journey was run. - Provider, bridge, target-format, or platform compatibility: no provider or format recognition change; the same archive remains refused when its header exceeds the configured admission. - Evidence, artifact, provenance, or reconstruction contract: no stored Evidence, identity, or provenance changes. The error retains its existing `truncated` code and limit facts while adding the known required bytes. - Target selection, authority, upstream behavior, and cleanup details (if applicable): no target process, external engine, or network service is selected or started; the CLI reads the synthetic archive only. - [x] 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. - Expected effects: - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none. ## Evidence and regression coverage - Tests added or updated: `src/artifacts/inventory/ArtifactGraphConstruction.test.ts`, `projects the parsed ASAR header size when admission rejects an archive`. It asserts the probe's parsed `headerBytes` and the projected `details.limit.required_value`. - Base reproduction or other evidence: the Issue's six CLI invocations were reproduced at the source revision reported by the Issue; the two below-limit cases omitted the field while four default/exact-limit controls succeeded. The same regression failed on the exact validated base at the `required_value` assertion. - User-visible CLI/MCP output (if applicable): post-patch CLI returned `code: "truncated"`, `details.reason: "limit"`, `effective_value: 19`, and `required_value: 20` for a 20-byte header at limit 19; the 24-byte/23-byte case returned `required_value: 24`. - Remaining proof gaps: no separate MCP client journey, Windows/Linux run, or real application archive above the configured limit was executed. These do not change the observed synthetic CLI contract. - [ ] Observed, derived, and inferred claims remain distinguishable. - [ ] Artifact identity, source provenance, and failed attempts remain preserved. - [ ] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. - For evidence-bearing changes: not applicable; this PR changes an admission diagnostic and does not add or alter persisted artifact Evidence. - Boundary regressions: the source test checks producer extents through the affected error projection, and the built CLI smoke checks public JSON delivery. No resource ownership or finalization changes; lifecycle regression is not applicable. ## Validation performed - `node scripts/run-exact-tests.mjs -t '^projects the parsed ASAR header size when admission rejects an archive$' --reporter verbose src/artifacts/inventory/ArtifactGraphConstruction.test.ts` — 1 passed, 39 skipped. - `npx --yes --package=node@24.22.1 --package=npm@11.16.0 -- npm ci` — passed. - `npx --yes --package=node@24.22.1 --package=npm@11.16.0 -- npm run test:focused -- src/ghidra/GhidraInstallation.test.ts` — 113 passed. - `npx --yes --package=node@24.22.1 --package=npm@11.16.0 -- npm run check:fast` — passed. ## Compatibility, safety, and release - No migration or package changes are required. The regression and CLI smoke used synthetic ASAR bytes on macOS arm64 with Node 24.22.1; no provider, installed application, or target process was involved. ## Author readiness - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. Human owner: @Ha1baraA11 ## 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. - [x] I checked the final diff 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-11-05 01:48:05 +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#7846
No description provided.