Skip to content

TRT-1989: remove ProwJobRunTest during partition migration#3333

Open
neisw wants to merge 2 commits intoopenshift:mainfrom
neisw:trt-1989-partitions-prep
Open

TRT-1989: remove ProwJobRunTest during partition migration#3333
neisw wants to merge 2 commits intoopenshift:mainfrom
neisw:trt-1989-partitions-prep

Conversation

@neisw
Copy link
Contributor

@neisw neisw commented Mar 17, 2026

Removes tables targeted for partitioning from being managed automatically via gorm

Summary by CodeRabbit

  • Chores

    • Adjusted database migration flow to exclude specific test tables from the primary auto-migrate path and added a transitional initialization that conditionally creates legacy non‑partitioned test tables for new/unknown databases.
    • Preserved existing migration behavior and error handling; added a TODO placeholder for upcoming partitioned-table migration work.
  • Documentation

    • Added inline comments clarifying migration intent for the affected test models.

@openshift-ci-robot
Copy link

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 Mar 17, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 17, 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 "4.22.0" version, but no target version was set.

Details

In response to this:

Removes tables targeted for partitioning from being managed automatically via gorm

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
Contributor

coderabbitai bot commented Mar 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 31a96b82-70a6-41e9-a32f-b1684514a937

📥 Commits

Reviewing files that changed from the base of the PR and between 577c26b and 4c34d41.

📒 Files selected for processing (1)
  • pkg/db/db.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/db/db.go

Walkthrough

Removed ProwJobRunTest and ProwJobRunTestOutput from the primary AutoMigrate list and added a transition-phase initialization that conditionally creates non‑partitioned prow_job_run_tests and prow_job_run_test_outputs tables if absent; retained existing migrations for other models and added TODOs for partitioned-table migration. Added comment blocks above the two model types.

Changes

Cohort / File(s) Summary
Schema migration & init
pkg/db/db.go
Removed ProwJobRunTest and ProwJobRunTestOutput from the main AutoMigrate list. Added a transition-phase initialization that checks for and AutoMigrates the non‑partitioned prow_job_run_tests and prow_job_run_test_outputs tables when database state is new/unknown. Kept existing migration flow and error handling; added TODOs for partitioned-table migration.
Model comments
pkg/db/models/prow.go
Inserted comment blocks above the ProwJobRunTest and ProwJobRunTestOutput type declarations; no structural or API changes to the types.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Go Error Handling ✅ Passed All error handling follows Go best practices: proper error checks, correct fmt.Errorf wrapping with %w, no ignored errors, and safe pointer operations throughout.
Sql Injection Prevention ✅ Passed The PR adds initialization code using only GORM safe methods (Migrator().HasTable() and AutoMigrate()) with hardcoded table names, containing no raw SQL or user input.
Excessive Css In React Should Use Styles ✅ Passed The custom check for excessive CSS in React components is not applicable to this PR, which contains only backend Go database migration and model definition changes.
Single Responsibility And Clear Naming ✅ Passed Pull request maintains clear, descriptive naming conventions with action-oriented package, struct, and method names that communicate purpose explicitly.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.11.3)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


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

@openshift-ci openshift-ci bot requested review from sosiouxme and stbenjam March 17, 2026 12:30
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 17, 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 Mar 17, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 17, 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 "4.22.0" version, but no target version was set.

Details

In response to this:

Removes tables targeted for partitioning from being managed automatically via gorm

Summary by CodeRabbit

  • Chores
  • Adjusted database migration configuration
  • Added placeholders for future partitioned table support
  • Enhanced documentation with additional code comments

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.

Copy link
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 the current code and only fix it if needed.

Inline comments:
In `@pkg/db/db.go`:
- Around line 112-115: The TODO and commented-out models
(&models.ProwJobRunTest{}, &models.ProwJobRunTestOutput{}) remove these tables
from AutoMigrate and leave creation unclear; either re-add them to the
AutoMigrate call in pkg/db/db.go (so AutoMigrate includes ProwJobRunTest and
ProwJobRunTestOutput until partitioning is implemented) or implement an explicit
SQL migration/initialization routine that creates those tables (documenting that
path). Locate the AutoMigrate invocation that previously referenced
ProwJobRunTest and ProwJobRunTestOutput and either restore those model types
into AutoMigrate or add a clear migration function that runs CREATE TABLE for
ProwJobRunTest and ProwJobRunTestOutput and update the TODO to reference the
chosen approach.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 26cb8100-2410-462d-bf75-31c02e1ad93b

📥 Commits

Reviewing files that changed from the base of the PR and between 5bbcb4d and bf6747b.

📒 Files selected for processing (2)
  • pkg/db/db.go
  • pkg/db/models/prow.go

@openshift-ci-robot
Copy link

Scheduling required tests:
/test e2e

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 17, 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 "4.22.0" version, but no target version was set.

Details

In response to this:

Removes tables targeted for partitioning from being managed automatically via gorm

Summary by CodeRabbit

  • Chores

  • Adjusted database migration flow to skip certain models in the primary auto-migrate path and add a transitional initialization that ensures legacy non‑partitioned tables are created for new/unknown databases.

  • Added TODO placeholders for upcoming partitioned-table migration support.

  • Documentation

  • Enhanced inline comments near the affected models to clarify future migration intent.

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.

Copy link
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 the current code and only fix it if needed.

Inline comments:
In `@pkg/db/db.go`:
- Around line 120-123: The loop is calling d.DB.AutoMigrate(model) on the
wrapper struct instead of the actual model instance, so replace the AutoMigrate
call to pass the inner model (e.g., model.model) rather than the wrapper; keep
the HasTable check using model.tableName and the existing error handling,
ensuring ProwJobRunTest and ProwJobRunTestOutput (and any other entries in
modelsToInitialize) are migrated using their real model values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: d6d867b2-cc2a-4d34-9f45-e9d54863f430

📥 Commits

Reviewing files that changed from the base of the PR and between bf6747b and 577c26b.

📒 Files selected for processing (1)
  • pkg/db/db.go

@openshift-ci-robot
Copy link

Scheduling required tests:
/test e2e

@neisw neisw force-pushed the trt-1989-partitions-prep branch from 577c26b to 4c34d41 Compare March 17, 2026 17:48
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 17, 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 "4.22.0" version, but no target version was set.

Details

In response to this:

Removes tables targeted for partitioning from being managed automatically via gorm

Summary by CodeRabbit

  • Chores

  • Adjusted database migration flow to exclude specific test tables from the primary auto-migrate path and added a transitional initialization that conditionally creates legacy non‑partitioned test tables for new/unknown databases.

  • Preserved existing migration behavior and error handling; added a TODO placeholder for upcoming partitioned-table migration work.

  • Documentation

  • Added inline comments clarifying migration intent for the affected test models.

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-robot
Copy link

Scheduling required tests:
/test e2e

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 17, 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.

@neisw
Copy link
Contributor Author

neisw commented Mar 17, 2026

/hold
until we are ready to proceed with migration

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 17, 2026
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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