Skip to content

trace: recheck physical store availability for locked fetchurl - #752

Draft
ConnorBaker wants to merge 2 commits into
numtide:mainfrom
ConnorBaker:fix/locked-fetchurl-validity
Draft

ConnorBaker wants to merge 2 commits into
numtide:mainfrom
ConnorBaker:fix/locked-fetchurl-validity

Conversation

@ConnorBaker

@ConnorBaker ConnorBaker commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

A hash-pinned builtins.fetchurl first checks its physical fixed output, then its verified managed input, then the origin. The result cache must replay the same choice when the physical path, daemon registration or file contents change.

Record physical absence before using a managed file. For a present candidate, recheck local daemon registration or the original flat hash on replay. This allows an unchanged registered file to retain whole-command cache hits. A cold miss can wait for a producer or report a new download failure, so its evaluation declines a cache write.

The tests cover changing bytes with an unavailable origin, a managed cache hit followed by physical appearance and a private daemon whose registration changes with identical restored bytes. #751 shares the fixed-output observation and validator.

For a registered physical file, all seven x86-64 fold runs reused the result. Rechecking registration used about 5.2% more client instructions than main’s unchecked hit. The native x86 suite passed 2,127 tests. Both this PR and #751 contain the same validator commit and merge cleanly in either order.

AI assistance from OpenAI Codex.

Summary by CodeRabbit

  • Bug Fixes

    • Flat fetchurl results are now checked against the current store state before cached results are reused. Invalid or unregistered files no longer pass as valid, and files with incorrect pinned hashes trigger a download attempt.
    • Cached evaluations are skipped when a fetch is still required, helping prevent stale results.
  • Documentation

    • Clarified how locked fetchurl checks verified files and handles cached results.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

No actionable comments were generated in the recent review.

Walkthrough

Locked flat builtins.fetchurl checks cached fixed-output paths against store registration or content and records that validity in trace observations. Trace serialization and validation now preserve and recheck those observations. Cache misses that require a fetch mark the evaluation uncacheable.

Changes: Fixed-output fetch validity

Layer / File(s) Summary
Fixed-output trace representation
src/trace/mod.rs, src/trace/wire.rs, src/cli/cache_dump.rs
Trace observations now store fixed-output entry, hash, mode, and validity. Wire encoding and decoding support the observation, and cache dumps display its entry and validity.
Store validity and fetch cache checks
src/source/remote.rs, src/source/mod.rs, docs/explanation/caching.md
Flat fetches check cached paths through store registration or content hashing. If neither the store nor input store provides the file, the evaluation becomes uncacheable before fetching. The documentation describes this cache flow.
Trace revalidation and fetch tests
src/trace/validate.rs, tests/e2e_daemon.rs, tests/fetchurl.rs
Trace validation rechecks recorded fixed-output validity. Tests cover daemon registration, physical-file content, and managed input reuse.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Suggested reviewers: zimbatm, mic92

Merge Risk: Minimal · previous review 733b3

Locked flat fetchurl results now recheck whether the physical store file is still registered or valid before reusing a cached result. Evaluations that still need a download skip the cache write. The change is well covered by the supplied tests and shows no remaining concrete merge risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "trace: recheck physical store availability for locked fetchurl" matches the main change. The changeset adds a fixed-output trace observation (Obs::FixedOutput) and a recheck of the physical…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "trace: recheck physical store availability for locked fetchurl" matches the main change. The changeset adds a fixed-output trace observation (Obs::FixedOutput) and a recheck of the physical store path during replay (recheck_fixed_output, valid_expected). The fetch_file cache path now declines cache writes on misses. Tests cover the physical-store recheck for flat fetches. The title names the trace recheck and the locked fetchurl scope, and it omits the cache-write change, which is an expected omission.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5103aa05-bcf2-4f9f-8434-080da1e771ae
Commits

Reviewing files that changed from the base of the PR and between 140a202 and 733b33d.

Files selected for processing: 9

  • docs/explanation/caching.md
  • src/cli/cache_dump.rs
  • src/source/mod.rs
  • src/source/remote.rs
  • src/trace/mod.rs
  • src/trace/validate.rs
  • src/trace/wire.rs
  • tests/e2e_daemon.rs
  • tests/fetchurl.rs

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@ConnorBaker
ConnorBaker force-pushed the fix/locked-fetchurl-validity branch 5 times, most recently from 7457b1d to 733b33d Compare November 30, 2026 09:28
@ConnorBaker

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ConnorBaker

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ConnorBaker

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ConnorBaker

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ConnorBaker
ConnorBaker force-pushed the fix/locked-fetchurl-validity branch from 733b33d to 0a73654 Compare November 30, 2026 23:57
@ConnorBaker
ConnorBaker force-pushed the fix/locked-fetchurl-validity branch from 0a73654 to 4131fea Compare December 1, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant