[GH-ISSUE #5549] [Bug] inspect-artifact recommends an ineffective integrity-policy retry for checksum-invalid DMGs #3381

Closed
opened 2026-10-31 00:39:45 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @coygeek on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/5549

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Evidence, artifacts, or reconstruction

Observed behavior

On macOS, inspect-artifact on a checksum-invalid DMG tells the caller to rerun with --integrity-policy record-and-continue to retain observed bytes as untrusted. Following that instruction exits 1 again, returns the identical parsed error, repeats the same instruction, and returns no inspection Evidence. The intact-image control succeeds. This report concerns the false recovery offer; safe refusal of the corrupt image is acceptable.

Reproduction

An independent verifier ran the following sequence from the built source checkout. Each of the three REA calls ran once. REA's home, XDG configuration/data/cache/state directories and temporary files were isolated in the disposable fixture directory.

SCRATCH=$(mktemp -d)
mkdir -p "$SCRATCH/src" "$SCRATCH/home" "$SCRATCH/config" "$SCRATCH/data" "$SCRATCH/cache" "$SCRATCH/state" "$SCRATCH/temp"
printf 'fixture\n' > "$SCRATCH/src/file.txt"
run_rea() {
  env HOME="$SCRATCH/home" XDG_CONFIG_HOME="$SCRATCH/config" \
    XDG_DATA_HOME="$SCRATCH/data" XDG_CACHE_HOME="$SCRATCH/cache" \
    XDG_STATE_HOME="$SCRATCH/state" TMPDIR="$SCRATCH/temp" \
    node scripts/rea.mjs "$@"
}
hdiutil create -quiet -srcfolder "$SCRATCH/src" -volname Fixture -size 20m -format UDRO "$SCRATCH/intact.dmg"
hdiutil verify "$SCRATCH/intact.dmg"
run_rea inspect-artifact "$SCRATCH/intact.dmg" --format json --full-output > "$SCRATCH/intact.json"
cp "$SCRATCH/intact.dmg" "$SCRATCH/corrupt.dmg"
python3 - "$SCRATCH/corrupt.dmg" <<'PY'
import sys
with open(sys.argv[1], "r+b") as image:
    image.seek(600)
    original = image.read(1)
    image.seek(600)
    image.write(bytes([original[0] ^ 255]))
PY
hdiutil verify "$SCRATCH/corrupt.dmg"
run_rea inspect-artifact "$SCRATCH/corrupt.dmg" --format json --full-output > "$SCRATCH/default.json"
run_rea inspect-artifact "$SCRATCH/corrupt.dmg" --integrity-policy record-and-continue --format json --full-output > "$SCRATCH/continue.json"
python3 - "$SCRATCH" <<'PY'
import json, pathlib, sys
root = pathlib.Path(sys.argv[1])
default = json.loads((root / "default.json").read_text())
continued = json.loads((root / "continue.json").read_text())
print("Identical errors:", default["error"] == continued["error"])
print("Inspection data returned:", "data" in default, "data" in continued)
print(continued["error"]["remediation"]["action"])
PY

The intact image verifies and inspects successfully, with inspection exit 0. The corrupt copy fails native verification and both inspections exit 1. The final comparison prints Identical errors: True and Inspection data returned: False False. A final hdiutil info -plist check found neither fixture attached. The verifier removed the generated images after that check; no other image was detached.

Expected behavior

Recovery guidance should describe an action that can change the outcome. If native DMG verification cannot continue under either policy, explain that limitation and recommend a valid copy without advertising the ineffective policy retry. This does not require mounting a checksum-invalid image.

The expectation is grounded in the actual error's recovery promise and, by source inspection, src/contracts/artifactToolContracts.ts:83 and src/domain/artifactIntegrityPolicy.ts:3-13, which describe explicitly untrusted observations under record-and-continue. The general integrity documentation in docs/mcp-contracts.md:880-907 addresses entry mismatches and verified siblings; it does not establish an obligation to bypass native checksum verification.

Impact and scope

The caller receives an actionable retry instruction that demonstrably fails and promises an untrusted inspection result that this path does not return. The observed scope is the checksum-invalid UDRO fixture on macOS. The valid control succeeds, and no data loss or successful checksum bypass was observed. Using a checksum-valid copy is a demonstrated workaround. Broader frequency and recovery of arbitrary corrupt contents are unknown.

REA version

6.7.0; source commit 074768901f3cdc8205b61773fb1faf6f6c7b3ca8.

Runtime and platform

Node v26.12.0; macOS 27.0.1, build 26A434; arm64. System hdiutil; no Hopper or Ghidra involved.

Target and artifact context

A self-created read-only UDRO DMG containing one text file, plus a copy with byte 600 XORed with 255. The native verifier identifies the modified region as Primary GPT Table.

Interface

CLI

Earliest failure stage

Transport or result projection

Relevant output or evidence

Selected fields from both corrupt-image CLI results:

ok: false
error.code: artifact_operation_failed
error.category: integrity_mismatch
error.retryable: false
error.details.operation: inspect_artifact
error.details.reason: integrity
error.message and error.remediation.action:
Artifact bytes contradict declared integrity. If expected, rerun inspect_artifact with integrity_policy=record-and-continue (CLI: --integrity-policy record-and-continue) to retain observed bytes as untrusted; otherwise get a fresh copy.

The nested diagnostic includes hdiutil verify failed, is INVALID, and invalid checksum. Both parsed error objects are identical; duration metadata differs between the response envelopes. Neither response contains data. The intact control reports complete container-entry coverage with 3 nodes, 3 occurrences and 2 edges.

Typed outcome or recovery expected

Preserve a safe integrity refusal when native verification cannot continue, but return recovery guidance that identifies that limitation. A refusal after selecting record-and-continue should not recommend selecting that same policy again.

Analysis or suspected cause

Source-derived reasoning at the tested revision: src/domain/analysisErrorPresentation.ts:412-448 generates the policy retry for integrity failures without distinguishing native verification from continuable entry mismatches. src/artifacts/NativeDmgArtifactReader.ts:406-407,490-540 verifies before attachment and rethrows checksum failures. src/artifacts/inventory/reader.ts:40-42 creates the native reader without a policy input, while src/artifacts/inventory/scanCanonical.ts:67-104 passes the policy to entry scanning. Native verification fails before that entry-level handling can continue.

Additional context

Prepared with AI assistance and independently reproduced through the public CLI. The submitter checked current origin/main at 55cce6fc11a4edc32b4a6d4c2d8fd4f2ed2a4f18. The only later commit touching the cited source files, e50a271c72325880b5ff944973b0b42d81b4b158, changes input-validation and timeout guidance, leaving the integrity-retry logic unchanged. The latest published release remains 6.7.0.

Related PRs #3290 and #4146 address localized verification classification. Issue #5546 concerns an already-mounted valid image, and #3095 requests DMG extraction support. They do not report this checksum-failure recovery offer.

NOT_ENOUGH_INFO: the last known good version is unknown. This reproduction did not exercise MCP or other container formats.

Originally created by @coygeek on GitHub (Oct 20, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/5549 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area Evidence, artifacts, or reconstruction ### Observed behavior On macOS, `inspect-artifact` on a checksum-invalid DMG tells the caller to rerun with `--integrity-policy record-and-continue` to retain observed bytes as untrusted. Following that instruction exits 1 again, returns the identical parsed error, repeats the same instruction, and returns no inspection Evidence. The intact-image control succeeds. This report concerns the false recovery offer; safe refusal of the corrupt image is acceptable. ### Reproduction An independent verifier ran the following sequence from the built source checkout. Each of the three REA calls ran once. REA's home, XDG configuration/data/cache/state directories and temporary files were isolated in the disposable fixture directory. ```sh SCRATCH=$(mktemp -d) mkdir -p "$SCRATCH/src" "$SCRATCH/home" "$SCRATCH/config" "$SCRATCH/data" "$SCRATCH/cache" "$SCRATCH/state" "$SCRATCH/temp" printf 'fixture\n' > "$SCRATCH/src/file.txt" run_rea() { env HOME="$SCRATCH/home" XDG_CONFIG_HOME="$SCRATCH/config" \ XDG_DATA_HOME="$SCRATCH/data" XDG_CACHE_HOME="$SCRATCH/cache" \ XDG_STATE_HOME="$SCRATCH/state" TMPDIR="$SCRATCH/temp" \ node scripts/rea.mjs "$@" } hdiutil create -quiet -srcfolder "$SCRATCH/src" -volname Fixture -size 20m -format UDRO "$SCRATCH/intact.dmg" hdiutil verify "$SCRATCH/intact.dmg" run_rea inspect-artifact "$SCRATCH/intact.dmg" --format json --full-output > "$SCRATCH/intact.json" cp "$SCRATCH/intact.dmg" "$SCRATCH/corrupt.dmg" python3 - "$SCRATCH/corrupt.dmg" <<'PY' import sys with open(sys.argv[1], "r+b") as image: image.seek(600) original = image.read(1) image.seek(600) image.write(bytes([original[0] ^ 255])) PY hdiutil verify "$SCRATCH/corrupt.dmg" run_rea inspect-artifact "$SCRATCH/corrupt.dmg" --format json --full-output > "$SCRATCH/default.json" run_rea inspect-artifact "$SCRATCH/corrupt.dmg" --integrity-policy record-and-continue --format json --full-output > "$SCRATCH/continue.json" python3 - "$SCRATCH" <<'PY' import json, pathlib, sys root = pathlib.Path(sys.argv[1]) default = json.loads((root / "default.json").read_text()) continued = json.loads((root / "continue.json").read_text()) print("Identical errors:", default["error"] == continued["error"]) print("Inspection data returned:", "data" in default, "data" in continued) print(continued["error"]["remediation"]["action"]) PY ``` The intact image verifies and inspects successfully, with inspection exit 0. The corrupt copy fails native verification and both inspections exit 1. The final comparison prints `Identical errors: True` and `Inspection data returned: False False`. A final `hdiutil info -plist` check found neither fixture attached. The verifier removed the generated images after that check; no other image was detached. ### Expected behavior Recovery guidance should describe an action that can change the outcome. If native DMG verification cannot continue under either policy, explain that limitation and recommend a valid copy without advertising the ineffective policy retry. This does not require mounting a checksum-invalid image. The expectation is grounded in the actual error's recovery promise and, by source inspection, `src/contracts/artifactToolContracts.ts:83` and `src/domain/artifactIntegrityPolicy.ts:3-13`, which describe explicitly untrusted observations under `record-and-continue`. The general integrity documentation in `docs/mcp-contracts.md:880-907` addresses entry mismatches and verified siblings; it does not establish an obligation to bypass native checksum verification. ### Impact and scope The caller receives an actionable retry instruction that demonstrably fails and promises an untrusted inspection result that this path does not return. The observed scope is the checksum-invalid UDRO fixture on macOS. The valid control succeeds, and no data loss or successful checksum bypass was observed. Using a checksum-valid copy is a demonstrated workaround. Broader frequency and recovery of arbitrary corrupt contents are unknown. ### REA version 6.7.0; source commit `074768901f3cdc8205b61773fb1faf6f6c7b3ca8`. ### Runtime and platform Node v26.12.0; macOS 27.0.1, build 26A434; arm64. System `hdiutil`; no Hopper or Ghidra involved. ### Target and artifact context A self-created read-only UDRO DMG containing one text file, plus a copy with byte 600 XORed with 255. The native verifier identifies the modified region as Primary GPT Table. ### Interface CLI ### Earliest failure stage Transport or result projection ### Relevant output or evidence Selected fields from both corrupt-image CLI results: ```text ok: false error.code: artifact_operation_failed error.category: integrity_mismatch error.retryable: false error.details.operation: inspect_artifact error.details.reason: integrity error.message and error.remediation.action: Artifact bytes contradict declared integrity. If expected, rerun inspect_artifact with integrity_policy=record-and-continue (CLI: --integrity-policy record-and-continue) to retain observed bytes as untrusted; otherwise get a fresh copy. ``` The nested diagnostic includes `hdiutil verify failed`, `is INVALID`, and `invalid checksum`. Both parsed `error` objects are identical; duration metadata differs between the response envelopes. Neither response contains `data`. The intact control reports complete container-entry coverage with 3 nodes, 3 occurrences and 2 edges. ### Typed outcome or recovery expected Preserve a safe integrity refusal when native verification cannot continue, but return recovery guidance that identifies that limitation. A refusal after selecting `record-and-continue` should not recommend selecting that same policy again. ### Analysis or suspected cause Source-derived reasoning at the tested revision: `src/domain/analysisErrorPresentation.ts:412-448` generates the policy retry for integrity failures without distinguishing native verification from continuable entry mismatches. `src/artifacts/NativeDmgArtifactReader.ts:406-407,490-540` verifies before attachment and rethrows checksum failures. `src/artifacts/inventory/reader.ts:40-42` creates the native reader without a policy input, while `src/artifacts/inventory/scanCanonical.ts:67-104` passes the policy to entry scanning. Native verification fails before that entry-level handling can continue. ### Additional context Prepared with AI assistance and independently reproduced through the public CLI. The submitter checked current `origin/main` at `55cce6fc11a4edc32b4a6d4c2d8fd4f2ed2a4f18`. The only later commit touching the cited source files, `e50a271c72325880b5ff944973b0b42d81b4b158`, changes input-validation and timeout guidance, leaving the integrity-retry logic unchanged. The latest published release remains 6.7.0. Related PRs #3290 and #4146 address localized verification classification. Issue #5546 concerns an already-mounted valid image, and #3095 requests DMG extraction support. They do not report this checksum-failure recovery offer. NOT_ENOUGH_INFO: the last known good version is unknown. This reproduction did not exercise MCP or other container formats.
Author
Owner

@matbrgz commented on GitHub (Oct 20, 2026):

Cross-referencing with canonical issue #5546 and sibling #5547 regarding DMG integrity validation policies, retry guidance, and error recovery in inspect-artifact. Cataloged under Cluster BB in consolidation tracker #4330.

<!-- gh-comment-id:6295545836 --> @matbrgz commented on GitHub (Oct 20, 2026): Cross-referencing with canonical issue #5546 and sibling #5547 regarding DMG integrity validation policies, retry guidance, and error recovery in `inspect-artifact`. Cataloged under Cluster BB in consolidation tracker #4330.
Author
Owner

@morluto commented on GitHub (Oct 23, 2026):

Resolved on main in 35aa8ef83. Integrity-policy recovery is offered only for structured declared-versus-observed member contradictions; native DMG verification refusal gets valid-copy guidance. The executed projector control rejects ineffective policy advice without weakening refusal. Validation: src/domain/analysisErrorProjection.test.ts — does not offer entry-policy retries for integrity refusals without a declared-versus-observed entry contradiction; recorded execution at b03a15e6d. All 68 projector controls passed; enclosing group had unrelated cleanup failures. No checksum-invalid hdiutil run. The issue allows refusal and concerns recovery wording only.

<!-- gh-comment-id:6376135500 --> @morluto commented on GitHub (Oct 23, 2026): Resolved on main in [35aa8ef83](https://github.com/morluto/rea/commit/35aa8ef83964e21441b62f55f57de62d86dea475). Integrity-policy recovery is offered only for structured declared-versus-observed member contradictions; native DMG verification refusal gets valid-copy guidance. The executed projector control rejects ineffective policy advice without weakening refusal. Validation: `src/domain/analysisErrorProjection.test.ts` — does not offer entry-policy retries for integrity refusals without a declared-versus-observed entry contradiction; recorded execution at `b03a15e6d`. All 68 projector controls passed; enclosing group had unrelated cleanup failures. No checksum-invalid hdiutil run. The issue allows refusal and concerns recovery wording only.
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#3381
No description provided.