|
| 1 | +import * as NodeServices from "@effect/platform-node/NodeServices"; |
1 | 2 | import { describe, it, assert } from "@effect/vitest"; |
2 | 3 | import { |
3 | 4 | ProviderDriverKind, |
@@ -560,6 +561,43 @@ describe("providerMaintenanceRunner", () => { |
560 | 561 | ); |
561 | 562 | }); |
562 | 563 |
|
| 564 | + it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")( |
| 565 | + "runs the updater with no stdin, so a command that reads it cannot wait forever", |
| 566 | + () => |
| 567 | + Effect.gen(function* () { |
| 568 | + const { registry } = yield* makeRegistry(baseProvider); |
| 569 | + const updater = yield* makeTestRunner({ |
| 570 | + ...registry, |
| 571 | + getProviderMaintenanceCapabilitiesForInstance: (_instanceId, provider) => |
| 572 | + Effect.succeed({ |
| 573 | + ...lifecycleFor(provider), |
| 574 | + update: { |
| 575 | + command: "codex update", |
| 576 | + executable: "/bin/sh", |
| 577 | + // An open pipe here would block a CLI that reads stdin until the update times out. |
| 578 | + args: ["-c", "[ -c /dev/stdin ] || { echo 'stdin is an open pipe' >&2; exit 1; }"], |
| 579 | + lockKey: "codex-native", |
| 580 | + }, |
| 581 | + }), |
| 582 | + }); |
| 583 | + |
| 584 | + const result = yield* updater.updateProvider(CODEX_DRIVER); |
| 585 | + // The registry reports no new version, so a command that exits 0 ends as "unchanged". |
| 586 | + assert.strictEqual( |
| 587 | + result.providers[0]?.updateState?.message, |
| 588 | + "Update command completed, but T3 Code still detects an outdated provider version.", |
| 589 | + ); |
| 590 | + }).pipe( |
| 591 | + Effect.provide( |
| 592 | + Layer.mergeAll( |
| 593 | + NodeServices.layer, |
| 594 | + layerNonWindowsPlatform, |
| 595 | + layerLatestVersionHttpClient("1.0.0"), |
| 596 | + ), |
| 597 | + ), |
| 598 | + ), |
| 599 | + ); |
| 600 | + |
563 | 601 | it.effect("re-resolves ownership before running and executes the fresh command", () => { |
564 | 602 | const calls: Array<{ command: string; args: ReadonlyArray<string> }> = []; |
565 | 603 | const fresh: Array<boolean> = []; |
|
0 commit comments