This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Repository navigation
fix(control-plane): STALE_PHYSICAL_LEASE for overlapping stale leases; sidecar refuses closed file with held lease (#415, #516) - #525
Merged
Conversation
Author
Review record — head
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Closes #415
Closes #516
Summary
The lease state machine for stale and orphan leases now ends in an actionable terminal path. Nothing is auto-released and no SQLite manual edit is needed.
Already on main (#419,
709368f). The Owner-local, CLI-only hygiene commanddevspace carrier release-revoked-idle-cutover-lease <lease-id> …covers every #415 precondition:--confirmset to the lease id.It writes a durable receipt (migration 26), and replay returns
replayed:true. It also made the overlap scan skip an expired, disjoint lease whose path is gone. This PR does not add a second hygiene authority.Added here:
src/control-plane-ownership.ts. When an expired lease whose path no longer resolves overlaps the requested scope (judged by stored identity), acquisition now fails with the new bounded codeSTALE_PHYSICAL_LEASEinstead of a generic conflict. The error names the lease id and the exact hygiene command syntax. It still fails closed and never auto-releases.scripts/ops/m5-cutover/m5-cutover-lib.mjs.selectModestays pure and takes a newclosedLeaseinput. A closed cutover file whose state-root lease is not terminal now throwsRefusewith thecutover release-terminal-lease …replay hint. Before, it started a brand-new attempt and failed on overlapping scope. A terminal lease, a missing lease row, or no binding still returnsfull.m5-cutover-sidecar.mjs. BeforeselectMode, a read-only probe of the closed file'scoordinationBinding.leaseId, using the sameCarrierBindingStorethe sidecar already opens afterwards.carrier-binding.test.ts: non-revoked carrier, non-expired lease, wrong confirm/carrier/version/lease, pinned lease, terminal witness, and no state change on denial. Stale overlapping lease blocks withSTALE_PHYSICAL_LEASEwhile a disjoint one does not (control-plane-ownership.test.ts). Closed file plus held lease gives Refuse (m5-cutover.test.mjs).cutover release-terminal-lease(#477/#506)carrier release-revoked-idle-cutover-lease(#419)STALE_PHYSICAL_LEASE(new)OWNERSHIP_CONFLICTNo change to
cli.ts,durable-operations.ts,cutover-state.tsorserver.ts, so it does not overlap with #478. No schema change.Evidence
m5-cutover.test.mjs11/1 → 12/0;control-plane-ownership.test.ts36/1 → 37/0.carrier-binding.test.ts: 52/0. The new denial matrix was green immediately because fix: recover stale carrier leases safely #419 already enforced it, so it adds coverage only.npm run typecheckclean;check-test-chainOK; merged with main67907f2(refactor: C4 retire active Carrier governance from direct Dev MCP operations #478) and re-run.npm teststops inprocess-sessions-ci,local-agent-process-treeandhost-operation-policywith "detached grandchild survives". These fail identically on clean main on this macOS host (environment), so they are unrelated.Not done here
The live M5 orphan lease from the #415 body is not touched. Cleaning it is an Owner-local operation with the existing command and needs no code change.
🤖 Generated with Claude Code