@gjermundgaraba/effect-actions 0.22.0 → 0.24.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 (276) hide show
  1. package/README.md +9 -3
  2. package/dist/Action.d.mts +2 -2
  3. package/dist/Action.mjs +1 -0
  4. package/dist/ActionCli.d.mts +1 -1
  5. package/dist/ActionCli.mjs +1 -2
  6. package/dist/ActionHttp.d.mts +2 -2
  7. package/dist/ActionMcp.d.mts +20 -20
  8. package/dist/ActionMcp.mjs +9 -11
  9. package/dist/ActionRpc.d.mts +8 -15
  10. package/dist/ActionRpc.mjs +29 -54
  11. package/dist/ActionToolkit.d.mts +0 -2
  12. package/dist/ActionToolkit.mjs +0 -2
  13. package/dist/Event.d.mts +0 -23
  14. package/dist/Testing.mjs +3 -2
  15. package/dist/Webhook.mjs +2 -2
  16. package/dist/authentication/refusal.mjs +0 -1
  17. package/dist/cli/commands.mjs +0 -5
  18. package/dist/contract/authorizer.mjs +0 -5
  19. package/dist/contract/call.mjs +0 -23
  20. package/dist/contract/callback.mjs +0 -1
  21. package/dist/contract/caller.mjs +0 -11
  22. package/dist/contract/canonical.mjs +0 -5
  23. package/dist/contract/codec.d.mts +0 -1
  24. package/dist/contract/codec.mjs +0 -1
  25. package/dist/contract/codes.mjs +1 -15
  26. package/dist/contract/declared.mjs +0 -15
  27. package/dist/contract/digest.mjs +0 -1
  28. package/dist/contract/errors.d.mts +0 -4
  29. package/dist/contract/errors.mjs +0 -4
  30. package/dist/contract/feed.d.mts +0 -1
  31. package/dist/contract/feed.mjs +0 -20
  32. package/dist/contract/hints.mjs +0 -6
  33. package/dist/contract/hub.mjs +0 -3
  34. package/dist/contract/idempotency.mjs +0 -4
  35. package/dist/contract/implementation.d.mts +0 -1
  36. package/dist/contract/implementation.mjs +0 -27
  37. package/dist/contract/input-check.mjs +0 -1
  38. package/dist/contract/lease.mjs +0 -1
  39. package/dist/contract/listed.mjs +0 -6
  40. package/dist/contract/log.mjs +0 -8
  41. package/dist/contract/names.mjs +0 -1
  42. package/dist/contract/occurrence.mjs +0 -8
  43. package/dist/contract/pages.mjs +5 -12
  44. package/dist/contract/progress.mjs +2 -25
  45. package/dist/contract/push.d.mts +0 -5
  46. package/dist/contract/push.mjs +1 -24
  47. package/dist/contract/receiving.mjs +0 -7
  48. package/dist/contract/reported.mjs +0 -5
  49. package/dist/contract/serving.mjs +0 -18
  50. package/dist/contract/status.mjs +0 -3
  51. package/dist/contract/stream.mjs +0 -2
  52. package/dist/contract/subscribe.d.mts +0 -2
  53. package/dist/contract/subscribe.mjs +0 -8
  54. package/dist/contract/transient.mjs +0 -12
  55. package/dist/contract/watch.mjs +5 -17
  56. package/dist/contract/webhooks.mjs +0 -11
  57. package/dist/http/client.mjs +0 -1
  58. package/dist/http/events.d.mts +0 -10
  59. package/dist/http/events.mjs +2 -31
  60. package/dist/http/placed.d.mts +0 -2
  61. package/dist/http/streamed.d.mts +0 -1
  62. package/dist/http/streamed.mjs +4 -32
  63. package/dist/http/watch.mjs +0 -6
  64. package/dist/mcp/bridge.mjs +1 -26
  65. package/dist/mcp/client.d.mts +0 -1
  66. package/dist/mcp/client.mjs +0 -1
  67. package/dist/mcp/events.mjs +0 -6
  68. package/dist/mcp/progress.mjs +0 -7
  69. package/dist/mcp/protocol.mjs +0 -6
  70. package/dist/mcp/reply.mjs +0 -11
  71. package/dist/mcp/request.mjs +0 -1
  72. package/dist/mcp/watch.mjs +0 -6
  73. package/dist/rpc/watch.mjs +0 -6
  74. package/dist/stdio/console.mjs +2 -2
  75. package/dist/webhook/address.mjs +4 -9
  76. package/dist/webhook/attempt.mjs +2 -15
  77. package/dist/webhook/receiver.mjs +2 -8
  78. package/dist/webhook/signing.mjs +0 -3
  79. package/dist/webhook/stored.mjs +8 -17
  80. package/dist/webhook/subscriptions.mjs +19 -23
  81. package/docs/Action-streams.md +0 -12
  82. package/docs/Action.md +0 -10
  83. package/docs/ActionCli.md +2 -26
  84. package/docs/ActionHttp-failures.md +1 -1
  85. package/docs/ActionHttp.md +0 -28
  86. package/docs/ActionMcp-failures.md +2 -1
  87. package/docs/ActionMcp.md +2 -37
  88. package/docs/ActionRpc-events.md +0 -16
  89. package/docs/ActionRpc.md +0 -63
  90. package/docs/ActionToolkit.md +0 -11
  91. package/docs/Authentication-advanced.md +0 -31
  92. package/docs/Authentication.md +4 -13
  93. package/docs/Event.md +0 -37
  94. package/docs/README.md +1 -1
  95. package/docs/Testing-failures.md +1 -1
  96. package/docs/Testing.md +3 -13
  97. package/docs/Webhook.md +0 -46
  98. package/docs/setup-failures.md +1 -1
  99. package/docs/setup.md +5 -10
  100. package/examples/README.md +7 -1
  101. package/examples/assistant/src/agent.ts +8 -31
  102. package/examples/assistant/src/cli.ts +2 -9
  103. package/examples/assistant/src/commands.ts +0 -8
  104. package/examples/assistant/src/identity/Identity.ts +0 -10
  105. package/examples/assistant/src/identity/authorize.ts +0 -4
  106. package/examples/assistant/src/identity/members.ts +1 -3
  107. package/examples/assistant/src/identity/permissions.ts +0 -5
  108. package/examples/assistant/src/platform/tasks-file.ts +1 -6
  109. package/examples/assistant/src/scripted.ts +0 -4
  110. package/examples/assistant/src/tasks/Tasks.ts +0 -2
  111. package/examples/assistant/src/tasks/handlers.ts +0 -3
  112. package/examples/assistant/src/tasks/store.ts +0 -7
  113. package/examples/assistant/src/toolkit.ts +0 -11
  114. package/examples/assistant/test/commands.test.ts +0 -5
  115. package/examples/assistant/test/identity/identity.test.ts +6 -6
  116. package/examples/assistant/test/platform/tasks-file.test.ts +2 -6
  117. package/examples/assistant/test/tasks/tasks.test.ts +13 -14
  118. package/examples/assistant/test/toolkit.test.ts +7 -18
  119. package/examples/build-events/README.md +2 -0
  120. package/examples/build-events/src/Api.ts +0 -3
  121. package/examples/build-events/src/Rpc.ts +0 -2
  122. package/examples/build-events/src/builds/Builds.ts +0 -15
  123. package/examples/build-events/src/builds/events.ts +0 -10
  124. package/examples/build-events/src/builds/handlers.ts +0 -6
  125. package/examples/build-events/src/builds/log.ts +0 -6
  126. package/examples/build-events/src/builds/status.ts +0 -4
  127. package/examples/build-events/src/builds/store.ts +0 -21
  128. package/examples/build-events/src/cli.ts +0 -2
  129. package/examples/build-events/src/commands.ts +0 -9
  130. package/examples/build-events/src/deploys/approvers.ts +0 -3
  131. package/examples/build-events/src/deploys/events.ts +0 -8
  132. package/examples/build-events/src/deploys/handlers.ts +0 -2
  133. package/examples/build-events/src/identity/Identity.ts +0 -11
  134. package/examples/build-events/src/identity/members.ts +1 -2
  135. package/examples/build-events/src/identity/verifier.ts +8 -9
  136. package/examples/build-events/src/notifier/Notices.ts +0 -3
  137. package/examples/build-events/src/notifier/routes.ts +0 -10
  138. package/examples/build-events/src/notifier.ts +0 -8
  139. package/examples/build-events/src/routes.ts +0 -24
  140. package/examples/build-events/src/server.ts +0 -14
  141. package/examples/build-events/test/builds/events.test.ts +0 -6
  142. package/examples/build-events/test/builds/log.test.ts +0 -1
  143. package/examples/build-events/test/builds/progress.test.ts +0 -1
  144. package/examples/build-events/test/commands.test.ts +0 -5
  145. package/examples/build-events/test/deploys/events.test.ts +0 -1
  146. package/examples/build-events/test/http.test.ts +0 -4
  147. package/examples/build-events/test/notifier.test.ts +0 -9
  148. package/examples/build-events/test/routes.test.ts +0 -9
  149. package/examples/build-events/test/rpc.test.ts +0 -4
  150. package/examples/build-events/test/support/as.ts +3 -4
  151. package/examples/build-events/test/support/memory.ts +0 -5
  152. package/examples/build-events/test/webhooks.test.ts +0 -12
  153. package/examples/kitchen-sink/README.md +1 -1
  154. package/examples/kitchen-sink/src/Actions.ts +0 -10
  155. package/examples/kitchen-sink/src/Api.ts +0 -8
  156. package/examples/kitchen-sink/src/Rpc.ts +0 -4
  157. package/examples/kitchen-sink/src/admin/Admin.ts +0 -9
  158. package/examples/kitchen-sink/src/admin/authenticate.ts +2 -6
  159. package/examples/kitchen-sink/src/admin/authorize.ts +0 -5
  160. package/examples/kitchen-sink/src/admin/grants.ts +0 -5
  161. package/examples/kitchen-sink/src/admin/handlers.ts +0 -2
  162. package/examples/kitchen-sink/src/admin/keys.ts +1 -3
  163. package/examples/kitchen-sink/src/agent.ts +2 -13
  164. package/examples/kitchen-sink/src/assistant/Assistant.ts +7 -24
  165. package/examples/kitchen-sink/src/assistant/conversations.ts +3 -21
  166. package/examples/kitchen-sink/src/assistant/demo-model.ts +0 -5
  167. package/examples/kitchen-sink/src/assistant/handlers.ts +1 -30
  168. package/examples/kitchen-sink/src/attachments/Attachments.ts +0 -4
  169. package/examples/kitchen-sink/src/attachments/download.ts +0 -10
  170. package/examples/kitchen-sink/src/attachments/handlers.ts +0 -3
  171. package/examples/kitchen-sink/src/attachments/store.ts +0 -3
  172. package/examples/kitchen-sink/src/browser.ts +0 -9
  173. package/examples/kitchen-sink/src/cli.ts +0 -19
  174. package/examples/kitchen-sink/src/config.ts +3 -11
  175. package/examples/kitchen-sink/src/identity/Identity.ts +0 -18
  176. package/examples/kitchen-sink/src/identity/authenticate.ts +3 -14
  177. package/examples/kitchen-sink/src/identity/authorize.ts +0 -6
  178. package/examples/kitchen-sink/src/identity/directory.ts +8 -18
  179. package/examples/kitchen-sink/src/identity/handlers.ts +0 -3
  180. package/examples/kitchen-sink/src/identity/members.ts +1 -5
  181. package/examples/kitchen-sink/src/identity/quota.ts +0 -11
  182. package/examples/kitchen-sink/src/issues/Issues.ts +0 -24
  183. package/examples/kitchen-sink/src/issues/assistant.ts +0 -10
  184. package/examples/kitchen-sink/src/issues/events.ts +2 -16
  185. package/examples/kitchen-sink/src/issues/export.ts +0 -5
  186. package/examples/kitchen-sink/src/issues/guide.ts +0 -5
  187. package/examples/kitchen-sink/src/issues/handlers.ts +0 -5
  188. package/examples/kitchen-sink/src/issues/store.ts +19 -23
  189. package/examples/kitchen-sink/src/issues/write-limit.ts +0 -12
  190. package/examples/kitchen-sink/src/memory.ts +0 -9
  191. package/examples/kitchen-sink/src/ops.ts +0 -6
  192. package/examples/kitchen-sink/src/request-policy.ts +0 -17
  193. package/examples/kitchen-sink/src/routes.ts +0 -48
  194. package/examples/kitchen-sink/src/sdk.ts +0 -12
  195. package/examples/kitchen-sink/src/seed.ts +0 -10
  196. package/examples/kitchen-sink/src/server.ts +0 -22
  197. package/examples/kitchen-sink/src/stdio.ts +2 -12
  198. package/examples/kitchen-sink/src/workspaces/Workspaces.ts +0 -4
  199. package/examples/kitchen-sink/src/workspaces/handlers.ts +0 -4
  200. package/examples/kitchen-sink/src/workspaces/registry.ts +0 -5
  201. package/examples/kitchen-sink/src/workspaces/tenant.ts +0 -4
  202. package/examples/kitchen-sink/test/admin/admin.test.ts +0 -1
  203. package/examples/kitchen-sink/test/assistant/assistant.test.ts +0 -18
  204. package/examples/kitchen-sink/test/attachments/attachments.test.ts +0 -9
  205. package/examples/kitchen-sink/test/identity/identity.test.ts +0 -10
  206. package/examples/kitchen-sink/test/identity/session.test.ts +0 -10
  207. package/examples/kitchen-sink/test/issues/assistant.test.ts +3 -7
  208. package/examples/kitchen-sink/test/issues/events.test.ts +2 -9
  209. package/examples/kitchen-sink/test/issues/export.test.ts +0 -3
  210. package/examples/kitchen-sink/test/issues/issues.test.ts +6 -12
  211. package/examples/kitchen-sink/test/request-policy.test.ts +0 -6
  212. package/examples/kitchen-sink/test/routes.test.ts +0 -6
  213. package/examples/kitchen-sink/test/support/as.ts +3 -5
  214. package/examples/kitchen-sink/test/support/scripted.ts +0 -3
  215. package/examples/kitchen-sink/test/support/services.ts +0 -3
  216. package/examples/live-rpc/src/Rpc.ts +0 -4
  217. package/examples/live-rpc/src/browser.ts +0 -24
  218. package/examples/live-rpc/src/chat/Chat.ts +0 -22
  219. package/examples/live-rpc/src/chat/authorize.ts +0 -3
  220. package/examples/live-rpc/src/chat/events.ts +0 -14
  221. package/examples/live-rpc/src/chat/handlers.ts +0 -5
  222. package/examples/live-rpc/src/chat/room.ts +0 -6
  223. package/examples/live-rpc/src/chat/store.ts +0 -9
  224. package/examples/live-rpc/src/client.ts +0 -6
  225. package/examples/live-rpc/src/identity/Identity.ts +0 -6
  226. package/examples/live-rpc/src/identity/members.ts +1 -3
  227. package/examples/live-rpc/src/identity/verifier.ts +6 -12
  228. package/examples/live-rpc/src/page.ts +0 -10
  229. package/examples/live-rpc/src/routes.ts +0 -13
  230. package/examples/live-rpc/src/server.ts +0 -16
  231. package/examples/live-rpc/test/browser.test.ts +0 -9
  232. package/examples/live-rpc/test/chat/chat.test.ts +3 -11
  233. package/examples/live-rpc/test/routes.test.ts +0 -8
  234. package/examples/live-rpc/test/server.test.ts +0 -13
  235. package/examples/mcp-tools/src/instructions.ts +0 -4
  236. package/examples/mcp-tools/src/platform/fake-farm.ts +0 -6
  237. package/examples/mcp-tools/src/platform/print-farm.ts +0 -16
  238. package/examples/mcp-tools/src/printers/Printers.ts +0 -21
  239. package/examples/mcp-tools/src/printers/farm.ts +0 -5
  240. package/examples/mcp-tools/src/printers/handlers.ts +0 -6
  241. package/examples/mcp-tools/src/routes.ts +0 -11
  242. package/examples/mcp-tools/src/server.ts +0 -9
  243. package/examples/mcp-tools/src/stdio.ts +1 -13
  244. package/examples/mcp-tools/test/printers/printers.test.ts +0 -10
  245. package/examples/mcp-tools/test/routes.test.ts +0 -14
  246. package/examples/notes-service/src/Api.ts +0 -4
  247. package/examples/notes-service/src/browser.ts +0 -12
  248. package/examples/notes-service/src/cli.ts +0 -2
  249. package/examples/notes-service/src/commands.ts +0 -30
  250. package/examples/notes-service/src/identity/Identity.ts +0 -2
  251. package/examples/notes-service/src/identity/authorize.ts +0 -4
  252. package/examples/notes-service/src/identity/users.ts +1 -3
  253. package/examples/notes-service/src/identity/verifier.ts +4 -11
  254. package/examples/notes-service/src/notes/Notes.ts +0 -12
  255. package/examples/notes-service/src/notes/handlers.ts +0 -4
  256. package/examples/notes-service/src/notes/store.ts +62 -48
  257. package/examples/notes-service/src/routes.ts +0 -12
  258. package/examples/notes-service/src/server.ts +0 -6
  259. package/examples/notes-service/src/status/Status.ts +0 -1
  260. package/examples/notes-service/src/status/handlers.ts +0 -1
  261. package/examples/notes-service/src/stdio.ts +2 -12
  262. package/examples/notes-service/src/worker.ts +0 -7
  263. package/examples/notes-service/test/commands.test.ts +0 -20
  264. package/examples/notes-service/test/notes/as.ts +3 -4
  265. package/examples/notes-service/test/notes/in-process.test.ts +3 -6
  266. package/examples/notes-service/test/notes/notes.test.ts +0 -6
  267. package/examples/notes-service/test/routes.test.ts +0 -5
  268. package/examples/notes-service/test/worker.test.ts +0 -1
  269. package/examples/quickstart/src/Api.ts +0 -1
  270. package/examples/quickstart/src/client.ts +0 -3
  271. package/examples/quickstart/src/greeting/Greeting.ts +0 -2
  272. package/examples/quickstart/src/greeting/handlers.ts +0 -1
  273. package/examples/quickstart/src/routes.ts +0 -1
  274. package/examples/quickstart/src/server.ts +3 -6
  275. package/examples/quickstart/test/routes.test.ts +0 -1
  276. package/package.json +6 -6
@@ -10,21 +10,15 @@ export const logs = Action.implement(
10
10
  Effect.gen(function* () {
11
11
  const store = yield* BuildStore;
12
12
 
13
- // The handler returns a `Stream`, run in a scope of its own that closes when the caller
14
- // stops reading, so what it acquires is released then.
15
13
  return ({ buildId }) =>
16
14
  Stream.unwrap(
17
15
  Effect.gen(function* () {
18
16
  const member = yield* CurrentMember;
19
- // A failure before the first line, `BuildNotFound` here, fails the call as an action
20
- // answering one value fails, a 404 over HTTP; one after a line ends the stream, the
21
- // lines before it already read.
22
17
  const log = yield* store.logOf(member.pipelines, buildId);
23
18
 
24
19
  return Stream.fromIterable(log.map((line) => ({ line })));
25
20
  })
26
21
  );
27
22
  }),
28
- // Which builds a member may read is the store's check, by pipeline.
29
23
  { authorize: Action.allowAll }
30
24
  );
@@ -5,9 +5,6 @@ import { CurrentMember } from "../identity/Identity.js";
5
5
  import { PipelineStatus } from "./Builds.js";
6
6
  import { BuildStore } from "./store.js";
7
7
 
8
- // A current source: the value as it is, which the library sends first and again after each
9
- // notify reaching the subscriber's key, keeping the revision that tells them apart, so the store
10
- // keeps no cursor for it. The key is the pipeline: a build of another wakes no one here.
11
8
  export const statusEvents = Event.implement(
12
9
  PipelineStatus,
13
10
  Effect.gen(function* () {
@@ -23,6 +20,5 @@ export const statusEvents = Event.implement(
23
20
  key: ({ pipeline }) => pipeline,
24
21
  };
25
22
  }),
26
- // Every member may watch; which pipelines each sees is the store's check.
27
23
  { authorize: Event.allowAll }
28
24
  );
@@ -3,19 +3,14 @@ import { Context, Effect, Layer } from "effect";
3
3
  import { BuildNotFound } from "./Builds.js";
4
4
  import type { Build } from "./Builds.js";
5
5
 
6
- /** One page of the builds finished since a cursor. */
7
6
  export interface Finished {
8
7
  readonly builds: readonly Build[];
9
8
  readonly cursor: string;
10
9
  readonly hasMore: boolean;
11
- /** Whether builds before the page may be missing: the cursor was not one of this store's. */
12
10
  readonly truncated: boolean;
13
- /** The store's epoch: a build's id is unique within it, and a restarted memory store starts another. */
14
11
  readonly epoch: string;
15
12
  }
16
13
 
17
- // The position a cursor of `epoch` names, among `length` builds; none for another epoch's cursor
18
- // or one that is not a cursor at all.
19
14
  const positionOf = (
20
15
  epoch: string,
21
16
  cursor: string,
@@ -32,45 +27,29 @@ const positionOf = (
32
27
  : undefined;
33
28
  };
34
29
 
35
- /**
36
- * Where finished builds are recorded, in the order they finished. Which pipelines a member may
37
- * see is checked here, in the data access, so no subscription can skip it.
38
- */
39
30
  export class BuildStore extends Context.Service<
40
31
  BuildStore,
41
32
  {
42
- /** Record a build that finished, with the lines its log holds. */
43
33
  readonly finish: (
44
34
  pipeline: string,
45
35
  status: Build["status"],
46
36
  log: readonly string[]
47
37
  ) => Effect.Effect<Build>;
48
- /** The log of build `buildId`, which must be one of `pipelines`. */
49
38
  readonly logOf: (
50
39
  pipelines: readonly string[],
51
40
  buildId: string
52
41
  ) => Effect.Effect<readonly string[], BuildNotFound>;
53
- /**
54
- * The builds of `pipelines` finished after `cursor`, at most `limit`; a `null` cursor is
55
- * the current position, with none.
56
- */
57
42
  readonly finishedSince: (
58
43
  pipelines: readonly string[],
59
44
  cursor: string | null,
60
45
  limit: number
61
46
  ) => Effect.Effect<Finished>;
62
- /** How `pipeline`'s last build ended, `null` before any did or where it is not of `pipelines`. */
63
47
  readonly statusOf: (
64
48
  pipelines: readonly string[],
65
49
  pipeline: string
66
50
  ) => Effect.Effect<Build["status"] | null>;
67
51
  }
68
52
  >()("build-events/BuildStore") {
69
- // DEMO ONLY: builds live in this process's memory, so a restart forgets them and numbers them
70
- // from 1 again. Its cursors carry an epoch of their own, so one from before the restart, or one
71
- // it never gave, is answered from the start as `truncated`: the subscriber is sent a gap, never
72
- // a silent loss. In a database the cursor is the position in its own change feed, such as a
73
- // sequence column, so a subscriber resumes after a restart.
74
53
  static readonly layerMemory = Layer.sync(BuildStore, () => {
75
54
  const epoch = crypto.randomUUID();
76
55
  const finished: Build[] = [];
@@ -9,8 +9,6 @@ import { Command } from "effect/cli";
9
9
 
10
10
  import { commands } from "./commands.js";
11
11
 
12
- // Entrypoint: `BUILDS_TOKEN=grace node --import tsx examples/build-events/src/cli.ts watch
13
- // build.finished`, with server.ts running.
14
12
  Command.run(commands, { version: "1.0.0" }).pipe(
15
13
  Effect.provide([NodeHttpClient.layerUndici, NodeServices.layer]),
16
14
  ActionCli.logToStderr,
@@ -5,8 +5,6 @@ import { HttpClient, HttpClientRequest } from "effect/http";
5
5
 
6
6
  import { Http } from "./Api.js";
7
7
 
8
- // The binding's client, connected to where the server is and as which member, both read from
9
- // config when a command runs.
10
8
  const api = Effect.gen(function* () {
11
9
  const baseUrl = yield* Config.String("BUILDS_URL").pipe(
12
10
  Config.withDefault("http://127.0.0.1:3000")
@@ -22,11 +20,4 @@ const api = Effect.gen(function* () {
22
20
  });
23
21
  });
24
22
 
25
- // A command per action, and `watch <event>` per event type: `builds watch build.finished
26
- // --pipeline api` holds the event's stream open and prints each occurrence as a line of JSON,
27
- // its `cursor` included, until it is stopped. `--cursor <cursor>` resumes after that line;
28
- // omitted, the watch starts from now. The lines pipe into `jq` or a script as they come.
29
- // `builds start-build --pipeline api` prints each step as a line of JSON on stderr as it
30
- // starts, and the build on stdout, which a pipe reads alone. `builds tail-log --build-id
31
- // build-1` prints each line of its log as a line of JSON as it arrives.
32
23
  export const commands = ActionCli.remote(Http, { name: "builds", client: api });
@@ -3,11 +3,9 @@ import type { Scope } from "effect";
3
3
 
4
4
  import type { Environment } from "./Deploys.js";
5
5
 
6
- /** Who stands by to approve deploys, and to which environment. */
7
6
  export class Approvers extends Context.Service<
8
7
  Approvers,
9
8
  {
10
- /** Stands `member` by to approve deploys to `environment`, every one where undefined, until the scope closes. */
11
9
  readonly standBy: (
12
10
  environment: Environment | undefined,
13
11
  member: string
@@ -17,7 +15,6 @@ export class Approvers extends Context.Service<
17
15
  ) => Effect.Effect<readonly string[]>;
18
16
  }
19
17
  >()("build-events/Approvers") {
20
- // DEMO ONLY: approvers live in this process's memory, where a real one is a rota in a store.
21
18
  static readonly layerMemory = Layer.sync(Approvers, () => {
22
19
  const approvers: Array<{
23
20
  readonly environment: Environment | undefined;
@@ -5,11 +5,6 @@ import { CurrentMember } from "../identity/Identity.js";
5
5
  import { Approvers } from "./approvers.js";
6
6
  import { DeployRequested } from "./Deploys.js";
7
7
 
8
- // A log source, for occurrences nothing else keeps: the library keeps each one `requestDeploy`
9
- // publishes, for 10 minutes and at most 10,000 of them by default, and gives each subscriber
10
- // what its `match` accepts. A subscriber resuming from a cursor gets what the log still holds:
11
- // after a restart, or once its occurrences are dropped, a gap first. An upstream you can ask
12
- // "what since?", such as a table, is a check source.
13
8
  export const deployEvents = Event.implement(
14
9
  DeployRequested,
15
10
  Effect.gen(function* () {
@@ -19,9 +14,6 @@ export const deployEvents = Event.implement(
19
14
  log: {},
20
15
  match: ({ environment }, deploy) =>
21
16
  environment === undefined || deploy.environment === environment,
22
- // Set up while each subscription lasts, as the subscriber: a stream's as long as it is
23
- // read, a poll's until 5 minutes after its last poll. It may run again for one
24
- // subscription, after a restart, so standing by twice must be harmless.
25
17
  subscription: ({ environment }) =>
26
18
  Effect.flatMap(CurrentMember, (member) =>
27
19
  approvers.standBy(environment, member.id)
@@ -24,8 +24,6 @@ export const deploys = Action.implement(
24
24
  approvers: yield* approvers.standingBy(environment),
25
25
  };
26
26
 
27
- // Nothing else keeps a deploy request, so `deploy.requested` is a log source: the
28
- // library keeps what is published here, and delivers it to each subscriber at once.
29
27
  yield* events.publish(DeployRequested, {
30
28
  eventId: deploy.id,
31
29
  data: deploy,
@@ -1,7 +1,6 @@
1
1
  import * as Authentication from "@gjermundgaraba/effect-actions/Authentication";
2
2
  import { Context, Schema } from "effect";
3
3
 
4
- /** A member, and the pipelines whose builds it may see. */
5
4
  export const Member = Schema.Struct({
6
5
  id: Schema.String,
7
6
  pipelines: Schema.Array(Schema.String),
@@ -9,20 +8,10 @@ export const Member = Schema.Struct({
9
8
 
10
9
  export type Member = typeof Member.Type;
11
10
 
12
- /**
13
- * Who is subscribing or calling. Every event and action here declares it, `caller:
14
- * CurrentMember`; authentication provides it per request.
15
- */
16
11
  export class CurrentMember extends Context.Service<CurrentMember, Member>()(
17
12
  "build-events/CurrentMember"
18
13
  ) {}
19
14
 
20
- // How a remote caller proves it is a member: a bearer token. Clients import this descriptor
21
- // with the contracts; its verifier stays on the server. `principal` names a member as one
22
- // subscriber: a poll arrives as a request among others, and a surface keys what it holds
23
- // between polls, deploy.requested's standing by, by it. Without it, MCP and HTTP refuse to
24
- // serve that event, and no event is offered by webhook. `schema` keeps a webhook subscriber's
25
- // identity, so the deliveries a restart restores run as that member.
26
15
  export const Login = Authentication.make("build-events.Login", CurrentMember, {
27
16
  principal: (member) => member.id,
28
17
  schema: Member,
@@ -1,7 +1,6 @@
1
1
  import type { Member } from "./Identity.js";
2
2
 
3
- // DEMO ONLY: the members who may sign in, each under a token that is their name.
4
- export const members = {
3
+ export const demoMembers = {
5
4
  ada: { id: "ada", pipelines: ["api", "web"] },
6
5
  grace: { id: "grace", pipelines: ["web"] },
7
6
  } as const satisfies Readonly<Record<string, Member>>;
@@ -3,20 +3,19 @@ import * as Authentication from "@gjermundgaraba/effect-actions/Authentication";
3
3
  import { Effect, Redacted } from "effect";
4
4
 
5
5
  import { Login } from "./Identity.js";
6
- import { members } from "./members.js";
6
+ import { demoMembers } from "./members.js";
7
7
 
8
- const isMember = (token: string): token is keyof typeof members =>
9
- Object.hasOwn(members, token);
8
+ const isMember = (token: string): token is keyof typeof demoMembers =>
9
+ Object.hasOwn(demoMembers, token);
10
10
 
11
- // DEMO ONLY: a token is a member's name. A real verifier checks a signed token with your
12
- // authorization server's library. An unknown token is the built-in `Unauthenticated`, which
13
- // every client decodes, a watch's included.
14
- export const authenticate = Authentication.layer(Login, (token) => {
11
+ const demoVerify = (token: Redacted.Redacted) => {
15
12
  const name = Redacted.value(token);
16
13
 
17
14
  return isMember(name)
18
- ? Effect.succeed(members[name])
15
+ ? Effect.succeed(demoMembers[name])
19
16
  : Effect.fail(
20
17
  new Action.Unauthenticated({ message: "Unknown demo token." })
21
18
  );
22
- });
19
+ };
20
+
21
+ export const authenticate = Authentication.layer(Login, demoVerify);
@@ -2,7 +2,6 @@ import { Context, Effect, Layer } from "effect";
2
2
 
3
3
  import type { Build } from "../builds/Builds.js";
4
4
 
5
- /** The failed builds the notifier was told of, in the order it was told. */
6
5
  export class Notices extends Context.Service<
7
6
  Notices,
8
7
  {
@@ -10,8 +9,6 @@ export class Notices extends Context.Service<
10
9
  readonly all: Effect.Effect<readonly Build[]>;
11
10
  }
12
11
  >()("build-events/Notices") {
13
- // DEMO ONLY: notices live in this process's memory; a notifier sends each on, to a chat or a
14
- // pager, as it arrives.
15
12
  static readonly layerMemory = Layer.sync(Notices, () => {
16
13
  const notices: Build[] = [];
17
14
 
@@ -17,12 +17,8 @@ export interface NotifierOptions {
17
17
  readonly publicUrl: string;
18
18
  }
19
19
 
20
- // The route build-events POSTs each failed build to, where the watch below reads them: the
21
- // watch's delivery appends its path to this process's public URL.
22
20
  const receiver = Webhook.layerReceiver({ path: "/hooks/builds" });
23
21
 
24
- // A second service, the notifier: it watches build.finished for failures by webhook, the
25
- // server POSTing each to it, rather than holding a stream open to build-events.
26
22
  const watcher = ({ buildEvents, token, publicUrl }: NotifierOptions) =>
27
23
  Layer.effectDiscard(
28
24
  Effect.gen(function* () {
@@ -42,8 +38,6 @@ const watcher = ({ buildEvents, token, publicUrl }: NotifierOptions) =>
42
38
  { status: "failed" },
43
39
  {
44
40
  mode: Webhook.delivery({ baseUrl: publicUrl }),
45
- // Where it reached is kept, so a restart resumes there; failures the server no
46
- // longer keeps arrive as a Gap instead.
47
41
  resume: {
48
42
  store: yield* KeyValueStore.KeyValueStore,
49
43
  key: "failed-builds",
@@ -51,15 +45,11 @@ const watcher = ({ buildEvents, token, publicUrl }: NotifierOptions) =>
51
45
  }
52
46
  )
53
47
  .pipe(
54
- // A Gap says failures were missed, which no notice can name: it is logged, for an
55
- // operator to look the builds up.
56
48
  Stream.runForEach((received) =>
57
49
  Predicate.isTagged(received, "Occurrence")
58
50
  ? notices.add(received.data)
59
51
  : Effect.logWarning("Failed builds were missed", received)
60
52
  ),
61
- // A failure no reconnect outlasts, such as a wrong PUBLIC_URL or a revoked token,
62
- // ends the watch: it is logged here, for a deployment to alert on or restart by.
63
53
  Effect.tapCause(Effect.logError)
64
54
  )
65
55
  );
@@ -8,21 +8,15 @@ import { KeyValueStore } from "effect/persistence";
8
8
  import { Notices } from "./notifier/Notices.js";
9
9
  import { notifier } from "./notifier/routes.js";
10
10
 
11
- // Entrypoint of the second service: `BUILDS_TOKEN=grace PUBLIC_URL=https://<its public name>
12
- // node --import tsx examples/build-events/src/notifier.ts`, with server.ts running. build-events
13
- // POSTs only to a globally reachable address, so on one machine give it a tunnel's name.
14
11
  const server = Layer.unwrap(
15
12
  Effect.gen(function* () {
16
13
  const buildEvents = yield* Config.String("BUILDS_URL").pipe(
17
14
  Config.withDefault("http://127.0.0.1:3000")
18
15
  );
19
16
 
20
- // Redacted, so a log or an error printing the configuration never shows the token.
21
17
  const token = yield* Config.Redacted("BUILDS_TOKEN");
22
18
  const publicUrl = yield* Config.String("PUBLIC_URL");
23
19
 
24
- // The loopback default serves this machine alone, which a tunnel reaches; HOST=0.0.0.0 lets
25
- // build-events reach it directly.
26
20
  const host = yield* Config.String("HOST").pipe(
27
21
  Config.withDefault("127.0.0.1")
28
22
  );
@@ -31,11 +25,9 @@ const server = Layer.unwrap(
31
25
 
32
26
  return HttpRouter.serve(notifier({ buildEvents, token, publicUrl })).pipe(
33
27
  Layer.provide(NodeHttpServer.layer(createServer, { host, port })),
34
- // The receiver's route is public and reads each body whole: a delivery is at most 256 KiB.
35
28
  Layer.provide(
36
29
  Layer.succeed(HttpServerRequest.MaxBodySize, ByteSize.kibibytes(256))
37
30
  ),
38
- // DEMO ONLY: notices and the watch's cursor live in this process's memory.
39
31
  Layer.provide([
40
32
  Notices.layerMemory,
41
33
  KeyValueStore.layerMemory,
@@ -16,7 +16,6 @@ import { Login } from "./identity/Identity.js";
16
16
  import { authenticate } from "./identity/verifier.js";
17
17
  import { Rpc } from "./Rpc.js";
18
18
 
19
- // Every domain's implementation, once: the events beside the actions, in one list.
20
19
  const implementations = [
21
20
  builds,
22
21
  logs,
@@ -26,17 +25,6 @@ const implementations = [
26
25
  deployEvents,
27
26
  ];
28
27
 
29
- // The actions as MCP tools and the events as MCP events, at `/mcp`. A client polls with
30
- // `events/poll`, or holds `events/stream` open and is pushed each occurrence. Both events are
31
- // protected, so each request needs a member's token, and each subscriber sees what its token
32
- // lets it. This long-lived process holds the deploy event's `subscription` hook between polls and
33
- // its log in memory, and pushes each occurrence: a `requestScoped` endpoint would serve the events
34
- // by poll and webhook alone, and a serverless host, where no process lasts, check sources alone,
35
- // without `Webhook.layer`.
36
- //
37
- // A tool answers one result, so `tailLog` would collect a whole log before answering, all of it
38
- // in a model's context: its implementation, `logs`, is left out, and the endpoint serves every
39
- // other action and every event.
40
28
  const mcp = ActionMcp.layerHttp(
41
29
  [builds, buildEvents, statusEvents, deploys, deployEvents],
42
30
  {
@@ -46,25 +34,13 @@ const mcp = ActionMcp.layerHttp(
46
34
  }
47
35
  );
48
36
 
49
- // The same implementations as routes under `/api`, for a client that speaks HTTP rather than
50
- // MCP: one implementation of each event serves every surface.
51
37
  const api = ActionHttp.layer(Http, implementations);
52
38
 
53
- // And as Effect RPC at `/rpc`, over HTTP. A watch is a stream rpc that never ends, so the
54
- // serialization frames each element as it is sent: `layerNdjson` does, where `layerJson` would
55
- // answer once every stream of the request ended, which a watch never does.
56
39
  const rpc = ActionRpc.layer(Rpc, implementations).pipe(
57
40
  Layer.provide(RpcServer.layerProtocolHttp({ path: "/rpc" })),
58
41
  Layer.provide(RpcSerialization.layerNdjson)
59
42
  );
60
43
 
61
- // Webhook delivery for MCP and HTTP alike: a member names a callback URL and a secret, with
62
- // MCP's `events/subscribe` or `POST /api/events/<name>/subscribe`, and each occurrence it may see
63
- // is POSTed there, signed. One layer holds the subscriptions of both, so either surface refreshes
64
- // one made over the other. `persist` keeps each in a `KeyValueStore`, so a restart goes on
65
- // delivering from where it reached, as the subscriber `Login`'s `schema` keeps. It needs an
66
- // `HttpClient` to POST, `Dns` to check where each callback resolves, and the store, which
67
- // `server.ts` provides.
68
44
  export const routes = Layer.mergeAll(mcp, api, rpc).pipe(
69
45
  Layer.provide(authenticate),
70
46
  Layer.provide(Webhook.layer({ persist: true }))
@@ -16,11 +16,8 @@ import { BuildStore } from "./builds/store.js";
16
16
  import { Approvers } from "./deploys/approvers.js";
17
17
  import { routes } from "./routes.js";
18
18
 
19
- // Entrypoint: `node --import tsx examples/build-events/src/server.ts`.
20
- // It chooses the stores, reads the configuration and starts Node's HTTP server.
21
19
  const server = Layer.unwrap(
22
20
  Effect.gen(function* () {
23
- // The loopback default serves this machine alone; HOST=0.0.0.0 lets others reach it.
24
21
  const host = yield* Config.String("HOST").pipe(
25
22
  Config.withDefault("127.0.0.1")
26
23
  );
@@ -33,27 +30,16 @@ const server = Layer.unwrap(
33
30
 
34
31
  return HttpRouter.serve(routes).pipe(
35
32
  Layer.provide(NodeHttpServer.layer(createServer, { host, port })),
36
- // Request bodies have no size limit unless the host sets one. This covers every route
37
- // that reads its body whole, the MCP endpoint and the webhook subscribe routes included.
38
33
  Layer.provide(
39
34
  Layer.succeed(HttpServerRequest.MaxBodySize, ByteSize.mebibytes(1))
40
35
  ),
41
- // DEMO ONLY: builds and approvers live in this process's memory; a deployment provides
42
- // stores that last.
43
36
  Layer.provide([BuildStore.layerMemory, Approvers.layerMemory]),
44
- // The events this process announces: a notify after a build finishes, and each deploy
45
- // request published. One for the whole server, which holds every subscriber's connection.
46
37
  Layer.provide(Event.layerMemory),
47
- // Webhook subscriptions are kept as files under WEBHOOKS_DIR, so a restart goes on
48
- // delivering them; after one, the memory store above sends each a gap first. The files
49
- // hold each subscriber's secret: give the directory to this server alone, and each server
50
- // process its own, since the layer is its store's one writer.
51
38
  Layer.provide(
52
39
  KeyValueStore.layerFileSystem(webhooks).pipe(
53
40
  Layer.provide([NodeFileSystem.layer, NodePath.layer])
54
41
  )
55
42
  ),
56
- // Webhook delivery POSTs with fetch, and resolves each callback with the system's resolver.
57
43
  Layer.provide([FetchHttpClient.layer, NodeDns.layer])
58
44
  );
59
45
  })
@@ -14,14 +14,12 @@ it.effect(
14
14
  "delivers each build a member may see as it finishes, as the subscription selects",
15
15
  () =>
16
16
  Effect.gen(function* () {
17
- // One client holds both: the action that finishes builds and the event that reports them.
18
17
  const client = yield* Action.client([builds, buildEvents]);
19
18
 
20
19
  const failed = yield* client
21
20
  .watch(BuildFinished, { status: "failed" })
22
21
  .pipe(Stream.take(1), Stream.runCollect, as("grace"), Effect.forkChild);
23
22
 
24
- // The watch starts from now: let it take its first position before builds finish.
25
23
  yield* TestClock.adjust("0 millis");
26
24
  yield* client
27
25
  .finishBuild({ pipeline: "api", status: "failed" })
@@ -29,12 +27,10 @@ it.effect(
29
27
  yield* client
30
28
  .finishBuild({ pipeline: "web", status: "passed" })
31
29
  .pipe(as("ada"));
32
- // Each build finished notifies: the watch reads at once, with no wait for its next poll.
33
30
  yield* client
34
31
  .finishBuild({ pipeline: "web", status: "failed" })
35
32
  .pipe(as("ada"));
36
33
 
37
- // grace sees only the web pipeline, and asked only for failures.
38
34
  expect(yield* Fiber.join(failed)).toMatchObject([
39
35
  {
40
36
  _tag: "Occurrence",
@@ -54,8 +50,6 @@ it.effect(
54
50
  .finishBuild({ pipeline: "web", status: "passed" })
55
51
  .pipe(as("ada"));
56
52
 
57
- // A cursor of the store before a restart, its offset one this store has too: what it named
58
- // is gone, so the watch is told.
59
53
  const resumed = yield* client
60
54
  .watch(BuildFinished, {}, { cursor: "an-earlier-epoch:0" })
61
55
  .pipe(Stream.take(2), Stream.runCollect, as("grace"));
@@ -39,7 +39,6 @@ describe("a build's log", () => {
39
39
  const rpc = yield* ActionRpc.client(Rpc);
40
40
  const { id } = yield* http.startBuild({ pipeline: "api" });
41
41
 
42
- // Each call returns a `Stream`: a line is read as the server sends it.
43
42
  const lines = [
44
43
  yield* Stream.runCollect(http.tailLog({ buildId: id })),
45
44
  yield* Stream.runCollect(rpc.tailLog({ buildId: id })).pipe(
@@ -41,7 +41,6 @@ describe("a build started by a member", () => {
41
41
  const onProgress = (step: (typeof steps)[number]) =>
42
42
  Effect.sync(() => seen.push(step));
43
43
 
44
- // A caller asks for the steps by giving `onProgress`; without it, the call answers alone.
45
44
  const answers = [
46
45
  yield* http.startBuild({ pipeline: "api" }, { onProgress }),
47
46
  yield* mcp.startBuild({ pipeline: "api" }, { onProgress }),
@@ -14,7 +14,6 @@ import { inMemory } from "./support/memory.js";
14
14
 
15
15
  const served = Testing.layer(routes).pipe(Layer.provide(inMemory()));
16
16
 
17
- // Effect's own runner, given arguments instead of the process's, as the member `token` names.
18
17
  const run = (token: string, args: readonly string[]) =>
19
18
  Command.runWith(commands, { version: "0" })(args).pipe(
20
19
  Effect.provide(
@@ -29,7 +28,6 @@ describe("the commands", () => {
29
28
  "print each build a member may see as a line of JSON, until stopped",
30
29
  () =>
31
30
  Effect.gen(function* () {
32
- // A watch runs until it is stopped, as Ctrl-C stops it: here, by interrupting it.
33
31
  const watching = yield* Effect.forkChild(
34
32
  run("grace", ["watch", "build.finished"])
35
33
  );
@@ -47,7 +45,6 @@ describe("the commands", () => {
47
45
  yield* TestClock.adjust("5 seconds");
48
46
  yield* Fiber.interrupt(watching);
49
47
 
50
- // Each line carries its cursor: `--cursor` given it resumes after that build.
51
48
  const lines = yield* Schema.decodeUnknownEffect(
52
49
  Schema.Array(Schema.fromJsonString(Schema.Unknown))
53
50
  )(yield* TestConsole.logLines);
@@ -65,7 +62,6 @@ describe("the commands", () => {
65
62
  Effect.gen(function* () {
66
63
  yield* run("ada", ["start-build", "--pipeline", "api"]);
67
64
 
68
- // stdout holds the answer alone, so `builds start-build ... | jq` reads the build.
69
65
  expect(yield* TestConsole.logLines).toStrictEqual([
70
66
  JSON.stringify(
71
67
  { id: "build-1", pipeline: "api", status: "passed" },
@@ -94,7 +90,6 @@ describe("the commands", () => {
94
90
  ]);
95
91
  yield* run("ada", ["tail-log", "--build-id", "build-1"]);
96
92
 
97
- // A line per element, as JSON Lines: `builds tail-log ... | jq -r .line` prints the log.
98
93
  expect((yield* TestConsole.logLines).slice(1)).toStrictEqual([
99
94
  '{"line":"failed"}',
100
95
  ]);
@@ -42,7 +42,6 @@ it.effect(
42
42
  },
43
43
  ]);
44
44
 
45
- // The stream ended, and with it grace's standing by.
46
45
  const later = yield* client
47
46
  .requestDeploy({ environment: "production", version: "1.1.0" })
48
47
  .pipe(as("ada"));
@@ -14,7 +14,6 @@ import { inMemory } from "./support/memory.js";
14
14
 
15
15
  const served = Testing.layer(routes).pipe(Layer.provide(inMemory()));
16
16
 
17
- // One client of the binding per member: the token is the member, as in production.
18
17
  const as = (token: string) =>
19
18
  ActionHttp.client(Http, {
20
19
  transformClient: HttpClient.mapRequest(
@@ -30,12 +29,10 @@ describe("the service, over HTTP", () => {
30
29
  const ada = yield* as("ada");
31
30
  const grace = yield* as("grace");
32
31
 
33
- // `watch` asks for `text/event-stream`, and the route holds the stream open.
34
32
  const watched = yield* grace
35
33
  .watch(BuildFinished)
36
34
  .pipe(Stream.take(1), Stream.runCollect, Effect.forkChild);
37
35
 
38
- // The watch starts from now: let it take its first position before builds finish.
39
36
  yield* TestClock.adjust("0 millis");
40
37
  yield* ada.finishBuild({ pipeline: "api", status: "passed" });
41
38
  yield* ada.finishBuild({ pipeline: "web", status: "passed" });
@@ -53,7 +50,6 @@ describe("the service, over HTTP", () => {
53
50
  const ada = yield* as("ada");
54
51
  const grace = yield* as("grace");
55
52
 
56
- // `mode: "poll"` asks for a page at a time, as a client that cannot hold a stream does.
57
53
  const polled = yield* grace
58
54
  .watch(
59
55
  DeployRequested,
@@ -14,9 +14,6 @@ import { inMemory, settled } from "./support/memory.js";
14
14
  describe("the notifier, by webhook", () => {
15
15
  it.effect("is told of each failed build its member may see", () =>
16
16
  Effect.gen(function* () {
17
- // Both services in memory: build-events POSTs to the notifier's routes, and the notifier
18
- // calls build-events. Each one's client reaches the other, a cycle no layer builds, so
19
- // the notifier's client waits for build-events' to be handed over.
20
17
  const toBuildEvents = yield* Deferred.make<HttpClient.HttpClient>();
21
18
 
22
19
  const handedOver = Layer.succeed(
@@ -34,8 +31,6 @@ describe("the notifier, by webhook", () => {
34
31
  publicUrl: "https://hooks.example.com",
35
32
  }).pipe(Layer.provide(handedOver));
36
33
 
37
- // The notices and the watch's cursor are provided around both, so the test reads the ones
38
- // the notifier writes.
39
34
  const services = Testing.layer(routes).pipe(
40
35
  Layer.provide(inMemory(Testing.layer(notifierRoutes))),
41
36
  Layer.provideMerge(
@@ -49,7 +44,6 @@ describe("the notifier, by webhook", () => {
49
44
  const notices = yield* Notices;
50
45
  const cursors = yield* KeyValueStore.KeyValueStore;
51
46
 
52
- // The notifier's watch keeps a position once it is subscribed.
53
47
  yield* settled(cursors.has("failed-builds"));
54
48
 
55
49
  const ada = yield* ActionHttp.client(Http, {
@@ -60,11 +54,9 @@ describe("the notifier, by webhook", () => {
60
54
 
61
55
  yield* ada.finishBuild({ pipeline: "api", status: "failed" });
62
56
  yield* ada.finishBuild({ pipeline: "web", status: "passed" });
63
- // Each build finished notifies `build.finished`: it is POSTed at once, no poll awaited.
64
57
  yield* ada.finishBuild({ pipeline: "web", status: "failed" });
65
58
  yield* settled(Effect.map(notices.all, (all) => all.length > 0));
66
59
 
67
- // grace sees the web pipeline alone, and the notifier asked for failures alone.
68
60
  expect(yield* notices.all).toStrictEqual([
69
61
  { id: "build-3", pipeline: "web", status: "failed" },
70
62
  ]);
@@ -72,7 +64,6 @@ describe("the notifier, by webhook", () => {
72
64
  yield* ada.finishBuild({ pipeline: "web", status: "failed" });
73
65
  yield* settled(Effect.map(notices.all, (all) => all.length > 1));
74
66
 
75
- // Once build-4 is read, build-3 is handled: a restart resumes after the third build.
76
67
  expect(yield* cursors.get("failed-builds")).toMatch(/:3$/u);
77
68
  }).pipe(Effect.provide(services));
78
69
  })