Skip to content

feat(leasing): call lease-end participants before reclaiming a device - #494

Merged
V3RON merged 8 commits into
mainfrom
task/469
Oct 12, 2026
Merged

V3RON merged 8 commits into
mainfrom
task/469

Conversation

@V3RON

@V3RON V3RON commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Closes #469

Status

Implement: done (43/43 green) Review: round 2 + claims-only passed Hardware: n/a Gate: running
Next: gate

Done when

  • The tests above pass.
  • Removing the wait before reclaim.reclaim makes "the driver's reclaim does not start until the participant returns" fail.
  • Removing the cut-short from beginMaintenance makes the first nuke test fail.
  • The diff of src/leasing/create-leasing.test.ts and src/leasing/lease-release-coordinator.test.ts adds only the new config key and the coordinator's new options; the participant tests are all in src/leasing/lease-end-participants.test.ts.
  • Dropping the deferred-reclaim marker from the background release makes the "daemon stopped while a participant has not returned" test fail.

Assumptions

  • Assumption: the red commit's scaffolding (the two port types, LeasingOptions.leaseEndParticipants, TestEngineOptions.leaseEndParticipants, Config.lease.endWaitMs with its 600000 default) is type-only, so the tests and the commit hook's typecheck compile; no behaviour yet.
  • Assumption: log fields are leaseId, deviceId and error, as the coordinator's existing background-reclaim error uses.
  • Assumption: the coordinator takes one optional leaseEnd option (clock, ceiling, participants), set only when a participant is registered — it keeps the no-participant path and the existing coordinator tests unchanged.
  • Assumption: the protocol bump is 28 to 29, with the gateway and daemon-protocol tests that pin the number moved with it — the spec says +1 at merge, and the schema change is what needs it.
  • Assumption: lease.endWaitMs is any positive number up to 2147483647 (not only integers) — the spec says "positive number".

Review

Spec review: 1 blocking, 1 fixed, 1 notes. Code review: 2 blocking, 1 fixed, 0 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 2. Tokens: 4.2M.

Rejected:

  • code: participants called inside decisions.run (lease-release-coordinator.ts:173) — duplicate of the spec finding, fixed there

Written by an agent.

@V3RON

V3RON commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

Review notes

Not blocking, not verified. Each is one reviewer's claim.

  • spec: src/leasing/lease-release-coordinator.ts:1808 after dispose(), a new ending gets an aborted signal and runs reclaim.reclaim at once, as it does without participants today.

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review October 12, 2026 20:47
@V3RON
V3RON merged commit dc31641 into main Oct 12, 2026
37 checks passed
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.

Leasing calls lease-end participants before it reclaims a device

1 participant