Skip to content

feat(artifacts): name integrity checks for the remaining readers and their projections - #11098

Merged
morluto merged 1 commit into
feat/integrity-check-readersfrom
feat/integrity-check-more-readers
Nov 15, 2026
Merged

morluto merged 1 commit into
feat/integrity-check-readersfrom
feat/integrity-check-more-readers

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

Refs #10508 (Phase 6.1). Stacked on #11056. The Mach-O slice, iNES, FIT, safe output tree, JavaScript file, SQLite snapshot and inventory classify/scan readers raised integrity failures that only the message told apart, and nine provider projections rebuilt AnalysisArtifactChangedError by hand and dropped the check. Each of these readers now names the check, and every projection goes through readerIntegrityFailure.

Problem and expected behavior

  • Tests matched "Root artifact changed before inventory", "iNES reconstruction differs", "structural slice index is malformed", "Nested ASAR was not present in inventory" and similar to tell which check failed.
  • Tshark, GPU, model, native Mach-O, plist, provider file failures, browser capture, API contract and Android mapping each built new AnalysisArtifactChangedError(…, cause.message, …) themselves, so a check the reader named never reached public output.
  • Expected: the reader names the check; one owner projects it.

Change and scope

  • New check values: declared-digest (FIT hash, container CRC, declared entry digest), layout-consistency (Mach-O structural index or lipo disagreement, slice or region range outside the artifact), reconstruction (iNES regions do not reassemble into the source), inventory-node (JavaScript reads a node or verified state the inventory lacks), output-readback and output-lifecycle (safe output tree).
  • Existing values reused: foreign-entry/entry-metadata (Mach-O, iNES, FIT open), read-coverage, declared-size, member-identity (extracted or re-read bytes differ from inventory), container-identity (root, iNES source, SQLite file set and journal changed).
  • readerIntegrityFailure(operation, path, failure, options?): options replace the default cause and add facts; the check always comes from the reader failure. Used by the nine projections above.
  • Dedicated test for the Ghidra re-attribution copy, which the previous PR left untested.
  • AsarEntryStream already named all three of its checks; nothing left there.

Not included: the readers listed under remaining proof gaps.

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: each reader names its check on ArtifactReaderFailure.integrityCheck at the throw site; readerIntegrityFailure (StableArtifactFailure.ts) owns the projection to AnalysisArtifactChangedError and now takes provider options; ArtifactIntegrityCheck gains six values
  • 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: more integrity errors carry details.integrity_check, with six new values (declared-digest, layout-consistency, reconstruction, inventory-node, output-readback, output-lifecycle). 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): unchanged; the routed projections keep the cause and options they passed before (cleanup wrapper, captured output, details)
  • 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: converted from message matching to integrityCheck: artifactInventoryRegularRoot, inesArtifact, artifactAdmittedIdentity (2), javascriptIntegrityPolicy, artifactProvider.machOSlices, ArtifactEmbeddedFormatProbes.test.ts; FitArtifactReader.test.ts also asserts the check (it keeps the message regex because image, node and algorithm exist only in prose). Added: ArtifactOperationFailure.test.ts (helper keeps the check when a provider supplies its own cause and options) and GhidraProvider.behavior.test.ts (the Ghidra re-attribution keeps the check, with and without the launcher wrapper)
  • Base reproduction or other evidence: mutation (run, reverted): dropping integrityCheck from the Ghidra copy in GhidraProviderClient.ts fails the new direct-cause case (the launcher case goes through analysisClientFailureForOperation and was already covered); dropping ...options from readerIntegrityFailure fails the new helper case
  • User-visible CLI/MCP output (if applicable): e.g. {"code":"artifact_integrity_mismatch",…,"details":{"reason":"integrity","integrity_check":"container-identity",…}} for a root replaced after target admission
  • Remaining proof gaps: readers not covered here still raise unnamed integrity failures (Bun, Deno, .NET bundle, positional, decoded region, uImage, UnityFS, wxapkg, Node SEA, PyInstaller CArchive/PYZ layout, dylib, keyed archive, asset catalog, artifact extraction, readStableArtifact, ArtifactFileSource, GPU/model sources, NativeMachoSource); ArtifactAnalysisResources.integrityChanged keeps its own post-run message. Most of the newly named sites have no deterministic public CLI/MCP trigger (each needs a race or a corrupted layout), so they are checked through the reader tests listed above

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 -- the nine converted/added test files: 425 passed, 1 skipped (base: 422 passed, 1 skipped). Warm wall/CPU (user+sys): 7.9 s / 13.4 s after, 7.2 s / 12.4 s before
  • Same files' producers, regression: npm run test:focused -- src/application/environment/environmentBundleWrite.test.ts src/artifacts/MachOSliceArtifactReader.test.ts src/artifacts/SafeOutputTreeAdmission.test.ts src/browser/history/CaptureFailures.test.ts src/sqlite/SqliteDatabaseSnapshotLimits.test.ts tests/boundary/filesystem/safeOutputTree.test.ts tests/boundary/sqlite/sqliteDatabaseSnapshot.test.ts tests/boundary/providers/native/machoSliceReader.test.ts: 110 passed, 1 skipped
  • npm run test:focused -- tests/boundary/android/androidMappingFile.test.ts tests/boundary/model/modelArtifact.test.ts tests/acceptance/gpuCodeObjectsCli.test.ts tests/boundary/providers/ghidra/ghidraFileFailure.test.ts tests/boundary/mcp/modelArtifactPartialReadFailure.test.ts: 180 passed
  • Mutations above: each failed the matching new case, then reverted
  • npm run check:fast: passed; node scripts/verify/architecture-guards.mjs: passed
  • command — result

Compatibility, safety, and release

  • Breaking changes or migration steps: none (additive values)
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; macOS only. The Ghidra case uses the test provider double, not a real Ghidra
  • 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-15T12:19:54.942453Z
We couldn’t complete this review. Comment @codex review to try again.
67ce136 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 reviewed changes appear safe to merge; no actionable defects were found.

Summary

This PR names existing integrity failures and routes nine provider conversions through readerIntegrityFailure.

  • Artifact readers report which integrity check stopped a read.
  • Provider errors keep the check named by the artifact reader.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Reader["Reader detects an existing failure"] --> Failure["ArtifactReaderFailure + integrityCheck"]
  Failure --> Helper["readerIntegrityFailure + provider options"]
  Helper --> Changed["AnalysisArtifactChangedError"]
  Failure --> Translate["translateArtifactFailure"]
  Translate --> Operation["ArtifactOperationError"]
  Changed --> Public["Public error details.integrity_check"]
  Operation --> Public
Loading

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

@morluto
morluto merged commit c0623f9 into feat/integrity-check-readers Nov 15, 2026
1 check passed
@morluto
morluto deleted the feat/integrity-check-more-readers branch November 15, 2026 12:31
morluto added a commit that referenced this pull request Nov 15, 2026
…-exposure readers (#11056)

* feat(artifacts): name integrity checks for DMG, directory and release-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.

* fix(artifacts): name missing directory entry state and keep integrity checks through error copies

* feat(artifacts): name integrity checks for ZIP, PyInstaller and changed release files (#11081)

feat(artifacts): name integrity checks for ZIP, PyInstaller and changed release files, and keep them through reader projections

* feat(artifacts): name integrity checks for the remaining readers and their projections (#11098)
@morluto morluto added area: evidence Evidence, artifacts, and reconstruction enhancement New feature or request labels Nov 22, 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 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant