test(pkg): cover interrupted lockdir recovery - #16170
Draft
Alizter wants to merge 1 commit into
Draft
Conversation
Alizter
force-pushed
the
repro/lockdir-interrupted-recovery
branch
2 times, most recently
from
August 24, 2026 15:33
17dd8f2 to
11c8b48
Compare
Add a focused cram regression for the persisted state left when lockdir regeneration is interrupted after moving the canonical dune.lock to .dune.lock. The next dune pkg lock is expected to restore a valid canonical lock directory and remove the hidden staging directory. The regression intentionally fails on current main: regeneration refuses while .dune.lock exists and leaves dune.lock absent. Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter
force-pushed
the
repro/lockdir-interrupted-recovery
branch
from
August 24, 2026 15:47
11c8b48 to
2d1f4b3
Compare
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.
Description
Add a standalone cram regression for the persisted state left when lock-directory regeneration is interrupted after the canonical
dune.lockhas been moved to.dune.lock.The test starts with a generated and validated solution for package
a, moves it to the hidden path, changes the project to require packageb, and requires the nextdune pkg lockto install the newly requested canonical solution and remove the staging backup. Using distinct solutions prevents an implementation that merely restores the stale backup from passing.This is intentionally a test-only draft. The expected fixed behavior remains in the cram, so the new test is red on
main.Current Failure
Current Dune refuses regeneration because the occupied
.dune.lockpath blocks the old canonical-to-hidden rename.dune.lockremains absent and the validated hidden backup remains present.Related Issue and Motivation
#10852 introduced the hidden backup as part of atomic lock-directory replacement and noted that it could be restored after failure. This regression fixes the desired recovery behavior in place before any implementation PR is proposed.
Verification
nix develop path:. -c dune fmtpassed.nix develop path:. -c dune build @checkpassed.lock-directory-regeneration-safety.tpassed.Checklist