Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a thread with an event type from a newer build can still resync after a downgrade #15937

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 9 commits intomain fromrefs/pull/15937/headmerged by shivamhwp(GitHub profile, opens in a new tab) View on GitHub

Showing 5 changed files with 147 additions and 33 deletions (loading 3).

x
0 of 5 viewed, 5 left
95 additions and 0 deletionsapps/server/src/persistence/OrchestrationEventStore.test.tsModified
View file
@@ -393,6 +393,101 @@
}),
+​
+ it.effect.each([
+ ["agent", "thread"],
+ ["application", "thread"],
+ ["application", "project"],
+ ] as const)(
+ "%s replay skips unknown %s types but rejects malformed known payloads",
+ ([reader, aggregateKind]) =>
+ Effect.gen(function* () {
+ const store = yield* OrchestrationEventStore.OrchestrationEventStore;
+ const sql = yield* SqlClient.SqlClient;
+ const streamId = ThreadId.make(`skip-unknown:${reader}:${aggregateKind}`);
+ const now = "2026-01-05T00:00:00.000Z";
+ // Direct SQL models rows written by a newer build, which append cannot accept.
+ const insertRow = Effect.fnUntraced(function* (
+ version: number,
+ eventType: string,
+ payload: string,
+ ) {
+ const [row] = yield* sql<{ sequence: number }>`
+ INSERT INTO orchestration_events (
+ event_id, aggregate_kind, stream_id, stream_version, event_type,
+ occurred_at, actor_kind, payload_json, metadata_json, application_event_version
+ ) VALUES (
+ ${`${streamId}:${version}`}, ${aggregateKind}, ${streamId}, ${version}, ${eventType},
+ ${now}, 'server', ${payload}, '{}', 2