@markjaquith/agency 3.2.14 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +20 -3
  2. package/cli-main.ts +1 -0
  3. package/package.json +7 -2
  4. package/src/cli-parser.ts +13 -0
  5. package/src/commands/work.ts +70 -2
  6. package/src/services/ReadinessService.ts +20 -0
  7. package/src/workbase/execution-contract.ts +10 -1
  8. package/src/workbase/schemas.ts +12 -0
  9. package/fixtures/protocol/orchestration-recipes.json +0 -53
  10. package/pi-extensions/agency.test.ts +0 -117
  11. package/src/check-commits.test.ts +0 -58
  12. package/src/cli-parser.test.ts +0 -945
  13. package/src/cli.test.ts +0 -1889
  14. package/src/commands/act.test.ts +0 -418
  15. package/src/commands/archive.test.ts +0 -236
  16. package/src/commands/context.test.ts +0 -711
  17. package/src/commands/description.test.ts +0 -103
  18. package/src/commands/doctor.test.ts +0 -185
  19. package/src/commands/epic.test.ts +0 -196
  20. package/src/commands/init.test.ts +0 -117
  21. package/src/commands/integration.test.ts +0 -165
  22. package/src/commands/pr.test.ts +0 -248
  23. package/src/commands/push.test.ts +0 -56
  24. package/src/commands/read-only.test.ts +0 -161
  25. package/src/commands/repo.test.ts +0 -199
  26. package/src/commands/restore.test.ts +0 -106
  27. package/src/commands/status.test.ts +0 -113
  28. package/src/commands/sync.test.ts +0 -200
  29. package/src/commands/task-phase.test.ts +0 -410
  30. package/src/commands/task.test.ts +0 -281
  31. package/src/commands/validate.test.ts +0 -186
  32. package/src/commands/work.test.ts +0 -1375
  33. package/src/commands/workbase.test.ts +0 -170
  34. package/src/graph-schema.test.ts +0 -124
  35. package/src/protocol.test.ts +0 -163
  36. package/src/readiness.test.ts +0 -105
  37. package/src/services/ArchiveBulkService.test.ts +0 -384
  38. package/src/services/ArchiveService.test.ts +0 -1092
  39. package/src/services/EpicService.test.ts +0 -74
  40. package/src/services/FileSystemService.test.ts +0 -81
  41. package/src/services/GraphMutationService.test.ts +0 -486
  42. package/src/services/GraphService.test.ts +0 -494
  43. package/src/services/IntegrationService.test.ts +0 -1091
  44. package/src/services/LifecycleTransaction.test.ts +0 -145
  45. package/src/services/PullRequestService.test.ts +0 -716
  46. package/src/services/PushService.test.ts +0 -408
  47. package/src/services/ReadinessService.test.ts +0 -290
  48. package/src/services/RepositoryService.test.ts +0 -789
  49. package/src/services/ReviewService.test.ts +0 -408
  50. package/src/services/SyncService.test.ts +0 -1377
  51. package/src/services/TaskPhaseService.test.ts +0 -852
  52. package/src/services/VersionControlService.test.ts +0 -62
  53. package/src/services/WorkbaseService.test.ts +0 -910
  54. package/src/services/WorktreeLock.test.ts +0 -205
  55. package/src/services/WorktreePerformance.test.ts +0 -71
  56. package/src/services/WorktreeService.test.ts +0 -2292
  57. package/src/test-utils.ts +0 -110
  58. package/src/usage-log.test.ts +0 -188
  59. package/src/utils/chooser.test.ts +0 -192
  60. package/src/utils/effect.test.ts +0 -30
  61. package/src/utils/interactive.pty.test.ts +0 -128
  62. package/src/utils/interactive.test.tsx +0 -860
  63. package/src/utils/process.test.ts +0 -132
  64. package/src/utils/progress.test.ts +0 -37
  65. package/src/work-view.test.ts +0 -151
  66. package/src/workbase/agent-command.test.ts +0 -128
  67. package/src/workbase/checkout-command.test.ts +0 -62
  68. package/src/workbase/delivery-command.test.ts +0 -180
  69. package/src/workbase/dependency-graph.test.ts +0 -50
  70. package/src/workbase/execution-contract.test.ts +0 -161
  71. package/src/workbase/frontmatter.test.ts +0 -67
  72. package/src/workbase/repository-reference.test.ts +0 -25
  73. package/src/workbase/schemas.test.ts +0 -543
  74. package/src/workbase/work-target.test.ts +0 -108
  75. package/src/workbase/worktree-command.test.ts +0 -61
@@ -1,1377 +0,0 @@
1
- import { afterEach, beforeEach, describe, expect, spyOn, test } from "bun:test"
2
- import { Effect } from "effect"
3
- import { chmod, mkdir, rm } from "node:fs/promises"
4
- import { join } from "node:path"
5
- import { cleanupTempDir, createTempDir, runTestEffect } from "../test-utils"
6
- import { PullRequestService } from "./PullRequestService"
7
- import { ReviewService } from "./ReviewService"
8
- import { SyncService } from "./SyncService"
9
- import { TaskService } from "./TaskService"
10
- import { WorktreeService } from "./WorktreeService"
11
- import { WorkbaseService } from "./WorkbaseService"
12
-
13
- const git = async (args: string[], cwd?: string) => {
14
- const process = Bun.spawn(["git", ...args], {
15
- cwd,
16
- stdout: "pipe",
17
- stderr: "pipe",
18
- })
19
- await process.exited
20
- if (process.exitCode !== 0) {
21
- throw new Error(await new Response(process.stderr).text())
22
- }
23
- }
24
-
25
- describe("SyncService", () => {
26
- let root: string
27
- let originalPath: string | undefined
28
-
29
- beforeEach(async () => {
30
- root = await createTempDir()
31
- await Bun.write(join(root, "agency.json"), '{"version":2}\n')
32
- const source = join(root, "source")
33
- await mkdir(source, { recursive: true })
34
- await git(["init", "--initial-branch=main"], source)
35
- await git(["config", "user.email", "test@example.com"], source)
36
- await git(["config", "user.name", "Test"], source)
37
- await Bun.write(join(source, "README.md"), "example\n")
38
- await git(["add", "README.md"], source)
39
- await git(["-c", "commit.gpgsign=false", "commit", "-m", "initial"], source)
40
- await mkdir(join(root, "repos"), { recursive: true })
41
- await git(["clone", "--bare", source, join(root, "repos/agency")])
42
- await git(["clone", "--bare", source, join(root, "repos/reference")])
43
-
44
- const bin = join(root, "bin")
45
- await mkdir(bin)
46
- const gh = join(bin, "gh")
47
- await Bun.write(
48
- gh,
49
- `#!/bin/sh
50
- if [ -n "$GH_CAPTURE" ]; then printf '%s\n' "$@" "GIT_DIR=$GIT_DIR" > "$GH_CAPTURE"; fi
51
- case "$*" in
52
- *mergeable*) ;;
53
- *) echo "mergeable field was not requested" >&2; exit 2 ;;
54
- esac
55
- case "$*" in
56
- *baseRepository*) echo "unsupported baseRepository field was requested" >&2; exit 3 ;;
57
- esac
58
- if [ "$2" = "view" ]; then
59
- cat <<'JSON'
60
- {"number":42,"state":"MERGED","title":"Ship","isDraft":false,"headRefName":"feat/example","baseRefName":"main","headRepository":{"nameWithOwner":"example/agency"},"url":"https://github.com/example/agency/pull/42","mergedAt":"2100-01-01T00:00:00Z","mergeCommit":{"oid":"abc"},"mergeable":"MERGEABLE"}
61
- JSON
62
- exit 0
63
- fi
64
- cat <<'JSON'
65
- [{"number":42,"state":"MERGED","title":"Ship","isDraft":false,"headRefName":"feat/example","baseRefName":"main","headRepository":{"nameWithOwner":"example/agency"},"url":"https://github.com/example/agency/pull/42","mergedAt":"2100-01-01T00:00:00Z","mergeCommit":{"oid":"abc"},"mergeable":"MERGEABLE"}]
66
- JSON
67
- `,
68
- )
69
- await chmod(gh, 0o755)
70
- originalPath = process.env.PATH
71
- process.env.PATH = `${bin}:${originalPath}`
72
- })
73
-
74
- afterEach(async () => {
75
- if (originalPath === undefined) delete process.env.PATH
76
- else process.env.PATH = originalPath
77
- delete process.env.GH_CAPTURE
78
- await cleanupTempDir(root)
79
- })
80
-
81
- test("validates before applying repository setup", async () => {
82
- await rm(join(root, "repos/agency"), { recursive: true, force: true })
83
- await Bun.write(
84
- join(root, "agency.json"),
85
- JSON.stringify({
86
- version: 2,
87
- repositories: {
88
- agency: { remote: "https://example.com/agency.git" },
89
- },
90
- }),
91
- )
92
- await mkdir(join(root, "tasks/invalid"), { recursive: true })
93
- await Bun.write(
94
- join(root, "tasks/invalid/TASK.md"),
95
- `---
96
- ticketUrl: null
97
- repo: unknown
98
- branch: task/invalid
99
- base: main
100
- pr: null
101
- ---
102
- `,
103
- )
104
-
105
- await expect(
106
- runTestEffect(
107
- SyncService.pipe(
108
- Effect.flatMap((service) =>
109
- service.reconcile({ cwd: root, apply: true }),
110
- ),
111
- ),
112
- ),
113
- ).rejects.toThrow("Unknown repository alias 'unknown'")
114
- expect(await Bun.file(join(root, "repos/agency")).exists()).toBe(false)
115
- })
116
-
117
- test("observes drift without mutation and applies only safe transitions", async () => {
118
- await runTestEffect(
119
- TaskService.pipe(
120
- Effect.flatMap((service) =>
121
- service.create(
122
- {
123
- id: "example",
124
- ticketUrl: null,
125
- repo: "agency",
126
- repos: [{ repo: "reference", ref: "main" }],
127
- branch: "feat/example",
128
- base: "main",
129
- },
130
- root,
131
- ),
132
- ),
133
- ),
134
- )
135
- const workspace = await runTestEffect(
136
- WorktreeService.pipe(
137
- Effect.flatMap((service) =>
138
- service.materialize("example", undefined, root),
139
- ),
140
- ),
141
- )
142
- await git(
143
- ["remote", "set-url", "origin", "git@github.com:example/agency.git"],
144
- join(root, "repos/agency"),
145
- )
146
- await Bun.write(
147
- join(workspace.codePath, "reference", "LOCAL.md"),
148
- "dirty\n",
149
- )
150
-
151
- const taskPath = join(root, "tasks/example/TASK.md")
152
- const before = await Bun.file(taskPath).text()
153
- const observed = await runTestEffect(
154
- SyncService.pipe(
155
- Effect.flatMap((service) => service.reconcile({ cwd: root })),
156
- ),
157
- )
158
-
159
- expect(observed.mode).toBe("dry-run")
160
- expect(observed.warnings).toEqual([])
161
- expect(observed.changes.map((change) => change.kind)).toEqual([
162
- "record-pr",
163
- "mark-done",
164
- ])
165
- expect(await Bun.file(taskPath).text()).toBe(before)
166
-
167
- const applied = await runTestEffect(
168
- SyncService.pipe(
169
- Effect.flatMap((service) =>
170
- service.reconcile({ cwd: root, apply: true }),
171
- ),
172
- ),
173
- )
174
- expect(applied.changes.map((change) => change.kind)).toEqual([
175
- "record-pr",
176
- "mark-done",
177
- ])
178
- expect(applied.changes.every((change) => change.status === "applied")).toBe(
179
- true,
180
- )
181
- const task = await runTestEffect(
182
- TaskService.pipe(
183
- Effect.flatMap((service) => service.show("example", root)),
184
- ),
185
- )
186
- expect(task.data).toMatchObject({
187
- status: "done",
188
- pr: {
189
- provider: "github",
190
- repository: "example/agency",
191
- identifier: "42",
192
- url: "https://github.com/example/agency/pull/42",
193
- state: "merged",
194
- draft: false,
195
- merged: true,
196
- headRepository: "example/agency",
197
- headBranch: "feat/example",
198
- baseRepository: "example/agency",
199
- baseBranch: "main",
200
- mergeable: true,
201
- },
202
- })
203
- })
204
-
205
- test("records a conflicting open PR without changing lifecycle status", async () => {
206
- await runTestEffect(
207
- TaskService.pipe(
208
- Effect.flatMap((service) =>
209
- service.create(
210
- {
211
- id: "example",
212
- ticketUrl: null,
213
- repo: "agency",
214
- branch: "feat/example",
215
- base: "main",
216
- },
217
- root,
218
- ),
219
- ),
220
- ),
221
- )
222
- await runTestEffect(
223
- WorktreeService.pipe(
224
- Effect.flatMap((service) =>
225
- service.materialize("example", undefined, root),
226
- ),
227
- ),
228
- )
229
- await git(
230
- ["remote", "set-url", "origin", "git@github.com:example/agency.git"],
231
- join(root, "repos/agency"),
232
- )
233
- await runTestEffect(
234
- PullRequestService.pipe(
235
- Effect.flatMap((service) =>
236
- service.setUrl(
237
- "example",
238
- undefined,
239
- "https://github.com/example/agency/pull/42",
240
- root,
241
- ),
242
- ),
243
- ),
244
- )
245
- await Bun.write(
246
- join(root, "bin", "gh"),
247
- `#!/bin/sh
248
- cat <<'JSON'
249
- {"number":42,"state":"OPEN","title":"Ship","isDraft":false,"headRefName":"feat/example","baseRefName":"main","headRepository":{"nameWithOwner":"example/agency"},"baseRepository":{"nameWithOwner":"example/agency"},"url":"https://github.com/example/agency/pull/42","mergedAt":null,"mergeCommit":null,"mergeable":"CONFLICTING"}
250
- JSON
251
- `,
252
- )
253
- await chmod(join(root, "bin", "gh"), 0o755)
254
-
255
- const applied = await runTestEffect(
256
- SyncService.pipe(
257
- Effect.flatMap((service) =>
258
- service.reconcile({ cwd: root, apply: true }),
259
- ),
260
- ),
261
- )
262
- expect(applied.changes).toContainEqual(
263
- expect.objectContaining({ kind: "record-pr", target: "task:example" }),
264
- )
265
- expect(applied.changes.some((change) => change.kind === "mark-done")).toBe(
266
- false,
267
- )
268
- const task = await runTestEffect(
269
- TaskService.pipe(
270
- Effect.flatMap((service) => service.show("example", root)),
271
- ),
272
- )
273
- expect(task.data).toMatchObject({
274
- status: "open",
275
- pr: { state: "open", merged: false, mergeable: false },
276
- })
277
- })
278
-
279
- test("rejects a concurrent target change before recording a pull request", async () => {
280
- await runTestEffect(
281
- TaskService.pipe(
282
- Effect.flatMap((service) =>
283
- service.create(
284
- {
285
- id: "concurrent",
286
- ticketUrl: null,
287
- repo: "agency",
288
- branch: "feat/example",
289
- base: "main",
290
- },
291
- root,
292
- ),
293
- ),
294
- ),
295
- )
296
- await git(
297
- ["remote", "set-url", "origin", "git@github.com:example/agency.git"],
298
- join(root, "repos/agency"),
299
- )
300
- const taskPath = join(root, "tasks/concurrent/TASK.md")
301
- await Bun.write(
302
- join(root, "bin", "gh"),
303
- `#!/bin/sh
304
- printf '\nConcurrent edit.\n' >> ${JSON.stringify(taskPath)}
305
- cat <<'JSON'
306
- [{"number":42,"state":"MERGED","title":"Ship","isDraft":false,"headRefName":"feat/example","baseRefName":"main","headRepository":{"nameWithOwner":"example/agency"},"url":"https://github.com/example/agency/pull/42","mergedAt":"2100-01-01T00:00:00Z","mergeCommit":{"oid":"abc"},"mergeable":"MERGEABLE"}]
307
- JSON
308
- `,
309
- )
310
- await chmod(join(root, "bin", "gh"), 0o755)
311
-
312
- const failure = await runTestEffect(
313
- SyncService.pipe(
314
- Effect.flatMap((service) =>
315
- service.reconcile({ cwd: root, apply: true }),
316
- ),
317
- Effect.flip,
318
- ),
319
- )
320
- expect(failure).toMatchObject({
321
- _tag: "RevisionConflictError",
322
- message: expect.stringContaining("Revision conflict"),
323
- })
324
- const content = await Bun.file(taskPath).text()
325
- expect(content).toContain("Concurrent edit.")
326
- expect(content).not.toContain("provider: github")
327
-
328
- await Bun.write(join(root, ".agency-graph-mutation.lock"), "busy")
329
- const transactionFailure = await runTestEffect(
330
- SyncService.pipe(
331
- Effect.flatMap((service) =>
332
- service.reconcile({ cwd: root, apply: true }),
333
- ),
334
- Effect.flip,
335
- ),
336
- )
337
- expect(transactionFailure).toMatchObject({
338
- _tag: "SyncError",
339
- message: expect.stringContaining("graph mutation is in progress"),
340
- })
341
- })
342
-
343
- test("queries and records a configured delivery provider", async () => {
344
- await runTestEffect(
345
- TaskService.pipe(
346
- Effect.flatMap((service) =>
347
- service.create(
348
- {
349
- id: "custom",
350
- ticketUrl: null,
351
- repo: "agency",
352
- branch: "feat/custom",
353
- base: "main",
354
- },
355
- root,
356
- ),
357
- ),
358
- ),
359
- )
360
- await runTestEffect(
361
- WorktreeService.pipe(
362
- Effect.flatMap((service) =>
363
- service.materialize("custom", undefined, root),
364
- ),
365
- ),
366
- )
367
- await git(
368
- [
369
- "remote",
370
- "set-url",
371
- "origin",
372
- "https://forge.example/example/agency.git",
373
- ],
374
- join(root, "repos/agency"),
375
- )
376
- const callPath = join(root, "query-call.json")
377
- const record = {
378
- provider: "forge",
379
- repository: "example/agency",
380
- identifier: "17",
381
- url: "https://forge.example/example/agency/pulls/17",
382
- state: "open",
383
- draft: false,
384
- merged: false,
385
- } as const
386
- await Bun.write(
387
- join(root, "bin", "deliver"),
388
- `#!/usr/bin/env bun
389
- await Bun.write(${JSON.stringify(callPath)}, JSON.stringify({ args: Bun.argv.slice(2), base: process.env.DELIVERY_BASE }))
390
- process.stdout.write(${JSON.stringify(JSON.stringify(record))})
391
- `,
392
- )
393
- await chmod(join(root, "bin", "deliver"), 0o755)
394
- await Bun.write(
395
- join(root, "agency.json"),
396
- JSON.stringify({
397
- version: 2,
398
- delivery: {
399
- provider: "forge",
400
- createCommand: ["deliver", "create"],
401
- queryCommand: ["deliver", "query", "{repository}", "{branch}"],
402
- environment: { DELIVERY_BASE: "{base}" },
403
- },
404
- }),
405
- )
406
-
407
- const result = await runTestEffect(
408
- SyncService.pipe(
409
- Effect.flatMap((service) =>
410
- service.reconcile({ cwd: root, apply: true }),
411
- ),
412
- ),
413
- )
414
- expect(result.changes).toContainEqual(
415
- expect.objectContaining({ kind: "record-pr", target: "task:custom" }),
416
- )
417
- expect(await Bun.file(callPath).json()).toEqual({
418
- args: ["query", "example/agency", "feat/custom"],
419
- base: "main",
420
- })
421
- const task = await runTestEffect(
422
- TaskService.pipe(
423
- Effect.flatMap((service) => service.show("custom", root)),
424
- ),
425
- )
426
- expect("pr" in task.data && task.data.pr).toEqual(record)
427
- })
428
-
429
- test("marks working execution done after merge", async () => {
430
- await runTestEffect(
431
- TaskService.pipe(
432
- Effect.flatMap((service) =>
433
- service.create(
434
- {
435
- id: "working",
436
- ticketUrl: null,
437
- repo: "agency",
438
- branch: "feat/example",
439
- base: "main",
440
- },
441
- root,
442
- ),
443
- ),
444
- ),
445
- )
446
- await runTestEffect(
447
- WorktreeService.pipe(
448
- Effect.flatMap((service) =>
449
- service.materialize("working", undefined, root),
450
- ),
451
- ),
452
- )
453
- await git(
454
- ["remote", "set-url", "origin", "git@github.com:example/agency.git"],
455
- join(root, "repos/agency"),
456
- )
457
- await runTestEffect(
458
- TaskService.pipe(
459
- Effect.flatMap((service) =>
460
- service.setStatus("working", "working", root),
461
- ),
462
- ),
463
- )
464
-
465
- const synced = await runTestEffect(
466
- SyncService.pipe(
467
- Effect.flatMap((service) =>
468
- service.reconcile({ cwd: root, apply: true }),
469
- ),
470
- ),
471
- )
472
- expect(synced.changes.map((change) => change.kind)).toContain("mark-done")
473
- expect(
474
- await runTestEffect(
475
- TaskService.pipe(
476
- Effect.flatMap((service) => service.show("working", root)),
477
- ),
478
- ),
479
- ).toMatchObject({
480
- data: { status: "done" },
481
- })
482
- })
483
-
484
- test("materializes missing workspaces but leaves branch conflicts unresolved", async () => {
485
- await Bun.write(join(root, "bin", "gh"), "#!/bin/sh\nprintf '[]\\n'\n")
486
- await chmod(join(root, "bin", "gh"), 0o755)
487
- for (const [id, branch] of [
488
- ["missing", "feat/missing"],
489
- ["conflict", "feat/conflict"],
490
- ] as const) {
491
- await runTestEffect(
492
- TaskService.pipe(
493
- Effect.flatMap((service) =>
494
- service.create(
495
- { id, ticketUrl: null, repo: "agency", branch, base: "main" },
496
- root,
497
- ),
498
- ),
499
- ),
500
- )
501
- }
502
- const repository = join(root, "repos/agency")
503
- await git(["branch", "feat/conflict", "main"], repository)
504
- await git(
505
- ["worktree", "add", join(root, "external-conflict"), "feat/conflict"],
506
- repository,
507
- )
508
-
509
- const observed = await runTestEffect(
510
- SyncService.pipe(
511
- Effect.flatMap((service) => service.reconcile({ cwd: root })),
512
- ),
513
- )
514
- expect(observed.changes).toContainEqual(
515
- expect.objectContaining({
516
- kind: "materialize-workspace",
517
- target: "task:missing",
518
- status: "planned",
519
- }),
520
- )
521
- expect(observed.unresolved).toContainEqual(
522
- expect.objectContaining({
523
- kind: "branch-conflict",
524
- target: "task:conflict",
525
- }),
526
- )
527
- expect(
528
- await Bun.file(
529
- join(root, "tasks/missing/code/agency/README.md"),
530
- ).exists(),
531
- ).toBe(false)
532
-
533
- const applied = await runTestEffect(
534
- SyncService.pipe(
535
- Effect.flatMap((service) =>
536
- service.reconcile({ cwd: root, apply: true }),
537
- ),
538
- ),
539
- )
540
- expect(applied.changes).toContainEqual(
541
- expect.objectContaining({
542
- kind: "materialize-workspace",
543
- target: "task:missing",
544
- status: "applied",
545
- }),
546
- )
547
- expect(
548
- applied.executions.find((item) => item.target === "task:missing")
549
- ?.checkouts[0],
550
- ).toMatchObject({ exists: true, registered: true, dirty: false })
551
- expect(
552
- await Bun.file(join(root, "tasks/missing/code/agency/README.md")).text(),
553
- ).toBe("example\n")
554
- expect(
555
- await Bun.file(
556
- join(root, "tasks/conflict/code/agency/README.md"),
557
- ).exists(),
558
- ).toBe(false)
559
- })
560
-
561
- test("reconciles a recorded merged PR without materializing an absent checkout", async () => {
562
- await runTestEffect(
563
- TaskService.pipe(
564
- Effect.flatMap((service) =>
565
- service.create(
566
- {
567
- id: "recorded-merged",
568
- ticketUrl: null,
569
- repo: "agency",
570
- branch: "feat/example",
571
- base: "main",
572
- },
573
- root,
574
- ),
575
- ),
576
- ),
577
- )
578
- await git(
579
- ["remote", "set-url", "origin", "git@github.com:example/agency.git"],
580
- join(root, "repos/agency"),
581
- )
582
- await runTestEffect(
583
- PullRequestService.pipe(
584
- Effect.flatMap((service) =>
585
- service.setUrl(
586
- "recorded-merged",
587
- undefined,
588
- "https://github.com/example/agency/pull/42",
589
- root,
590
- ),
591
- ),
592
- ),
593
- )
594
-
595
- const applied = await runTestEffect(
596
- SyncService.pipe(
597
- Effect.flatMap((service) =>
598
- service.reconcile({
599
- cwd: root,
600
- apply: true,
601
- taskId: "recorded-merged",
602
- }),
603
- ),
604
- ),
605
- )
606
- expect(applied.changes.map((change) => change.kind)).toEqual([
607
- "record-pr",
608
- "mark-done",
609
- ])
610
- expect(applied.executions[0]?.checkouts).toEqual([])
611
- expect(
612
- await Bun.file(join(root, "tasks/recorded-merged/code/agency")).exists(),
613
- ).toBe(false)
614
- })
615
-
616
- test("reports malformed successful GitHub responses", async () => {
617
- await runTestEffect(
618
- TaskService.pipe(
619
- Effect.flatMap((service) =>
620
- service.create(
621
- {
622
- id: "malformed-detail",
623
- ticketUrl: null,
624
- repo: "agency",
625
- branch: "feat/example",
626
- base: "main",
627
- },
628
- root,
629
- ),
630
- ),
631
- ),
632
- )
633
- await runTestEffect(
634
- PullRequestService.pipe(
635
- Effect.flatMap((service) =>
636
- service.setUrl(
637
- "malformed-detail",
638
- undefined,
639
- "https://github.com/example/agency/pull/42",
640
- root,
641
- ),
642
- ),
643
- ),
644
- )
645
- await runTestEffect(
646
- TaskService.pipe(
647
- Effect.flatMap((service) =>
648
- service.create(
649
- {
650
- id: "malformed-list",
651
- ticketUrl: null,
652
- repo: "agency",
653
- branch: "feat/malformed-list",
654
- base: "main",
655
- },
656
- root,
657
- ),
658
- ),
659
- ),
660
- )
661
- await Bun.write(join(root, "bin", "gh"), "#!/bin/sh\nprintf '{}\\n'\n")
662
- await chmod(join(root, "bin", "gh"), 0o755)
663
-
664
- const result = await runTestEffect(
665
- SyncService.pipe(
666
- Effect.flatMap((service) =>
667
- service.reconcile({ cwd: root, taskId: "malformed-detail" }),
668
- ),
669
- ),
670
- )
671
- expect(result.warnings).toContainEqual({
672
- kind: "pr-provider-invalid-output",
673
- target: "task:malformed-detail",
674
- message: expect.stringContaining(
675
- "GitHub CLI did not return a valid pull request",
676
- ),
677
- })
678
- expect(result.executions[0]?.pr).toMatchObject({
679
- url: "https://github.com/example/agency/pull/42",
680
- state: "open",
681
- })
682
-
683
- const listResult = await runTestEffect(
684
- SyncService.pipe(
685
- Effect.flatMap((service) =>
686
- service.reconcile({ cwd: root, taskId: "malformed-list" }),
687
- ),
688
- ),
689
- )
690
- expect(listResult.warnings).toContainEqual({
691
- kind: "pr-provider-invalid-output",
692
- target: "task:malformed-list",
693
- message: expect.stringContaining(
694
- "GitHub CLI did not return a valid pull request list",
695
- ),
696
- })
697
- })
698
-
699
- test("reconciles a uniquely discovered merged PR without materializing", async () => {
700
- await runTestEffect(
701
- TaskService.pipe(
702
- Effect.flatMap((service) =>
703
- service.create(
704
- {
705
- id: "discovered-merged",
706
- ticketUrl: null,
707
- repo: "agency",
708
- branch: "feat/example",
709
- base: "main",
710
- },
711
- root,
712
- ),
713
- ),
714
- ),
715
- )
716
- await git(
717
- ["remote", "set-url", "origin", "git@github.com:example/agency.git"],
718
- join(root, "repos/agency"),
719
- )
720
-
721
- const applied = await runTestEffect(
722
- SyncService.pipe(
723
- Effect.flatMap((service) =>
724
- service.reconcile({
725
- cwd: root,
726
- apply: true,
727
- taskId: "discovered-merged",
728
- }),
729
- ),
730
- ),
731
- )
732
- expect(applied.changes.map((change) => change.kind)).toEqual([
733
- "record-pr",
734
- "mark-done",
735
- ])
736
- expect(applied.executions[0]?.checkouts).toEqual([])
737
- expect(
738
- await Bun.file(
739
- join(root, "tasks/discovered-merged/code/agency"),
740
- ).exists(),
741
- ).toBe(false)
742
- })
743
-
744
- test("materializes when discovered PR evidence is ambiguous", async () => {
745
- await runTestEffect(
746
- TaskService.pipe(
747
- Effect.flatMap((service) =>
748
- service.create(
749
- {
750
- id: "ambiguous",
751
- ticketUrl: null,
752
- repo: "agency",
753
- branch: "feat/example",
754
- base: "main",
755
- },
756
- root,
757
- ),
758
- ),
759
- ),
760
- )
761
- const gh = await Bun.file(join(root, "bin", "gh")).text()
762
- await Bun.write(
763
- join(root, "bin", "gh"),
764
- gh
765
- .replace('[{"number":42', '[{"number":42')
766
- .replace(
767
- "]\nJSON\n",
768
- `,{\"number\":43,\"state\":\"MERGED\",\"title\":\"Ship again\",\"isDraft\":false,\"headRefName\":\"feat/example\",\"baseRefName\":\"main\",\"headRepository\":{\"nameWithOwner\":\"example/agency\"},\"url\":\"https://github.com/example/agency/pull/43\",\"mergedAt\":\"2100-01-01T00:00:00Z\",\"mergeCommit\":{\"oid\":\"def\"},\"mergeable\":\"MERGEABLE\"}]\nJSON\n`,
769
- ),
770
- )
771
-
772
- const applied = await runTestEffect(
773
- SyncService.pipe(
774
- Effect.flatMap((service) =>
775
- service.reconcile({
776
- cwd: root,
777
- apply: true,
778
- taskId: "ambiguous",
779
- }),
780
- ),
781
- ),
782
- )
783
- expect(applied.unresolved).toContainEqual(
784
- expect.objectContaining({ kind: "multiple-prs" }),
785
- )
786
- expect(applied.changes).toContainEqual(
787
- expect.objectContaining({ kind: "materialize-workspace" }),
788
- )
789
- expect(
790
- await Bun.file(
791
- join(root, "tasks/ambiguous/code/agency/README.md"),
792
- ).text(),
793
- ).toBe("example\n")
794
- })
795
-
796
- test("leaves a missing checkout registration unresolved", async () => {
797
- await runTestEffect(
798
- TaskService.pipe(
799
- Effect.flatMap((service) =>
800
- service.create(
801
- {
802
- id: "stale",
803
- ticketUrl: null,
804
- repo: "agency",
805
- branch: "feat/stale",
806
- base: "main",
807
- },
808
- root,
809
- ),
810
- ),
811
- ),
812
- )
813
- const workspace = await runTestEffect(
814
- WorktreeService.pipe(
815
- Effect.flatMap((service) =>
816
- service.materialize("stale", undefined, root),
817
- ),
818
- ),
819
- )
820
- await rm(workspace.writablePath!, { recursive: true, force: true })
821
-
822
- const observed = await runTestEffect(
823
- SyncService.pipe(
824
- Effect.flatMap((service) => service.reconcile({ cwd: root })),
825
- ),
826
- )
827
- expect(observed.changes).toEqual([])
828
- expect(observed.unresolved).toContainEqual(
829
- expect.objectContaining({
830
- kind: "stale-registration",
831
- target: "task:stale",
832
- }),
833
- )
834
-
835
- const applied = await runTestEffect(
836
- SyncService.pipe(
837
- Effect.flatMap((service) =>
838
- service.reconcile({ cwd: root, apply: true }),
839
- ),
840
- ),
841
- )
842
- expect(applied.changes).toEqual([])
843
- expect(
844
- await Bun.file(join(workspace.writablePath!, "README.md")).exists(),
845
- ).toBe(false)
846
- })
847
-
848
- test("does not trust a recorded PR from another repository", async () => {
849
- await runTestEffect(
850
- TaskService.pipe(
851
- Effect.flatMap((service) =>
852
- service.create(
853
- {
854
- id: "example",
855
- ticketUrl: null,
856
- repo: "agency",
857
- branch: "feat/example",
858
- base: "main",
859
- },
860
- root,
861
- ),
862
- ),
863
- ),
864
- )
865
- await runTestEffect(
866
- PullRequestService.pipe(
867
- Effect.flatMap((service) =>
868
- service.setUrl(
869
- "example",
870
- undefined,
871
- "https://github.com/other/repository/pull/42",
872
- root,
873
- ),
874
- ),
875
- ),
876
- )
877
-
878
- const applied = await runTestEffect(
879
- SyncService.pipe(
880
- Effect.flatMap((service) =>
881
- service.reconcile({ cwd: root, apply: true }),
882
- ),
883
- ),
884
- )
885
- expect(applied.unresolved).toContainEqual(
886
- expect.objectContaining({
887
- kind: "pr-repository-conflict",
888
- target: "task:example",
889
- }),
890
- )
891
- expect(applied.changes.some((change) => change.kind === "mark-done")).toBe(
892
- false,
893
- )
894
- const task = await runTestEffect(
895
- TaskService.pipe(
896
- Effect.flatMap((service) => service.show("example", root)),
897
- ),
898
- )
899
- expect(task.data).toMatchObject({ status: "open" })
900
- })
901
-
902
- test("reconciles a merged upstream PR whose head is the writable fork", async () => {
903
- await runTestEffect(
904
- TaskService.pipe(
905
- Effect.flatMap((service) =>
906
- service.create(
907
- {
908
- id: "forked",
909
- ticketUrl: null,
910
- repo: "agency",
911
- branch: "task/polish-readme",
912
- base: "main",
913
- },
914
- root,
915
- ),
916
- ),
917
- ),
918
- )
919
- await runTestEffect(
920
- WorktreeService.pipe(
921
- Effect.flatMap((service) =>
922
- service.materialize("forked", undefined, root),
923
- ),
924
- ),
925
- )
926
- await git(
927
- ["remote", "set-url", "origin", "git@github.com:markjaquith/Pasted.git"],
928
- join(root, "repos/agency"),
929
- )
930
- await runTestEffect(
931
- PullRequestService.pipe(
932
- Effect.flatMap((service) =>
933
- service.setUrl(
934
- "forked",
935
- undefined,
936
- "https://github.com/getpasted/pasted/pull/17",
937
- root,
938
- ),
939
- ),
940
- ),
941
- )
942
- await Bun.write(
943
- join(root, "bin", "gh"),
944
- `#!/bin/sh
945
- cat <<'JSON'
946
- {"number":17,"state":"MERGED","title":"Polish README","isDraft":false,"headRefName":"task/polish-readme","baseRefName":"main","headRepository":{"nameWithOwner":"markjaquith/Pasted"},"baseRepository":{"nameWithOwner":"getpasted/pasted"},"url":"https://github.com/getpasted/pasted/pull/17","mergedAt":"2026-08-11T00:00:00Z","mergeCommit":{"oid":"241d45da1115ef685c91a5e6882d118c16801550"},"mergeable":"UNKNOWN"}
947
- JSON
948
- `,
949
- )
950
- await chmod(join(root, "bin", "gh"), 0o755)
951
-
952
- const applied = await runTestEffect(
953
- SyncService.pipe(
954
- Effect.flatMap((service) =>
955
- service.reconcile({ cwd: root, apply: true }),
956
- ),
957
- ),
958
- )
959
- expect(
960
- applied.unresolved.filter((notice) => notice.target === "task:forked"),
961
- ).toEqual([])
962
- expect(applied.changes.map((change) => change.kind)).toEqual([
963
- "record-pr",
964
- "mark-done",
965
- ])
966
- const task = await runTestEffect(
967
- TaskService.pipe(
968
- Effect.flatMap((service) => service.show("forked", root)),
969
- ),
970
- )
971
- expect(task.data).toMatchObject({
972
- status: "done",
973
- pr: {
974
- repository: "getpasted/pasted",
975
- headRepository: "markjaquith/Pasted",
976
- headBranch: "task/polish-readme",
977
- baseRepository: "getpasted/pasted",
978
- baseBranch: "main",
979
- state: "merged",
980
- merged: true,
981
- },
982
- })
983
- })
984
-
985
- test("leaves non-PR completion unchanged when a matching PR is discoverable", async () => {
986
- await runTestEffect(
987
- TaskService.pipe(
988
- Effect.flatMap((service) =>
989
- service.create(
990
- {
991
- id: "non-pr",
992
- ticketUrl: null,
993
- repo: "agency",
994
- branch: "feat/example",
995
- base: "main",
996
- },
997
- root,
998
- ),
999
- ),
1000
- ),
1001
- )
1002
- await runTestEffect(
1003
- TaskService.pipe(
1004
- Effect.flatMap((service) =>
1005
- service.setStatus("non-pr", "done", root, {
1006
- summary: "Investigation completed without changes.",
1007
- }),
1008
- ),
1009
- ),
1010
- )
1011
-
1012
- for (let attempt = 0; attempt < 2; attempt += 1) {
1013
- const applied = await runTestEffect(
1014
- SyncService.pipe(
1015
- Effect.flatMap((service) =>
1016
- service.reconcile({ cwd: root, apply: true }),
1017
- ),
1018
- ),
1019
- )
1020
- expect(
1021
- applied.changes.some(
1022
- (change) =>
1023
- change.kind === "record-pr" ||
1024
- change.kind === "mark-done" ||
1025
- change.kind === "materialize-workspace",
1026
- ),
1027
- ).toBe(false)
1028
- expect(applied.executions[0]?.checkouts).toEqual([])
1029
- }
1030
- expect(
1031
- await Bun.file(join(root, "tasks/non-pr/code/agency")).exists(),
1032
- ).toBe(false)
1033
-
1034
- const task = await runTestEffect(
1035
- TaskService.pipe(
1036
- Effect.flatMap((service) => service.show("non-pr", root)),
1037
- ),
1038
- )
1039
- expect(task.data).toMatchObject({
1040
- status: "done",
1041
- pr: null,
1042
- completion: {
1043
- mode: "non-pr",
1044
- summary: "Investigation completed without changes.",
1045
- },
1046
- })
1047
- expect(
1048
- await runTestEffect(
1049
- WorkbaseService.pipe(
1050
- Effect.flatMap((service) => service.validate(root)),
1051
- ),
1052
- ),
1053
- ).toMatchObject({ valid: true, issues: [] })
1054
- })
1055
-
1056
- test("reads each repository workspace inventory once", async () => {
1057
- for (const id of ["first", "second"]) {
1058
- await runTestEffect(
1059
- TaskService.pipe(
1060
- Effect.flatMap((service) =>
1061
- service.create(
1062
- {
1063
- id,
1064
- ticketUrl: null,
1065
- repo: "agency",
1066
- branch: `feat/${id}`,
1067
- base: "main",
1068
- },
1069
- root,
1070
- ),
1071
- ),
1072
- ),
1073
- )
1074
- await runTestEffect(
1075
- WorktreeService.pipe(
1076
- Effect.flatMap((service) => service.materialize(id, undefined, root)),
1077
- ),
1078
- )
1079
- }
1080
-
1081
- const callsPath = join(root, "workspace-list-calls")
1082
- const realGit = Bun.which("git")!
1083
- const gitWrapper = join(root, "bin", "git")
1084
- await Bun.write(
1085
- gitWrapper,
1086
- `#!/bin/sh
1087
- case "$*" in
1088
- *"worktree list --porcelain -z"*) printf 'call\\n' >> ${JSON.stringify(callsPath)} ;;
1089
- esac
1090
- exec ${JSON.stringify(realGit)} "$@"
1091
- `,
1092
- )
1093
- await chmod(gitWrapper, 0o755)
1094
-
1095
- await runTestEffect(
1096
- SyncService.pipe(
1097
- Effect.flatMap((service) => service.reconcile({ cwd: root })),
1098
- ),
1099
- )
1100
- expect((await Bun.file(callsPath).text()).trim().split("\n")).toHaveLength(
1101
- 1,
1102
- )
1103
- })
1104
-
1105
- test("reuses documents parsed during validation", async () => {
1106
- await runTestEffect(
1107
- TaskService.pipe(
1108
- Effect.flatMap((service) =>
1109
- service.create(
1110
- {
1111
- id: "single-read",
1112
- ticketUrl: null,
1113
- repo: "agency",
1114
- branch: "feat/single-read",
1115
- base: "main",
1116
- },
1117
- root,
1118
- ),
1119
- ),
1120
- ),
1121
- )
1122
- await runTestEffect(
1123
- TaskService.pipe(
1124
- Effect.flatMap((service) =>
1125
- service.setStatus("single-read", "done", root, {
1126
- summary: "Completed without a pull request",
1127
- }),
1128
- ),
1129
- ),
1130
- )
1131
- const taskPath = join(root, "tasks/single-read/TASK.md")
1132
- const taskContent = await Bun.file(taskPath).text()
1133
- const originalFile = Bun.file
1134
- let reads = 0
1135
- const fileSpy = spyOn(Bun, "file").mockImplementation(((path: string) => {
1136
- if (path === taskPath) reads += 1
1137
- return path === taskPath ? new Blob([taskContent]) : originalFile(path)
1138
- }) as typeof Bun.file)
1139
-
1140
- try {
1141
- await runTestEffect(
1142
- SyncService.pipe(
1143
- Effect.flatMap((service) => service.reconcile({ cwd: root })),
1144
- ),
1145
- )
1146
- } finally {
1147
- fileSpy.mockRestore()
1148
- }
1149
-
1150
- expect(reads).toBe(1)
1151
- })
1152
-
1153
- test("queries pull request providers concurrently", async () => {
1154
- for (const id of ["first", "second", "third"]) {
1155
- await runTestEffect(
1156
- TaskService.pipe(
1157
- Effect.flatMap((service) =>
1158
- service.create(
1159
- {
1160
- id,
1161
- ticketUrl: null,
1162
- repo: "agency",
1163
- branch: `feat/${id}`,
1164
- base: "main",
1165
- },
1166
- root,
1167
- ),
1168
- ),
1169
- ),
1170
- )
1171
- }
1172
-
1173
- const barrier = join(root, "query-barrier")
1174
- await mkdir(barrier)
1175
- await Bun.write(
1176
- join(root, "bin", "gh"),
1177
- `#!/bin/sh
1178
- branch=""
1179
- while [ "$#" -gt 0 ]; do
1180
- if [ "$1" = "--head" ]; then branch="$2"; break; fi
1181
- shift
1182
- done
1183
- id="\${branch##*/}"
1184
- touch ${JSON.stringify(barrier)}/"\${id}"
1185
- attempt=0
1186
- while [ "$attempt" -lt 200 ]; do
1187
- set -- ${JSON.stringify(barrier)}/*
1188
- if [ -e "$1" ] && [ "$#" -ge 3 ]; then printf '[]\\n'; exit 0; fi
1189
- attempt=$((attempt + 1))
1190
- sleep 0.01
1191
- done
1192
- echo "provider queries were serialized" >&2
1193
- exit 9
1194
- `,
1195
- )
1196
- await chmod(join(root, "bin", "gh"), 0o755)
1197
-
1198
- const result = await runTestEffect(
1199
- SyncService.pipe(
1200
- Effect.flatMap((service) => service.reconcile({ cwd: root })),
1201
- ),
1202
- )
1203
- expect(
1204
- result.warnings.filter(
1205
- (warning) => warning.kind === "pr-discovery-unavailable",
1206
- ),
1207
- ).toEqual([])
1208
- })
1209
-
1210
- test("inspects workspace dirtiness concurrently", async () => {
1211
- for (const id of ["first", "second", "third"]) {
1212
- await runTestEffect(
1213
- TaskService.pipe(
1214
- Effect.flatMap((service) =>
1215
- service.create(
1216
- {
1217
- id,
1218
- ticketUrl: null,
1219
- repo: "agency",
1220
- branch: `feat/${id}`,
1221
- base: "main",
1222
- },
1223
- root,
1224
- ),
1225
- ),
1226
- ),
1227
- )
1228
- await runTestEffect(
1229
- WorktreeService.pipe(
1230
- Effect.flatMap((service) => service.materialize(id, undefined, root)),
1231
- ),
1232
- )
1233
- }
1234
-
1235
- const barrier = join(root, "status-barrier")
1236
- await mkdir(barrier)
1237
- const realGit = Bun.which("git")!
1238
- await Bun.write(
1239
- join(root, "bin", "git"),
1240
- `#!/bin/sh
1241
- case "$*" in
1242
- *" status --porcelain"*)
1243
- workspace=""
1244
- previous=""
1245
- for argument in "$@"; do
1246
- if [ "$previous" = "-C" ]; then workspace="$argument"; fi
1247
- previous="$argument"
1248
- done
1249
- id="$(basename "$(dirname "$(dirname "$workspace")")")"
1250
- touch ${JSON.stringify(barrier)}/"$id"
1251
- attempt=0
1252
- while [ "$attempt" -lt 200 ]; do
1253
- set -- ${JSON.stringify(barrier)}/*
1254
- if [ -e "$1" ] && [ "$#" -ge 3 ]; then exec ${JSON.stringify(realGit)} -C "$workspace" status --porcelain; fi
1255
- attempt=$((attempt + 1))
1256
- sleep 0.01
1257
- done
1258
- echo "workspace inspections were serialized" >&2
1259
- exit 9
1260
- ;;
1261
- esac
1262
- exec ${JSON.stringify(realGit)} "$@"
1263
- `,
1264
- )
1265
- await chmod(join(root, "bin", "git"), 0o755)
1266
-
1267
- const result = await runTestEffect(
1268
- SyncService.pipe(
1269
- Effect.flatMap((service) => service.reconcile({ cwd: root })),
1270
- ),
1271
- )
1272
- expect(
1273
- result.warnings.filter(
1274
- (warning) => warning.kind === "status-inspection-failed",
1275
- ),
1276
- ).toEqual([])
1277
- })
1278
-
1279
- test("queries review sources concurrently", async () => {
1280
- const source = join(root, "source")
1281
- for (const id of ["first", "second", "third"]) {
1282
- const ref = `review-${id}`
1283
- await git(["branch", ref, "main"], source)
1284
- const review = await runTestEffect(
1285
- ReviewService.pipe(
1286
- Effect.flatMap((service) => service.resolve("agency", { ref }, root)),
1287
- ),
1288
- )
1289
- await runTestEffect(
1290
- TaskService.pipe(
1291
- Effect.flatMap((service) =>
1292
- service.create({ id, ticketUrl: null, review }, root),
1293
- ),
1294
- ),
1295
- )
1296
- }
1297
-
1298
- const barrier = join(root, "review-query-barrier")
1299
- await mkdir(barrier)
1300
- const realGit = Bun.which("git")!
1301
- await Bun.write(
1302
- join(root, "bin", "git"),
1303
- `#!/bin/sh
1304
- case "$*" in
1305
- *"ls-remote"*)
1306
- ref=""
1307
- for argument in "$@"; do ref="$argument"; done
1308
- id="\${ref##*-}"
1309
- touch ${JSON.stringify(barrier)}/"$id"
1310
- attempt=0
1311
- while [ "$attempt" -lt 200 ]; do
1312
- set -- ${JSON.stringify(barrier)}/*
1313
- if [ -e "$1" ] && [ "$#" -ge 3 ]; then printf '%s\t%s\n' '0123456789012345678901234567890123456789' "$ref"; exit 0; fi
1314
- attempt=$((attempt + 1))
1315
- sleep 0.01
1316
- done
1317
- echo "review source queries were serialized" >&2
1318
- exit 9
1319
- ;;
1320
- esac
1321
- exec ${JSON.stringify(realGit)} "$@"
1322
- `,
1323
- )
1324
- await chmod(join(root, "bin", "git"), 0o755)
1325
-
1326
- const result = await runTestEffect(
1327
- SyncService.pipe(
1328
- Effect.flatMap((service) => service.reconcile({ cwd: root })),
1329
- ),
1330
- )
1331
- expect(
1332
- result.warnings.filter(
1333
- (warning) => warning.kind === "review-source-unavailable",
1334
- ),
1335
- ).toEqual([])
1336
- })
1337
-
1338
- test("keeps pull request query failures concise", async () => {
1339
- await runTestEffect(
1340
- TaskService.pipe(
1341
- Effect.flatMap((service) =>
1342
- service.create(
1343
- {
1344
- id: "unavailable",
1345
- ticketUrl: null,
1346
- repo: "agency",
1347
- branch: "feat/unavailable",
1348
- base: "main",
1349
- },
1350
- root,
1351
- ),
1352
- ),
1353
- ),
1354
- )
1355
- await Bun.write(
1356
- join(root, "bin", "gh"),
1357
- `#!/bin/sh
1358
- echo "Unknown JSON field: unsupported" >&2
1359
- echo "Available fields:" >&2
1360
- echo " additions" >&2
1361
- exit 1
1362
- `,
1363
- )
1364
- await chmod(join(root, "bin", "gh"), 0o755)
1365
-
1366
- const result = await runTestEffect(
1367
- SyncService.pipe(
1368
- Effect.flatMap((service) => service.reconcile({ cwd: root })),
1369
- ),
1370
- )
1371
- expect(result.warnings).toContainEqual({
1372
- kind: "pr-discovery-unavailable",
1373
- target: "task:unavailable",
1374
- message: "Unknown JSON field: unsupported",
1375
- })
1376
- })
1377
- })