Skip to content

feat(artifacts): name integrity checks for DMG, directory and release-exposure readers - #11056

Merged
morluto merged 4 commits into
mainfrom
feat/integrity-check-readers
Nov 15, 2026
Merged

morluto merged 4 commits into
mainfrom
feat/integrity-check-readers

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Refs #10508 (Phase 6.1). Stacked on #11052. The DMG, directory and release-exposure readers raised integrity failures that only the message told apart. They now name the check, and stable single-file reads (AnalysisArtifactChangedError) carry it to public output as details.integrity_check.

Problem and expected behavior

  • Tests matched "changed before open", "changed during read" and "ASAR member changed before interpretation" to tell which check failed.
  • Expected: each reader names the check; the public artifact_changed error includes it.

Change and scope

  • Directory: member file identity or byte count changed before open, during inspection or during read → member-identity; entry without captured state → entry-metadata; root changed (integrity variant of the containment check) → container-identity.
  • Release exposure: member digest or file state changed during acquisition, before or during read → member-identity.
  • DMG: hdiutil verify checksum failure (the only DMG integrity classification) → image-checksum.
  • AnalysisArtifactChangedError.integrityCheck, set by projectOwnedArtifactIdentityFailure and the release-exposure reader, projected as details.integrity_check.

Not included: the other readers' integrity failures (PE, ZIP, PyInstaller, …).

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: DirectoryArtifactReader, ReleaseExposureReader, NativeDmgArtifactReader (producers); AnalysisArtifactChangedError (carrier for stable single-file reads), built by projectOwnedArtifactIdentityFailure and the release-exposure reader
  • Contribution scope fit and linked maintainer decision: approved owner change (Phase 6.1, [Design] Assert structured remediation facts instead of guidance prose #10508)
  • CLI and MCP/tool-catalog contract: additive: artifact_changed errors gain details.integrity_check when the reader named the check; ArtifactIntegrityCheck gains member-identity and image-checksum. Codes, categories and messages 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: directoryArtifactReaderOpen.test.ts (2 message assertions → integrityCheck: "member-identity"), nativeDmgArtifactReader.test.ts (real hdiutil checksum failure asserts image-checksum; diagnostic provenance assertions kept), ReleaseExposureReader.test.ts (changed ASAR member asserts details.integrity_check: "member-identity" through projectAnalysisError; keeps the member path)
  • Base reproduction or other evidence: mutation (run, reverted): with the directory checks renamed and the DMG check changed, 5 of 60 tests fail (4 directory, 1 real hdiutil)
  • User-visible CLI/MCP output (if applicable): {"code":"artifact_changed",…,"details":{"operation":"audit_release_exposure","path":"…","reason":"ASAR member changed before interpretation: dist/notes.txt","boundary":"stable-artifact-read","integrity_check":"member-identity"}}
  • Remaining proof gaps: release exposure's RegularFileChangedError conversion (asReadFailure) leaves the check unnamed because that error does not say which file changed. Only the DMG case ran against a real producer (hdiutil on macOS)

For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.

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 -- src/artifacts/ReleaseExposureReader.test.ts tests/boundary/filesystem/directoryArtifactReaderOpen.test.ts tests/boundary/filesystem/directoryArtifactReaderOwnership.test.ts tests/boundary/providers/native/nativeDmgArtifactReader.test.ts tests/boundary/filesystem/desktopApplication.test.ts: 420 passed, 5 skipped (154 s wall incl. build; ReleaseExposureReader.test.ts alone 47 s)
  • Directory and DMG files with the check values mutated: 5 failed (expected), then restored
  • npm run check:fast: passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none (additive)
  • Real Hopper/Ghidra, browser, or OS coverage: macOS hdiutil (real) for the DMG case
  • Package or release metadata impact: none
  • Security, privacy, process, or containment review: none

Author readiness

Human owner:

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

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T11:18:51.598526Z
We couldn’t complete this review. Comment @codex review to try again.
7076e35 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; the remaining check-name gap is non-blocking.

Fix All in CodexFindings

  1. P2 Changed members lack check names ▶
Fix with agent prompt
### Issue 1
src/artifacts/ReleaseExposureReader.ts:3199-3204
A disk member that changes during `readDiskMember()` can still produce an `artifact_changed` error without `details.integrity_check`. `readStableArtifact()` throws an unnamed `ArtifactReaderFailure`, but this branch only names `RegularFileChangedError`.

The new test misses this because it makes `readStableArtifact()` throw `RegularFileChangedError`, which its real checks do not produce. Cover the real stable-read failure and carry its member role through the error path without losing cleanup facts. This is non-blocking, but affected callers still have to read the message to identify the check.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR names artifact consistency checks and carries those names into public errors.

  • Artifact readers name the integrity check behind each failed read.
  • Evidence validation errors point to the nested field that failed.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Reader detects failed check] --> B[ArtifactReaderFailure with integrityCheck]
  B --> C[ArtifactOperationError]
  B --> D[readerIntegrityFailure]
  D --> E[AnalysisArtifactChangedError]
  E --> F[Redaction or operation change]
  C --> G[projectAnalysisError]
  F --> G
  G --> H[Public details.integrity_check]
Loading

Reviews (4) · Last reviewed commit: "feat(artifacts): name integrity checks f..." · Reviewed by Greptile

Comment thread src/domain/analysisErrorCore.ts Resolved
@morluto
morluto force-pushed the feat/integrity-check-readers branch from 7076e35 to 0a8118f Compare November 15, 2026 11:34
@morluto
morluto force-pushed the feat/integrity-check-public branch from 3337cc4 to 1255bff Compare November 15, 2026 11:36
@morluto
morluto force-pushed the feat/integrity-check-readers branch from 0a8118f to 64b20fa Compare November 15, 2026 11:36
@morluto
morluto changed the base branch from feat/integrity-check-public to main November 15, 2026 11:53
…-exposure readers

Directory members and release-exposure members whose file identity or
bytes changed since inventory report member-identity; a directory entry
without captured state reports entry-metadata and a changed directory root
container-identity; an hdiutil checksum failure reports image-checksum.
AnalysisArtifactChangedError carries the check from the reader failure and
projects it as details.integrity_check.
…ed release files (#11081)

feat(artifacts): name integrity checks for ZIP, PyInstaller and changed release files, and keep them through reader projections
@morluto
morluto merged commit 7134053 into main Nov 15, 2026
7 checks passed
@morluto
morluto deleted the feat/integrity-check-readers branch November 15, 2026 12:35
Comment on lines 3199 to 3204
cause instanceof RegularFileChangedError
? new ArtifactReaderFailure("integrity", cause.message, { cause })
? new ArtifactReaderFailure("integrity", cause.message, {
cause,
integrityCheck,
})
: cause;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Changed members lack check names

A disk member that changes during readDiskMember() can still produce an artifact_changed error without details.integrity_check. readStableArtifact() throws an unnamed ArtifactReaderFailure, but this branch only names RegularFileChangedError.

The new test misses this because it makes readStableArtifact() throw RegularFileChangedError, which its real checks do not produce. Cover the real stable-read failure and carry its member role through the error path without losing cleanup facts. This is non-blocking, but affected callers still have to read the message to identify the check.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/artifacts/ReleaseExposureReader.ts
Line: 3199-3204

Comment:
**Changed members lack check names**

A disk member that changes during `readDiskMember()` can still produce an `artifact_changed` error without `details.integrity_check`. `readStableArtifact()` throws an unnamed `ArtifactReaderFailure`, but this branch only names `RegularFileChangedError`.

The new test misses this because it makes `readStableArtifact()` throw `RegularFileChangedError`, which its real checks do not produce. Cover the real stable-read failure and carry its member role through the error path without losing cleanup facts. This is non-blocking, but affected callers still have to read the message to identify the check.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex

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 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant