Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): prune checkpoint refs owned by deleted threads #24140

MergedZheruel(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/24140/headmerged by juliusmarminge View on GitHub

Showing 4 changed files with 141 additions and 0 deletions (loading 2).

x
0 of 4 viewed, 4 left
109 additions and 0 deletionsapps/server/src/orchestration-v2/EventSink.test.tsAdded
View file
@@ -0,0 +1,109 @@
+import { assert, it } from "@effect/vitest";
+import {
+ CommandId,
+ EventId,
+ ProjectId,
+ ProviderInstanceId,
+ RunId,
+ ThreadId,
+ type OrchestrationV2AppThread,
+} from "@t3tools/contracts";
+import * as DateTime from "effect/DateTime";
+import * as Effect from "effect/Effect";
+import * as Layer from "effect/Layer";
+​
+import * as Sqlite from "../persistence/Sqlite.ts";
+import * as EventSink from "./EventSink.ts";
+import * as EventStore from "./EventStore.ts";
+import * as ProjectionStore from "./ProjectionStore.ts";
+​
+const layer = EventSink.layer.pipe(
+ Layer.provideMerge(Layer.merge(EventStore.layer, ProjectionStore.layer)),
+ Layer.provide(Sqlite.layerMemory),
+);
+​
+it.effect("rejects a planned fork whose source was deleted before it committed", () =>
+ Effect.gen(function* () {
+ const sink = yield* EventSink.EventSinkV2;
+ const projections = yield* ProjectionStore.ProjectionStoreV2;
+ const now = yield* DateTime.now;
+ const sourceId = ThreadId.make("fork-source");