Skip to content

refactor(resources): move the artifact file source into src/resources - #11484

Merged
morluto merged 1 commit into
refactor/stable-root-digest-resourcesfrom
refactor/artifact-file-source-resources
Nov 15, 2026
Merged

morluto merged 1 commit into
refactor/stable-root-digest-resourcesfrom
refactor/artifact-file-source-resources

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

Moves ArtifactFileSource and artifactFileAdmissionFailure from the artifacts provider into src/resources (git mv), and exports them from src/resources/index.ts:

  • src/artifacts/ArtifactFileSource.ts (and its test) -> src/resources/ArtifactFileSource.ts;
  • src/artifacts/ArtifactFileAdmission.ts -> src/resources/ArtifactFileAdmission.ts.

ArtifactFileSource hashed its bound descriptor through the artifacts hashReadable, which also ran the classification probe. It now uses the resources digest from #11445 (digestReadableToCompletion) directly and reads only sha256, so it no longer depends on artifacts and no longer runs a classification probe it discarded.

PlaywrightTraceDecoder imported assertArtifactFileSelectedSource from artifacts, so browser -> artifacts drops from 5 to 4.

Stacked on #11445. Third step of the ZIP half of #11426, after #11474 (ArtifactReaderLimits) and #11475 (src/domain/zip): with this, ZipArtifactReader's remaining artifacts dependencies have owners below providers. Refs #11359. Part of plan W9.

Problem and expected behavior

Shared archive readers (ZIP, Mach-O slices and others) bind their descriptor through an artifacts-provider class, so they could not leave the provider. Expected: the descriptor and hash binding lives with the other artifact file primitives in the shared provider toolkit.

Change and scope

  • One behaviour detail changed, deliberately. hashReadable checked the signal right after the last chunk. A cancellation in that window then preempted the source revalidation that follows. The new code keeps the completed digest, revalidates the source, and checks cancellation afterwards (the existing assertArtifactReadActive after binding). This is what the code comment there already required ("A completed digest needs source validation before late cancellation can decide the outcome"). Outcomes:
    • Matching digest: still cancelled.
    • Changed source: now reported as the integrity failure rather than as a cancellation.
  • tests/process-global/selectedArtifactSourceLifecycle.test.ts held the late abort inside a spy on hashReadable. It now spies on digestReadableToCompletion. Its abort = true case fails if the post-digest signal check is restored, because the abort then arrives before that check.
  • 25 importers use resources/index.js. Duplicate imports from that entry are merged.
  • Inside resources, the moved files import their siblings directly, as the other resources modules do.

Not included: the ZipArtifactReader move itself (next), and browser -> artifacts through ElectronFileScope (ASAR) and SazCapture/PlaywrightTraceDecoder (ZIP reader).

Contract and boundary impact

  • Semantic owner and earliest changed stage: the descriptor binding and admission-failure projection move from the artifacts provider to src/resources; hashing goes through the resources digest. Only the late-cancellation ordering described above changes.
  • Contribution scope fit and linked maintainer decision: [Design] Owner for the ZIP reader and the stable-root digest that other providers import from artifacts #11426 (coordinator decision on the ZIP split), [Design] Provider-to-provider import rule with declared exceptions #11359. No new capability.
  • CLI and MCP/tool-catalog contract: 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): descriptor ownership and cleanup are unchanged. A cancellation that arrives after the carrier digest completes no longer hides a changed carrier.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: 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: selectedArtifactSourceLifecycle.test.ts spies on the resources digest; ArtifactFileSource.test.ts moves with the class.
  • Base reproduction or other evidence: with the spy on the new digest and the post-digest signal check restored, rejects selected pathname replacement after real hashing even with a late abort (true) failed (1 failed, 7 passed). It passes after the change.
  • User-visible CLI/MCP output (if applicable): none.
  • Remaining proof gaps: none known.

For boundary fixes, the applicable lifecycle regression is cancellation during final validation, covered by the test above.

  • 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: passed, including the architecture guards.
  • node scripts/verify-module-boundaries.mjs: passed after lowering the baseline.
  • npm run test:focused -- with src/resources/ArtifactFileSource.test.ts, tests/process-global/selectedArtifactSourceLifecycle.test.ts, src/artifacts/{ArtifactSourceResolution,FitArtifactReader,HexRecordArtifactReader,NtfsMftArtifactReader,ZipArtifactReader,MachOSliceArtifactReader}.test.ts and src/artifacts/{UnityFsArtifactReader,WxapkgArtifactReader}.boundaries.test.ts: 10 files, 186 tests passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. These are internal modules.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: not applicable.

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-15T20:56:54.393542Z
We couldn’t complete this review. Comment @codex review to try again.
09c904e 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

[Medium impact] The PR appears safe to merge.

Summary

Moves ArtifactFileSource and artifactFileAdmissionFailure into src/resources and updates their callers.

  • Artifact readers get shared file-source checks from resources.
  • Carrier checks validate the source before late cancellation wins.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Reader binds expected SHA-256] --> B[Verify open file]
  B --> C[Digest file bytes]
  C --> D[Verify source again]
  D --> E{Source and digest match?}
  E -->|No| F[Report integrity failure]
  E -->|Yes| G{Cancelled?}
  G -->|Yes| H[Report cancellation]
  G -->|No| I[Save verified digest]
Loading

Reviews (2) · Last reviewed commit: "refactor(resources): move the artifact f..." · Reviewed by Greptile

@morluto
morluto merged commit 8992872 into refactor/stable-root-digest-resources Nov 15, 2026
1 check passed
@morluto
morluto deleted the refactor/artifact-file-source-resources branch November 15, 2026 21:00
morluto added a commit that referenced this pull request Nov 15, 2026
…s an observer (#11445)

* refactor(resources): own the stable-root digest with classification as an observer

* refactor(resources): move the artifact file source into src/resources (#11484)
@morluto morluto added the area: evidence Evidence, artifacts, and reconstruction label 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant