From d9491d3478a02b92a84be21399aa0437f3f548cc Mon Sep 17 00:00:00 2001 From: Ronaldo Davi Date: Mon, 14 Sep 2026 23:31:04 -0300 Subject: [PATCH 1/4] fix(core): commit generated migration for session directory index perf(core) commit 5372b2ed3f added a composite index declaration (session_directory_time_created_id_idx on directory, time_created, id) to packages/core/src/session/sql.ts but never ran the migration generator, so the declared schema and the committed migration/snapshot diverged. unit (linux)/unit (windows) on dev have been red ever since (DatabaseMigration > declared schema has no ungenerated migrations), blocking CI on every PR regardless of what it touches. Ran `bun script/migration.ts` from packages/core (the tool the check's own error message points to) to generate the missing migration file and regenerate schema.json/schema.gen.ts/migration.gen.ts -- no manual edits to any generated file. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_015KrFrdVEmx7apnofWUViJw --- .../migration/20260915022715_tearful_micromax.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 packages/core/src/database/migration/20260915022715_tearful_micromax.ts diff --git a/packages/core/src/database/migration/20260915022715_tearful_micromax.ts b/packages/core/src/database/migration/20260915022715_tearful_micromax.ts new file mode 100644 index 000000000000..7df87bb79612 --- /dev/null +++ b/packages/core/src/database/migration/20260915022715_tearful_micromax.ts @@ -0,0 +1,13 @@ +import { Effect } from "effect" +import type { DatabaseMigration } from "../migration" + +export default { + id: "20260915022715_tearful_micromax", + up(tx) { + return Effect.gen(function* () { + yield* tx.run( + `CREATE INDEX \`session_directory_time_created_id_idx\` ON \`session\` (\`directory\`,\`time_created\`,\`id\`);`, + ) + }) + }, +} satisfies DatabaseMigration.Migration From d297b9e8c510b063fe4fc1f08d11b57ec556b7e1 Mon Sep 17 00:00:00 2001 From: Ronaldo Davi Date: Mon, 14 Sep 2026 23:31:29 -0300 Subject: [PATCH 2/4] fix(core): register new session directory index migration Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_015KrFrdVEmx7apnofWUViJw --- packages/core/src/database/migration.gen.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/database/migration.gen.ts b/packages/core/src/database/migration.gen.ts index 8bce30db11a6..f43660017df5 100644 --- a/packages/core/src/database/migration.gen.ts +++ b/packages/core/src/database/migration.gen.ts @@ -41,5 +41,6 @@ export const migrations = ( import("./migration/20260622170816_reset_v2_session_state"), import("./migration/20260622202450_simplify_session_input"), import("./migration/20260914135618_add_schedule"), + import("./migration/20260915022715_tearful_micromax"), ]) ).map((module) => module.default) satisfies DatabaseMigration.Migration[] From 73b17bf157ed2032ad37e9f82c4b34524a56e723 Mon Sep 17 00:00:00 2001 From: Ronaldo Davi Date: Mon, 14 Sep 2026 23:32:33 -0300 Subject: [PATCH 3/4] fix(core): regenerate schema.gen.ts with session directory index Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_015KrFrdVEmx7apnofWUViJw --- packages/core/src/database/schema.gen.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/core/src/database/schema.gen.ts b/packages/core/src/database/schema.gen.ts index 973c91990f3a..874ea42396e9 100644 --- a/packages/core/src/database/schema.gen.ts +++ b/packages/core/src/database/schema.gen.ts @@ -282,6 +282,9 @@ export default { yield* tx.run(`CREATE INDEX \`session_project_idx\` ON \`session\` (\`project_id\`);`) yield* tx.run(`CREATE INDEX \`session_workspace_idx\` ON \`session\` (\`workspace_id\`);`) yield* tx.run(`CREATE INDEX \`session_parent_idx\` ON \`session\` (\`parent_id\`);`) + yield* tx.run( + `CREATE INDEX \`session_directory_time_created_id_idx\` ON \`session\` (\`directory\`,\`time_created\`,\`id\`);`, + ) yield* tx.run(`CREATE INDEX \`todo_session_idx\` ON \`todo\` (\`session_id\`);`) }) }, From cc408cd1009a010aa5d1fdd1059477793db9a5cf Mon Sep 17 00:00:00 2001 From: Ronaldo Davi Date: Mon, 14 Sep 2026 23:35:13 -0300 Subject: [PATCH 4/4] fix(core): update schema.json snapshot with session directory index Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_015KrFrdVEmx7apnofWUViJw --- packages/core/schema.json | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/packages/core/schema.json b/packages/core/schema.json index 3105a5bb5910..19f3d48a0f30 100644 --- a/packages/core/schema.json +++ b/packages/core/schema.json @@ -1,9 +1,9 @@ { "version": "7", "dialect": "sqlite", - "id": "7d1f95cf-b536-437e-9f8a-8594750305e7", + "id": "c184339e-6ab6-4608-a9d2-eb36759ce9cb", "prevIds": [ - "f14a9b18-8207-487e-a3d3-227e629ba9ad" + "7d1f95cf-b536-437e-9f8a-8594750305e7" ], "ddl": [ { @@ -2260,6 +2260,28 @@ "entityType": "indexes", "table": "session" }, + { + "columns": [ + { + "value": "directory", + "isExpression": false + }, + { + "value": "time_created", + "isExpression": false + }, + { + "value": "id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "session_directory_time_created_id_idx", + "entityType": "indexes", + "table": "session" + }, { "columns": [ { @@ -2276,4 +2298,4 @@ } ], "renames": [] -} \ No newline at end of file +}