← Back to Pull requests

fix(vehicle_labor_appraisal): stop counting reassembly pieces twice #3720

Closed
unknown closed this pull request without merging on Nov 22, 2026 19:36 UTC
View on GitHub
unknown unknown commented on Nov 22, 2026 19:21 UTC
Author

Read logged out on 2026-11-22: the proof vehicle's reassembly segment priced carpet, seat and headliner pieces (INT-CARPET-RR, INT-SEATS-RR, INT-HEADLINER-RR: 7 of 9.75 h). The interior segment was open on the same operations, so the same work was counted twice.

The change is one migration, 20261122203000_vehicle_labor_appraisal_no_double_count.sql: the #3711 body, logic_version 20261122203000.1.

  • When a matched reassembly piece has an operation code or line system that an open segment's rule keys on, it is counted in that segment.

  • That piece stays listed with counted_in. Its hours leave reassembly and the totals, and the reassembly segment reports them as hours_counted_elsewhere.

  • Matched pieces now carry their line system key. They still carry no text.
  • Test plan


  • test_vehicle_labor_appraisal.sql on PG17 passes.

  • - The brake pads piece (line system brakes) is counted in chassis.
    - The seat foam piece (INT-SEATS-RR) is counted in interior.
    - Reassembly is 0 h, with 6.5 h counted elsewhere.
    - The totals still equal the segment sums.
  • Live after deploy: proof vehicle reassembly 2.75 h (7 h counted elsewhere), totals down 7 h. Other vehicles unchanged unless the same overlap applies to them.
  • 🤖 Generated with Claude Code

    <!-- CURSOR_SUMMARY -->
    ---

    [!NOTE]

    Medium Risk

    Changes core labor appraisal totals and segment hours for any vehicle with reassembly pieces overlapping open segment rules; covered by updated SQL contract tests.

    > Overview

    Replaces vehicle_labor_appraisal (logic 20261122203000.1) so labor hours are not counted in both reassembly and an evidence-open segment when the same work is already priced elsewhere.

    > After segments are built, matched reassembly pieces are checked against other active rules via operation code or receipt system key. Overlapping hours are removed from reassembly and from aggregate totals; the reassembly segment exposes hours_counted_elsewhere, and each affected piece keeps a counted_in segment reference. Matched pieces now include their line system in the JSON output.

    > test_vehicle_labor_appraisal.sql loads the new migration, adds a seat-foam witness fixture, and asserts brake pads roll into chassis, seat foam into interior, with reassembly at 0 h and 6.5 h reported elsewhere.

    > <sup>Reviewed by Cursor Bugbot for commit 6fdc41f5e203b7e45d40a258e5093d2dd450f32d. Bugbot is set up for automated code reviews on this repo. Configure here.</sup>

    <!-- /CURSOR_SUMMARY -->

    Diff: 330 lines (+247 / -83) across 4 files Reviewer: cursor[bot] Review duration: 14m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 330 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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
    Diff Size diff_size
    0.347
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3720"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.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: 42.1% (MEDIUM) · Higher = larger blast radius
    42.1%
    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: 60.5% · Lower = rushed or shallow review
    60.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: 16.6% · Safe to merge
    16.6%
    Repository