Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(scripts): server metrics measure a busy server on a copy of real data #41280

Mergedjuliusmarmingemerged 7 commits intoperf/server-metrics-loop-delay fromrefs/pull/41280/headmerged by juliusmarminge View on GitHub

Showing 5 changed files with 79 additions and 1 deletion (loading 4).

x
0 of 5 viewed, 5 left
79 additions and 1 deletionapps/server/scripts/migrate-dev-db.test.tsModified
View file
@@ -7,7 +7,7 @@
​
import { runMigrations } from "../src/persistence/Migrations.ts";
import * as NodeSqliteClient from "@t3tools/shared/nodeSqliteClient";
-import { runMigrateDevDb } from "./migrate-dev-db.ts";
+import { dropResumableFamilies, runMigrateDevDb } from "./migrate-dev-db.ts";
​
const withDatabase = <A, E, R>(
databasePath: string,
@@ -102,6 +102,8 @@
["subagent-parent", "project-kept", "completed", "{}", "2026-08-05"],
["subagent-child", "project-kept", "completed", subagentPayload, "2026-08-05"],
["deleted-project-thread", "project-deleted", "completed", "{}", "2026-08-05"],
+ // Finished, but startup recovery would deliver its unread steer and start a turn.
+ ["steer-thread", "project-kept", "completed", "{}", "2026-08-09"],
] as const;
for (const [threadId, projectId, runStatus, payload, updatedAt] of threads) {
yield* sql`INSERT INTO orchestration_v2_projection_threads
@@ -114,6 +116,10 @@
(event_id, aggregate_kind, stream_id, stream_version, event_type, occurred_at, actor_kind, payload_json, metadata_json, application_event_version)
VALUES (${`event-${threadId}`}, 'thread', ${threadId}, 0, 'thread.created', '2026-08-01', 'user', '{}', '{}', 2)`;
+ yield* sql`INSERT INTO orchestration_v2_projection_turn_items
+ (turn_item_id, thread_id, run_id, ordinal, type, status, updated_at, payload_json)
+ VALUES ('steer-item', 'steer-thread', 'run-steer-thread', 2, 'user_message', 'pending',
+ '2026-08-09', '{"inputIntent":"steer"}')`;
// A V1 thread the server already imported must not trip the legacy guard.
yield* sql`INSERT INTO projection_threads