← Back to Pull requests

TRT-3006: Sippy: restore historical test-details links for closed regressions #4221

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 17, 2026 23:06 UTC
Author

Summary

TRT-3006: once a Component Readiness regression closed and rolled off the current report, its test_details link disappeared. This PR restores it as a historical link, anchored to the regression's last failure, for every closed regression and every closed view association.

Whether a link is historical is decided per regression and per view. The triage's resolved flag and Jira status are not used, so a triage like 811 with mixed open and closed rows shows each row correctly.

| Regression | View association | test_details:<view> link |
|---|---|---|
| Open | Active | Current report (unchanged) |
| Open | Inactive | Historical, labeled "Closed in this view" |
| Closed (incl. force closed) | Any | Historical, labeled "Closed regression" |

Backend

  • InjectRegressionHATEOASLinks (pkg/api/componentreadiness/triage.go) now covers every recorded view association. Historical links are built from the persisted regression and the view config. No historical report is run, and nothing is synthesized into regressed_tests.

  • Sample window (HistoricalSampleWindow): whole UTC days. It starts at 00:00 seven calendar days before the last-failure date, and the end is the following UTC midnight (exclusive), so the failure itself is included. Regression 49971 (last_failure 2026-09-29T01:33:26Z) gets 2026-09-22T00:00:00Z to 2026-09-30T00:00:00Z.

  • Basis: resolved with the existing utils.GetViewReleaseOptionsAt, anchored at the last failure. So now-60d..now-30d follows the anchor, while ga-30d..ga and absolute dates are unchanged (5.0-main: 4.22, 2026-05-10T00:00:00Z to 2026-06-09T23:59:59Z). The testBasisRelease override still works.

  • The link carries concrete dates, the test ID, release, component/capability, every variant, the view's grouping, filters, advanced and cross-compare options, and regressionId=<id>.

  • Spot-check regressions get no historical link. Test details resolve a view's spot-check samples from the current time, not from the URL's sample dates, so such a link would show recent runs.

  • historical_link_unavailable: when a closed view association gets no link, the regression record maps that view to a readable reason: no last failure, spot-check, view no longer configured, or a generic basis failure. The UI shows this reason and doesn't work it out again. Expected gaps are historicalLinkGapErrors that wrap errNoHistoricalLink, so they are logged at debug level.

  • GET /regressions/{id} now preloads Triages.Bug, matching ListOpenRegressions, so a historical report's triage table shows Jira details.

  • Triage responses: GetTriage and ListTriages take a RegressionLinkConfig (which InjectRegressionHATEOASLinks now also takes) and add these links to embedded regressions. The server wires this up in regressionLinkConfig. If releases can't be loaded, it logs one warning and returns nil, which skips the links. The list endpoint skips the release lookup when fields omits regressions. Internal potential-match callers pass nil. Triages returned by POST/PUT are not enriched.

  • Date parsing fix (util.ParseCRReleaseTimeAt): an explicit RFC 3339 time on today's UTC date used to be rounded to the cache boundary even if it was already in the past. That moved a historical exclusive end of "today 00:00" (and could pull it back to yesterday 16:00). Now only boundaries at or after now are rounded, so "now"-like requests still get stable cache keys. A round-trip test (TestHistoricalURLSurvivesRequestParsing) fails without this fix.

  • No schema changes and no stored reports.
  • Frontend

  • TriagedRegressionTestList (triage details and the shared CR modal table): view columns are built from current reports plus views where a listed regression closed, so triage 792's 5.0-main column appears even when regressed_tests is empty.

  • - Closed rows show a clock/history icon with a green check badge. The tooltip and accessible name read, e.g., "Closed regression. View historical test details for September 22–29, 2026."
    - Rows closed in only one view say "Closed in this view".
    - Rows with no available link show a disabled icon with the reason from historical_link_unavailable (or "no readable sample window" when the UI can't parse the link).
    - History controls use the grid's managed tab index, so arrow-key navigation reaches the link. Status columns are keyed by view name, so a sort stays on its view when a historical column is added.
    - Open rows keep their severity icons. The recorded closure wins over report data: a cached report built before a closure can still list the regression, but its cell shows the historical link. Filtering, sorting (new comparator), selection and the Test Analysis link still work.
  • TestDetailsReport + new HistoricalRegressionNotice: when regressionId is in the URL, the page fetches /api/component_readiness/regressions/<id> alongside the report, without going through the report cache.

  • - It shows the closure context only after checking the record matches the test ID, release, variants and view.
    - The notice lists the regression ID, closure date, last failure, and sample/basis windows. The statistical assessment is left as computed.
    - The "more than 48 hours ago / View latest" banner is still shown alongside the notice.
    - Mismatched, missing or failed lookups show warnings. A report without a view (for example after Generate Report clears it) cannot check per-view closure, so an open regression gets neutral wording instead of being called open. If the window has no data, the closure details still appear with an explicit "no test results" message.
    - Regression-tracking middleware is unchanged, so viewing history never alters tracking state.
  • HistoricalRegressionUtils.jsx: the closure, link, window and notice helpers shared by the table, redirect, and notice. A single closure rule (historicalClosure), one URL date parser (parseUrlDate), and exported ClosureScope/LookupStatus/CellKind constants. General CR helpers (viewControls/viewControlDefaults, variant parsing, compareViewNames, TEST_DETAILS_LINK_PREFIX) live in CompReadyUtils.jsx.

  • RegressionRedirect: /regressions/:id prefers a view where the regression is still open (main view first) and opens a historical report only when every association has closed.

  • CompReadyVars: explicit URL parameters now override view defaults (viewControlDefaults), matching the API. An exclusive midnight end shows as the last included day (Sept 29 23:59:59). Generate Report keeps the original URL value unless the user edits that date. regressionId survives Generate Report and is cleared when switching views.

  • In-app FAQ entry explaining the indicator.
  • Seed data

    sippy seed-data now adds two closed regressions to the existing network triage (OCPBUGS-40002, triage 1), which also has an active regression, so historical links can be reached from the triage list:

  • [sig-arch] Check build pods use all cpu cores (gcp/amd64): tracked in 4.22-main and 4.22-gcp-only, so it has two historical links.

  • [sig-cli] oc adm should handle upgrades gracefully (aws/amd64): tracked in 4.22-main.
  • They are recorded in the seed sample release (clock.sample.Name, currently 4.22) with the basis release of their first view (currently 4.21), so the seed follows the views to a new release instead of failing on a hardcoded release. Each test gets extra failing sample release runs in a five day window that ends two days before the current sample window. Its last failure falls in that window, so the historical report shows it as an extreme regression against the basis. Both tests pass in the current report, so regression tracking does not reopen them. The definitions are historicalRegressionSeeds in cmd/sippy/seed_data.go.

    Screenshots

    These screenshots were taken before the seed included historical regressions. They used the seed DB with regression 4 temporarily closed and regression 6's 4.22-gcp-only association deactivated, and the seed rows were restored afterwards.

    Mixed triage: open rows keep severity icons, the closed regression and the closed-in-view association get historical links:

    !Triage table with historical links for closed regressions

    Following the historical link. The controls show the historical sample and basis, and the rolling basis is resolved from the last failure (Sep 15 to Oct 15, while the view currently resolves to Sep 18 to Oct 18). Triages come from the regression record:

    !Closed regression notice on historical test details

    Tests

  • Seed data (Go unit, table-driven): cmd/sippy/seed_data_test.go covers building the historical regressions (release from the seed clock, basis from the view, variants limited to the view's DB grouping, closed view associations, failure counts), invalid seed definitions, guards that the seeded tests are regressed in their failure window but not in the current report, and that the historical report window covers every seeded failing run without reaching the current sample window.

  • Go unit (table-driven): triage_history_test.go covers the sample window, GA/rolling/absolute basis, basis override, cross-compare, force closed, missing last failure, unresolvable basis, multiple views, closure in one view, removed views, a spot-check regression open elsewhere, historical_link_unavailable reasons, gap errors wrapping errNoHistoricalLink, triage enrichment, and the parse round-trip (today / yesterday / long ago). Also new ParseCRReleaseTimeAt cases, updated TestInjectRegressionHATEOASLinks, and TestFieldSelectionIncludes.

  • Integration (real PostgreSQL via testcontainers): TestQuerySampleJobRunTestStatus/historical_regression_window_includes_the_last_failure checks exact success, flake, and failure counts per run: a pass at the window's first instant, the failure at the last-failure time, and nothing at the following midnight.

  • E2E: Test_TriageAPI/embedded_regressions_carry_current_and_historical_test_details_links covers GET and list triage plus the regression endpoint, with a closed regression, a closed regression without last_failure (including its historical_link_unavailable reason), and an open regression. It also checks that the regression endpoint's triages include their bug.

  • Vitest (helpers only, per repo rules) in HistoricalRegressionUtils.test.jsx: closure scope, column names, cell state and unavailable reasons (API-supplied, missing, unreadable link), sort rank, redirect link choice, URL date parsing, date-range formatting, end-time control conversion, and regression identity validation. CompReadyUtils.test.jsx covers URL-over-view precedence (including cross-compare), variant parsing, and view ordering.

  • Playwright BDD: new historical-regressions.feature (12 scenarios) covers the closed-only triage, the mixed triage, status column sorting (ascending and descending), the test details notice (including triage Jira columns and the stale banner shown alongside it), Generate Report keeping dates and regressionId, the closed-in-this-view notice with and without a closure time, no-view wording, mismatched record (stale banner still shown), missing record, failed lookup, and the no-data window.
  • Validation

    | Check | Result |
    |---|---|
    | make lint (MCP run_lint) | Pass (golangci-lint 0 issues, ESLint, npm audit) |
    | make test (MCP run_tests) | Pass: BDD 138 passed, Go 16650 tests in ./pkg/... (32 skipped), Vitest 270 passed, MCP pytest 289 passed |
    | go test ./cmd/sippy/ | Pass, including the seed data tests (make test covers only ./pkg/...) |
    | make e2e (MCP run_e2e, BigQuery off) | Pass: 155 tests, 2 skipped. Log read: the componentreadiness/triage package passed, including the historical link subtest |
    | go test ./test/integration/ | Not run on the latest commit: no container runtime socket was available, so testcontainers could not start PostgreSQL. The package compiles and passes go vet. An earlier revision of TestQuerySampleJobRunTestStatus passed |
    | Manual, local seed data | On the previous commit (before the seed release was derived from the clock; the seeded data is unchanged), seeded a scratch database and ran sippy serve against it. Triage 1 returned historical test_details links for all three closed view associations. Each link reported an extreme regression from its seeded failure-window sample (45/60 passing vs 97/100 basis, and 30/60 vs 160/200). Neither test is regressed in the current 4.22-main or 4.22-gcp-only report. The triage table and test details screenshots above are from an earlier revision |

    Not verified / limitations

  • BigQuery: e2e ran without BigQuery. Boundary parity is from code inspection only: the BigQuery test-details queries use the same prowjob_start >= @From AND < @To as PostgreSQL. No BigQuery run was done.

  • Production triages 792 and 811 were not checked against production data. The same shapes (closed-only, mixed open/closed, closed in one view, missing last failure) are covered by the e2e test, BDD scenarios and the local manual check.

  • The ticket asked for Vitest tests of table icons and navigation. Repo rules limit Vitest to helpers, so that UI behavior is covered in BDD and only the extracted helpers are unit tested.

  • Historical links anchor to the regression-wide last failure, since view associations do not record their own. For an association that closed while another view kept the regression open, the window may end after that association's closure.

  • Historical links use the view's current configuration (a reconstructed query, not a snapshot). Noted in the triage feature doc and code comments.

  • Pre-existing quirk, unchanged: the PostgreSQL component-report prefix-sum path treats a sample end as an inclusive day. It doesn't affect test details, which use run-level < end filters.
  • Docs

  • pkg/api/README.md: new Component Readiness Regressions section (including historical_link_unavailable), notes on triage response links, and test_details date/regressionId parameters.

  • docs/features/component-readiness-triage.md (added on main by #4230): new "Reviewing closed regressions" section describing the user-facing behavior, notice titles (including an open regression's historical report) and warnings, redirect preference, limitations, and the seeded historical regressions for local testing.

  • Historical window date semantics are documented in the HistoricalSampleWindow and generateHistoricalTestDetailsURL comments in pkg/api/componentreadiness/triage.go.
  • 🤖 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

    New Features
    Closed regressions can link to historical test reports, with notices showing closure details and the report’s sample and comparison periods.
    Triage tables show historical or unavailable report indicators for closed regressions, with sorting by status.
    Historical report links preserve regression context and use the selected view’s settings. Report time controls handle date boundaries consistently.
    Reports explain when regression details do not match or historical data is unavailable.
    Added sample data for exploring historical regressions.
    Documentation
    * Added guidance on reviewing closed regressions and understanding historical reports, unavailable links, and closure notices.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: sosiouxme Review duration: 18625m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.52) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    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%
    42%
    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.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #4221"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% 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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 43.0% · Lower = rushed or shallow review
    43.0%
    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: 29.7% · Safe to merge
    29.7%