Skip to content

feat(schedule): a run booking can claim its hours - #347

Merged
T-Crypt merged 2 commits into
nextfrom
T-Crypt/claim-run-booking
Nov 16, 2026
Merged

T-Crypt merged 2 commits into
nextfrom
T-Crypt/claim-run-booking

Conversation

@T-Crypt

@T-Crypt T-Crypt commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Closes #345.

What changes

berth schedule book --claim books a run that claims its hours. While the booking lasts, the booked engine's waiter drains any holder except a hold or a pinned lease (a training is pinned), whatever the holder's priority. Without --claim, a run works as before.

On 2026-11-16 a batch run for strata (00:00 to 01:25) lost its hours to an idle foreground lease, strata-sc117. That lease held the card from 22:36 until 06:00. All three requests in the window waited 10 minutes and were refused with held by strata-sc117 [foreground, active].

The claim belongs to the operator:

  • Booking.Check refuses a claim on a priority change or on downtime.
  • The gateway books no claim. A "claim" field in a POST body is ignored, and PATCH or DELETE on a claiming run returns 403.
  • The harbor form has the checkbox and keeps the claim when you move a booking.
  • berth schedule shows the kind as run (claim).

The drain happens only when the booked engine asks for the card. A claim never empties the card for a job that does not show up.

Proof

  • TestClaimRunBookingDrainsAHigherHolder (broker) fails without the change: a batch run with a claim did not drain a foreground holder. It also checks that a run without a claim leaves the holder alone and that a claim never drains a hold.
  • TestScheduleRoutesLeaveTheOperatorsBookings (gateway): a claim in the body books none, and move or cancel of a claiming run is a 403.
  • TestScheduleAgainstADaemon (cli): --claim reaches the schedule file, the board shows it, and --kind down --claim is refused.
  • TestCheckRefusesBadBookings (schedule): a claim on a priority booking is refused.
  • Full proof is green: build, gofmt, vet, go test ./..., the Windows build and vet, golangci-lint 2.14.0.

berth schedule book --claim books a run whose waiter drains any holder
but a hold or a pinned lease, whatever the holder's priority. A batch
run used to lose its hours to an idle foreground holder: on 2026-11-16
an idle strata-sc117 lease kept the card from 22:36 to 06:00 and all
three requests in the 00:00 run were refused after 10 minutes.

The claim is the operator's. Check refuses it on a priority change or a
downtime, the gateway books none and answers 403 to a move or cancel of
one, and the harbor form carries it through a move.

Closes #345
@T-Crypt
T-Crypt merged commit e451ba8 into next Nov 16, 2026
4 checks passed
@T-Crypt
T-Crypt deleted the T-Crypt/claim-run-booking branch November 16, 2026 15:00
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.

1 participant