Skip to content

Commit dc77580

Browse files
committed
test(server): tailer truncation test no longer waits on the live clock
Completing the stop deferred after the rewrite triggers the final read directly, so the test does not depend on the 250ms poll.
1 parent 3a6b3e8 commit dc77580

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeTaskOutputTail.test.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const makeTaskFile = Effect.gen(function* () {
2020
return { root, tasks, file: path.join(tasks, `${TASK_ID}.output`) };
2121
});
2222

23-
// TestClock cannot interleave with real filesystem I/O; use the live clock.
23+
// TestClock cannot interleave with real filesystem I/O; tests that wait on a poll use the live clock.
2424
describe("tailClaudeTaskOutput", () => {
2525
it.live("follows a file that appears after the task starts, across split characters", () =>
2626
Effect.scoped(
@@ -48,7 +48,7 @@ describe("tailClaudeTaskOutput", () => {
4848
).pipe(Effect.provide(NodeServices.layer)),
4949
);
5050

51-
it.live("drops a split character when the file is truncated and rewritten", () =>
51+
it.effect("drops a split character when the file is truncated and rewritten", () =>
5252
Effect.scoped(
5353
Effect.gen(function* () {
5454
const fileSystem = yield* FileSystem.FileSystem;
@@ -57,16 +57,18 @@ describe("tailClaudeTaskOutput", () => {
5757
// End the first read inside the two-byte é.
5858
yield* fileSystem.writeFile(file, new TextEncoder().encode("café").subarray(0, 4));
5959
const chunks = yield* Queue.unbounded<string>();
60+
const stop = yield* Deferred.make<void>();
6061
yield* tailClaudeTaskOutput({
6162
root,
6263
sessionId: SESSION_ID,
6364
taskId: TASK_ID,
64-
stop: yield* Deferred.make<void>(),
65+
stop,
6566
onChunk: (chunk) => Queue.offer(chunks, chunk),
6667
}).pipe(Effect.forkScoped);
6768
assert.equal(yield* Queue.take(chunks), "caf");
6869

6970
yield* fileSystem.writeFileString(file, "ok\n");
71+
yield* Deferred.succeed(stop, undefined);
7072
assert.equal(yield* Queue.take(chunks), "ok\n");
7173
}),
7274
).pipe(Effect.provide(NodeServices.layer)),

0 commit comments

Comments
 (0)