Repository navigation
pty ipc test fs mock: lstatSync and copyFileSync (Fixes #74) - #75
Merged
nachumi-a2zoperations merged 1 commit intoNov 17, 2026
Conversation
pty-pane-restart-carry.test.ts (PR #72) runs real window-route restarts, which reach codex's TOML trust write; it lstats the config (symlink check) and keeps a rolling backup (copyFileSync). Neither was on the shared fs mock, so every row logged a caught "[agent-trust] ... No lstatSync/copyFileSync export" to stderr. lstatSync answers like the mock's stat (ENOENT for a path the fake filesystem lacks; never a symlink); copyFileSync is a no-op, as a copy is invisible in the fake filesystem. Both are plain functions, so the harness's mock resets cannot drop them. Across the 22 test files that use this mock, the missing-export lines go from 3 to 0 (all three were the carry test's rows); pass counts are unchanged (50 passed, 1 skipped, before and after), so no row depended on the throw. Fixes #74 Signed-off-by: Nachumi Eliyahu <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #74 (the nit from PR #72's Reviewer PASS). Test-only: no product code.
Cause
pty-pane-restart-carry.test.ts(PR carry-over follow-ups: carriesFrom only for a proven PTY, attach rows, claim-unmatched line (Fixes #70) #72) runs real window-route restarts withcommand: 'codex', which reach codex's TOML trust write (upsertOrcaCreatedProjectTrustLevel→writeTomlConfigAtomically). That write:lstatSyncs the config (resolveTomlWritePath: symlinks are preserved);writeRollingFileBackup→copyFileSync).fsModuleMock(pty-ipc-mock-registry.ts), so every row logged a caught[agent-trust] codex trust for /tmp/restart failed; the agent will ask Error: [vitest] No "lstatSync" export is defined on the "fs" mock.lstatSyncadded, the next missing export wascopyFileSync, so both are added.pty-pane-restart-replace.test.tsstayed quiet because its rows are refused before the spawn.Fix (the mock only)
lstatSync(path): like the mock's stat.ENOENTfor a path the fake filesystem lacks (existsSyncMock); otherwisestatSyncMock(path)withisSymbolicLink: () => false, since the fake filesystem has no symlinks. It mirrors the existingfsPromisesModuleMock.stat.copyFileSync: a no-op (a copy is invisible in the fake filesystem).vi.fn, so the harness's mock resets cannot drop them.Red first, and no row depended on the throw (local, MacBook, Node 24.22.1 +
--config; the Reviewer's Dell run is the evidence)--silent=false.[agent-trust] … No "lstatSync" exportlines (one per row). After the fix: 0, and 3/3 pass.fsModuleMock:Gates (MacBook, Node 24.22.1, no override)
pnpm check:changed --base=origin/blowzer/fork-only: 23/23 at 193f775.