Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(control-api): pin the oauth-19 migrations' legacyVersions aliases

Diego Zacarias8d2664e41e91
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 2495d5a15..857697a4b 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.677",
+ "version": "0.1.678",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.677",
+ "version": "0.1.678",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",
diff --git a/control-api/package.json b/control-api/package.json
index 24feb396f..9350318bb 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.677",
+ "version": "0.1.678",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/test/db.dynamicClientsTableMigration.test.ts b/control-api/test/db.dynamicClientsTableMigration.test.ts
index 07d0d3ef9..5c26fa7ea 100644
--- a/control-api/test/db.dynamicClientsTableMigration.test.ts
+++ b/control-api/test/db.dynamicClientsTableMigration.test.ts
@@ -20,8 +20,8 @@ describe('0119_dynamic_clients_table migration', () => {
it('is registered after 0115, immediately before its runtime-access grant', async () => {
const { CONTROL_API_MIGRATIONS } = await import('../src/db.js')
const versions = CONTROL_API_MIGRATIONS.map(m => m.version)
- // Renumbered 0116->0117 during the dev sync: dev's 0116_mcp_secret_rollback_permits
- // now sits between 0115 and this migration, so this guards ordering, not adjacency.
+ // Renumbered 0116->0117->0119 across dev syncs: dev's 0116-0118 now sit between
+ // 0115 and this migration, so this guards ordering, not adjacency.
expect(versions).toContain('0119_dynamic_clients_table')
expect(versions.indexOf('0115_llm_allowed_models_image_input')).toBeLessThan(
versions.indexOf('0119_dynamic_clients_table')
@@ -32,6 +32,21 @@ describe('0119_dynamic_clients_table migration', () => {
)
})
+ it('carries the pre-renumber names as legacyVersions so a deploy that already ran them is not re-executed', async () => {
+ // Environments that recorded an earlier name (the oauth-19 dev cluster) must
+ // mark the current version applied from that row instead of re-running the DDL.
+ const { CONTROL_API_MIGRATIONS } = await import('../src/db.js')
+ const byVersion = (v: string) => CONTROL_API_MIGRATIONS.find(m => m.version === v)
+ expect(byVersion('0119_dynamic_clients_table')?.legacyVersions).toEqual([
+ '0116_dynamic_clients_table',
+ '0117_dynamic_clients_table',
+ ])
+ expect(byVersion('0120_dynamic_clients_runtime_access')?.legacyVersions).toEqual([
+ '0117_dynamic_clients_runtime_access',
+ '0118_dynamic_clients_runtime_access',
+ ])
+ })
+
it('creates the dynamic_clients table with the encrypted columns, owner-unique constraint and issuer index', async () => {
const { initDb } = await import('../src/db.js')
await initDb()
diff --git a/control-api/test/db.oauthInstallIdentityMigration.test.ts b/control-api/test/db.oauthInstallIdentityMigration.test.ts
index 384cf9a93..baa2bfa13 100644
--- a/control-api/test/db.oauthInstallIdentityMigration.test.ts
+++ b/control-api/test/db.oauthInstallIdentityMigration.test.ts
@@ -31,6 +31,12 @@ describe('0121_oauth_install_identity migration', () => {
)
})
+ it('carries its pre-renumber name as legacyVersions so a deploy that already ran it is not re-executed', async () => {
+ const { CONTROL_API_MIGRATIONS } = await import('../src/db.js')
+ const migration = CONTROL_API_MIGRATIONS.find(m => m.version === '0121_oauth_install_identity')
+ expect(migration?.legacyVersions).toEqual(['0119_oauth_install_identity'])
+ })
+
it('adds install_id + cr_uid to dynamic_clients and cr_uid to oauth_grants, with the bound/length CHECKs', async () => {
const { initDb } = await import('../src/db.js')
await initDb()