fix(server): preserve released migration ordering
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
7732874f50
commit
20a3519393
13 files changed
+37
-33
No files matched your search
@@ -45,15 +45,15 @@ import Migration0029 from "./Migrations/029_ProjectionThreadDetailOrderingIndexe
|
||||
import Migration0030 from "./Migrations/030_ProjectionThreadShellArchiveIndexes.ts";
|
||||
import Migration0031 from "./Migrations/031_AuthAuthorizationScopes.ts";
|
||||
import Migration0032 from "./Migrations/032_AuthPairingProofKeyThumbprint.ts";
|
||||
import Migration0033 from "./Migrations/033_OrchestrationV2.ts";
|
||||
import Migration0034 from "./Migrations/034_OrchestrationV2Subagents.ts";
|
||||
import Migration0035 from "./Migrations/035_OrchestrationV2Foundation.ts";
|
||||
import Migration0036 from "./Migrations/036_OrchestrationV2ProviderSessionBindings.ts";
|
||||
import Migration0037 from "./Migrations/037_OrchestrationV2ThreadLaunchWorkflows.ts";
|
||||
import Migration0038 from "./Migrations/038_ApplicationEventSource.ts";
|
||||
import Migration0039 from "./Migrations/039_OrchestrationV2EffectCancellation.ts";
|
||||
import Migration0040 from "./Migrations/040_ScheduledTasks.ts";
|
||||
import Migration0041 from "./Migrations/041_ProjectionThreadsSettled.ts";
|
||||
import Migration0033 from "./Migrations/033_ProjectionThreadsSettled.ts";
|
||||
import Migration0034 from "./Migrations/034_OrchestrationV2.ts";
|
||||
import Migration0035 from "./Migrations/035_OrchestrationV2Subagents.ts";
|
||||
import Migration0036 from "./Migrations/036_OrchestrationV2Foundation.ts";
|
||||
import Migration0037 from "./Migrations/037_OrchestrationV2ProviderSessionBindings.ts";
|
||||
import Migration0038 from "./Migrations/038_OrchestrationV2ThreadLaunchWorkflows.ts";
|
||||
import Migration0039 from "./Migrations/039_ApplicationEventSource.ts";
|
||||
import Migration0040 from "./Migrations/040_OrchestrationV2EffectCancellation.ts";
|
||||
import Migration0041 from "./Migrations/041_ScheduledTasks.ts";
|
||||
|
||||
/**
|
||||
* Migration loader with all migrations defined inline.
|
||||
@@ -98,15 +98,15 @@ export const migrationEntries = [
|
||||
[30, "ProjectionThreadShellArchiveIndexes", Migration0030],
|
||||
[31, "AuthAuthorizationScopes", Migration0031],
|
||||
[32, "AuthPairingProofKeyThumbprint", Migration0032],
|
||||
[33, "OrchestrationV2", Migration0033],
|
||||
[34, "OrchestrationV2Subagents", Migration0034],
|
||||
[35, "OrchestrationV2Foundation", Migration0035],
|
||||
[36, "OrchestrationV2ProviderSessionBindings", Migration0036],
|
||||
[37, "OrchestrationV2ThreadLaunchWorkflows", Migration0037],
|
||||
[38, "ApplicationEventSource", Migration0038],
|
||||
[39, "OrchestrationV2EffectCancellation", Migration0039],
|
||||
[40, "ScheduledTasks", Migration0040],
|
||||
[41, "ProjectionThreadsSettled", Migration0041],
|
||||
[33, "ProjectionThreadsSettled", Migration0033],
|
||||
[34, "OrchestrationV2", Migration0034],
|
||||
[35, "OrchestrationV2Subagents", Migration0035],
|
||||
[36, "OrchestrationV2Foundation", Migration0036],
|
||||
[37, "OrchestrationV2ProviderSessionBindings", Migration0037],
|
||||
[38, "OrchestrationV2ThreadLaunchWorkflows", Migration0038],
|
||||
[39, "ApplicationEventSource", Migration0039],
|
||||
[40, "OrchestrationV2EffectCancellation", Migration0040],
|
||||
[41, "ScheduledTasks", Migration0041],
|
||||
] as const;
|
||||
|
||||
export const makeMigrationLoader = (throughId?: number) =>
|
||||
|
||||
File renamed without changes.
+10
-6
@@ -8,12 +8,12 @@ import * as NodeSqliteClient from "../NodeSqliteClient.ts";
|
||||
|
||||
const layer = it.layer(Layer.mergeAll(NodeSqliteClient.layerMemory()));
|
||||
|
||||
layer("033_034_OrchestrationV2", (it) => {
|
||||
layer("034_035_OrchestrationV2", (it) => {
|
||||
it.effect("installs the orchestration v2 and subagent schemas", () =>
|
||||
Effect.gen(function* () {
|
||||
const sql = yield* SqlClient.SqlClient;
|
||||
|
||||
yield* runMigrations({ toMigrationInclusive: 34 });
|
||||
yield* runMigrations({ toMigrationInclusive: 35 });
|
||||
|
||||
const migrations = yield* sql<{
|
||||
readonly migration_id: number;
|
||||
@@ -21,16 +21,20 @@ layer("033_034_OrchestrationV2", (it) => {
|
||||
}>`
|
||||
SELECT migration_id, name
|
||||
FROM effect_sql_migrations
|
||||
WHERE migration_id IN (33, 34)
|
||||
WHERE migration_id IN (33, 34, 35)
|
||||
ORDER BY migration_id
|
||||
`;
|
||||
assert.deepStrictEqual(migrations, [
|
||||
{
|
||||
migration_id: 33,
|
||||
name: "OrchestrationV2",
|
||||
name: "ProjectionThreadsSettled",
|
||||
},
|
||||
{
|
||||
migration_id: 34,
|
||||
name: "OrchestrationV2",
|
||||
},
|
||||
{
|
||||
migration_id: 35,
|
||||
name: "OrchestrationV2Subagents",
|
||||
},
|
||||
]);
|
||||
@@ -50,7 +54,7 @@ layer("033_034_OrchestrationV2", (it) => {
|
||||
it.effect("backfills provider-session thread bindings in migration 036", () =>
|
||||
Effect.gen(function* () {
|
||||
const sql = yield* SqlClient.SqlClient;
|
||||
yield* runMigrations({ toMigrationInclusive: 35 });
|
||||
yield* runMigrations({ toMigrationInclusive: 36 });
|
||||
yield* sql`
|
||||
INSERT INTO orchestration_v2_projection_provider_sessions (
|
||||
provider_session_id,
|
||||
@@ -75,7 +79,7 @@ layer("033_034_OrchestrationV2", (it) => {
|
||||
)
|
||||
`;
|
||||
|
||||
yield* runMigrations({ toMigrationInclusive: 36 });
|
||||
yield* runMigrations({ toMigrationInclusive: 37 });
|
||||
|
||||
const bindings = yield* sql<{
|
||||
readonly provider_session_id: string;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+3
-3
@@ -8,11 +8,11 @@ import * as NodeSqliteClient from "../NodeSqliteClient.ts";
|
||||
|
||||
const layer = it.layer(Layer.mergeAll(NodeSqliteClient.layerMemory()));
|
||||
|
||||
layer("038_ApplicationEventSource", (it) => {
|
||||
layer("039_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: 37 });
|
||||
yield* runMigrations({ toMigrationInclusive: 38 });
|
||||
|
||||
yield* sql`
|
||||
INSERT INTO orchestration_v2_events (
|
||||
@@ -84,7 +84,7 @@ layer("038_ApplicationEventSource", (it) => {
|
||||
)
|
||||
`;
|
||||
|
||||
yield* runMigrations({ toMigrationInclusive: 38 });
|
||||
yield* runMigrations({ toMigrationInclusive: 39 });
|
||||
|
||||
const events = yield* sql<{
|
||||
readonly sequence: number;
|
||||
+3
-3
@@ -142,7 +142,7 @@ export default Effect.gen(function* () {
|
||||
projectRows,
|
||||
(project) =>
|
||||
Effect.gen(function* () {
|
||||
const createdEventId = `migration:38:project:${project.project_id}:baseline`;
|
||||
const createdEventId = `migration:39:project:${project.project_id}:baseline`;
|
||||
const createdPayload = {
|
||||
projectId: project.project_id,
|
||||
title: project.title,
|
||||
@@ -158,7 +158,7 @@ export default Effect.gen(function* () {
|
||||
const createdPayloadJson = yield* encodeJson(createdPayload);
|
||||
const migrationMetadataJson = yield* encodeJson({
|
||||
applicationEventVersion: 2,
|
||||
migration: 38,
|
||||
migration: 39,
|
||||
});
|
||||
yield* sql`
|
||||
INSERT INTO orchestration_events (
|
||||
@@ -222,7 +222,7 @@ export default Effect.gen(function* () {
|
||||
application_event_version
|
||||
)
|
||||
VALUES (
|
||||
${`migration:38:project:${project.project_id}:deleted`},
|
||||
${`migration:39:project:${project.project_id}:deleted`},
|
||||
'project',
|
||||
${project.project_id},
|
||||
(
|
||||
+3
-3
@@ -8,11 +8,11 @@ import * as NodeSqliteClient from "../NodeSqliteClient.ts";
|
||||
|
||||
const layer = it.layer(Layer.mergeAll(NodeSqliteClient.layerMemory()));
|
||||
|
||||
layer("039_OrchestrationV2EffectCancellation", (it) => {
|
||||
layer("040_OrchestrationV2EffectCancellation", (it) => {
|
||||
it.effect("preserves existing effects and adds the cancelled terminal status", () =>
|
||||
Effect.gen(function* () {
|
||||
const sql = yield* SqlClient.SqlClient;
|
||||
yield* runMigrations({ toMigrationInclusive: 38 });
|
||||
yield* runMigrations({ toMigrationInclusive: 39 });
|
||||
yield* sql`
|
||||
INSERT INTO orchestration_v2_effect_outbox (
|
||||
effect_id,
|
||||
@@ -47,7 +47,7 @@ layer("039_OrchestrationV2EffectCancellation", (it) => {
|
||||
)
|
||||
`;
|
||||
|
||||
yield* runMigrations({ toMigrationInclusive: 39 });
|
||||
yield* runMigrations({ toMigrationInclusive: 40 });
|
||||
yield* sql`
|
||||
UPDATE orchestration_v2_effect_outbox
|
||||
SET
|
||||
File renamed without changes.
Reference in new issue
Block a user