Repository navigation
test(fleet-queue): concurrent-claim regression fixture for the losing-claim race (#7068) - #8107
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 the remaining acceptance item of #7068 (claim race: task 11895, lanes code-m/code-f, 2026-11-08 — a losing
fleet queue claimcall returned the winner's live claim, lane stamp and all).What I found
The mechanism was already fixed by #7617 (PR #7882): the early Turso claim shape re-read its result as "the newest claimed row for (queue, worker_id)" — with every lane sharing
repo-worker-code, the loser was handed another lane's task. Currentverb_claimpicks a candidate id first, claims it with ONE conditional UPDATE that re-checks the full pick predicate, reads the row back by id, and re-picks on 0 affected rows;claim_by_idre-checks the observed status the same way. The Postgresclaim_repo_task(migration-0023) usesFOR UPDATE SKIP LOCKED+RETURNINGand never had the shape.What #7068 still lacked was acceptance item 2: a regression test exercising two concurrent claims (distinct lane ids, same queue) showing exactly one winner per task. This PR adds it — no behavior change.
Changes (
pkgs/fleet/crates/fleet-queue/src/turso_queue.rsonly)claim_update_sql(pick_predicate)— byte-identical statement — so its shape is pinnable in tests without a live store.claim_update_sql_rechecks_pick_eligibility_for_the_picked_id— the UPDATE is keyedWHERE id = ?and re-checks status/attempts/not_before, so the loser's UPDATE matches 0 rows once the winner flips the row toclaimed.claim_race_two_lanes_exactly_one_winner_per_task— the task 11895 fixture: both lanes see the queued row claimable; after code-f's claim lands (statusclaimed,lane_id = code-f), the loser's claim view of that row is closed, and the next queued row stays claimable (loser moves on or gets no-task — never the winner's row).claim_paths_never_reread_a_workers_newest_claimed_row— source oracle in the style of fleet-search's serve-contract tests: neither claim path may reintroduce a worker-keyed newest-claimed re-read; read-back stays by row id.Tests
cargo test -p fleet-queue --features queue-broker— 125 passed, 0 failed (18 claim-filtered, including the 3 new tests).cargo fmt --checkreports pre-existing drift across this crate under the current toolchain; this change follows the file's existing style and does not reformat unrelated code.Queue: task 14493 (repo-health-code-pilot), lane code-k.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.