← Back to Pull requests

TRT-3065: Sippy triage reconciliation oscillates between legacy and current Jira bug rows #4175

Closed
unknown closed this pull request without merging on Nov 03, 2026 16:04 UTC
View on GitHub
unknown unknown commented on Nov 02, 2026 18:55 UTC
Author

Summary

Fixes TRT-3065: triage reconciliation kept switching between legacy and current Jira bug rows that share a URL (triage 508 is one example).

Root cause

Legacy on-prem and current cloud Jira records can exist side by side under different numeric IDs for the same issue URL. The link step in ReconcileTriages matched every bug row for the triage URL using t.bug_id != b.id. With two rows, the row the triage is not linked to always matches. As a result, each pass:

  • relinked the triage to the other row

  • copied that row's summary into the description

  • advanced updated_at
  • Fix (pkg/dataloader/bugloader/bugloader.go)

  • New latestBugPerURL subquery: DISTINCT ON (url) over non-deleted bugs, ordered by last_change_time DESC NULLS LAST, id DESC. The latest Jira change wins, a timestamp tie goes to the higher ID, and rows with no timestamp sort last.

  • Triages are now linked to that row first. The description, auto-resolve and auto-unresolve steps then join on t.bug_id, so all of them use the same row.

  • No-op guards are kept: IS DISTINCT FROM on the link and description updates, plus the existing locked re-checks before resolving or unresolving.

  • Matching through bug_id when the URL has changed (Jira key change) works as before.
  • Audit changes and cleaning up the duplicate rows in the source data or the database are out of scope, as the ticket says.

    Tests (test/integration/triage_jira_progression_test.go)

    New table-driven TestReconcileTriagesDuplicateBugRows. Each case runs reconciliation 4 times and checks that bug_id, description and resolution stay the same, and that updated_at and the audit log entries don't change after the first pass. Cases:

  • the newer row has the lower ID

  • the newer row has the higher ID

  • the triage is already linked to the legacy row

  • equal timestamps (higher ID wins)

  • a NULL last_change_time

  • a newer row that is soft-deleted
  • Without the fix, 5 of the 6 cases fail. The soft-deleted case passes with and without the fix, since there is only one live row in that case.

    Validation

  • make integration: passed (572 tests). I had to point podman at the k8s-file log driver locally so testcontainers could start.

  • make lint: passed (0 issues).

  • make test: passed (BDD 51, Go 16937 with 32 skipped, Vitest 192, mcp pytest 53).

  • make e2e: failed. 149 tests ran: 2 failures and 1 skip. Both failures are test/e2e/componentreadiness hitting the 10-minute timeout while TestRegressionCacheLoader runs the BigQuery-backed regression cache loader. The e2e run doesn't touch the bugloader package (0.0% coverage), so I believe this failure is environmental and unrelated. I did not rerun it on main to confirm.
  • 🤖 Generated with Claude Code

    ---
    Generated with Claude Code

    <!-- coderabbit-review -->

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Bug Fixes
    Triage records now consistently link to the most recently updated active Jira bug when multiple entries share a URL. Entries without a change timestamp are considered after dated entries, with ties resolved consistently.
    Existing links are corrected when needed, and descriptions are updated only when the linked bug has a non-empty, changed summary.
    Automatic resolution checks now use the linked bug rather than matching by URL, so triages without a linked bug are not matched this way.
    * Repeated reconciliation avoids unnecessary changes to descriptions, resolution status, update timestamps, and audit history.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 475 lines (+356 / -119) across 5 files Reviewer: sosiouxme Review duration: 1268m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 475 lines diff across 5 files
    0.46
    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.369
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4175"
    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: 45.7% (MEDIUM) · Higher = larger blast radius
    45.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: 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: 18.1% · Safe to merge
    18.1%