Skip to content

feat(artifacts): require every integrity reader failure to name its check - #11505

Merged
morluto merged 1 commit into
mainfrom
feat/artifact-integrity-check-required
Nov 16, 2026
Merged

morluto merged 1 commit into
mainfrom
feat/artifact-integrity-check-required

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Refs #10508 (Phase 6.1 follow-up from #11119/#11129). An integrity ArtifactReaderFailure can no longer be constructed without naming the check that failed: the constructor overloads require integrityCheck for a literal "integrity" reason, and a rebuild whose reason is not a literal must carry the check explicitly. The last unnamed site, DotnetBundleArtifactReader.open, now uses assertProducedEntry.

Problem and expected behavior

Change and scope

  • ArtifactReaderFailure (src/resources/ArtifactReader.ts): three constructor overloads: "integrity" requires integrityCheck; other literal reasons unchanged; a non-literal ArtifactReaderFailureReason requires the integrityCheck key (value may be undefined). primaryFacts() always returns integrityCheck, so existing ...primary.primaryFacts() rebuilds keep compiling and keep the check.
  • DotnetBundleArtifactReader.open: assertProducedEntry (foreign-entry / entry-metadata).
  • pyInstallerReaderFailure (PyInstallerFailure.ts) is the one adapter from parser failures; the reader's private copy is removed and the embedded-format probe uses it.
  • OwnedLeaseCleanupFailure carries integrityCheck. Directory traversal, SQLite journal, DMG and Mach-O verification sites state the check (or undefined) explicitly. ArtifactResourceRetryFailure takes ArtifactReaderFailureOptions instead of ConstructorParameters (which resolves to the last overload).
  • Test fixtures that built unnamed integrity failures now name container-identity.
  • Not included: other error families; the cookie probe currently only returns format/limit failures from its byte reads, so its fix is latent (source-derived).

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: ArtifactReaderFailure constructor owns the rule; assertProducedEntry owns the produced-entry check; pyInstallerReaderFailure owns the parser-failure adaptation (duplicate removed)
  • Contribution scope fit and linked maintainer decision: Phase 6.1 cleanup ([Design] Assert structured remediation facts instead of guidance prose #10508); coordinator listed the Dotnet switch and the type-level guard
  • CLI and MCP/tool-catalog contract: no schema change; a .NET bundle entry mismatch now reports details.integrity_check (foreign-entry or entry-metadata) where it had none
  • 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): none; cleanup facts on rebuilt failures are unchanged
  • 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: src/resources/ArtifactReader.test.ts (new: @ts-expect-error for an unnamed integrity failure and for a non-literal rebuild without the check; a primaryFacts() rebuild keeps the check); tests/boundary/filesystem/dotnetBundleArtifacts.test.ts asserts entry-metadata for forged metadata and foreign-entry for an unknown key; 13 test fixtures name their check.
  • Base reproduction or other evidence: source-derived: on base the .NET open threw integrity with no integrityCheck, so the two new toMatchObject assertions cannot match; not run against base.
  • Remaining proof gaps: tests/process-global/stableArtifactConsumers.test.ts (fixture-only change) was typechecked but not run.

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 check:fast (typecheck, lint, architecture guards): passed. Pre-push hook passed.
  • npm run test:focused -- the 19 files below: 19 passed, 648 tests passed, 5 skipped: dotnetBundleArtifacts, ArtifactReader, ArtifactResourceScope, OwnedLease, ArtifactEmbeddedFormatProbes, NativeMachoSource, PyInstallerArtifactReader, PyInstallerBoundaries, SqliteDatabaseSnapshotLimits, environmentBundleWrite, FitArtifactReader, ReleaseExposureReader, InterfaceBuilderFinalization, CaptureFailures, AppleDispatchMetadata.failure, artifactInventorySnapshot, assetCatalogFinalization, interfaceBuilderBundle, artifactFileOutcomes.
  • npx oxfmt on changed files: clean.
  • After rebasing onto main (import-only conflicts in ArtifactEmbeddedFormatProbes, DotnetBundleArtifactReader, PyInstallerArtifactReader after refactor(resources): own the stable-root digest with classification as an observer #11445 moved abortIfNeeded/ArtifactFileSource to resources): npm run check:fast passed; npm run test:focused -- dotnetBundleArtifacts, ArtifactReader, ArtifactEmbeddedFormatProbes, PyInstallerArtifactReader, OwnedLease: 5 files, 115 passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none for CLI/MCP users. Internal: code constructing an integrity ArtifactReaderFailure must name integrityCheck.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable
  • 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-15T21:11:21.148587Z
We couldn’t complete this review. Comment @codex review to try again.
1d341a9 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 new blocking issue was found.

Summary

Tightens ArtifactReaderFailure constructor requirements and preserves named checks when failures are rebuilt.

  • Artifact reader failures now keep the name of every integrity check.
  • The .NET bundle reader names the check when an entry does not match.
  • PyInstaller failures keep their named check across reader paths.

Reviews (4) · Last reviewed commit: "feat(artifacts): require every integrity..." · Reviewed by Greptile

Comment thread src/resources/ArtifactReader.ts Resolved
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Correction to my thread reply: the DMG subclass is NativeDmgCommandFailure, and the rebuild in src/resources/ArtifactFileOperation.ts is a subclass constructor there (alongside ExportPublishedCleanupFailure in exportResources.ts). The reasoning is unchanged.

@morluto
morluto force-pushed the feat/artifact-integrity-check-required branch from 1d341a9 to 3674088 Compare November 15, 2026 21:28
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto main (import-only conflicts after #11445; no logic change). @greptileai review

@morluto
morluto force-pushed the feat/artifact-integrity-check-required branch from 3674088 to 7f24d55 Compare November 15, 2026 23:11
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto main (7f24d55; one import conflict in ArtifactEmbeddedFormatProbes.ts, resolved by keeping main's merged ArtifactReaderFailure, abortIfNeeded import plus this PR's pyInstallerReaderFailure). check:fast and 4 affected test files (96 tests) pass.

@greptileai review

…heck

ArtifactReaderFailure overloads require integrityCheck for a literal
"integrity" reason and an explicit (possibly undefined) check for a rebuild
whose reason is not a literal; primaryFacts always carries it. The .NET bundle
reader uses assertProducedEntry, and the PyInstaller cookie probe and owned
lease cleanup rewrap keep the check they previously dropped.
@morluto
morluto force-pushed the feat/artifact-integrity-check-required branch from 7f24d55 to 344a3b1 Compare November 15, 2026 23:46
@morluto
morluto merged commit 6fa58b0 into main Nov 16, 2026
6 checks passed
@morluto
morluto deleted the feat/artifact-integrity-check-required branch November 16, 2026 00:10
morluto added a commit that referenced this pull request Nov 16, 2026
…ilure (#11624)

* feat(android)!: require integrity_check on a JNI library integrity failure

A JNI library failure is now a tagged union: kind integrity carries a
required integrity_check, and no other kind carries one. The producer builds
it from the reader failure, whose integrity constructor requires the check
since #11505. Also drop the stale "evidence produced before this field"
clause from the electron_semantics comment; earlier Evidence revisions are
refused.

BREAKING CHANGE: Android JNI Evidence whose library failure has kind
"integrity" must name integrity_check. Records written before #11191 that
lack it no longer parse; recreate them.

Refs #10510

* test(android): check the JNI failure union in its JSON Schema and the unnamed-check refusal

Exclude integrity from the other failure kinds with excludedValues, so the
JSON Schema conversion declares the exclusion that a bare refine dropped.
The test checks the converted schema against the same valid and malformed
records, and drives an integrity read failure with an explicitly undefined
check: the read is refused, the reader is closed and every checkpoint parses.
@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