From 389879cd816e323c7b4385ec144d1ce09fe4c33a Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 20 Jul 2026 18:35:11 +0200 Subject: [PATCH] test(orchestrator): align integration fixtures Co-authored-by: codex --- .../Adapters/AcpAdapterV2.test.ts | 12 +++++-- .../ProviderContinuationService.test.ts | 35 +++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts index 2141bc07e4..c3fa477bda 100644 --- a/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts +++ b/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts @@ -19,6 +19,11 @@ import { ThreadId, type OrchestrationV2ProviderThread, } from "@t3tools/contracts"; +import { HostProcessPlatform } from "@t3tools/shared/hostProcess"; +import * as DateTime from "effect/DateTime"; +import * as Crypto from "effect/Crypto"; +import * as Deferred from "effect/Deferred"; +import type * as Duration from "effect/Duration"; import * as Cause from "effect/Cause"; import * as Clock from "effect/Clock"; import * as Crypto from "effect/Crypto"; @@ -444,6 +449,7 @@ function makeTurnInput(input: { describe("AcpAdapterV2", () => { it.live("cleans detached fixtures when an assertion aborts the test scope", () => Effect.gen(function* () { + if ((yield* HostProcessPlatform) !== "linux") return; const fileSystem = yield* FileSystem.FileSystem; let published: ReadonlyArray = []; const failed = yield* Effect.scoped( @@ -648,6 +654,7 @@ describe("AcpAdapterV2", () => { it.live("reaps detached native work when the provider exits before explicit teardown", () => Effect.gen(function* () { + if ((yield* HostProcessPlatform) !== "linux") return; const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner; const fileSystem = yield* FileSystem.FileSystem; const idAllocator = yield* IdAllocatorV2; @@ -730,6 +737,7 @@ describe("AcpAdapterV2", () => { it.live("surfaces reduced guarantee when delegated cgroup containment is unavailable", () => Effect.gen(function* () { + if ((yield* HostProcessPlatform) !== "linux") return; const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner; const fileSystem = yield* FileSystem.FileSystem; const idAllocator = yield* IdAllocatorV2; @@ -7066,7 +7074,7 @@ describe("AcpAdapterV2", () => { it.live("direct Stop skips uninterruptible ACP cancel and recovers after native teardown", () => Effect.gen(function* () { - if (process.platform !== "linux") return; + if ((yield* HostProcessPlatform) !== "linux") return; const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner; const fileSystem = yield* FileSystem.FileSystem; const idAllocator = yield* IdAllocatorV2; @@ -7504,7 +7512,7 @@ describe("AcpAdapterV2", () => { it.live("restart_active terminates native work and reloads a clean runtime", () => Effect.gen(function* () { - if (process.platform !== "linux") return; + if ((yield* HostProcessPlatform) !== "linux") return; const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner; const fileSystem = yield* FileSystem.FileSystem; const idAllocator = yield* IdAllocatorV2; diff --git a/apps/server/src/orchestration-v2/ProviderContinuationService.test.ts b/apps/server/src/orchestration-v2/ProviderContinuationService.test.ts index 79b942709a..f3bbe36438 100644 --- a/apps/server/src/orchestration-v2/ProviderContinuationService.test.ts +++ b/apps/server/src/orchestration-v2/ProviderContinuationService.test.ts @@ -6,6 +6,7 @@ import { type OrchestrationV2ThreadProjection, } from "@t3tools/contracts"; import * as Deferred from "effect/Deferred"; +import * as DateTime from "effect/DateTime"; import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; import * as Option from "effect/Option"; @@ -190,4 +191,38 @@ describe("ProviderContinuationService", () => { ); }); }); + + it.effect("clears a sticky continuation offer when its thread is archived", () => { + return Effect.gen(function* () { + const dispatched = yield* Queue.unbounded(); + const cleared = yield* Ref.make(false); + yield* Effect.gen(function* () { + const requests = yield* ProviderContinuationRequests; + yield* requests.offer({ + ...request(), + clearIfCurrent: () => Ref.set(cleared, true), + }); + for (let attempt = 0; attempt < 20 && !(yield* Ref.get(cleared)); attempt += 1) { + yield* Effect.yieldNow; + } + assert.isTrue(yield* Ref.get(cleared)); + assert.isTrue(Option.isNone(yield* Queue.poll(dispatched))); + }).pipe( + Effect.provide( + testLayer({ + dispatched, + getThreadProjection: () => + Effect.succeed({ + ...projection, + thread: { + ...projection.thread, + archivedAt: DateTime.makeUnsafe("2026-07-20T00:00:00.000Z"), + }, + }), + }), + ), + Effect.scoped, + ); + }); + }); });