[PR #5592] [CLOSED] fix(artifacts): stop offering integrity-policy retries for checksum-invalid DMGs #6984

Closed
opened 2026-11-01 21:44:29 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5592
Author: @kaoru0822-kitauji
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: fix/dmg-integrity-retry-advice


📝 Commits (1)

  • c76e981 fix(artifacts): stop offering integrity-policy retries for checksum-invalid DMGs

📊 Changes

2 files changed (+90 additions, -0 deletions)

View changed files

📝 src/domain/analysisErrorPresentation.ts (+10 -0)
📝 tests/boundary/mcp/artifactMcp.test.ts (+80 -0)

📄 Description

Summary

Fixes #5549. inspect_artifact on a checksum-invalid DMG told callers to rerun with integrity_policy=record-and-continue. That retry fails with the same error because the policy cannot bypass native hdiutil verify. The tool now explains that the policy does not apply to this failure and recommends a valid copy instead.

Problem and expected behavior

integrity_policy decides only one case: a declared digest contradicts the observed bytes (scanReader digestArtifactEntry). That error always carries declared and observed digest details, and it projects as artifact_integrity_mismatch. The presentation layer offered the policy retry for every integrity failure from a policy-accepting operation. Those failures include container self-verification, such as an hdiutil verify checksum failure, which has no declared digest details. Such a failure stops the operation under either policy, so the advertised retry could never succeed.

Change and scope

artifactMessage in src/domain/analysisErrorPresentation.ts now offers the policy retry only when the error carries declared-integrity details. Those details are the fact the policy-owning producer attaches, and the projection already uses the same fact to choose artifact_integrity_mismatch. Integrity failures without these details now say that integrity_policy cannot relax the check and recommend a valid, unchanged copy. The safe refusal itself does not change, and REA still does not bypass checksum verification or mount the image.

Not included: two producers attach integrity details to failures that record-and-continue also cannot continue. These are Godot PCK "carrier changed after inventory" and ASAR "unpacked entry changed before read", and both still receive the retry advice. Separating them needs a producer-side discriminator in ArtifactIntegrityDetails, which is a larger contract change. I left it out of this focused fix. This PR does not touch NativeDmgArtifactReader.ts or NativeDmgOwnership.ts (see #5572).

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: error presentation (src/domain/analysisErrorPresentation.ts); producers are unchanged.
  • Contribution scope fit and linked maintainer decision: an ordinary fix within existing boundaries, so no scope decision is needed.
  • CLI and MCP/tool-catalog contract: only the error.message/remediation.action text changes for artifact_operation_failed integrity errors from inventory_artifact, inspect_artifact, extract_artifact and analyze_javascript_application. Codes, categories, retryable: false, details and schemas are unchanged.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • 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.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/mcp/artifactMcp.test.ts gains a darwin-only test using the real hdiutil. It creates a UDRO DMG, flips one data-fork byte, opens the image through MCP and calls inspect_artifact with integrity_policy set to fail and then to record-and-continue. It checks that both calls return artifact_operation_failed/integrity_mismatch, retryable: false, and the new message and remediation, which no longer recommend the policy.
  • Base reproduction or other evidence: with the source fix reverted, the new test fails and receives the old message (… If expected, rerun inspect_artifact with integrity_policy=record-and-continue …). With the fix applied, it passes. Afterwards hdiutil info showed no fixture image attached.
  • User-visible CLI/MCP output (if applicable): error.message / remediation.action: Artifact failed an integrity check that integrity_policy cannot relax, such as a container checksum or a source that changed while being read. Get a valid, unchanged copy and try again.
  • Remaining proof gaps: I did not rerun the CLI inspect-artifact command from the issue. The shared presentation layer produces both the CLI and MCP output, but only the MCP path was run. The Godot/ASAR detail-carrying cases above are unchanged.

For evidence-bearing changes:

  • 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

  • npm run test:focused -- tests/boundary/mcp/artifactMcp.test.ts with the source fix reverted: 1 failed (the new test), 10 passed.
  • npm run test:focused -- tests/boundary/mcp/artifactMcp.test.ts tests/boundary/mcp/asarUnpackedExtractionMcp.test.ts tests/boundary/mcp/godotPckMcp.test.ts tests/boundary/providers/native/nativeDmgArtifactReader.test.ts: 4 files, 63 tests passed (macOS arm64, real hdiutil).
  • npm run check:fast: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Only the advisory text changes.
  • Real Hopper/Ghidra, browser, or OS coverage: real macOS hdiutil only. No Hopper or Ghidra.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: checksum-invalid images are still refused before attachment, and the test detaches nothing it did not attach.

Author readiness

Human owner: @kaoru0822-kitauji

  • 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.

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.

🤖 Generated with Claude Code


🔄 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/5592 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/dmg-integrity-retry-advice` --- ### 📝 Commits (1) - [`c76e981`](https://github.com/morluto/rea/commit/c76e981dcdcdd8e6c146c3ec044361c3471efc1e) fix(artifacts): stop offering integrity-policy retries for checksum-invalid DMGs ### 📊 Changes **2 files changed** (+90 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/analysisErrorPresentation.ts` (+10 -0) 📝 `tests/boundary/mcp/artifactMcp.test.ts` (+80 -0) </details> ### 📄 Description ## Summary Fixes #5549. `inspect_artifact` on a checksum-invalid DMG told callers to rerun with `integrity_policy=record-and-continue`. That retry fails with the same error because the policy cannot bypass native `hdiutil verify`. The tool now explains that the policy does not apply to this failure and recommends a valid copy instead. ## Problem and expected behavior `integrity_policy` decides only one case: a declared digest contradicts the observed bytes (`scanReader` `digestArtifactEntry`). That error always carries declared and observed digest details, and it projects as `artifact_integrity_mismatch`. The presentation layer offered the policy retry for every `integrity` failure from a policy-accepting operation. Those failures include container self-verification, such as an `hdiutil verify` checksum failure, which has no declared digest details. Such a failure stops the operation under either policy, so the advertised retry could never succeed. ## Change and scope `artifactMessage` in `src/domain/analysisErrorPresentation.ts` now offers the policy retry only when the error carries declared-integrity details. Those details are the fact the policy-owning producer attaches, and the projection already uses the same fact to choose `artifact_integrity_mismatch`. Integrity failures without these details now say that `integrity_policy` cannot relax the check and recommend a valid, unchanged copy. The safe refusal itself does not change, and REA still does not bypass checksum verification or mount the image. Not included: two producers attach integrity details to failures that `record-and-continue` also cannot continue. These are Godot PCK "carrier changed after inventory" and ASAR "unpacked entry changed before read", and both still receive the retry advice. Separating them needs a producer-side discriminator in `ArtifactIntegrityDetails`, which is a larger contract change. I left it out of this focused fix. This PR does not touch `NativeDmgArtifactReader.ts` or `NativeDmgOwnership.ts` (see #5572). Follow the [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope). Unresolved scope, authority, side effects, or required verification block integration. Link the required maintainer scope decision for new providers or capabilities involving target execution, injection, mutation, or protection recovery; ordinary fixes within existing boundaries may state "not applicable". Draft PRs may leave the scope decision pending and the readiness and merge checklists unchecked. Maintainers can help resolve open questions. ## Contract and boundary impact - Semantic owner and earliest changed stage: error presentation (`src/domain/analysisErrorPresentation.ts`); producers are unchanged. - Contribution scope fit and linked maintainer decision: an ordinary fix within existing boundaries, so no scope decision is needed. - CLI and MCP/tool-catalog contract: only the `error.message`/`remediation.action` text changes for `artifact_operation_failed` integrity errors from `inventory_artifact`, `inspect_artifact`, `extract_artifact` and `analyze_javascript_application`. Codes, categories, `retryable: false`, details and schemas are unchanged. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact (CI generates and validates ignored catalogs and `skills/`; edit authored instructions in `.agents/skills/reverse-engineer-anything/` and never commit build outputs): none. Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible. - [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. ## Evidence and regression coverage - Tests added or updated: `tests/boundary/mcp/artifactMcp.test.ts` gains a darwin-only test using the real `hdiutil`. It creates a UDRO DMG, flips one data-fork byte, opens the image through MCP and calls `inspect_artifact` with `integrity_policy` set to `fail` and then to `record-and-continue`. It checks that both calls return `artifact_operation_failed`/`integrity_mismatch`, `retryable: false`, and the new message and remediation, which no longer recommend the policy. - Base reproduction or other evidence: with the source fix reverted, the new test fails and receives the old message (`… If expected, rerun inspect_artifact with integrity_policy=record-and-continue …`). With the fix applied, it passes. Afterwards `hdiutil info` showed no fixture image attached. - User-visible CLI/MCP output (if applicable): `error.message` / `remediation.action`: `Artifact failed an integrity check that integrity_policy cannot relax, such as a container checksum or a source that changed while being read. Get a valid, unchanged copy and try again.` - Remaining proof gaps: I did not rerun the CLI `inspect-artifact` command from the issue. The shared presentation layer produces both the CLI and MCP output, but only the MCP path was run. The Godot/ASAR detail-carrying cases above are unchanged. For evidence-bearing changes: - [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 - `npm run test:focused -- tests/boundary/mcp/artifactMcp.test.ts` with the source fix reverted: 1 failed (the new test), 10 passed. - `npm run test:focused -- tests/boundary/mcp/artifactMcp.test.ts tests/boundary/mcp/asarUnpackedExtractionMcp.test.ts tests/boundary/mcp/godotPckMcp.test.ts tests/boundary/providers/native/nativeDmgArtifactReader.test.ts`: 4 files, 63 tests passed (macOS arm64, real `hdiutil`). - `npm run check:fast`: passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. Only the advisory text changes. - Real Hopper/Ghidra, browser, or OS coverage: real macOS `hdiutil` only. No Hopper or Ghidra. - Package or release metadata impact: none. - Security, privacy, process, or containment review: checksum-invalid images are still refused before attachment, and the test detaches nothing it did not attach. ## Author readiness Human owner: @kaoru0822-kitauji - [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. ## 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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:44:29 +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#6984
No description provided.