update runsinglemigration to accept migration options - #3626
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
Walkthrough
ChangesMigration Options Parameter
🎯 2 (Simple) | ⏱️ ~12 minutes
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
|
Merge activity
|
Confidence Score: 4/5Safe to merge; the only concern is a latent pointer-aliasing issue that does not cause any current misbehaviour. The change is small and all internal callers are correctly updated. The one thing worth watching is that framework/configstore/migrations.go — specifically the Important Files Changed
Reviews (1): Last reviewed commit: "update runsinglemigration to accept migr..." | Re-trigger Greptile |
| migrationOpts := migrator.DefaultOptions | ||
| if options != nil { | ||
| migrationOpts = options | ||
| } |
There was a problem hiding this comment.
When
options is nil, migrationOpts is assigned the same pointer as the global migrator.DefaultOptions. migrator.New mutates the *Options it receives to fill in any zero-value fields in-place. Today DefaultOptions is fully populated so no mutation fires, but if a new field is added to Options without a corresponding default, New would corrupt the package-level global on the first call, affecting every subsequent migration for the lifetime of the process. Copying the struct value avoids this aliasing risk entirely.
| migrationOpts := migrator.DefaultOptions | |
| if options != nil { | |
| migrationOpts = options | |
| } | |
| defaultCopy := *migrator.DefaultOptions | |
| migrationOpts := &defaultCopy | |
| if options != nil { | |
| migrationOpts = options | |
| } |
## Summary `RunSingleMigration` previously always used `migrator.DefaultOptions`, making it impossible for callers to supply custom migrator options. This PR adds an optional `*migrator.Options` parameter so downstream consumers (e.g. bifrost-enterprise, plugins) can pass their own options when needed, while all existing internal callers pass `nil` to retain the default behavior. ## Changes - Added an `options *migrator.Options` parameter to `RunSingleMigration`; when `nil` is passed, `migrator.DefaultOptions` is used as before - Updated all internal call sites to pass `nil`, preserving existing behavior ## Type of change - [ ] Bug fix - [ ] Feature - [x] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [x] Core (Go) - [ ] Transports (HTTP) - [ ] Providers/Integrations - [x] Plugins - [ ] UI (React) - [ ] Docs ## How to test ```sh go test ./framework/configstore/... ``` Verify that all existing migrations continue to run successfully with `nil` options, and that a custom `*migrator.Options` value is correctly applied when provided. ## Breaking changes - [x] Yes - [ ] No `RunSingleMigration` is a public function. Its signature has changed — callers outside this repository (e.g. bifrost-enterprise, plugins) must add a `nil` (or custom options) argument as the second parameter. ## Related issues N/A ## Security considerations None. This change only affects how migrator options are threaded through to the migration runner. ## Checklist - [ ] I read `docs/contributing/README.md` and followed the guidelines - [ ] I added/updated tests where appropriate - [ ] I updated documentation where needed - [ ] I verified builds succeed (Go and UI) - [ ] I verified the CI pipeline passes locally if applicable
## Summary `RunSingleMigration` previously always used `migrator.DefaultOptions`, making it impossible for callers to supply custom migrator options. This PR adds an optional `*migrator.Options` parameter so downstream consumers (e.g. bifrost-enterprise, plugins) can pass their own options when needed, while all existing internal callers pass `nil` to retain the default behavior. ## Changes - Added an `options *migrator.Options` parameter to `RunSingleMigration`; when `nil` is passed, `migrator.DefaultOptions` is used as before - Updated all internal call sites to pass `nil`, preserving existing behavior ## Type of change - [ ] Bug fix - [ ] Feature - [x] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [x] Core (Go) - [ ] Transports (HTTP) - [ ] Providers/Integrations - [x] Plugins - [ ] UI (React) - [ ] Docs ## How to test ```sh go test ./framework/configstore/... ``` Verify that all existing migrations continue to run successfully with `nil` options, and that a custom `*migrator.Options` value is correctly applied when provided. ## Breaking changes - [x] Yes - [ ] No `RunSingleMigration` is a public function. Its signature has changed — callers outside this repository (e.g. bifrost-enterprise, plugins) must add a `nil` (or custom options) argument as the second parameter. ## Related issues N/A ## Security considerations None. This change only affects how migrator options are threaded through to the migration runner. ## Checklist - [ ] I read `docs/contributing/README.md` and followed the guidelines - [ ] I added/updated tests where appropriate - [ ] I updated documentation where needed - [ ] I verified builds succeed (Go and UI) - [ ] I verified the CI pipeline passes locally if applicable

Summary
RunSingleMigrationpreviously always usedmigrator.DefaultOptions, making it impossible for callers to supply custom migrator options. This PR adds an optional*migrator.Optionsparameter so downstream consumers (e.g. bifrost-enterprise, plugins) can pass their own options when needed, while all existing internal callers passnilto retain the default behavior.Changes
options *migrator.Optionsparameter toRunSingleMigration; whennilis passed,migrator.DefaultOptionsis used as beforenil, preserving existing behaviorType of change
Affected areas
How to test
go test ./framework/configstore/...Verify that all existing migrations continue to run successfully with
niloptions, and that a custom*migrator.Optionsvalue is correctly applied when provided.Breaking changes
RunSingleMigrationis a public function. Its signature has changed — callers outside this repository (e.g. bifrost-enterprise, plugins) must add anil(or custom options) argument as the second parameter.Related issues
N/A
Security considerations
None. This change only affects how migrator options are threaded through to the migration runner.
Checklist
docs/contributing/README.mdand followed the guidelines