Skip to content

TRT-1989: model changes to prep for partitioning#3532

Open
neisw wants to merge 1 commit into
openshift:mainfrom
neisw:trt-1989-migration-prep
Open

TRT-1989: model changes to prep for partitioning#3532
neisw wants to merge 1 commit into
openshift:mainfrom
neisw:trt-1989-migration-prep

Conversation

@neisw
Copy link
Copy Markdown
Contributor

@neisw neisw commented May 15, 2026

Model changes include

  • Release and ProwJobRunStartTime for future partitioning
  • ProwJobId for future use to remove join based on ProwJobRunId to get ProwJobId to then get variants

Summary by CodeRabbit

  • Chores
    • Enhanced internal data models to track release information and execution timestamps alongside test records, improving data organization and consistency for more contextual insights into test results.

@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 May 15, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented May 15, 2026

@neisw: This pull request references TRT-1989 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:

Model changes include

  • Release and ProwJobRunStartTime for future partitioning
  • ProwJobId for future use to remove join based on ProwJobRunId to get ProwJobId to then get variants

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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

Walkthrough

This PR extends Prow job run and test record models with partitioning fields (ProwJobRelease, ProwJobRunTimestamp) and updates the data loading pipeline to extract and populate these fields from GCS job data. Synthetic data seeding and test fixtures are updated to include the new schema fields.

Changes

Prow run and test partitioning fields

Layer / File(s) Summary
Database schema extensions
pkg/db/models/prow.go
ProwJobRun gains ProwJobRelease, ProwJobRunTest gains ProwJobID/ProwJobRunTimestamp/ProwJobRunRelease, and ProwJobRunTestOutput gains ProwJobRunTestTimestamp/ProwJobRunTestRelease columns for partitioning.
GCS data loading pipeline
pkg/dataloader/prowloader/prow.go
processGCSBucketJobRun passes prow job ID, release, and start time to prowJobRunTestsFromGCS, which propagates context through extractTestCases to populate new fields on test records and outputs. Recursive suite processing passes the same context through the extraction tree.
Synthetic data seeding
cmd/sippy/seed_data.go
seedRunsForJob now sets ProwJobRelease on seeded ProwJobRun records and populates ProwJobID, ProwJobRunRelease, and ProwJobRunTimestamp on seeded ProwJobRunTest entries.
Test fixture updates
pkg/api/job_runs_test.go, pkg/sippyserver/pr_new_tests_worker_test.go
Test setup in TestRunJobAnalysis and mock fixtures in TestUnit_getNewTestsForJobRun populate the new partitioning fields on run and test records to match the updated schema.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 15 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Go Error Handling ⚠️ Warning pkg/dataloader/prowloader/prow.go line 1218 contains panic() outside init() and not for fatal conditions. Panic should not be used for expected data consistency issues. Return error from prowJobRunTestsFromGCS when syntheticSuite lookup fails, allowing caller to handle instead of crashing application.
Single Responsibility And Clear Naming ⚠️ Warning ProwJobRunTest has 13 fields, exceeding ~7-field guideline. Adds 3 denormalized fields (ProwJobID, timestamp, release) duplicating parent data for partitioning, violating single responsibility. Refactor denormalized partitioning metadata into a separate sub-struct to keep ProwJobRunTest focused.
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding model fields for future database partitioning preparation, which aligns with all modified files across seed data, tests, data loading, and model definitions.
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.
Sql Injection Prevention ✅ Passed PR uses proper SQL parameterization. seed_data.go uses GORM placeholders, prow.go uses named BigQuery parameters, and no user input is directly concatenated into SQL queries.
Excessive Css In React Should Use Styles ✅ Passed Check not applicable. PR contains only Go backend code (database models, tests, data loading). No React components, JSX, or CSS styling present.
Test Coverage For New Features ✅ Passed Structural changes (field additions + parameter propagation) in existing functions only. No new functions added. Existing tests updated. Falls under refactors covered by existing tests exception.
Stable And Deterministic Test Names ✅ Passed The PR does not use Ginkgo testing framework. Modified test files use Go's standard testing package with table-driven tests. All test names are static, deterministic strings with no dynamic content.
Test Structure And Quality ✅ Passed Check requires assessment of Ginkgo tests. Repository uses standard Go testing, not Ginkgo. PR test files are standard Go unit tests. Check not applicable.
Microshift Test Compatibility ✅ Passed No Ginkgo e2e tests are added. Changes are to Go database models, seed data, and standard unit tests in Sippy. Check not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No Ginkgo e2e tests are added in this PR. Changes are database models, data loading, and Go unit tests—not Ginkgo e2e tests. Check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed Not applicable. PR contains no Kubernetes manifests, operator code, or scheduling constraints—only backend database model and test code changes.
Ote Binary Stdout Contract ✅ Passed No OTE Binary Stdout Contract violations detected. All fmt.Printf statements are inside test functions (not process-level code). No stdout writes in main(), init(), or top-level code.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests are added in this PR. Changes are database model schema updates and unit test fixtures only.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot requested review from deepsm007 and sosiouxme May 15, 2026 13:37
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 15, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 May 15, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@pkg/db/models/prow.go`:
- Around line 92-99: ProwJobID was added as a denormalized lookup key but lacks
an index; modify the struct field declaration for ProwJobID (the ProwJobID field
in the prow job run tests model) to add a GORM index tag (e.g., include
`gorm:"index"` or a named index) so queries filtering by ProwJobID use an index
rather than causing full table scans.
🪄 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: d96f992c-5f51-4c25-a083-71ee5bfd7ce3

📥 Commits

Reviewing files that changed from the base of the PR and between e99b97d and 171fc89.

📒 Files selected for processing (5)
  • cmd/sippy/seed_data.go
  • pkg/api/job_runs_test.go
  • pkg/dataloader/prowloader/prow.go
  • pkg/db/models/prow.go
  • pkg/sippyserver/pr_new_tests_worker_test.go

Comment thread pkg/db/models/prow.go
Comment on lines +92 to +99
// used for variants
// skips joining on ProwJobRunID just to get ProwJobID
ProwJobID uint
// used for partitioning
ProwJobRunTimestamp time.Time `gorm:"expression:DATE(timestamp AT TIME ZONE 'UTC')"`
// used for partitioning
ProwJobRunRelease string `gorm:"varchar(10)"`
TestID uint `gorm:"index;index:idx_prow_job_run_tests_test_id_status"`
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot May 15, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Index the new denormalized lookup key.

ProwJobID is added to avoid a join, but without an index this can still force full scans on prow_job_run_tests under real data volume.

💡 Suggested fix
-	ProwJobID uint
+	ProwJobID uint `gorm:"index"`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// used for variants
// skips joining on ProwJobRunID just to get ProwJobID
ProwJobID uint
// used for partitioning
ProwJobRunTimestamp time.Time `gorm:"expression:DATE(timestamp AT TIME ZONE 'UTC')"`
// used for partitioning
ProwJobRunRelease string `gorm:"varchar(10)"`
TestID uint `gorm:"index;index:idx_prow_job_run_tests_test_id_status"`
// used for variants
// skips joining on ProwJobRunID just to get ProwJobID
ProwJobID uint `gorm:"index"`
// used for partitioning
ProwJobRunTimestamp time.Time `gorm:"expression:DATE(timestamp AT TIME ZONE 'UTC')"`
// used for partitioning
ProwJobRunRelease string `gorm:"varchar(10)"`
TestID uint `gorm:"index;index:idx_prow_job_run_tests_test_id_status"`
🤖 Prompt for 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.

In `@pkg/db/models/prow.go` around lines 92 - 99, ProwJobID was added as a
denormalized lookup key but lacks an index; modify the struct field declaration
for ProwJobID (the ProwJobID field in the prow job run tests model) to add a
GORM index tag (e.g., include `gorm:"index"` or a named index) so queries
filtering by ProwJobID use an index rather than causing full table scans.

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.

@coderabbitai, we are only staging the new columns for now and beginning data collection. We will be migrating the tables and backfilling the new columns at a later time. Indexing will be updated then.

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.

@neisw, understood — thanks for the context! A phased approach (stage columns → collect data → migrate/backfill → add indexes) makes sense here. Would you like me to open a follow-up GitHub issue to track adding the index on ProwJobID (and any other partitioning-related indexes) once the migration and backfill are complete?


✏️ Learnings added
Learnt from: neisw
Repo: openshift/sippy PR: 3532
File: pkg/db/models/prow.go:92-99
Timestamp: 2026-05-15T13:46:44.315Z
Learning: In `pkg/db/models/prow.go`, the `ProwJobID`, `ProwJobRunTimestamp`, and `ProwJobRunRelease` fields added to `ProwJobRunTest`, as well as `ProwJobRelease` on `ProwJobRun` and the timestamp/release fields on `ProwJobRunTestOutput`, are being staged in a phased approach: columns are added first for data collection, with table migration, backfill, and index creation deferred to a later PR. Do not flag missing indexes on these new columns as blocking issues.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 15, 2026

@neisw: 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.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants