fix(ploeg): keep the legacy claim off Work Items a live Shift owns #153
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ryangr0/ploeg-legacy-claim-respects-shifts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A role-less claim tried the Shift path first and fell back to
Store.ClaimWithin after ErrNoWork or ErrBudgetExhausted. ClaimWithin
selected any queued item, including one owned by a live Shift. Two
role-less workers could race: one locked the Shift's pending empty-role
Run, the other skipped it under SKIP LOCKED, got ErrNoWork and leased the
same still-queued Work Item through the legacy path. That created a Run
outside the Shift and its pool, and managed mode signed a token for it.
An exhausted Shift pool likewise fell through to an unpooled legacy
claim.
ClaimWithin now excludes items with a live Shift, and a role-less claim
that the Shift path refuses for budget answers 204 without trying the
legacy path. Items without a Shift are claimed as before; the claimable
index test now covers the new predicate.
The roleless KEDA scaler query in ops/helm/ploeg/templates/scaledjob.yaml is deliberately unchanged: it now counts a superset (empty-role Shift Runs keep their item queued), which only overshoots. Its 'must stay in sync with store.Claim' comment is now slightly loose.
Verified with
mise run verifyon the pinned toolchain (all gates passed).Ticket: https://vikunja.webgrip.dev/tasks/1735
🤖 Generated with Claude Code