fix(server): preserve released migration ordering
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
e50b801e85
commit
cfbdceb33a
12 files changed
+27
-15
No files matched your search
@@ -58,6 +58,14 @@ import Migration037V2 from "./Migrations/037_OrchestrationV2ThreadLaunchWorkflow
|
||||
import Migration038V2 from "./Migrations/038_ApplicationEventSource.ts";
|
||||
import Migration039V2 from "./Migrations/039_OrchestrationV2EffectCancellation.ts";
|
||||
import Migration040V2 from "./Migrations/040_ScheduledTasks.ts";
|
||||
import Migration034V2 from "./Migrations/034_OrchestrationV2.ts";
|
||||
import Migration035V2 from "./Migrations/035_OrchestrationV2Subagents.ts";
|
||||
import Migration036V2 from "./Migrations/036_OrchestrationV2Foundation.ts";
|
||||
import Migration037V2 from "./Migrations/037_OrchestrationV2ProviderSessionBindings.ts";
|
||||
import Migration038V2 from "./Migrations/038_OrchestrationV2ThreadLaunchWorkflows.ts";
|
||||
import Migration039V2 from "./Migrations/039_ApplicationEventSource.ts";
|
||||
import Migration040V2 from "./Migrations/040_OrchestrationV2EffectCancellation.ts";
|
||||
import Migration041V2 from "./Migrations/041_ScheduledTasks.ts";
|
||||
|
||||
/**
|
||||
* Migration loader with all migrations defined inline.
|
||||
|
||||
+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