Created
July 27, 2026 23:59
-
-
Save arikon/776891c3d2420cabf5ce0903fd76dfa5 to your computer and use it in GitHub Desktop.
oh-my-codex #3329: deterministic smoke candidate-budget regression
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From 537458dd0e1b58ec7671ca517371c516a8fb65a5 Mon Sep 17 00:00:00 2001 | |
| From: Sergey Belov <peimei@ya.ru> | |
| Date: Tue, 28 Jul 2026 01:58:20 +0200 | |
| Subject: [PATCH] test(smoke): isolate candidate budget from deadline | |
| --- | |
| .../__tests__/smoke-packed-install.test.ts | 24 ++++++++++--------- | |
| 1 file changed, 13 insertions(+), 11 deletions(-) | |
| diff --git a/src/scripts/__tests__/smoke-packed-install.test.ts b/src/scripts/__tests__/smoke-packed-install.test.ts | |
| index 40674072..9c5f7c92 100644 | |
| --- a/src/scripts/__tests__/smoke-packed-install.test.ts | |
| +++ b/src/scripts/__tests__/smoke-packed-install.test.ts | |
| @@ -1,6 +1,6 @@ | |
| // @ts-nocheck | |
| import assert from 'node:assert/strict'; | |
| -import { access, chmod, mkdtemp, mkdir, readFile, rm, symlink, writeFile } from 'node:fs/promises'; | |
| +import { chmod, mkdtemp, mkdir, readFile, rm, symlink, writeFile } from 'node:fs/promises'; | |
| import { EventEmitter } from 'node:events'; | |
| import { tmpdir } from 'node:os'; | |
| import { delimiter, join } from 'node:path'; | |
| @@ -714,24 +714,26 @@ test('packed lifecycle fails before probing the 33rd unique PATH candidate', asy | |
| if (process.platform === 'win32') return; | |
| const root = await mkdtemp(join(tmpdir(), 'omx-codex-candidate-budget-')); | |
| const candidateDirs = Array.from({ length: 33 }, (_value, index) => join(root, `candidate-${index}`)); | |
| - const thirtyThirdProbe = join(root, '33rd-candidate-was-probed'); | |
| + const spawnCalls: string[] = []; | |
| try { | |
| await Promise.all(candidateDirs.map((dir) => mkdir(dir, { recursive: true }))); | |
| - await Promise.all(candidateDirs.map(async (dir, index) => { | |
| + await Promise.all(candidateDirs.map(async (dir) => { | |
| const executable = join(dir, 'codex'); | |
| - await writeFile( | |
| - executable, | |
| - index === candidateDirs.length - 1 | |
| - ? `#!/bin/sh\n: > ${JSON.stringify(thirtyThirdProbe)}\nprintf '%s\\n' 'codex-cli 0.142.5'\n` | |
| - : '#!/bin/sh\nexit 1\n', | |
| - ); | |
| + await writeFile(executable, ''); | |
| await chmod(executable, 0o755); | |
| })); | |
| assert.throws( | |
| - () => probeCodexVersion(root, { PATH: candidateDirs.join(delimiter) }), | |
| + () => probeCodexVersion(root, { PATH: candidateDirs.join(delimiter) }, { | |
| + spawnSyncImpl: ((command: string) => { | |
| + spawnCalls.push(command); | |
| + return { status: 1, stdout: '', stderr: '', error: undefined }; | |
| + }) as never, | |
| + }), | |
| /32-candidate PATH budget/, | |
| ); | |
| - await assert.rejects(access(thirtyThirdProbe)); | |
| + assert.equal(spawnCalls.length, 32); | |
| + assert.deepEqual(spawnCalls, candidateDirs.slice(0, 32).map((dir) => join(dir, 'codex'))); | |
| + assert.equal(spawnCalls.includes(join(candidateDirs[32], 'codex')), false); | |
| } finally { | |
| await rm(root, { recursive: true, force: true }); | |
| } | |
| -- | |
| 2.50.1 (Apple Git-155) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment