The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 10:15 UTC
test(server): cover thread lookup through command invariants (#9978)
Julius Marminge committed
Sep 5, 2026 at 00:12 UTC
b3f8dd979af2bb089f94e6f1006ebbb2cf748db4
2 files changed
+3
-10
apps/server/src/orchestration/commandInvariants.test.ts
+2
-9
@@ -11,12 +11,7 @@ import {
11
} from "@t3tools/contracts";
12
import * as Effect from "effect/Effect";
13
14
-import {
15
- findThreadById,
16
- listThreadsByProjectId,
17
- requireThread,
18
- requireThreadAbsent,
19
-} from "./commandInvariants.ts";
14
+import { listThreadsByProjectId, requireThread, requireThreadAbsent } from "./commandInvariants.ts";
15
16
const now = "2026-01-01T00:00:00.000Z";
17
@@ -121,9 +116,7 @@ const messageSendCommand: OrchestrationCommand = {
116
};
117
118
describe("commandInvariants", () => {
124
- it("finds threads by id and project", () => {
125
- expect(findThreadById(readModel, ThreadId.make("thread-1"))?.projectId).toBe("project-a");
126
- expect(findThreadById(readModel, ThreadId.make("missing"))).toBeUndefined();
119
+ it("lists threads by project", () => {
120
expect(
121
listThreadsByProjectId(readModel, ProjectId.make("project-b")).map((thread) => thread.id),
122
).toEqual([ThreadId.make("thread-2")]);
apps/server/src/orchestration/commandInvariants.ts
+1
-1
@@ -18,7 +18,7 @@ function invariantError(commandType: string, detail: string): OrchestrationComma
18
});
19
}
20
21
-export function findThreadById(
21
+function findThreadById(
22
readModel: OrchestrationReadModel,
23
threadId: ThreadId,
24
): OrchestrationThread | undefined {