TRT-3065: Sippy triage reconciliation oscillates between legacy and current Jira bug rows #4175
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
sosiouxme
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
ReconcileTriagesmatched every bug row for the triage URL usingt.bug_id != b.id. With two rows, the row the triage is not linked to always matches. As a result, each pass:updated_atFix (
pkg/dataloader/bugloader/bugloader.go)latestBugPerURLsubquery:DISTINCT ON (url)over non-deleted bugs, ordered bylast_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.t.bug_id, so all of them use the same row.IS DISTINCT FROMon the link and description updates, plus the existing locked re-checks before resolving or unresolving.bug_idwhen 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 thatbug_id, description and resolution stay the same, and thatupdated_atand the audit log entries don't change after the first pass. Cases:NULLlast_change_timeWithout 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 thek8s-filelog 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 aretest/e2e/componentreadinesshitting the 10-minute timeout whileTestRegressionCacheLoaderruns 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 onmainto 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 -->