Public: anyone can read this; the crew can change it.

Full suite red: test/mcp-say-build.test.ts #12821

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/12802-full-suite-red-test-mcp-say-build-test-t → main 4 commits fork

  • Merged. scout/12802-full-suite-red-test-mcp-say-build-test-t was merged into main as 956cf9a.

Review

Sign in to review this change.
1 file changed +14 −2
test/mcp-say-build.test.ts +14 −2
@@ -11,7 +11,8 @@ import { setTemplateMark } from "../src/core/app_templates.ts";
1111 import { getRepo } from "../src/core/repos.ts";
1212 import { createToken } from "../src/core/tokens.ts";
1313 import { createUser, type User } from "../src/core/users.ts";
14 import { configureConversation } from "../src/crew/conversation.ts";
14 import { listTurns } from "../src/core/conversations.ts";
15 import { configureConversation, turnRunning } from "../src/crew/conversation.ts";
1516 import { serve, type Servers } from "../src/http/server.ts";
1617 import { quietLogs } from "./helpers/globals.ts";
1718
@@ -34,6 +35,17 @@ async function say(token: string, args: unknown): Promise<{ error?: string; valu
3435 return body.result.isError === true ? { error: text } : { value: JSON.parse(text) };
3536 }
3637
38 /** Until the stand-in run has written its answer and ended: state, not a guess at the time. */
39 async function builderDone(userId: string, conversation: string): Promise<void> {
40 const deadline = Date.now() + 15_000;
41 for (;;) {
42 const turns = listTurns(app.db, userId, conversation);
43 if (turns.ok && turns.value.some((t) => t.role === "agent") && !turnRunning(app, userId, conversation)) return;
44 if (Date.now() > deadline) throw new Error("the stand-in build run did not end in 15 s");
45 await new Promise<void>((next) => setImmediate(next));
46 }
47 }
48
3749 beforeAll(async () => {
3850 dir = await mkdtemp(join(tmpdir(), "forge-say-build-"));
3951 app = createApp({ dataDir: dir, port: 0, host: "forge.test" });
@@ -79,7 +91,7 @@ test("build, state, diff, restore, publish through say", async () => {
7991 const { conversation, repo, branch } = started.value;
8092 expect(repo).toBe("alice/tip-calculator");
8193 expect(branch).toBe(`talk-${conversation}`);
82 await Bun.sleep(300);
94 await builderDone(alice.id, conversation);
8395
8496 const empty = await say(tok["rw"]!, { action: "build_state", conversation });
8597 expect(empty.value.versions).toEqual([]);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs