← Back to Pull requests

test(gateway): pin the waiter of a wait cancelled under a full job queue #6039

Open
unknown opened this pull request with 217 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 12, 2026 15:50 UTC
Author

Description

Problem

submit_and_wait removes its waiter through a guard when the caller leaves by any path. One of the paths, a caller dropped while its submit is parked on a queue slot, had no test. The module's unit tests build the queue over a dropped context, so a submit returns at the context check before it parks.

Solution

One unit test over the crate's test-only AppContext builder and a capacity-one queue whose one slot the test holds. The wait is dropped while parked. The test reads the waiter under the key while the submit waits, gone after the drop, and a later caller's under the key.

Changes

  • model_gateway/src/workflow/job_queue.rs: the test a_wait_cancelled_under_a_full_queue_leaves_no_waiter.
  • Test Plan

  • cargo test -p smg --lib -- workflow::job_queue::tests: 21 passed, three runs.

  • cargo clippy -p smg --all-targets -- -D warnings, cargo fmt --check and cargo doc -p smg with warnings denied: clean.

  • Two mutants, job_queue.rs restored after each. The guard created after the submit, the refused arm removing the waiter itself: the new test red at the drop. The guard dropped at once: the new test red while parked.

  • Reviewed on this head: ACCEPT, the review of 2026-11-12T15:50:20Z (the carry onto main, the same change reviewed on 2026-11-12T05:43:53Z). A green second gate, the test gate of 2026-11-12T06:54:03Z, read again by content on the carry.
  • Numbers

    | measure | before | after |
    |---|---|---|
    | tests of a wait cancelled while the queue is full | 0 | 1 |
    | job queue unit tests | 20 | 21 |
    | mutants of the guard's placement the suite catches | 0 of 2 | 2 of 2 |

    Release note

    A test pins that a caller leaving a full job queue takes its waiter with it.

    Diff: 217 lines (+162 / -55) across 2 files Reviewer: claude[bot] Review duration: 7m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.37) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 217 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.322
    Real PR Conversation Timeline
    1 comments
    "Review active on #6039"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.7% (MEDIUM) · Higher = larger blast radius
    36.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.6% · Safe to merge
    19.6%