Open History to see the last commit
1// @effect-diagnostics nodeBuiltinImport:off - Measures real local HTTP/WebSocket sockets.
2import * as NodeHttp from "node:http";
3import * as NodeUtil from "node:util";
4import { assert, it } from "@effect/vitest";
5import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
6import * as NodeHttpPlatform from "@effect/platform-node/NodeHttpPlatform";
7import * as NodeServices from "@effect/platform-node/NodeServices";
8import {
9 ORCHESTRATION_PROTOCOL_HEADER,
10 ORCHESTRATION_PROTOCOL_VERSION,
11 AuthSessionId,
12 AuthOrchestrationReadScope,
13 EnvironmentHttpApi,
14 EnvironmentId,
15 EnvironmentAuthenticatedAuth,
16 EnvironmentAuthenticatedPrincipal,
17 ORCHESTRATION_V2_WS_METHODS,
18 OrchestrationV2RpcSchemas,
19 OrchestrationV2ThreadBoundedSnapshot,
20 OrchestrationV2ThreadDetailSnapshot,
21 OrchestrationV2ThreadHistoryPage,
22 OrchestrationV2ShellSnapshot,
23 OrchestrationV2GetThreadProjectionError,
24 OrchestrationV2GetShellSnapshotError,
25 ProviderDriverKind,
26 type OrchestrationV2ThreadStreamItem,
27 type OrchestrationV2ShellStreamItem,
28} from "@t3tools/contracts";
29import * as Context from "effect/Context";
30import * as Config from "effect/Config";
31import * as Effect from "effect/Effect";
32import * as FileSystem from "effect/FileSystem";
33import * as Layer from "effect/Layer";
34import * as PubSub from "effect/PubSub";
35import * as Queue from "effect/Queue";
36import * as Schema from "effect/Schema";
37import * as Scope from "effect/Scope";
38import * as Stream from "effect/Stream";
39import * as HttpApi from "effect/http-api/HttpApi";
40import * as HttpApiBuilder from "effect/http-api/HttpApiBuilder";
41import { HttpRouter, HttpServer } from "effect/http";
42import { Rpc, RpcGroup, RpcServer, RpcSerialization } from "effect/rpc";
43import * as ServerEnvironment from "../src/environment/ServerEnvironment.ts";
44import * as SqlitePersistence from "../src/persistence/Sqlite.ts";
45import * as OrchestrationEventStore from "../src/persistence/OrchestrationEventStore.ts";
46import * as EventStore from "../src/orchestration-v2/EventStore.ts";
47import * as EventSink from "../src/orchestration-v2/EventSink.ts";
48import * as ProjectionStore from "../src/orchestration-v2/ProjectionStore.ts";
49import * as ThreadManagementService from "../src/orchestration-v2/ThreadManagementService.ts";
50import * as ProjectStore from "../src/orchestration-v2/ProjectStore.ts";
51import * as ProjectService from "../src/project/ProjectService.ts";
52import * as ProjectEnrichmentService from "../src/project/ProjectEnrichmentService.ts";
53import * as OrchestrationHttp from "../src/orchestration-v2/http.ts";
54import * as ServerHttp from "../src/http.ts";
55import { subscribeOrchestrationV2Thread, subscribeOrchestrationV2Shell } from "../src/ws.ts";
56import {
57 measureHttpGet,
58 openMeasuredWsClient,
59 type HttpTransferMeasurement,
60 type MeasuredWsClient,
61} from "./NetworkTransferMeasurement.integration.ts";
62import { makeSqlStatementCounter } from "./SqlStatementCounter.integration.ts";
63import {
64 formatTransferBudgetReport,
65 formatTransferBudgetResult,
66 transferBudgetViolations,
67 type TransferBudgetRun,
68} from "./TransferBudgetReport.integration.ts";
69import { TRANSFER_HISTORY_TURN_COUNT } from "./fixtures/transferBudget.ts";
70import {
71 LONG_TURN_THREAD_ID,
72 longTurnThreadBatches,
73 SHELL_IDLE_SUBAGENTS,
74 SHELL_SETTLED_THREADS,
75 shellFleetEvents,
76 STALE_TODO_LAST_FINISHED_CHECKPOINT_ID,
77 STALE_TODO_LIVE_RUN_ID,
78 STALE_TODO_SUBAGENTS_PER_RUN,
79 STALE_TODO_THREAD_ID,
80 staleTodoListThreadBatches,
81 THREAD_ID,
82 threadCreated,
83 turnEvents,
84} from "./TransferBudgetV2Fixture.integration.ts";
85
86// The opt-ins current web and mobile clients send; keep in sync with client-runtime's
87// boundedThreadSnapshotHttp.ts, threadHistoryHttp.ts, shellSnapshotHttp.ts, threads.ts and shell.ts.
88const CLIENT_BOUNDED_QUERY = "compactTurnItems=1&dedupeBodies=1&compactIds=1";
89const CLIENT_HISTORY_QUERY = "compactIds=1";
90const CLIENT_SHELL_QUERY = "omitIdleSubagents=1&omitOlderSettled=1";
91
92const decodeThreadSnapshot = Schema.decodeUnknownEffect(
93 Schema.fromJsonString(Schema.toCodecJson(OrchestrationV2ThreadDetailSnapshot)),
94);
95const decodeBoundedSnapshot = Schema.decodeUnknownEffect(
96 Schema.fromJsonString(Schema.toCodecJson(OrchestrationV2ThreadBoundedSnapshot)),
97);
98const decodeHistoryPage = Schema.decodeUnknownEffect(
99 Schema.fromJsonString(Schema.toCodecJson(OrchestrationV2ThreadHistoryPage)),
100);
101const decodeShellSnapshot = Schema.decodeUnknownEffect(
102 Schema.fromJsonString(Schema.toCodecJson(OrchestrationV2ShellSnapshot)),
103);
104
105const layerPersistence = EventSink.layer.pipe(
106 Layer.provideMerge(EventStore.layerFromOrchestrationEventStore),
107 Layer.provideMerge(ProjectionStore.layer),
108 Layer.provideMerge(OrchestrationEventStore.layer),
109 Layer.provideMerge(SqlitePersistence.layerMemory),
110);
111const layerManagement = Layer.unwrap(
112 Effect.gen(function* () {
113 const projections = yield* ProjectionStore.ProjectionStoreV2;
114 const sink = yield* EventSink.EventSinkV2;
115 return Layer.mock(ThreadManagementService.ThreadManagementService)({
116 ensureLegacyTranscript: () => Effect.void,
117 getThreadSnapshot: (id) => projections.getThreadSnapshot(id).pipe(Effect.orDie),
118 getThreadSnapshotWindow: (id, options) =>
119 projections.getThreadSnapshotWindow(id, options).pipe(Effect.orDie),
120 getThreadHistoryPage: (id, cursor, throughEntryId, conversationOnly) =>
121 projections
122 .getThreadHistoryPage(id, cursor, throughEntryId, conversationOnly)
123 .pipe(Effect.orDie),
124 getThreadShell: (id) => projections.getThreadShell(id).pipe(Effect.orDie),
125 getShellSnapshot: (options) => projections.getShellSnapshot(options).pipe(Effect.orDie),
126 listActiveShellIndex: () => projections.listActiveShellIndex().pipe(Effect.orDie),
127 listActiveSubagentThreadIds: () =>
128 projections.listActiveSubagentThreadIds().pipe(Effect.orDie),
129 readShellSnapshot: (options) =>
130 projections.readShellSnapshot(options).pipe(Effect.map(Effect.orDie), Effect.orDie),
131 streamStoredEventsFrom: (input) =>
132 sink.stream({ ...input, bounded: true }).pipe(Stream.orDie),
133 });
134 }),
135);
136const layerEnrichment = Layer.unwrap(
137 Effect.gen(function* () {
138 const changes = yield* PubSub.unbounded<never>();
139 return Layer.mock(ProjectEnrichmentService.ProjectEnrichmentService)({
140 getAvailable: () =>
141 Effect.succeed({
142 repositoryIdentity: null,
143 faviconPath: null,
144 repositoryIdentityResolved: true,
145 }),
146 subscribeChanges: PubSub.subscribe(changes),
147 });
148 }),
149);
150const layerServices = layerManagement.pipe(
151 Layer.provideMerge(
152 Layer.succeed(ServerEnvironment.ServerEnvironmentIdentity, {
153 getEnvironmentId: Effect.succeed(EnvironmentId.make("transfer-test")),
154 }),
155 ),
156 Layer.provideMerge(ProjectStore.layer),
157 Layer.provideMerge(Layer.mock(ProjectService.ProjectService)({})),
158 Layer.provideMerge(layerEnrichment),
159 Layer.provideMerge(layerPersistence),
160);
161class TransferApi extends HttpApi.make("environment").add(
162 EnvironmentHttpApi.groups.orchestration,
163) {}
164const layerAuth = Layer.succeed(EnvironmentAuthenticatedAuth, (effect) =>
165 effect.pipe(
166 Effect.provideService(EnvironmentAuthenticatedPrincipal, {
167 sessionId: AuthSessionId.make("transfer-session"),
168 subject: "transfer-test",
169 method: "browser-session-cookie",
170 scopes: new Set([AuthOrchestrationReadScope]),
171 }),
172 ),
173);
174const group = RpcGroup.make(
175 Rpc.make(ORCHESTRATION_V2_WS_METHODS.subscribeThread, {
176 payload: OrchestrationV2RpcSchemas.subscribeThread.input,
177 success: OrchestrationV2RpcSchemas.subscribeThread.output,
178 error: OrchestrationV2GetThreadProjectionError,
179 stream: true,
180 }),
181 Rpc.make(ORCHESTRATION_V2_WS_METHODS.subscribeShell, {
182 payload: OrchestrationV2RpcSchemas.subscribeShell.input,
183 success: OrchestrationV2RpcSchemas.subscribeShell.output,
184 error: OrchestrationV2GetShellSnapshotError,
185 stream: true,
186 }),
187);
188const layerHandlers = group.toLayer({
189 [ORCHESTRATION_V2_WS_METHODS.subscribeThread]: (input) =>
190 Stream.unwrap(subscribeOrchestrationV2Thread(input)),
191 [ORCHESTRATION_V2_WS_METHODS.subscribeShell]: (input) =>
192 Stream.unwrap(subscribeOrchestrationV2Shell(input)),
193});
194const layerRoutes = Layer.mergeAll(
195 HttpApiBuilder.layer(TransferApi).pipe(
196 Layer.provide(OrchestrationHttp.layer),
197 Layer.provide(layerAuth),
198 ),
199 RpcServer.layerHttp({ group, path: "/ws", protocol: "websocket" }).pipe(
200 Layer.provide(layerHandlers),
201 Layer.provide(RpcSerialization.layerJson),
202 ),
203).pipe(Layer.provide(ServerHttp.layerHttpCompression), Layer.provide(NodeHttpPlatform.layer));
204
205function difference(
206 after: { wireBytes: number; decodedBytes: number; messages: number },
207 before: typeof after,
208) {
209 return {
210 wireBytes: after.wireBytes - before.wireBytes,
211 decodedBytes: after.decodedBytes - before.decodedBytes,
212 messages: after.messages - before.messages,
213 };
214}
215type StreamItem = OrchestrationV2ThreadStreamItem | OrchestrationV2ShellStreamItem;
216const collectUntil = Effect.fn("transfer.collectUntil")(function* <T extends StreamItem>(
217 queue: Queue.Queue<T>,
218 done: (item: T) => boolean,
219) {
220 const items: T[] = [];
221 while (true) {
222 const item = yield* Queue.take(queue);
223 items.push(item);
224 if (done(item)) return items;
225 }
226});
227const subscribe = Effect.fn("transfer.subscribe")(function* (
228 client: MeasuredWsClient,
229 kind: "thread" | "shell",
230 afterSequence: number,
231) {
232 const queue = yield* Queue.unbounded<StreamItem>();
233 const stream: Stream.Stream<StreamItem, unknown> =
234 kind === "thread"
235 ? client.client[ORCHESTRATION_V2_WS_METHODS.subscribeThread]({
236 threadId: THREAD_ID,
237 afterSequence,
238 requestCompletionMarker: true,
239 acceptBoundedSnapshot: true,
240 acceptCompactTurnItems: true,
241 acceptCompactIds: true,
242 acceptDedupedBodies: true,
243 })
244 : client.client[ORCHESTRATION_V2_WS_METHODS.subscribeShell]({
245 afterSequence,
246 requestCompletionMarker: true,
247 omitIdleSubagents: true,
248 omitOlderSettled: true,
249 });
250 yield* stream.pipe(
251 Stream.runForEach((item) => Queue.offer(queue, item)),
252 Scope.provide(client.scope),
253 Effect.forkIn(client.scope),
254 );
255 return queue;
256});
257const synchronized = (queue: Queue.Queue<StreamItem>) =>
258 collectUntil(queue, (item) => item.kind === "synchronized").pipe(
259 Effect.map((items) =>
260 items.some((item) => item.kind === "snapshot") ? ("snapshot" as const) : ("replay" as const),
261 ),
262 );
263
264it.live("reports V2 thread HTTP and WebSocket transfer budgets", () =>
265 Effect.gen(function* () {
266 const runs: TransferBudgetRun[] = [];
267 for (const provider of [
268 ProviderDriverKind.make("codex"),
269 ProviderDriverKind.make("claudeAgent"),
270 ]) {
271 const counter = makeSqlStatementCounter();
272 const run = yield* Effect.scoped(
273 Effect.gen(function* () {
274 const sink = yield* EventSink.EventSinkV2;
275 const projection = yield* ProjectionStore.ProjectionStoreV2;
276 yield* sink.write({ events: [threadCreated(provider)] });
277 for (let index = 0; index < TRANSFER_HISTORY_TURN_COUNT; index++)
278 yield* sink.write({ events: turnEvents(provider, index, false) });
279 const context = yield* Effect.context<Layer.Success<typeof layerServices>>();
280 const server = yield* Layer.build(
281 HttpRouter.serve(layerRoutes, { disableListenLog: true }).pipe(
282 Layer.provide(Layer.succeedContext(context)),
283 Layer.provideMerge(
284 NodeHttpServer.layer(NodeHttp.createServer, {
285 host: "127.0.0.1",
286 port: 0,
287 websocket: { perMessageDeflate: true },
288 }),
289 ),
290 ),
291 );
292 const address = Context.get(server, HttpServer.HttpServer).address;
293 if (!("port" in address)) return yield* Effect.die("Expected TCP server");
294 const base = `http://127.0.0.1:${address.port}`;
295 const threadSnapshot = yield* measureHttpGet({
296 url: `${base}/api/orchestration/threads/${THREAD_ID}`,
297 headers: { [ORCHESTRATION_PROTOCOL_HEADER]: String(ORCHESTRATION_PROTOCOL_VERSION) },
298 });
299 assert.equal(
300 threadSnapshot.status,
301 200,
302 Buffer.from(threadSnapshot.decodedBody).toString(),
303 );
304 assert.equal(threadSnapshot.contentEncoding, "gzip");
305 const decodedThread = yield* decodeThreadSnapshot(
306 Buffer.from(threadSnapshot.decodedBody).toString(),
307 );
308 assert.equal(decodedThread.projection.messages.length, TRANSFER_HISTORY_TURN_COUNT * 2);
309 assert.equal(decodedThread.projection.turnItems.length, TRANSFER_HISTORY_TURN_COUNT * 6);
310 assert.notInclude(Buffer.from(threadSnapshot.decodedBody).toString(), "digest=");
311 const shellSnapshot = yield* measureHttpGet({
312 url: `${base}/api/orchestration/shell`,
313 headers: { [ORCHESTRATION_PROTOCOL_HEADER]: String(ORCHESTRATION_PROTOCOL_VERSION) },
314 });
315 assert.equal(shellSnapshot.status, 200);
316 const decodedShell = yield* decodeShellSnapshot(
317 Buffer.from(shellSnapshot.decodedBody).toString(),
318 );
319 assert.equal(decodedShell.threads.length, 1);
320 const sequence = decodedThread.snapshotSequence;
321 assert.equal(decodedShell.snapshotSequence, sequence);
322 const url = `${base.replace("http:", "ws:")}/ws`;
323 const thread = yield* openMeasuredWsClient({ url, cookie: "" });
324 const shell = yield* openMeasuredWsClient({ url, cookie: "" });
325 const second = yield* openMeasuredWsClient({ url, cookie: "" });
326 assert.include(thread.recorder.negotiatedExtensions(), "permessage-deflate");
327 const tq = yield* subscribe(thread, "thread", sequence);
328 const sq = yield* subscribe(shell, "shell", sequence);
329 const ttq = yield* subscribe(second, "thread", sequence);
330 const ssq = yield* subscribe(second, "shell", sequence);
331 for (const queue of [tq, sq, ttq, ssq])
332 assert.equal(yield* synchronized(queue), "replay");
333 const threadBefore = thread.recorder.totals();
334 const shellBefore = shell.recorder.totals();
335 const secondBefore = second.recorder.totals();
336 const sqlBefore = counter.count();
337 const events = turnEvents(provider, TRANSFER_HISTORY_TURN_COUNT, true);
338 const stored = yield* sink.write({ events });
339 const last = stored.at(-1)!;
340 const threadTerminal = (item: StreamItem) =>
341 "sequence" in item && item.sequence >= last.sequence;
342 // Shell items carry the shell read when their batch is projected, and unchanged
343 // shells are skipped, so a turn split across batches may never yield an item at
344 // the last sequence. Wait for the final shell instead.
345 const finalShell = yield* projection.getThreadShell(THREAD_ID);
346 const shellTerminal = (item: StreamItem) =>
347 item.kind === "thread.updated" && NodeUtil.isDeepStrictEqual(item.thread, finalShell);
348 const liveTurn = yield* collectUntil(tq, threadTerminal);
349 yield* collectUntil(ttq, threadTerminal);
350 // A direct check, so live dedupe stays guarded however small the turn gets.
351 const liveAnswer = liveTurn.flatMap((item) =>
352 item.kind === "event" &&
353 item.event.type === "turn-item.updated" &&
354 item.event.payload.type === "assistant_message"
355 ? [item.event.payload]
356 : [],
357 );
358 assert.equal(liveAnswer.length, 1);
359 assert.equal(liveAnswer[0]!.textOmitted, true);
360 for (const queue of [sq, ssq]) yield* collectUntil(queue, shellTerminal);
361 const measuredTurnWebSocket = difference(thread.recorder.totals(), threadBefore);
362 const measuredTurnShellWebSocket = difference(shell.recorder.totals(), shellBefore);
363 const measuredTurnSecondClientWebSocket = difference(
364 second.recorder.totals(),
365 secondBefore,
366 );
367 const measuredTurnSqlStatements = counter.count() - sqlBefore;
368 const durable = yield* projection.getThreadProjection(THREAD_ID);
369 assert.isTrue(
370 durable.turnItems.some(
371 (item) =>
372 item.type === "dynamic_tool" && JSON.stringify(item.output).length > 1_000_000,
373 ),
374 );
375 yield* second.close;
376 const reconnectSqlStart = counter.count();
377 const resumedThread = yield* openMeasuredWsClient({ url, cookie: "" });
378 const resumedShell = yield* openMeasuredWsClient({ url, cookie: "" });
379 const rq = yield* subscribe(resumedThread, "thread", sequence);
380 const rsq = yield* subscribe(resumedShell, "shell", sequence);
381 const threadMode = yield* synchronized(rq);
382 const shellMode = yield* synchronized(rsq);
383 const reconnectThread = { ...resumedThread.recorder.totals(), mode: threadMode };
384 const reconnectShell = { ...resumedShell.recorder.totals(), mode: shellMode };
385 const reconnectSqlStatements = counter.count() - reconnectSqlStart;
386 assert.equal(threadMode, "snapshot");
387
388 for (const events of longTurnThreadBatches(provider)) yield* sink.write({ events });
389 const get = (path: string) =>
390 measureHttpGet({
391 url: `${base}${path}`,
392 headers: { [ORCHESTRATION_PROTOCOL_HEADER]: String(ORCHESTRATION_PROTOCOL_VERSION) },
393 }).pipe(Effect.tap((http) => Effect.sync(() => assert.equal(http.status, 200))));
394 const decoded = (http: HttpTransferMeasurement) =>
395 Buffer.from(http.decodedBody).toString();
396 const longTurnPath = `/api/orchestration/threads/${LONG_TURN_THREAD_ID}`;
397 const readColdOpen = (query: string) =>
398 Effect.gen(function* () {
399 const http = yield* get(`${longTurnPath}/bounded?${query}`);
400 const snapshot = yield* decodeBoundedSnapshot(decoded(http));
401 const rows = snapshot.projection.visibleTurnItems.length;
402 return { http, rows, cursor: snapshot.historyCursor };
403 });
404 const readHistoryPage = (cursor: string, query: string) =>
405 Effect.gen(function* () {
406 const http = yield* get(
407 `${longTurnPath}/history?cursor=${encodeURIComponent(cursor)}&${query}`,
408 );
409 const page = yield* decodeHistoryPage(decoded(http));
410 assert.isTrue(page.hasMoreHistory);
411 return { http, rows: page.items.length };
412 });
413 const readShell = (query: string) =>
414 Effect.gen(function* () {
415 const http = yield* get(`/api/orchestration/shell?${query}`);
416 return { http, rows: (yield* decodeShellSnapshot(decoded(http))).threads.length };
417 });
418
419 const { cursor: _, ...longTurnColdOpenLegacy } =
420 yield* readColdOpen("compactTurnItems=1");
421 const { cursor, ...longTurnColdOpen } = yield* readColdOpen(CLIENT_BOUNDED_QUERY);
422 if (cursor === null) return yield* Effect.die("Expected older long-turn history");
423 const longTurnHistoryPageLegacy = yield* readHistoryPage(cursor, "");
424 const longTurnHistoryPage = yield* readHistoryPage(cursor, CLIENT_HISTORY_QUERY);
425
426 // The transfer thread plus the long-turn thread.
427 const earlierThreads = decodedShell.threads.length + 1;
428 yield* sink.write({ events: shellFleetEvents(provider) });
429 const fleetShellLegacy = yield* readShell("");
430 const fleetShell = yield* readShell(CLIENT_SHELL_QUERY);
431 assert.equal(
432 fleetShellLegacy.rows,
433 earlierThreads + SHELL_SETTLED_THREADS + SHELL_IDLE_SUBAGENTS,
434 );
435
436 for (const events of staleTodoListThreadBatches(provider)) yield* sink.write({ events });
437 const staleTodoHttp = yield* get(
438 `/api/orchestration/threads/${STALE_TODO_THREAD_ID}/bounded?${CLIENT_BOUNDED_QUERY}`,
439 );
440 const staleTodo = (yield* decodeBoundedSnapshot(decoded(staleTodoHttp))).projection;
441 // Clients show the diff of the last finished turn from this record.
442 assert.include(
443 staleTodo.checkpoints.map((checkpoint) => checkpoint.id),
444 STALE_TODO_LAST_FINISHED_CHECKPOINT_ID,
445 );
446 // The caps below also pass when the running turn loses its own tasks.
447 assert.lengthOf(
448 staleTodo.subagents.filter((subagent) => subagent.runId === STALE_TODO_LIVE_RUN_ID),
449 STALE_TODO_SUBAGENTS_PER_RUN,
450 );
451 const staleTodoColdOpen = {
452 http: staleTodoHttp,
453 rows: staleTodo.visibleTurnItems.length,
454 records: {
455 nodes: staleTodo.nodes.length,
456 subagents: staleTodo.subagents.length,
457 plans: staleTodo.plans.length,
458 providerTurns: staleTodo.providerTurns.length,
459 checkpoints: staleTodo.checkpoints.length,
460 },
461 };
462 return {
463 provider,
464 threadSnapshot,
465 shellSnapshot,
466 measuredTurnWebSocket,
467 measuredTurnShellWebSocket,
468 measuredTurnSecondClientWebSocket,
469 measuredTurnSqlStatements,
470 reconnectThread,
471 reconnectShell,
472 reconnectSqlStatements,
473 longTurnColdOpenLegacy,
474 longTurnColdOpen,
475 longTurnHistoryPageLegacy,
476 longTurnHistoryPage,
477 fleetShellLegacy,
478 fleetShell,
479 staleTodoColdOpen,
480 } satisfies TransferBudgetRun;
481 }).pipe(
482 Effect.provide(Layer.fresh(layerServices).pipe(Layer.provideMerge(NodeServices.layer))),
483 Effect.withTracer(counter.tracer),
484 ),
485 );
486 runs.push(run);
487 }
488 const fs = yield* FileSystem.FileSystem;
489 const report = formatTransferBudgetReport(runs);
490 const outputPaths = yield* Config.all({
491 report: Config.String("T3CODE_TRANSFER_BUDGET_REPORT_PATH").pipe(Config.withDefault("")),
492 result: Config.String("T3CODE_TRANSFER_BUDGET_RESULT_PATH").pipe(Config.withDefault("")),
493 });
494 for (const [path, contents] of [
495 [outputPaths.report, report],
496 [outputPaths.result, formatTransferBudgetResult(runs)],
497 ])
498 if (path && contents) yield* fs.writeFileString(path, contents);
499 yield* Effect.log(report);
500 assert.deepEqual(transferBudgetViolations(runs), []);
501 }).pipe(Effect.provide(NodeServices.layer)),
502);