Skip to content

fix(coderd/database/dbfake): prevent cross-test job stealing in WorkspaceBuildBuilder#22598

Merged
mafredri merged 1 commit intomainfrom
plan-w4dh
Mar 4, 2026
Merged

fix(coderd/database/dbfake): prevent cross-test job stealing in WorkspaceBuildBuilder#22598
mafredri merged 1 commit intomainfrom
plan-w4dh

Conversation

@mafredri
Copy link
Member

@mafredri mafredri commented Mar 4, 2026

Previously, WorkspaceBuildBuilder.doInTX() inserted provisioner jobs
with empty tags and used a loop in AcquireProvisionerJob that could
match other tests' pending jobs when parallel tests share a database.

Add a unique tag (jobID -> "true") to each provisioner job at insert
time, then use that tag in AcquireProvisionerJob to target only the
correct job. This follows the same pattern used in dbgen.ProvisionerJob.

Closes coder/internal#1367

Copy link
Contributor

@ssncferreira ssncferreira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Super clean 🥇

…paceBuildBuilder

Previously, WorkspaceBuildBuilder.doInTX() inserted provisioner jobs
with empty tags and used a loop in AcquireProvisionerJob that could
match other tests' pending jobs when parallel tests share a database.

Add a unique tag (jobID -> "true") to each provisioner job at insert
time, then use that tag in AcquireProvisionerJob to target only the
correct job. This follows the same pattern used in dbgen.ProvisionerJob.

Closes coder/internal#1367
@mafredri mafredri enabled auto-merge (squash) March 4, 2026 16:23
@mafredri mafredri merged commit c7dd429 into main Mar 4, 2026
43 of 45 checks passed
@mafredri mafredri deleted the plan-w4dh branch March 4, 2026 17:47
@github-actions github-actions bot locked and limited conversation to collaborators Mar 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flake: TestTasks/Send/SendToNonActiveStates/Pending

2 participants