diff --git a/apps/server/src/orchestration/commandInvariants.test.ts b/apps/server/src/orchestration/commandInvariants.test.ts index 9aaeba943423fc70274178f2f46b622882751f1c..93777c67d3e17bfd2bb504f9ae914b33dcdbf18e 100644 --- a/apps/server/src/orchestration/commandInvariants.test.ts +++ b/apps/server/src/orchestration/commandInvariants.test.ts @@ -11,12 +11,7 @@ import { } from "@t3tools/contracts"; import * as Effect from "effect/Effect"; -import { - findThreadById, - listThreadsByProjectId, - requireThread, - requireThreadAbsent, -} from "./commandInvariants.ts"; +import { listThreadsByProjectId, requireThread, requireThreadAbsent } from "./commandInvariants.ts"; const now = "2026-01-01T00:00:00.000Z"; @@ -121,9 +116,7 @@ const messageSendCommand: OrchestrationCommand = { }; describe("commandInvariants", () => { - it("finds threads by id and project", () => { - expect(findThreadById(readModel, ThreadId.make("thread-1"))?.projectId).toBe("project-a"); - expect(findThreadById(readModel, ThreadId.make("missing"))).toBeUndefined(); + it("lists threads by project", () => { expect( listThreadsByProjectId(readModel, ProjectId.make("project-b")).map((thread) => thread.id), ).toEqual([ThreadId.make("thread-2")]); diff --git a/apps/server/src/orchestration/commandInvariants.ts b/apps/server/src/orchestration/commandInvariants.ts index beaad93d5eefa0cb9f4025f2f4b72490af2f7777..110a499d37c92b63b6fe8adc0bcdebd8aafad8e5 100644 --- a/apps/server/src/orchestration/commandInvariants.ts +++ b/apps/server/src/orchestration/commandInvariants.ts @@ -18,7 +18,7 @@ function invariantError(commandType: string, detail: string): OrchestrationComma }); } -export function findThreadById( +function findThreadById( readModel: OrchestrationReadModel, threadId: ThreadId, ): OrchestrationThread | undefined {