Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

handlers.test.ts

654 lines23.1 KB

1import {
2 EnvironmentId,
3 ProjectId,
4 ProviderInstanceId,
5 ThreadId,
6 type OrchestrationV2ServerCommand as OrchestrationCommand,
7 PullRequestOperationError,
8 type OrchestrationProjectShell,
9 type PullRequestRef,
10 type PullRequestReviewGuideResult,
11 type ThreadPullRequestLink,
12 SourceControlProviderKind,
13} from "@t3tools/contracts";
14import { describe, expect, it } from "@effect/vitest";
15import * as Crypto from "effect/Crypto";
16import * as Effect from "effect/Effect";
17import * as Layer from "effect/Layer";
18import * as Option from "effect/Option";
19import * as Ref from "effect/Ref";
20import * as Stream from "effect/Stream";
21import type { Tool } from "effect/ai";
22​
23import * as Orchestrator from "../../../orchestration-v2/Orchestrator.ts";
24import {
25 type PullRequestTestThread,
26 v2PullRequestThread,
27} from "../../../orchestration-v2/testkit/pullRequestFixtures.ts";
28import * as ProjectService from "../../../project/ProjectService.ts";
29import * as PullRequestReviewGuideService from "../../../pullRequest/PullRequestReviewGuideService.ts";
30import * as McpInvocationContext from "../../McpInvocationContext.ts";
31import * as McpToolAccess from "../../McpToolAccess.ts";
32import * as McpToolAccessTestkit from "../../McpToolAccess.testkit.ts";
33import { listThreadPullRequests } from "./handlers.ts";
34import * as PullRequestsHandlers from "./handlers.ts";
35import { PullRequestsToolkit } from "./tools.ts";
36​
37const PROJECT_ID = ProjectId.make("project-1");
38const THREAD_ID = ThreadId.make("thread-1");
39​
40const testCrypto = Crypto.make({
41 randomBytes: (size) => new Uint8Array(size).fill(7),
42 digest: (_algorithm, data) => Effect.succeed(data),
43});
44​
45const invocation = (
46 capabilities: ReadonlyArray<McpInvocationContext.McpCapability>,
47): McpInvocationContext.McpInvocationScope => ({
48 environmentId: EnvironmentId.make("environment-1"),
49 requestNamespace: "provider-session-1",
50 thread: {
51 threadId: THREAD_ID,
52 providerSessionId: "provider-session-1",
53 providerInstanceId: ProviderInstanceId.make("codex"),
54 },
55 client: undefined,
56 capabilities: new Set(capabilities),
57 issuedAt: 1,
58});
59​
60function makeProject(
61 repositoryIdentity: OrchestrationProjectShell["repositoryIdentity"] = {
62 canonicalKey: "github.com/t3tools/t3code",
63 locator: {
64 source: "git-remote",
65 remoteName: "origin",
66 remoteUrl: "git@github.com:T3Tools/T3Code.git",
67 },
68 provider: SourceControlProviderKind.make("github"),
69 displayName: "T3Tools/T3Code",
70 owner: "T3Tools",
71 name: "T3Code",
72 },
73): OrchestrationProjectShell {
74 return {
75 id: PROJECT_ID,
76 title: "Project",
77 workspaceRoot: "/workspace/project",
78 defaultModelSelection: null,
79 scripts: [],
80 repositoryIdentity,
81 createdAt: "2026-08-01T00:00:00.000Z",
82 updatedAt: "2026-08-01T00:00:00.000Z",
83 };
85​
86function makeThread(pullRequests: ReadonlyArray<ThreadPullRequestLink>): PullRequestTestThread {
87 return {
88 id: THREAD_ID,
89 projectId: PROJECT_ID,
90 title: "Thread",
91 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5" },
92 runtimeMode: "full-access",
93 interactionMode: "default",
94 branch: null,
95 worktreePath: null,
96 pullRequests,
97 createdAt: "2026-08-01T00:00:00.000Z",
98 updatedAt: "2026-08-20T00:00:00.000Z",
99 archivedAt: null,
100 settledOverride: null,
101 settledAt: null,
102 latestUserMessageAt: "2026-08-20T00:00:00.000Z",
103 };
105​
106function makeLink(
107 number: number,
108 overrides: Partial<ThreadPullRequestLink> & {
109 readonly headBranch?: string;
110 readonly baseBranch?: string;
111 } = {},
112): ThreadPullRequestLink {
113 const { headBranch, baseBranch, ...rest } = overrides;
114 return {
115 host: "github.com",
116 repository: "t3tools/t3code",
117 number,
118 url: `https://github.com/t3tools/t3code/pull/${number}`,
119 source: "manual",
120 linkedAt: "2026-08-10T00:00:00.000Z",
121 snapshot:
122 headBranch === undefined
123 ? null
124 : {
125 state: "open",
126 title: `PR ${number}`,
127 headBranch,
128 baseBranch: baseBranch ?? "main",
129 isDraft: false,
130 updatedAt: null,
131 syncedAt: "2026-08-27T00:00:00.000Z",
132 },
133 stack: null,
134 ...rest,
135 };
137​
138interface HarnessOptions {
139 readonly thread?: PullRequestTestThread | null;
140 readonly project?: OrchestrationProjectShell | null;
141 readonly reject?: (command: OrchestrationCommand) => string | null;
142 readonly projects?: ReadonlyArray<OrchestrationProjectShell>;
143 readonly generate?: (
144 input: PullRequestRef,
145 ) => Effect.Effect<
146 PullRequestReviewGuideResult & { started: boolean },
147 PullRequestOperationError
148 >;
150​
151const NO_GUIDE: PullRequestReviewGuideResult = { guide: null, run: null, currentHeadSha: "head-1" };
152​
153const makeHarness = Effect.fn("makePullRequestsToolkitHarness")(function* (
154 options: HarnessOptions = {},
155) {
156 const commands = yield* Ref.make<ReadonlyArray<OrchestrationCommand>>([]);
157 const guideRequests = yield* Ref.make<ReadonlyArray<PullRequestRef>>([]);
158 const thread = options.thread === undefined ? makeThread([]) : options.thread;
159 const project = options.project === undefined ? makeProject() : options.project;
160 const dispatch: Orchestrator.OrchestratorV2Shape["dispatch"] = (command) =>
161 Effect.gen(function* () {
162 const rejection = options.reject?.(command) ?? null;
163 if (rejection !== null)
164 return yield* new Orchestrator.OrchestratorDispatchError({
165 commandId: command.commandId,
166 commandType: command.type,
167 cause: rejection,
168 });
169 yield* Ref.update(commands, (recorded) => [...recorded, command]);
170 return { sequence: 1, storedEvents: [] };
171 });
172 const layerDependencies = Layer.mergeAll(
173 Layer.mock(ProjectService.ProjectService)({
174 getShell: () => Effect.succeed(Option.fromNullishOr(project)),
175 listShells: () => Effect.succeed(options.projects ?? (project ? [project] : [])),
176 }),
177 Layer.mock(PullRequestReviewGuideService.PullRequestReviewGuideService)({
178 get: () => Effect.succeed(NO_GUIDE),
179 generate: (input) =>
180 Ref.update(guideRequests, (recorded) => [...recorded, input]).pipe(
181 Effect.andThen(
182 options.generate?.(input) ??
183 Effect.succeed({
184 ...NO_GUIDE,
185 run: {
186 _tag: "Running" as const,
187 headSha: "head-1",
188 startedAt: "2026-10-11T00:00:00.000Z",
189 },
190 started: true,
191 }),
192 ),
193 ),
194 }),
195 Layer.mock(Orchestrator.OrchestratorV2)({
196 getThreadShell: (id) =>
197 Effect.succeed(id === THREAD_ID && thread ? v2PullRequestThread(thread) : null),
198 dispatch,
199 }),
200 Layer.succeed(Crypto.Crypto, testCrypto),
201 McpToolAccessTestkit.liveThreadsLayer,
202 );
203 const toolkit = yield* PullRequestsToolkit.pipe(
204 Effect.provide(
205 McpToolAccess.HandlersLayer.layer(PullRequestsHandlers.layer).pipe(
206 Layer.provide(layerDependencies),
207 ),
208 ),
209 );
210 const call = <Name extends keyof typeof PullRequestsToolkit.tools>(
211 name: Name,
212 params: Parameters<typeof toolkit.handle<Name>>[1],
213 capabilities: ReadonlyArray<McpInvocationContext.McpCapability> = ["pull-requests"],
214 ) =>
215 toolkit.handle(name, params).pipe(
216 Stream.unwrap,
217 Stream.runCollect,
218 Effect.map(
219 (chunk) => chunk.at(-1)!.result as Tool.Success<(typeof PullRequestsToolkit.tools)[Name]>,
220 ),
221 Effect.provideService(McpInvocationContext.McpInvocationContext, invocation(capabilities)),
222 Effect.provide(layerDependencies),
223 );
224 return { commands, guideRequests, call };
225});
226​
227describe("pull request toolkit handlers", () => {
228 it.effect("refuses a credential without the pull-requests capability", () =>
229 Effect.gen(function* () {
230 const harness = yield* makeHarness();
231 const error = yield* harness
232 .call("list_thread_pull_requests", {}, ["preview"])
233 .pipe(Effect.flip);
234 expect(error).toMatchObject({
235 _tag: "McpCapabilityUnavailableError",
236 capability: "pull-requests",
237 threadId: THREAD_ID,
238 });
239 expect(yield* Ref.get(harness.commands)).toEqual([]);
240 }),
241 );
242​
243 it.effect("links by URL with source agent on the token's thread", () =>
244 Effect.gen(function* () {
245 const harness = yield* makeHarness();
246 const result = yield* harness.call("link_pull_request", {
247 url: "https://github.com/T3Tools/T3Code/pull/123/files",
248 });
249 expect(result).toEqual({
250 host: "github.com",
251 repository: "t3tools/t3code",
252 number: 123,
253 url: "https://github.com/T3Tools/T3Code/pull/123/files",
254 alreadyLinked: false,
255 });
256 expect(yield* Ref.get(harness.commands)).toMatchObject([
257 {
258 type: "thread.pull-request.link",
259 threadId: THREAD_ID,
260 host: "github.com",
261 repository: "t3tools/t3code",
262 number: 123,
263 source: "agent",
264 },
265 ]);
266 }),
267 );
268​
269 it.effect("watching an unlinked pull request links it first", () =>
270 Effect.gen(function* () {
271 const harness = yield* makeHarness();
272 const result = yield* harness.call("watch_pull_request", {
273 url: "https://github.com/t3tools/t3code/pull/9",
274 });
275 expect(result).toMatchObject({ number: 9, watching: false, wasWatching: false });
276 expect(yield* Ref.get(harness.commands)).toMatchObject([
277 {
278 type: "thread.pull-request.watch",
279 number: 9,
280 watching: true,
281 link: { url: "https://github.com/t3tools/t3code/pull/9", source: "agent" },
282 },
283 ]);
284 }),
285 );
286​
287 it.effect("refuses to watch a merged pull request and stops an existing watch", () =>
288 Effect.gen(function* () {
289 const watch = {
290 startedAt: "2026-08-20T00:00:00.000Z",
291 headSha: null,
292 failedChecks: [],
293 passed: false,
294 passedChecks: [],
295 remarksThrough: "2026-08-20T00:00:00.000Z",
296 remarkIds: [],
297 conflicting: false,
298 wakes: 0,
299 };
300 const merged = makeLink(1, { headBranch: "done" });
301 const harness = yield* makeHarness({
302 thread: makeThread([
303 { ...merged, snapshot: merged.snapshot && { ...merged.snapshot, state: "merged" } },
304 makeLink(2, { headBranch: "idle" }),
305 makeLink(3, { headBranch: "watched", watch }),
306 ]),
307 });
308 const error = yield* harness
309 .call("watch_pull_request", { repository: "t3tools/t3code", number: 1 })
310 .pipe(Effect.flip);
311 expect(error).toMatchObject({ _tag: "PullRequestNotOpenError", state: "merged" });
312 expect(
313 yield* harness.call("unwatch_pull_request", { repository: "t3tools/t3code", number: 3 }),
314 ).toMatchObject({ wasWatching: true });
315 expect(yield* Ref.get(harness.commands)).toMatchObject([
316 { type: "thread.pull-request.watch", number: 3, watching: false },
317 ]);
318 }),
319 );
320​
321 it.effect("watches a pull request saved as closed, since it may have reopened", () =>
322 Effect.gen(function* () {
323 const closed = makeLink(1, { headBranch: "closed" });
324 const harness = yield* makeHarness({
325 thread: makeThread([
326 { ...closed, snapshot: closed.snapshot && { ...closed.snapshot, state: "closed" } },
327 ]),
328 });
329 yield* harness.call("watch_pull_request", { repository: "t3tools/t3code", number: 1 });
330 expect(yield* Ref.get(harness.commands)).toMatchObject([
331 { type: "thread.pull-request.watch", number: 1, watching: true },
332 ]);
333 }),
334 );
335​
336 it.effect("refuses a watch from a subagent thread, whose parent owns the pull request", () =>
337 Effect.gen(function* () {
338 const harness = yield* makeHarness({
339 thread: {
340 ...makeThread([makeLink(1, { headBranch: "feature" })]),
341 lineage: {
342 rootThreadId: ThreadId.make("parent"),
343 parentThreadId: ThreadId.make("parent"),
344 relationshipToParent: "subagent",
345 },
346 },
347 });
348 const error = yield* harness
349 .call("watch_pull_request", { repository: "t3tools/t3code", number: 1 })
350 .pipe(Effect.flip);
351 expect(error).toMatchObject({ _tag: "PullRequestWatchFromSubagentError" });
352 expect(yield* Ref.get(harness.commands)).toEqual([]);
353 }),
354 );
355​
356 it.effect("builds the URL in the project host's own shape", () =>
357 Effect.gen(function* () {
358 const harness = yield* makeHarness({
359 project: makeProject({
360 canonicalKey: "gitlab.com/group/sub/project",
361 locator: {
362 source: "git-remote",
363 remoteName: "origin",
364 remoteUrl: "git@gitlab.com:group/sub/project.git",
365 },
366 provider: SourceControlProviderKind.make("gitlab"),
367 displayName: "group/sub/project",
368 }),
369 });
370 const result = yield* harness.call("link_pull_request", {
371 repository: "group/sub/project",
372 number: 42,
373 });
374 expect(result.url).toBe("https://gitlab.com/group/sub/project/-/merge_requests/42");
375 expect(result.host).toBe("gitlab.com");
376 const other = yield* harness.call("link_pull_request", {
377 host: "gitlab.example.test",
378 repository: "team/repo",
379 number: 7,
380 });
381 expect(other.url).toBe("https://gitlab.example.test/team/repo/-/merge_requests/7");
382 const onGitHub = yield* harness.call("link_pull_request", {
383 host: "github.com",
384 repository: "acme/web",
385 number: 9,
386 });
387 expect(onGitHub.url).toBe("https://github.com/acme/web/pull/9");
388 }),
389 );
390​
391 it.effect("links a URL but not a bare number when the project's host is unknown", () =>
392 Effect.gen(function* () {
393 const harness = yield* makeHarness({
394 project: makeProject({
395 canonicalKey: "scm.example.test/tfs/collection/project/_git/repo",
396 locator: {
397 source: "git-remote",
398 remoteName: "origin",
399 remoteUrl: "http://dummy:secret@scm.example.test:8080/tfs/Collection/Project/_git/Repo",
400 },
401 provider: SourceControlProviderKind.make("unknown"),
402 displayName: "tfs/collection/project/_git/repo",
403 }),
404 });
405 const error = yield* harness
406 .call("link_pull_request", { repository: "tfs/Collection/Project/_git/Repo", number: 124 })
407 .pipe(Effect.flip);
408 expect(error).toMatchObject({ _tag: "PullRequestUrlUnavailableError" });
409​
410 const supplied = "https://scm.example.test/tfs/Collection/Project/_git/Repo/pullrequest/123";
411 const fromUrl = yield* harness.call("link_pull_request", { url: supplied });
412 expect(fromUrl).toEqual({
413 host: "scm.example.test",
414 repository: "tfs/collection/project/_git/repo",
415 number: 123,
416 url: supplied,
417 alreadyLinked: false,
418 });
419 expect(yield* Ref.get(harness.commands)).toMatchObject([
420 { type: "thread.pull-request.link", number: 123, url: supplied },
421 ]);
422 }),
423 );
424​
425 it.effect("treats a duplicate link as alreadyLinked rather than an error", () =>
426 Effect.gen(function* () {
427 const harness = yield* makeHarness({
428 thread: makeThread([makeLink(123)]),
429 reject: (command) =>
430 command.type === "thread.pull-request.link" ? "already linked" : null,
431 });
432 const result = yield* harness.call("link_pull_request", {
433 url: "https://github.com/t3tools/t3code/pull/123",
434 });
435 expect(result.alreadyLinked).toBe(true);
436 }),
437 );
438​
439 it.effect("unlinks a linked pull request and reports a missing one as wasLinked=false", () =>
440 Effect.gen(function* () {
441 const harness = yield* makeHarness({
442 thread: makeThread([makeLink(5)]),
443 reject: (command) =>
444 command.type === "thread.pull-request.unlink" && command.number !== 5
445 ? "not linked"
446 : null,
447 });
448 const linked = yield* harness.call("unlink_pull_request", {
449 repository: "t3tools/t3code",
450 number: 5,
451 });
452 expect(linked).toEqual({
453 host: "github.com",
454 repository: "t3tools/t3code",
455 number: 5,
456 wasLinked: true,
457 });
458 const missing = yield* harness.call("unlink_pull_request", {
459 url: "https://github.com/t3tools/t3code/pull/9",
460 });
461 expect(missing.wasLinked).toBe(false);
462 expect(yield* Ref.get(harness.commands)).toMatchObject([
463 { type: "thread.pull-request.unlink", number: 5 },
464 ]);
465 }),
466 );
467​
468 it("reports an older Forgejo link's HTTP port when listing thread links", () => {
469 const result = listThreadPullRequests(
470 makeThread([
471 makeLink(42, {
472 host: "forge.example",
473 url: "http://forge.example:3000/t3tools/t3code/pulls/42",
474 }),
475 ]),
476 );
477 expect(result.pullRequests[0]?.host).toBe("forge.example:3000");
478 });
479​
480 it.effect("lists visible links with host state and derived chain order", () =>
481 Effect.gen(function* () {
482 const harness = yield* makeHarness({
483 thread: makeThread([
484 makeLink(3, { headBranch: "feat-c", baseBranch: "feat-b", source: "agent" }),
485 makeLink(1, { headBranch: "feat-a", baseBranch: "main", source: "created" }),
486 makeLink(2, { headBranch: "feat-b", baseBranch: "feat-a", source: "agent" }),
487 makeLink(9, { source: "stack-dismissed" }),
488 makeLink(10),
489 ]),
490 });
491 const result = yield* harness.call("list_thread_pull_requests", {});
492 expect(result.pullRequests.map((entry) => entry.number)).toEqual([3, 1, 2, 10]);
493 expect(result.pullRequests[0]).toEqual({
494 host: "github.com",
495 repository: "t3tools/t3code",
496 number: 3,
497 url: "https://github.com/t3tools/t3code/pull/3",
498 source: "agent",
499 watching: false,
500 state: "open",
501 title: "PR 3",
502 headBranch: "feat-c",
503 baseBranch: "feat-b",
504 isDraft: false,
505 stack: { kind: "derived", position: 3, size: 3 },
506 });
507 expect(result.pullRequests[3]).toMatchObject({
508 number: 10,
509 state: null,
510 title: null,
511 headBranch: null,
512 stack: null,
513 });
514 expect(result.chains).toEqual([
515 { kind: "derived", numbers: [1, 2, 3] },
516 { kind: "derived", numbers: [10] },
517 ]);
518 }),
519 );
520});
521​
522describe("listThreadPullRequests", () => {
523 it("reports a native stack position for each member", () => {
524 const stack = {
525 kind: "native" as const,
526 id: "stack-1",
527 number: 1,
528 url: "https://github.com/t3tools/t3code/stack/1",
529 base: "main",
530 layers: [
531 { number: 1, headBranch: "a", state: "open" as const },
532 { number: 2, headBranch: "b", state: "open" as const },
533 ],
534 };
535 const result = listThreadPullRequests({
536 pullRequests: [
537 makeLink(2, { stack, source: "stack" }),
538 makeLink(1, { stack, source: "created" }),
539 ],
540 });
541 expect(result.pullRequests.map((entry) => [entry.number, entry.stack])).toEqual([
542 [2, { kind: "native", position: 2, size: 2 }],
543 [1, { kind: "native", position: 1, size: 2 }],
544 ]);
545 expect(result.chains).toEqual([{ kind: "native", numbers: [1, 2] }]);
546 });
547​
548 it("gives pull requests built on the same one the same position", () => {
549 const result = listThreadPullRequests({
550 pullRequests: [
551 makeLink(1, { headBranch: "feat-a", baseBranch: "main" }),
552 makeLink(2, { headBranch: "feat-b", baseBranch: "feat-a" }),
553 makeLink(3, { headBranch: "feat-c", baseBranch: "feat-a" }),
554 ],
555 });
556 expect(result.pullRequests.map((entry) => [entry.number, entry.stack])).toEqual([
557 [1, { kind: "derived", position: 1, size: 3 }],
558 [2, { kind: "derived", position: 2, size: 3 }],
559 [3, { kind: "derived", position: 2, size: 3 }],
560 ]);
561 expect(result.chains).toEqual([{ kind: "derived", numbers: [1, 2, 3] }]);
562 });
563});
564​
565describe("pull request guide tools", () => {
566 it.effect(
567 "writes guides through the project whose checkout is each pull request's repository",
568 () =>
569 Effect.gen(function* () {
570 const other = {
571 ...makeProject({
572 canonicalKey: "github.com/acme/web",
573 locator: {
574 source: "git-remote",
575 remoteName: "origin",
576 remoteUrl: "git@github.com:acme/web.git",
577 },
578 provider: SourceControlProviderKind.make("github"),
579 displayName: "acme/web",
580 owner: "acme",
581 name: "web",
582 }),
583 id: ProjectId.make("project-web"),
584 };
585 const harness = yield* makeHarness({ projects: [makeProject(), other] });
586 const result = yield* harness.call("write_pull_request_guides", {
587 pullRequests: [
588 { url: "https://github.com/acme/web/pull/7" },
589 { repository: "t3tools/t3code", number: 12 },
590 { url: "https://github.com/someone/else/pull/1" },
591 ],
592 });
593 expect(
594 result.guides.map((guide) => [guide.repository, guide.number, guide.outcome]),
595 ).toEqual([
596 ["acme/web", 7, "started"],
597 ["t3tools/t3code", 12, "started"],
598 ["someone/else", 1, "failed"],
599 ]);
600 expect(result.guides[2]?.detail).toContain("No project in this environment");
601 expect(
602 (yield* Ref.get(harness.guideRequests)).map((ref) => [ref.projectId, ref.number]),
603 ).toEqual([
604 ["project-web", 7],
605 [PROJECT_ID, 12],
606 ]);
607 }),
608 );
609​
610 it.effect("reports an unreadable entry on its own and still writes the rest of the batch", () =>
611 Effect.gen(function* () {
612 const harness = yield* makeHarness();
613 const result = yield* harness.call("write_pull_request_guides", {
614 pullRequests: [
615 { url: "https://example.com/not-a-pull-request" },
616 { repository: "t3tools/t3code" },
617 { repository: "t3tools/t3code", number: 5 },
618 ],
619 });
620 expect(result.guides.map((guide) => guide.outcome)).toEqual(["failed", "failed", "started"]);
621 expect(result.guides[0]?.detail).toContain("not a recognised pull request URL");
622 expect(result.guides[1]?.detail).toContain("Pass either url");
623 expect((yield* Ref.get(harness.guideRequests)).map((ref) => ref.number)).toEqual([5]);
624 }),
625 );
626​
627 it.effect("finds an Azure DevOps checkout for a pull request named by its full path", () =>
628 Effect.gen(function* () {
629 const azure = {
630 ...makeProject({
631 canonicalKey: "dev.azure.com/org/project/_git/web",
632 locator: {
633 source: "git-remote",
634 remoteName: "origin",
635 remoteUrl: "https://dev.azure.com/org/project/_git/web",
636 },
637 provider: SourceControlProviderKind.make("azure-devops"),
638 displayName: "org/project/_git/web",
639 owner: "org",
640 name: "web",
641 }),
642 id: ProjectId.make("project-azure"),
643 };
644 const harness = yield* makeHarness({ projects: [makeProject(), azure] });
645 const result = yield* harness.call("write_pull_request_guides", {
646 pullRequests: [{ host: "dev.azure.com", repository: "org/project/_git/web", number: 9 }],
647 });
648 expect(result.guides.map((guide) => guide.outcome)).toEqual(["started"]);
649 expect((yield* Ref.get(harness.guideRequests)).map((ref) => ref.projectId)).toEqual([
650 "project-azure",
651 ]);
652 }),
653 );
654});