fix: reorder migrationReAddAllowDirectKeysColumn before config hash refresh migration and update schema with new fields - #3883
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR extends the configuration schema with new authentication, identity-mapping, and model-filtering options while reordering migrations to resolve schema projection dependencies. Five new schema properties are added: ChangesConfiguration and Migration Updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Comment |
|
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Confidence Score: 5/5Safe to merge — the migration reorder is a targeted correctness fix and all three migrations involved are idempotent. The migration reorder directly addresses the startup crash on affected databases and both migration functions guard their DDL with existence checks, so already-healthy deployments are unaffected. Schema additions are additive and do not break existing consumers. The test exclusion is narrowly scoped to an enterprise-only field. No files require special attention; the schema's missing conditional constraint for per_user_headers → per_user_header_keys was flagged in a prior review and is tracked outside this diff. Important Files Changed
Reviews (3): Last reviewed commit: "fix: test fixes" | Re-trigger Greptile |
ed94e65 to
a59bd24
Compare
Merge activity
|
a59bd24 to
65bdd6e
Compare

Summary
Fixes a migration ordering bug where
migrationReAddAllowDirectKeysColumnwas running aftermigrationRefreshConfigHashAfterMCPExternalServerURLRemoval, causing a"no such column: allow_direct_keys"failure on databases where the earlier drop migration had already run. The fix movesmigrationReAddAllowDirectKeysColumnto execute before the config hash refresh migration. Additionally, several schema additions are included to keep the config schema in sync with current struct definitions.Changes
migrationReAddAllowDirectKeysColumnto run beforemigrationRefreshConfigHashAfterMCPExternalServerURLRemovalin the migration chain, since the hash refresh migration SELECTsconfig_clientusing theTableClientConfigstruct which still declaresallow_direct_keysallow_direct_keysto the config schema under the client config sectionsource_idfield to the team schema for optional external source identifier (e.g. SCIM group ID) mappingblacklisted_modelsarray field to the provider config schema for blocking specific models even when matched byallowed_modelsper_user_headersas a validauth_typeenum value for MCP connectionsper_user_header_keysarray field to MCP connection config for specifying required caller-supplied headers when usingper_user_headersauthgovernance.virtual_keysexclusion foraccess_profile_idin the schema field test, as it is an enterprise-only field not present on the OSSTableVirtualKeyType of change
Affected areas
How to test
Verify that on a database where
drop_allow_direct_keys_column_ddlhas previously run, the full migration chain completes without a"no such column: allow_direct_keys"error. Confirm the config schema validates correctly against the updatedconfig.schema.json.Breaking changes
Related issues
The migration ordering issue would cause startup failures on any deployment that had previously run the column-drop migration before the config hash refresh migration was introduced.
Security considerations
The
allow_direct_keysfeature permits callers to bypass the registered key pool by supplying a raw provider API key viax-bf-direct-key. Ensure this field defaults tofalseand is only enabled intentionally, as it bypasses key management controls.Checklist
docs/contributing/README.mdand followed the guidelinesSummary by CodeRabbit
allow_direct_keyssetting for direct API key usagesource_idfield for mapping teams to external systemsblacklisted_modelsoption to restrict model access in virtual key providersper_user_headersauthentication option for MCP client connections