← Back to Pull requests

feat(wod): read and judge the parts a score targets #567

Open
unknown opened this pull request with 264 lines diff across 3 files
View on GitHub
unknown unknown commented on Dec 01, 2026 16:01 UTC
Author

Summary


First of three slices of the WOD scores (split validated by the owner: SC-API-264 here, then SC-API-292 #565 for the contract and POST /activities, then SC-API-293 #566 for one WOD on a single activity). No route changes here.

  • wod.Repository.Targets: the parts a score targets, with the challenge and day of their WOD, in one query, in the caller's transaction, FOR SHARE OF w, p in WOD order (a WOD deletion waits for it, or its parts are gone; a part changed meanwhile is read as it is now). Parts of a deleted challenge or one no longer CrossFit are left out.

  • activity.ScoresRefusal (pure): scores only on a crossfit activity (422 scores_not_allowed); a part not found or of a challenge where the activity does not count (active participant, window) answers alike (422 wod_part_unavailable, nothing revealed); the WOD day in the same week of that challenge as the activity's start (422 wod_other_week), weeks via scoring.Window.

  • New apperr codes (422); they enter the contract with the route (SC-API-292).

  • README §2.5: a time equal to the time cap counts as finished; the "not finished" box is not an API field (owner decision 2026-12-01).
  • Checks


  • make fmt && make lint && make test ✅ · make test-integration ✅

  • TestScoresRefusal: 25 cases (two challenges with different week cuts, March and November DST, exact window bounds, left challenge, unknown part, missing time zone).

  • TestTargets (filters) and TestTargetsHoldWOD (a deletion waits for a score transaction, then answers wod_scored; fails without FOR SHARE, checked by mutation).

  • Reviews: sql-query, closure, spec-guardian, go, rules-tester: nothing blocking; applied: lock parts too, docs on alignment and the week lock, clearer test cases.
  • To confirm


  • 422 wod_part_unavailable (not 404) for an unknown part: it is a reference in the body, not the resource of the URL, and answers like a part of a challenge where the activity does not count.
  • Size


    239 lines (tests ~140), above the 200-line limit.

    Closes #510

    🤖 Generated with Claude Code

    Diff: 264 lines (+198 / -66) across 3 files Reviewer: github-actions[bot] Review duration: 3m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.39) × (1 − Review Confidence (0.31)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 264 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 53% · Reviewer familiarity: 35%
    30%
    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.334
    Real PR Conversation Timeline
    1 comments
    "Review active on #567"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 30.5% 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: 39.3% (MEDIUM) · Higher = larger blast radius
    39.3%
    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: 30.5% · Lower = rushed or shallow review
    30.5%
    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: 27.3% · Safe to merge
    27.3%