Skip to content

TRT-2741: Add GA release test data loader sourced from BigQuery#3780

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
mstaeble:worktree-trt-2741-ga-test-data
Jul 16, 2026
Merged

TRT-2741: Add GA release test data loader sourced from BigQuery#3780
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
mstaeble:worktree-trt-2741-ga-test-data

Conversation

@mstaeble

@mstaeble mstaeble commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a prow_ga_raw_test_data table and GATestStatusLoader that fetches test results from BigQuery for each GA release's lookback windows
  • Supports three lookback windows (1-day, 30-day, 90-day) matching Component Readiness view definitions
  • Stores integer FK IDs (test_id, prow_job_id, suite_id) instead of strings, reducing row size ~6x (from ~265 to ~44 bytes/row)
  • Adds prow_ga_test_statuses_matview that joins raw data with prow_jobs for variant_combination_id (tests/suites JOINs eliminated since IDs stored directly)
  • Loader runs as a separate pod (--loader ga-test-status), not included in default loaders
  • Uses COPY-to-temp-table + INSERT...SELECT with JOINs to resolve string names to integer IDs server-side (same pattern as prow loader)

Staging test results

Loaded release 4.17 against staging (510K BQ rows):

Phase Time Notes
BQ fetch (all 3 windows) 21s UNNEST with struct array params, static date bounds for partition pruning
COPY to temp table 56s 510K string rows to session-local unlogged temp table
INSERT...SELECT with JOINs 2.3s 460K rows inserted (50K filtered by dimension table INNER JOIN misses)
Commit 41ms
Total per release 1m19s

Matview refresh (460K raw rows, 1 release):

Operation Time Rows
Initial populate 2.2s 382K
Concurrent refresh 8.2s 382K

~10% of BQ rows (50K/510K) were dropped by INNER JOINs to tests/prow_jobs, which is expected: these are tests/jobs from older releases that the prow loader doesn't load into Postgres dimension tables.

Review feedback

  • Fixed ga_date < NOW() to ga_date < CURRENT_DATE to avoid loading partial GA-day data
  • Fixed seed function to distinguish gorm.ErrRecordNotFound from real DB errors in dimension lookups

Test plan

  • go build compiles
  • go vet passes
  • Unit tests pass for modified packages
  • make lint passes
  • make test passes (13,938 Go tests, sippy-ng Jest tests)
  • Loaded release 4.17 against staging, verified data persisted and matview refreshed
  • Verified --force-ga-refresh correctly re-fetches and replaces data

🤖 Generated with Claude Code

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 15, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 15, 2026

Copy link
Copy Markdown

@mstaeble: This pull request references TRT-2741 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Adds a prow_ga_raw_test_data staging table and GATestStatusLoader that fetches test results from BigQuery for the window before each release's GA date
  • Supports three lookback windows (1-day, 30-day, 90-day) to match all configured Component Readiness view definitions
  • Adds prow_ga_test_statuses_matview that joins raw data with dimension tables (tests, prow_jobs, suites) for efficient querying
  • Uses atomic DELETE+CopyFrom in a pgx transaction per (release, window) pair to ensure data integrity
  • Tracks load state via ga_data_loaded_date on release_definitions, updated only after all windows succeed

Test plan

  • make lint passes
  • make test passes (13923 Go tests, sippy-ng Jest tests, Python tests)
  • make e2e passes
  • Deploy to staging and verify matview populates correctly
  • Verify --force-ga-refresh correctly re-fetches and replaces data

@coderabbitai ignore

🤖 Generated with Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2026
@openshift-ci

openshift-ci Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@openshift-ci-robot: Thanks for the notice. This PR has @coderabbitai ignore set in its description, so CodeRabbit will not be performing reviews or taking further action on it. This Jira target-version warning is outside CodeRabbit's scope — no action needed from my side.

@mstaeble
mstaeble force-pushed the worktree-trt-2741-ga-test-data branch from 0a7d821 to a6ccc80 Compare July 15, 2026 22:52
@mstaeble mstaeble changed the title [WIP] TRT-2741: Add GA release test data table sourced from BigQuery TRT-2741: Add GA release test data loader sourced from BigQuery Jul 15, 2026
@mstaeble
mstaeble marked this pull request as ready for review July 15, 2026 22:52
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2026
@openshift-ci
openshift-ci Bot requested review from dgoodwin and sosiouxme July 15, 2026 22:52
@mstaeble
mstaeble marked this pull request as draft July 15, 2026 22:54
@mstaeble mstaeble changed the title TRT-2741: Add GA release test data loader sourced from BigQuery [WIP] TRT-2741: Add GA release test data loader sourced from BigQuery Jul 15, 2026
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2026
@mstaeble
mstaeble force-pushed the worktree-trt-2741-ga-test-data branch from a6ccc80 to a0f401f Compare July 15, 2026 22:56
@mstaeble

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 56 minutes.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a ga-test-status loader that aggregates BigQuery test results across GA windows, persists raw aggregates in Postgres, seeds synthetic data, tracks loaded GA dates, and exposes results through a refreshed materialized view.

Changes

GA test status pipeline

Layer / File(s) Summary
GA data contracts and schema
pkg/api/componentreadiness/utils/utils.go, pkg/db/models/prow.go, pkg/db/models/releases.go, pkg/db/db.go, pkg/bigquery/bqlabel/labels.go
Adds GA window helpers, raw aggregate and loaded-date fields, schema migration registration, and a BigQuery loader label.
BigQuery extraction and Postgres loading
pkg/dataloader/gateststatus/loader.go
Adds release selection, windowed and deduplicated BigQuery aggregation, transactional raw-row replacement, and GA load-date tracking.
Loader command integration
cmd/sippy/load.go
Adds --force-ga-refresh and registers ga-test-status with BigQuery/Postgres validation and materialized-view refresh.
Synthetic data and status view
cmd/sippy/seed_data.go, pkg/db/views.go
Seeds synthetic GA raw rows and adds a materialized view aggregating totals, successes, and flakes.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LoadCommand
  participant GATestStatusLoader
  participant BigQuery
  participant Postgres
  LoadCommand->>GATestStatusLoader: Start GA test status load
  GATestStatusLoader->>Postgres: Select GA releases
  GATestStatusLoader->>BigQuery: Query GA window aggregates
  BigQuery-->>GATestStatusLoader: Return deduplicated counts
  GATestStatusLoader->>Postgres: Persist raw counts and loaded date
Loading

Possibly related PRs

  • openshift/sippy#3716: Both changes update ReleaseDefinition to use cloud.google.com/go/civil date handling.

Suggested reviewers: sosiouxme, dgoodwin


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 3 warnings)

Check name Status Explanation Resolution
Sql Injection Prevention ❌ Error gateststatus formats l.bqClient.Dataset into SQL via fmt.Sprintf, and --bigquery-dataset is user-configurable with no validation found. Validate/allowlist dataset identifiers before interpolation, or avoid dynamic identifiers by mapping to fixed, trusted dataset names.
Go Error Handling ⚠️ Warning seedGARawTestData swallows DB lookup errors with continue and a warning, so operational errors aren’t wrapped or returned. Only ignore confirmed record not found; otherwise return fmt.Errorf(...: %w) and add coverage for lookup failures.
Test Coverage For New Features ⚠️ Warning FAIL: The new GA loader, window helpers, and seeding logic have no corresponding tests, and there is no regression test for the ga_date < NOW() eligibility bug. Add unit tests for GAWindowStart/End and the new loader/seed paths, plus a regression test that proves GA releases only load after CURRENT_DATE.
Feature Documentation ⚠️ Warning No docs/features page was updated for the new GA test-status loader/matview feature, and docs/features has no GA-related doc. Add or update a docs/features page covering ga-test-status, GA windows, the raw table/matview flow, and load-state behavior.
✅ Passed checks (17 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Excessive Css In React Should Use Styles ✅ Passed PR only changes Go backend loaders/models/views; no React components or inline CSS objects were modified, so this styling rule doesn't apply.
Single Responsibility And Clear Naming ✅ Passed The new gateststatus package, GA raw-data model, and GA view/seed helpers are narrowly scoped and clearly named; no newly added broad or ambiguous API stands out.
Stable And Deterministic Test Names ✅ Passed No test files or Ginkgo titles were added/modified; the changed files contain no It/Describe/Context/When calls, so there are no unstable test names to flag.
Test Structure And Quality ✅ Passed Branch diff has no *_test.go files or Ginkgo test changes, so the Ginkgo test-quality checklist isn’t applicable here.
Microshift Test Compatibility ✅ Passed The changed files are loader/model/DB code only; no new Ginkgo e2e tests or MicroShift-unsupported APIs/features were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo/e2e test files or test declarations were added in the changed files; this SNO-specific check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR only changes data-loader/DB code; no manifests, controllers, or scheduling fields (affinity/nodeSelector/replicas/PDB) were added.
Ote Binary Stdout Contract ✅ Passed PASS: The PR adds no fmt.Print/os.Stdout/klog writes in main/init/suite setup; the new GA loader uses logrus logging and flags/constants only.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added in the changed files, so IPv4/disconnected-network compatibility issues are not applicable.
No-Weak-Crypto ✅ Passed Scanned all modified files; none reference MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, and no custom crypto or token/secret comparisons were added.
Container-Privileges ✅ Passed The diff only touches Go source files; no container/K8s manifests or securityContext/privilege settings were added in the changed files.
No-Sensitive-Data-In-Logs ✅ Passed Added logs only emit releases, counts, and operational status; no passwords, tokens, PII, hostnames, or customer data are logged.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: a new GA release test data loader sourced from BigQuery.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mstaeble

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/sippy/seed_data.go`:
- Around line 1128-1149: Wrap the `CreateInBatches` call and every
`ga_data_loaded_date` update in a single database transaction. Use the
transaction handle for both insertion and updates, propagate any error so the
transaction rolls back, and commit only after all releases in the `gaReleases`
loop complete successfully.
- Around line 1059-1156: The GA data pipeline needs cross-layer test coverage.
In cmd/sippy/seed_data.go:1059-1156, add tests for seedGARawTestData covering
window scaling, missing test/job dimension lookups, generated row values,
ga_data_loaded_date updates, and transaction rollback. In
pkg/db/views.go:496-509, add tests covering grouping, job filtering, and
total/success/flake aggregation behavior.
- Around line 1074-1106: Update the suite lookup and the test/job queries in the
GA raw test data generation flow to distinguish confirmed record-not-found
errors from operational database failures. Continue the existing fallback or
skip behavior only for not-found results; wrap and return any other errors
instead of continuing, ensuring callers receive failures and releases are not
marked loaded with incomplete rows.

In `@pkg/dataloader/gateststatus/loader.go`:
- Around line 207-215: Update GATestStatusLoader.gaReleases to compare the
date-only ga_date column against CURRENT_DATE instead of NOW(), ensuring
releases are loaded only after the GA day is complete. Add a regression test
covering a release on the current date and verifying it is excluded, while a
prior-date release remains eligible.
- Around line 231-274: Validate l.bqClient.Dataset at client construction using
an anchored allow-list or the project’s shared BigQuery identifier helper, and
reject malformed values before this query’s fmt.Sprintf interpolation. Ensure
only valid dataset identifiers reach the query while preserving normal
configured dataset behavior.

In `@pkg/db/models/prow.go`:
- Around line 228-232: The model fields in the diff lack a database-level
uniqueness constraint for each persisted aggregate. Update the relevant GORM
tags on Release, WindowDays, TestID, ProwJobID, and SuiteID to share a composite
unique index covering (release, window_days, test_id, prow_job_id, suite_id),
preserving the existing index behavior where needed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 651e401b-c985-4afc-a935-b9a9f4139631

📥 Commits

Reviewing files that changed from the base of the PR and between 8450071 and a0f401f.

📒 Files selected for processing (9)
  • cmd/sippy/load.go
  • cmd/sippy/seed_data.go
  • pkg/api/componentreadiness/utils/utils.go
  • pkg/bigquery/bqlabel/labels.go
  • pkg/dataloader/gateststatus/loader.go
  • pkg/db/db.go
  • pkg/db/models/prow.go
  • pkg/db/models/releases.go
  • pkg/db/views.go

Comment thread cmd/sippy/seed_data.go
Comment thread cmd/sippy/seed_data.go
Comment thread cmd/sippy/seed_data.go
Comment thread pkg/dataloader/gateststatus/loader.go
Comment thread pkg/dataloader/gateststatus/loader.go
Comment thread pkg/db/models/prow.go
Add a new `ga-test-status` loader that fetches test results from BigQuery
for GA releases and stores them in `prow_ga_raw_test_data`. The loader
runs as a separate pod (not included in default loaders) and supports
three lookback windows (1-day, 30-day, 90-day) matching Component
Readiness view definitions.

Key design choices:
- Per-release BQ query batching all 3 windows via UNNEST with struct
  array parameters, with static scalar date bounds for partition pruning
- COPY-to-temp-table + INSERT...SELECT with JOINs to resolve string
  names (test_name, job_name, suite) to integer FK IDs server-side,
  reducing row size from ~265 bytes to ~44 bytes (6x reduction)
- Matview (prow_ga_test_statuses_matview) only needs a single JOIN on
  prow_jobs for variant_combination_id; tests and suites JOINs are
  eliminated since IDs are stored directly
- Load state tracked via ga_data_loaded_date on release_definitions,
  updated atomically within the per-release transaction

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mstaeble
mstaeble force-pushed the worktree-trt-2741-ga-test-data branch from a0f401f to 90bc050 Compare July 16, 2026 03:04
@mstaeble

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mstaeble
mstaeble marked this pull request as ready for review July 16, 2026 03:44
@mstaeble mstaeble changed the title [WIP] TRT-2741: Add GA release test data loader sourced from BigQuery TRT-2741: Add GA release test data loader sourced from BigQuery Jul 16, 2026
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 16, 2026
@openshift-ci
openshift-ci Bot requested a review from petr-muller July 16, 2026 03:45
@openshift-ci
openshift-ci Bot requested a review from smg247 July 16, 2026 03:45
@mstaeble

Copy link
Copy Markdown
Contributor Author

@coderabbitai resolve

@openshift-ci openshift-ci Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Comments resolved and changes approved.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

Comment thread pkg/db/db.go
&models.ReleasePullRequest{},
&models.ReleaseRepository{},
&models.ReleaseJobRun{},
&models.ProwGARawTestDatum{},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you thinking making this a partitioned table (possibly only by release) is overkill? Would this table go away once we fully backfill for older job runs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My initial stance is that partitioning this table is overkill. I will explore the benefit of that later if there is a need for improvement.

If we were to fully backfill, then yes this table would not be necessary. We may still want the matviews that this table feeds, though. The same data static data is used across many CR reports. It does not change from one day to the next, unlike the sample data.

Comment thread pkg/db/views.go
ReplaceStrings: map[string]string{},
},
{
Name: "prow_ga_test_statuses_matview",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You just got rid of matviews 😁

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove some, add some more.

We did not get rid of all matviews. My goal is not to eliminate matviews.

@neisw

neisw commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 16, 2026
@openshift-ci

openshift-ci Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mstaeble, neisw

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 16, 2026
@openshift-ci

openshift-ci Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@mstaeble: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 7d545cf into openshift:main Jul 16, 2026
10 checks passed
@mstaeble
mstaeble deleted the worktree-trt-2741-ga-test-data branch July 17, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants