Wait for pending derivations before checking validity - #61
Open
jacobmichels wants to merge 1 commit into
Open
Conversation
jacobmichels
requested review from
joshheinrichs-shopify and
lilyinstarlight
September 6, 2026 03:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
macOS CI on
mainfails inflakes / provenanceafter the test clears its store and restores a package from a binary cache. The provenance check, which checks how the package was built, reports that it cannot recreate the package's.drvfile (its build recipe).A validity lookup can race with an asynchronous recipe write. The write clears the cached metadata, but an earlier lookup can finish afterward and cache a stale “missing” result. Waiting only before the final validity check is too late.
Change
Wait for any queued write in
AttrCursor::forceDerivation()before the first validity lookup. Keep the existing regeneration path for recipes that are genuinely absent.Add a deterministic regression test that completes a write between a missing-path lookup and the caching of its result. It uses a temporary local store and a controlled write schedule, without threads or sleeps. The test reproduces the same error before the fix and passes afterward.
Checks
nix develop -c meson compile -C buildnix develop -c meson test -C build --no-rebuild --print-errorlogs nix-expr-tests eval-cache provenancenix develop -c ./maintainers/format.shLocal checks run on Linux. macOS confirmation remains with CI.