Skip to content

test(server): run fake provider CLIs through a Node stub on every host - #9567

Merged
juliusmarminge merged 1 commit into
windows-tests/symlinksfrom
windows-tests/fake-cli
Sep 4, 2026
Merged

test(server): run fake provider CLIs through a Node stub on every host#9567
juliusmarminge merged 1 commit into
windows-tests/symlinksfrom
windows-tests/fake-cli

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 4, 2026

Copy link
Copy Markdown
Member

Seven suites faked a provider CLI with a #!/bin/sh script made executable
by chmod, which Windows cannot run: the shebang is ignored and there is no
extension for PATHEXT to match, so the spawn either failed or fell through
to a real CLI on PATH. CodexTextGeneration's fake was a 120-line sh
argument parser.

Add apps/server/src/testUtils/fakeCli.ts. writeFakeCli writes the CLI's
behaviour as a Node stub and a launcher shaped for the host: a shebang
script on posix, a .cmd shim on Windows, which resolveSpawnCommand already
routes through a shell. execScriptSource covers the common case of handing
over to the mock ACP agent after an argv check. ClaudeTextGeneration, which
had its own .cmd branch, moves onto the shared helper too.

The tests that assert the agent logged SIGTERM on stop are skipped on
Windows, where the child is terminated rather than signalled.

Part of the Windows test-suite stack rooted at #9564; the manual Windows lane comes from #9538.

Model: Claude Fable 5 in Claude Code.

🤖 Generated with Claude Code

Note

Run fake provider CLI fixtures through a shared Node stub on Windows and POSIX hosts

  • Adds a shared writeFakeCli utility in fakeCli.ts that emits a Node stub module plus a platform-appropriate launcher (POSIX shell or Windows .cmd), replacing per-test shell-script generation across provider and text-generation test suites
  • Refactors CursorAdapter, CursorProvider, GrokAdapter, GrokProvider, CodexTextGeneration, CursorTextGeneration, GrokTextGeneration, and ClaudeTextGeneration tests to build their fake agent binaries through the shared writer
  • Adds a Windows .cmd wrapper for the Codex collaboration mock peer and selects it on win32 in the integration test; adds .cmd/.bat CRLF checkout rules in .gitattributes
  • Guards SIGTERM-dependent child-process exit assertions with a win32 skip condition in CursorAdapter, CursorProvider, GrokAdapter, CursorTextGeneration, and CodexCollabRuntime tests, since Windows terminates processes without delivering SIGTERM
  • Risk: the new writeFakeCli writer is the single path for fake CLI creation; any mismatch between the generated Node stub contract and an individual test's expectations (e.g. argument validation in execScriptSource) will surface as fixture failures across all refactored suites

Macroscope summarized b4e082c.


Note

Low Risk
Changes are limited to test fixtures, git attributes, and conditional test skips; no production provider or spawn logic is modified.

Overview
Provider and text-generation tests no longer build fake CLIs with hand-written #!/bin/sh wrappers (and chmod), which fail or hit the real binary on Windows. They now go through writeFakeCli in apps/server/src/testUtils/fakeCli.ts, which writes a Node stub plus a host-specific launcher (POSIX shell script or .cmd shim), with env applied via a JSON sidecar. execScriptSource covers the common “validate argv, then import the mock ACP agent” pattern; Codex’s large shell-based fake is reimplemented in Node the same way.

Codex collab integration picks codexCollabMockPeer.cmd on win32 (new file); .gitattributes forces CRLF for *.cmd / *.bat.

Tests that assert SIGTERM in an exit log are skipIf on Windows, where children are killed without that signal. Production spawn paths are unchanged—this is test/fixture plumbing for the Windows test suite.

Reviewed by Cursor Bugbot for commit b4e082c. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 4, 2026
Comment thread apps/server/src/testUtils/fakeCli.ts Outdated
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.8 KiB 15.1 KiB
Codex Thread snapshot wire 7.0 KiB 7.3 KiB
Codex Live turn WebSocket wire 6.7 KiB 7.8 KiB
Codex Live turn WebSocket decoded 58.5 KiB 66.4 KiB
Codex Live turn messages 10 21
Claude Total thread wire 13.8 KiB 15.1 KiB
Claude Thread snapshot wire 7.0 KiB 7.3 KiB
Claude Live turn WebSocket wire 6.7 KiB 7.8 KiB
Claude Live turn WebSocket decoded 59.3 KiB 66.4 KiB
Claude Live turn messages 10 21

Baseline: unavailable · PR result: b4e082c · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.8 KiB
  • Claude decoded thread snapshot: 114.5 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Comment thread apps/server/src/testUtils/fakeCli.ts Outdated
Comment thread apps/server/src/provider/testFixtures/codexCollabMockPeer.cmd Outdated
@juliusmarminge
juliusmarminge force-pushed the windows-tests/fake-cli branch 2 times, most recently from 9d13453 to c1ae303 Compare September 4, 2026 07:20
@juliusmarminge
juliusmarminge marked this pull request as ready for review September 4, 2026 07:35
@macroscopeapp

macroscopeapp Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — The changes are confined to cross-platform test fixtures and test utilities, with no product-runtime or default-setting impact. Human review is required because the PR adds file-level and line-level directives that suppress static-analysis diagnostics.

No code changes detected at b4e082c. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge
juliusmarminge force-pushed the windows-tests/fake-cli branch 2 times, most recently from 2a88601 to 7e2a578 Compare September 4, 2026 17:48
Seven suites faked a provider CLI with a #!/bin/sh script made executable
by chmod, which Windows cannot run: the shebang is ignored and there is no
extension for PATHEXT to match, so the spawn either failed or fell through
to a real CLI on PATH. CodexTextGeneration's fake was a 120-line sh
argument parser.

Add apps/server/src/testUtils/fakeCli.ts. writeFakeCli writes the CLI's
behaviour as a Node stub and a launcher shaped for the host: a shebang
script on posix, a .cmd shim on Windows, which resolveSpawnCommand already
routes through a shell. execScriptSource covers the common case of handing
over to the mock ACP agent after an argv check. ClaudeTextGeneration, which
had its own .cmd branch, moves onto the shared helper too.

The tests that assert the agent logged SIGTERM on stop are skipped on
Windows, where the child is terminated rather than signalled.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@juliusmarminge
juliusmarminge merged commit 5c6c1d6 into main Sep 4, 2026
25 checks passed
@juliusmarminge
juliusmarminge deleted the windows-tests/fake-cli branch September 4, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant