From f3d2958518decfba16a762d05b43aec75d73f280 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 10 Aug 2026 18:50:27 +0200 Subject: [PATCH] chore(server): renumber v2 migrations 038-046 to 041-049 after main's 038-040 Main released ProjectionThreadsPinOrderKey (038), ProjectionProjectsDefaultThreadEnvMode (039) and ProjectionProjectFaviconPath (040), so the branch-private v2 stack shifts up by three. Registry ids were already 41-49; this renames the files and identifiers to match and updates the ledger expectations and through-id boundaries in the migration tests (released boundary 37 -> 40). Co-Authored-By: Claude Fable 5 --- apps/server/src/persistence/Migrations.ts | 36 ++++++------ ...est.ts => 041_042_OrchestrationV2.test.ts} | 57 ++++++++++--------- ...hestrationV2.ts => 041_OrchestrationV2.ts} | 0 ...nts.ts => 042_OrchestrationV2Subagents.ts} | 0 ... => 043_OrchestrationV2Foundation.test.ts} | 4 +- ...on.ts => 043_OrchestrationV2Foundation.ts} | 0 ...OrchestrationV2ProviderSessionBindings.ts} | 0 ...5_OrchestrationV2ThreadLaunchWorkflows.ts} | 0 ....ts => 046_ApplicationEventSource.test.ts} | 4 +- ...ource.ts => 046_ApplicationEventSource.ts} | 0 ...OrchestrationV2EffectCancellation.test.ts} | 4 +- ... 047_OrchestrationV2EffectCancellation.ts} | 0 ...cheduledTasks.ts => 048_ScheduledTasks.ts} | 0 ...ortState.ts => 049_LegacyV1ImportState.ts} | 0 14 files changed, 54 insertions(+), 51 deletions(-) rename apps/server/src/persistence/Migrations/{038_039_OrchestrationV2.test.ts => 041_042_OrchestrationV2.test.ts} (82%) rename apps/server/src/persistence/Migrations/{038_OrchestrationV2.ts => 041_OrchestrationV2.ts} (100%) rename apps/server/src/persistence/Migrations/{039_OrchestrationV2Subagents.ts => 042_OrchestrationV2Subagents.ts} (100%) rename apps/server/src/persistence/Migrations/{040_OrchestrationV2Foundation.test.ts => 043_OrchestrationV2Foundation.test.ts} (93%) rename apps/server/src/persistence/Migrations/{040_OrchestrationV2Foundation.ts => 043_OrchestrationV2Foundation.ts} (100%) rename apps/server/src/persistence/Migrations/{041_OrchestrationV2ProviderSessionBindings.ts => 044_OrchestrationV2ProviderSessionBindings.ts} (100%) rename apps/server/src/persistence/Migrations/{042_OrchestrationV2ThreadLaunchWorkflows.ts => 045_OrchestrationV2ThreadLaunchWorkflows.ts} (100%) rename apps/server/src/persistence/Migrations/{043_ApplicationEventSource.test.ts => 046_ApplicationEventSource.test.ts} (96%) rename apps/server/src/persistence/Migrations/{043_ApplicationEventSource.ts => 046_ApplicationEventSource.ts} (100%) rename apps/server/src/persistence/Migrations/{044_OrchestrationV2EffectCancellation.test.ts => 047_OrchestrationV2EffectCancellation.test.ts} (95%) rename apps/server/src/persistence/Migrations/{044_OrchestrationV2EffectCancellation.ts => 047_OrchestrationV2EffectCancellation.ts} (100%) rename apps/server/src/persistence/Migrations/{045_ScheduledTasks.ts => 048_ScheduledTasks.ts} (100%) rename apps/server/src/persistence/Migrations/{046_LegacyV1ImportState.ts => 049_LegacyV1ImportState.ts} (100%) diff --git a/apps/server/src/persistence/Migrations.ts b/apps/server/src/persistence/Migrations.ts index ae722e690c..cd27b51a36 100644 --- a/apps/server/src/persistence/Migrations.ts +++ b/apps/server/src/persistence/Migrations.ts @@ -53,15 +53,15 @@ import Migration0037 from "./Migrations/037_ProjectionTurnsKeysetIndex.ts"; import Migration0038 from "./Migrations/038_ProjectionThreadsPinOrderKey.ts"; import Migration0039 from "./Migrations/039_ProjectionProjectsDefaultThreadEnvMode.ts"; import Migration0040 from "./Migrations/040_ProjectionProjectFaviconPath.ts"; -import Migration038V2 from "./Migrations/038_OrchestrationV2.ts"; -import Migration039V2 from "./Migrations/039_OrchestrationV2Subagents.ts"; -import Migration040V2 from "./Migrations/040_OrchestrationV2Foundation.ts"; -import Migration041V2 from "./Migrations/041_OrchestrationV2ProviderSessionBindings.ts"; -import Migration042V2 from "./Migrations/042_OrchestrationV2ThreadLaunchWorkflows.ts"; -import Migration043V2 from "./Migrations/043_ApplicationEventSource.ts"; -import Migration044V2 from "./Migrations/044_OrchestrationV2EffectCancellation.ts"; -import Migration045V2 from "./Migrations/045_ScheduledTasks.ts"; -import Migration046V2 from "./Migrations/046_LegacyV1ImportState.ts"; +import Migration0041 from "./Migrations/041_OrchestrationV2.ts"; +import Migration0042 from "./Migrations/042_OrchestrationV2Subagents.ts"; +import Migration0043 from "./Migrations/043_OrchestrationV2Foundation.ts"; +import Migration0044 from "./Migrations/044_OrchestrationV2ProviderSessionBindings.ts"; +import Migration0045 from "./Migrations/045_OrchestrationV2ThreadLaunchWorkflows.ts"; +import Migration0046 from "./Migrations/046_ApplicationEventSource.ts"; +import Migration0047 from "./Migrations/047_OrchestrationV2EffectCancellation.ts"; +import Migration0048 from "./Migrations/048_ScheduledTasks.ts"; +import Migration0049 from "./Migrations/049_LegacyV1ImportState.ts"; /** * Migration loader with all migrations defined inline. @@ -114,15 +114,15 @@ export const migrationEntries = [ [38, "ProjectionThreadsPinOrderKey", Migration0038], [39, "ProjectionProjectsDefaultThreadEnvMode", Migration0039], [40, "ProjectionProjectFaviconPath", Migration0040], - [41, "OrchestrationV2", Migration038V2], - [42, "OrchestrationV2Subagents", Migration039V2], - [43, "OrchestrationV2Foundation", Migration040V2], - [44, "OrchestrationV2ProviderSessionBindings", Migration041V2], - [45, "OrchestrationV2ThreadLaunchWorkflows", Migration042V2], - [46, "ApplicationEventSource", Migration043V2], - [47, "OrchestrationV2EffectCancellation", Migration044V2], - [48, "ScheduledTasks", Migration045V2], - [49, "LegacyV1ImportState", Migration046V2], + [41, "OrchestrationV2", Migration0041], + [42, "OrchestrationV2Subagents", Migration0042], + [43, "OrchestrationV2Foundation", Migration0043], + [44, "OrchestrationV2ProviderSessionBindings", Migration0044], + [45, "OrchestrationV2ThreadLaunchWorkflows", Migration0045], + [46, "ApplicationEventSource", Migration0046], + [47, "OrchestrationV2EffectCancellation", Migration0047], + [48, "ScheduledTasks", Migration0048], + [49, "LegacyV1ImportState", Migration0049], ] as const; export const migrationManifest = migrationEntries.map(([id, name]) => [id, name] as const); diff --git a/apps/server/src/persistence/Migrations/038_039_OrchestrationV2.test.ts b/apps/server/src/persistence/Migrations/041_042_OrchestrationV2.test.ts similarity index 82% rename from apps/server/src/persistence/Migrations/038_039_OrchestrationV2.test.ts rename to apps/server/src/persistence/Migrations/041_042_OrchestrationV2.test.ts index 24f9442356..75cf364de7 100644 --- a/apps/server/src/persistence/Migrations/038_039_OrchestrationV2.test.ts +++ b/apps/server/src/persistence/Migrations/041_042_OrchestrationV2.test.ts @@ -13,7 +13,7 @@ layer("038_039_OrchestrationV2", (it) => { Effect.sync(() => { assert.deepStrictEqual( migrationEntries.map(([id]) => id), - Array.from({ length: 46 }, (_, index) => index + 1), + Array.from({ length: 49 }, (_, index) => index + 1), ); }), ); @@ -22,7 +22,7 @@ layer("038_039_OrchestrationV2", (it) => { Effect.gen(function* () { const sql = yield* SqlClient.SqlClient; - yield* runMigrations({ toMigrationInclusive: 39 }); + yield* runMigrations({ toMigrationInclusive: 42 }); const migrations = yield* sql<{ readonly migration_id: number; @@ -30,24 +30,24 @@ layer("038_039_OrchestrationV2", (it) => { }>` SELECT migration_id, name FROM effect_sql_migrations - WHERE migration_id IN (36, 37, 38, 39) + WHERE migration_id IN (39, 40, 41, 42) ORDER BY migration_id `; assert.deepStrictEqual(migrations, [ { - migration_id: 36, - name: "ProjectionThreadsPinned", + migration_id: 39, + name: "ProjectionProjectsDefaultThreadEnvMode", }, { - migration_id: 37, - name: "ProjectionTurnsKeysetIndex", + migration_id: 40, + name: "ProjectionProjectFaviconPath", }, { - migration_id: 38, + migration_id: 41, name: "OrchestrationV2", }, { - migration_id: 39, + migration_id: 42, name: "OrchestrationV2Subagents", }, ]); @@ -64,10 +64,10 @@ layer("038_039_OrchestrationV2", (it) => { }), ); - it.effect("backfills provider-session thread bindings in migration 038", () => + it.effect("backfills provider-session thread bindings in migration 041", () => Effect.gen(function* () { const sql = yield* SqlClient.SqlClient; - yield* runMigrations({ toMigrationInclusive: 40 }); + yield* runMigrations({ toMigrationInclusive: 43 }); yield* sql` INSERT INTO orchestration_v2_projection_provider_sessions ( provider_session_id, @@ -92,7 +92,7 @@ layer("038_039_OrchestrationV2", (it) => { ) `; - yield* runMigrations({ toMigrationInclusive: 41 }); + yield* runMigrations({ toMigrationInclusive: 44 }); const bindings = yield* sql<{ readonly provider_session_id: string; @@ -113,7 +113,7 @@ layer("038_039_OrchestrationV2", (it) => { it.effect("preserves turn items with colliding ordinals in migration 037", () => Effect.gen(function* () { const sql = yield* SqlClient.SqlClient; - yield* runMigrations({ toMigrationInclusive: 39 }); + yield* runMigrations({ toMigrationInclusive: 42 }); yield* sql` INSERT INTO orchestration_v2_projection_runs ( run_id, @@ -150,7 +150,7 @@ layer("038_039_OrchestrationV2", (it) => { ('turn-item:d', 'thread:two', NULL, 42, 'assistant_message', 'completed', '2026-01-01T00:00:00.000Z', '{}') `; - yield* runMigrations({ toMigrationInclusive: 40 }); + yield* runMigrations({ toMigrationInclusive: 43 }); const positions = yield* sql<{ readonly thread_id: string; @@ -171,18 +171,18 @@ layer("038_039_OrchestrationV2", (it) => { ); }); -it.effect("upgrades a database already at released main migration 037", () => +it.effect("upgrades a database already at released main migration 040", () => Effect.gen(function* () { const sql = yield* SqlClient.SqlClient; - yield* runMigrations({ toMigrationInclusive: 37 }); + yield* runMigrations({ toMigrationInclusive: 40 }); const snoozeColumns = yield* sql<{ readonly name: string }>` PRAGMA table_info(projection_threads) `; assert.ok(snoozeColumns.some((column) => column.name === "snoozed_until")); assert.ok(snoozeColumns.some((column) => column.name === "snoozed_at")); - yield* runMigrations({ toMigrationInclusive: 46 }); + yield* runMigrations({ toMigrationInclusive: 49 }); const migrations = yield* sql<{ readonly migration_id: number; @@ -190,7 +190,7 @@ it.effect("upgrades a database already at released main migration 037", () => }>` SELECT migration_id, name FROM effect_sql_migrations - WHERE migration_id BETWEEN 36 AND 46 + WHERE migration_id BETWEEN 36 AND 49 ORDER BY migration_id `; assert.deepStrictEqual( @@ -198,15 +198,18 @@ it.effect("upgrades a database already at released main migration 037", () => [ [36, "ProjectionThreadsPinned"], [37, "ProjectionTurnsKeysetIndex"], - [38, "OrchestrationV2"], - [39, "OrchestrationV2Subagents"], - [40, "OrchestrationV2Foundation"], - [41, "OrchestrationV2ProviderSessionBindings"], - [42, "OrchestrationV2ThreadLaunchWorkflows"], - [43, "ApplicationEventSource"], - [44, "OrchestrationV2EffectCancellation"], - [45, "ScheduledTasks"], - [46, "LegacyV1ImportState"], + [38, "ProjectionThreadsPinOrderKey"], + [39, "ProjectionProjectsDefaultThreadEnvMode"], + [40, "ProjectionProjectFaviconPath"], + [41, "OrchestrationV2"], + [42, "OrchestrationV2Subagents"], + [43, "OrchestrationV2Foundation"], + [44, "OrchestrationV2ProviderSessionBindings"], + [45, "OrchestrationV2ThreadLaunchWorkflows"], + [46, "ApplicationEventSource"], + [47, "OrchestrationV2EffectCancellation"], + [48, "ScheduledTasks"], + [49, "LegacyV1ImportState"], ], ); diff --git a/apps/server/src/persistence/Migrations/038_OrchestrationV2.ts b/apps/server/src/persistence/Migrations/041_OrchestrationV2.ts similarity index 100% rename from apps/server/src/persistence/Migrations/038_OrchestrationV2.ts rename to apps/server/src/persistence/Migrations/041_OrchestrationV2.ts diff --git a/apps/server/src/persistence/Migrations/039_OrchestrationV2Subagents.ts b/apps/server/src/persistence/Migrations/042_OrchestrationV2Subagents.ts similarity index 100% rename from apps/server/src/persistence/Migrations/039_OrchestrationV2Subagents.ts rename to apps/server/src/persistence/Migrations/042_OrchestrationV2Subagents.ts diff --git a/apps/server/src/persistence/Migrations/040_OrchestrationV2Foundation.test.ts b/apps/server/src/persistence/Migrations/043_OrchestrationV2Foundation.test.ts similarity index 93% rename from apps/server/src/persistence/Migrations/040_OrchestrationV2Foundation.test.ts rename to apps/server/src/persistence/Migrations/043_OrchestrationV2Foundation.test.ts index 1d0ccddf3d..652f341c28 100644 --- a/apps/server/src/persistence/Migrations/040_OrchestrationV2Foundation.test.ts +++ b/apps/server/src/persistence/Migrations/043_OrchestrationV2Foundation.test.ts @@ -8,7 +8,7 @@ import * as NodeSqliteClient from "../NodeSqliteClient.ts"; it.effect("backfills the V2 event driver from payload before the legacy provider column", () => Effect.gen(function* () { const sql = yield* SqlClient.SqlClient; - yield* runMigrations({ toMigrationInclusive: 39 }); + yield* runMigrations({ toMigrationInclusive: 42 }); yield* sql` INSERT INTO orchestration_v2_events ( @@ -37,7 +37,7 @@ it.effect("backfills the V2 event driver from payload before the legacy provider ) `; - yield* runMigrations({ toMigrationInclusive: 40 }); + yield* runMigrations({ toMigrationInclusive: 43 }); const events = yield* sql<{ readonly event_id: string; diff --git a/apps/server/src/persistence/Migrations/040_OrchestrationV2Foundation.ts b/apps/server/src/persistence/Migrations/043_OrchestrationV2Foundation.ts similarity index 100% rename from apps/server/src/persistence/Migrations/040_OrchestrationV2Foundation.ts rename to apps/server/src/persistence/Migrations/043_OrchestrationV2Foundation.ts diff --git a/apps/server/src/persistence/Migrations/041_OrchestrationV2ProviderSessionBindings.ts b/apps/server/src/persistence/Migrations/044_OrchestrationV2ProviderSessionBindings.ts similarity index 100% rename from apps/server/src/persistence/Migrations/041_OrchestrationV2ProviderSessionBindings.ts rename to apps/server/src/persistence/Migrations/044_OrchestrationV2ProviderSessionBindings.ts diff --git a/apps/server/src/persistence/Migrations/042_OrchestrationV2ThreadLaunchWorkflows.ts b/apps/server/src/persistence/Migrations/045_OrchestrationV2ThreadLaunchWorkflows.ts similarity index 100% rename from apps/server/src/persistence/Migrations/042_OrchestrationV2ThreadLaunchWorkflows.ts rename to apps/server/src/persistence/Migrations/045_OrchestrationV2ThreadLaunchWorkflows.ts diff --git a/apps/server/src/persistence/Migrations/043_ApplicationEventSource.test.ts b/apps/server/src/persistence/Migrations/046_ApplicationEventSource.test.ts similarity index 96% rename from apps/server/src/persistence/Migrations/043_ApplicationEventSource.test.ts rename to apps/server/src/persistence/Migrations/046_ApplicationEventSource.test.ts index 38c347c786..46827f8e1e 100644 --- a/apps/server/src/persistence/Migrations/043_ApplicationEventSource.test.ts +++ b/apps/server/src/persistence/Migrations/046_ApplicationEventSource.test.ts @@ -12,7 +12,7 @@ layer("043_ApplicationEventSource", (it) => { it.effect("moves V2 events and current project state behind one global sequence", () => Effect.gen(function* () { const sql = yield* SqlClient.SqlClient; - yield* runMigrations({ toMigrationInclusive: 42 }); + yield* runMigrations({ toMigrationInclusive: 45 }); yield* sql` INSERT INTO orchestration_v2_events ( @@ -84,7 +84,7 @@ layer("043_ApplicationEventSource", (it) => { ) `; - yield* runMigrations({ toMigrationInclusive: 43 }); + yield* runMigrations({ toMigrationInclusive: 46 }); const events = yield* sql<{ readonly sequence: number; diff --git a/apps/server/src/persistence/Migrations/043_ApplicationEventSource.ts b/apps/server/src/persistence/Migrations/046_ApplicationEventSource.ts similarity index 100% rename from apps/server/src/persistence/Migrations/043_ApplicationEventSource.ts rename to apps/server/src/persistence/Migrations/046_ApplicationEventSource.ts diff --git a/apps/server/src/persistence/Migrations/044_OrchestrationV2EffectCancellation.test.ts b/apps/server/src/persistence/Migrations/047_OrchestrationV2EffectCancellation.test.ts similarity index 95% rename from apps/server/src/persistence/Migrations/044_OrchestrationV2EffectCancellation.test.ts rename to apps/server/src/persistence/Migrations/047_OrchestrationV2EffectCancellation.test.ts index 3b4cc9a4b3..f911fa0d16 100644 --- a/apps/server/src/persistence/Migrations/044_OrchestrationV2EffectCancellation.test.ts +++ b/apps/server/src/persistence/Migrations/047_OrchestrationV2EffectCancellation.test.ts @@ -12,7 +12,7 @@ layer("044_OrchestrationV2EffectCancellation", (it) => { it.effect("preserves existing effects and adds the cancelled terminal status", () => Effect.gen(function* () { const sql = yield* SqlClient.SqlClient; - yield* runMigrations({ toMigrationInclusive: 43 }); + yield* runMigrations({ toMigrationInclusive: 46 }); yield* sql` INSERT INTO orchestration_v2_effect_outbox ( effect_id, @@ -47,7 +47,7 @@ layer("044_OrchestrationV2EffectCancellation", (it) => { ) `; - yield* runMigrations({ toMigrationInclusive: 44 }); + yield* runMigrations({ toMigrationInclusive: 47 }); yield* sql` UPDATE orchestration_v2_effect_outbox SET diff --git a/apps/server/src/persistence/Migrations/044_OrchestrationV2EffectCancellation.ts b/apps/server/src/persistence/Migrations/047_OrchestrationV2EffectCancellation.ts similarity index 100% rename from apps/server/src/persistence/Migrations/044_OrchestrationV2EffectCancellation.ts rename to apps/server/src/persistence/Migrations/047_OrchestrationV2EffectCancellation.ts diff --git a/apps/server/src/persistence/Migrations/045_ScheduledTasks.ts b/apps/server/src/persistence/Migrations/048_ScheduledTasks.ts similarity index 100% rename from apps/server/src/persistence/Migrations/045_ScheduledTasks.ts rename to apps/server/src/persistence/Migrations/048_ScheduledTasks.ts diff --git a/apps/server/src/persistence/Migrations/046_LegacyV1ImportState.ts b/apps/server/src/persistence/Migrations/049_LegacyV1ImportState.ts similarity index 100% rename from apps/server/src/persistence/Migrations/046_LegacyV1ImportState.ts rename to apps/server/src/persistence/Migrations/049_LegacyV1ImportState.ts