Skip to content

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

TypeScript

fix: preserve BUG-192 migration identity after dev sync

Josuée617778a74d7
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index f7f8d9ea8..418e0868b 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.727",
+ "version": "0.1.728",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.727",
+ "version": "0.1.728",
"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 9eb9cb474..cc96d88dc 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.727",
+ "version": "0.1.728",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/src/db.ts b/control-api/src/db.ts
index 9d4886b78..b90487b9a 100644
--- a/control-api/src/db.ts
+++ b/control-api/src/db.ts
@@ -6332,7 +6332,9 @@ export const CONTROL_API_MIGRATIONS: DbMigration[] = [
apply: applyAdminSubscriptionRateLimitNamespace,
},
{
- version: '0125_bug192_password_admission',
+ version: '0126_bug192_password_admission',
+ // Preserve the deployed identity after dev assigned slot 0125 to admin admission.
+ legacyVersions: ['0125_bug192_password_admission'],
apply: applyPasswordAdmissionSchema,
},
]
diff --git a/control-api/test/bug192.passwordPersistence.realPostgres.integration.test.ts b/control-api/test/bug192.passwordPersistence.realPostgres.integration.test.ts
index d41b627a1..1da1783b4 100644
--- a/control-api/test/bug192.passwordPersistence.realPostgres.integration.test.ts
+++ b/control-api/test/bug192.passwordPersistence.realPostgres.integration.test.ts
@@ -122,7 +122,7 @@ realPg('Spec 043 persistence, migration, atomicity and fencing design acceptance
expect(permissions).toEqual({ state: true, pace: true })
const migrations = (
await holder.pool.query(
- "SELECT version FROM schema_migrations WHERE version='0125_bug192_password_admission'"
+ "SELECT version FROM schema_migrations WHERE version='0126_bug192_password_admission'"
)
).rows
expect(migrations).toHaveLength(1)
diff --git a/control-api/test/db.migrationsOrder.test.ts b/control-api/test/db.migrationsOrder.test.ts
index e299316cc..502d05c24 100644
--- a/control-api/test/db.migrationsOrder.test.ts
+++ b/control-api/test/db.migrationsOrder.test.ts
@@ -67,6 +67,34 @@ describe('CONTROL_API_MIGRATIONS ordering invariant', () => {
expect(currentCollisions).toEqual([])
})
+ it('recognizes deployed BUG-192 admission without reapplying its schema', async () => {
+ const { CONTROL_API_MIGRATIONS, initDb, assertDbReady } = await import('../src/db.js')
+ const migration = CONTROL_API_MIGRATIONS.find(
+ candidate => candidate.version === '0126_bug192_password_admission'
+ )
+ expect(migration?.legacyVersions).toEqual(['0125_bug192_password_admission'])
+ const appliedVersions = CONTROL_API_MIGRATIONS.filter(
+ candidate => candidate.version !== migration?.version
+ ).map(candidate => ({ version: candidate.version }))
+ appliedVersions.push({ version: '0125_bug192_password_admission' })
+ const query = vi.fn(async (sql: string) =>
+ sql.includes('SELECT version FROM schema_migrations')
+ ? { rows: appliedVersions, rowCount: appliedVersions.length }
+ : { rows: [], rowCount: 0 }
+ )
+ const release = vi.fn()
+ await initDb({ connect: vi.fn().mockResolvedValue({ query, release }) } as never)
+ expect(query.mock.calls.map(([sql]) => sql)).not.toContainEqual(
+ expect.stringContaining('CREATE TABLE IF NOT EXISTS password_identifier_state')
+ )
+ expect(query).toHaveBeenCalledWith(
+ expect.stringContaining('INSERT INTO schema_migrations(version)'),
+ ['0126_bug192_password_admission']
+ )
+ await expect(assertDbReady({ query } as never)).resolves.toBeUndefined()
+ expect(release).toHaveBeenCalledOnce()
+ })
+
it('recognizes all previously deployed feed migration versions without reapplying DDL', async () => {
const { CONTROL_API_MIGRATIONS, initDb } = await import('../src/db.js')
const migration = CONTROL_API_MIGRATIONS.find(