Skip to content

Commit fc47200

Browse files
author
PR Batch Tester
committed
test(server): use SQLite for pending card regression
1 parent 70924d2 commit fc47200

1 file changed

Lines changed: 20 additions & 27 deletions

File tree

‎apps/server/src/orchestration-v2/ProjectionStore.test.ts‎

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import {
2929
import * as DateTime from "effect/DateTime";
3030
import * as Effect from "effect/Effect";
3131
import * as Layer from "effect/Layer";
32-
import * as Option from "effect/Option";
3332
import * as Schema from "effect/Schema";
3433
import * as Tracer from "effect/Tracer";
3534
import * as SqlClient from "effect/sql/SqlClient";
@@ -1290,10 +1289,7 @@ it.effect.each([
12901289
);
12911290

12921291
// regression: #25806 pending request cards outlive the history window that drops their turn
1293-
it.effect.each([
1294-
["memory", ProjectionStore.layerMemory],
1295-
["SQL", layerTest],
1296-
] as const)("%s snapshot windows keep cards for requests still pending", ([storeKind, layer]) =>
1292+
it.effect("SQL snapshot windows keep cards for requests still pending", () =>
12971293
Effect.gen(function* () {
12981294
const store = yield* ProjectionStore.ProjectionStoreV2;
12991295
const now = yield* DateTime.now;
@@ -1473,27 +1469,24 @@ it.effect.each([
14731469
userTurnLimit: THREAD_HISTORY_PAGE_POLICY.maxUserTurns,
14741470
})
14751471
.pipe(Effect.withTracer(tracer));
1476-
const sqlClient = yield* Effect.serviceOption(SqlClient.SqlClient);
1477-
if (storeKind === "SQL") {
1478-
const sql = Option.getOrThrow(sqlClient);
1479-
const query = statements.find(
1480-
(statement) =>
1481-
statement.includes("FROM orchestration_v2_projection_runtime_requests AS request") &&
1482-
statement.includes("SELECT item.payload_json"),
1483-
);
1484-
assert.isDefined(query);
1485-
const plan = (yield* sql.unsafe<{ readonly detail: string }>(
1486-
`EXPLAIN QUERY PLAN ${query}`,
1487-
)).map((row) => row.detail);
1488-
assert.include(
1489-
plan[0],
1490-
"SEARCH request USING INDEX orchestration_v2_projection_runtime_requests_thread_status_idx",
1491-
);
1492-
assert.include(
1493-
plan[1],
1494-
"SEARCH item USING INDEX orchestration_v2_projection_turn_items_node_ordinal_idx",
1495-
);
1496-
}
1472+
const sql = yield* SqlClient.SqlClient;
1473+
const query = statements.find(
1474+
(statement) =>
1475+
statement.includes("FROM orchestration_v2_projection_runtime_requests AS request") &&
1476+
statement.includes("SELECT item.payload_json"),
1477+
);
1478+
assert.isDefined(query);
1479+
const plan = (yield* sql.unsafe<{ readonly detail: string }>(
1480+
`EXPLAIN QUERY PLAN ${query}`,
1481+
)).map((row) => row.detail);
1482+
assert.include(
1483+
plan[0],
1484+
"SEARCH request USING INDEX orchestration_v2_projection_runtime_requests_thread_status_idx",
1485+
);
1486+
assert.include(
1487+
plan[1],
1488+
"SEARCH item USING INDEX orchestration_v2_projection_turn_items_node_ordinal_idx",
1489+
);
14971490
const bounded = buildBoundedThreadProjection({
14981491
projection: snapshot.projection,
14991492
snapshotSequence: snapshot.snapshotSequence,
@@ -1512,7 +1505,7 @@ it.effect.each([
15121505
);
15131506
for (const id of pendingCardIds) assert.notInclude(visibleIds, id);
15141507
}
1515-
}).pipe(Effect.provide(layer)),
1508+
}).pipe(Effect.provide(layerTest)),
15161509
);
15171510

15181511
it.effect("lists only active subagent IDs without loading shell data", () =>

0 commit comments

Comments
 (0)