Skip to content

test(pkg): cover interrupted lockdir recovery - #16170

Draft
Alizter wants to merge 1 commit into
ocaml:mainfrom
Alizter:repro/lockdir-interrupted-recovery
Draft

test(pkg): cover interrupted lockdir recovery#16170
Alizter wants to merge 1 commit into
ocaml:mainfrom
Alizter:repro/lockdir-interrupted-recovery

Conversation

@Alizter

@Alizter Alizter commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Description

Add a standalone cram regression for the persisted state left when lock-directory regeneration is interrupted after the canonical dune.lock has 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 package b, and requires the next dune pkg lock to 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.lock path blocks the old canonical-to-hidden rename. dune.lock remains 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

  • The new cram failed at the intended rerun assertion in five consecutive local runs with byte-identical diagnostics.
  • nix develop path:. -c dune fmt passed.
  • nix develop path:. -c dune build @check passed.
  • Existing lock-directory-regeneration-safety.t passed.

Checklist

  • Test added.
  • Changelog not applicable: test-only reproducer.
  • Documentation not applicable: test-only reproducer.

@Alizter
Alizter force-pushed the repro/lockdir-interrupted-recovery branch 2 times, most recently from 17dd8f2 to 11c8b48 Compare August 24, 2026 15:33
@Alizter Alizter changed the title test(pkg): cover interrupted lockdir recovery fix(pkg): recover interrupted lockdir replacement Aug 24, 2026
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
Alizter force-pushed the repro/lockdir-interrupted-recovery branch from 11c8b48 to 2d1f4b3 Compare August 24, 2026 15:47
@Alizter Alizter changed the title fix(pkg): recover interrupted lockdir replacement test(pkg): cover interrupted lockdir recovery Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant