Skip to content

test(rust): make the test harness portable to Windows - #1190

Merged
thekevinscott merged 4 commits into
mainfrom
claude/1186-win-test-harness
Oct 2, 2026
Merged

thekevinscott merged 4 commits into
mainfrom
claude/1186-win-test-harness

Conversation

@thekevinbot

@thekevinbot thekevinbot commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1186

Test-harness fixes for Windows. No product code changes; the two packages/rust/src edits are inside #[cfg(test)] modules.

Every change is to a test that encoded a Unix assumption, not to what the test asserts:

  • extensions.rs: the fixture extension path is serialized with toml::Value instead of pasted into a basic string, where D:\a\... was an invalid escape.
  • persist_parsed_path_table.rs: native paths in the parser command template go through shlex::try_quote, since shlex was stripping their backslashes. set_modified now runs on a handle opened for writing, because Windows refuses it on a read-only one.
  • On-file hook fixtures (cli_e2e, cli_integration, config_root_derivation, declared_table_name, from_config, repeatable_config, sdk): these computed basename and root-relative path by splitting {path} on /. On Windows the whole backslash path ended up unescaped in the JSON payload. The hooks now normalize \ to / before splitting.
  • run_on_file_passes_absolute_path_for_path_placeholder writes the received {path} to a side file and compares it byte-for-byte, so the path no longer has to survive JSON. run_on_file_does_not_substitute_abspath drops its vestigial {path} argument.
  • watch_scan_correctness.rs: the helper strips either the given or the canonical root (on Windows these differ: C:\Users\RUNNER~1\... vs \\?\C:\Users\runneradmin\...) and joins the relative path with /.
  • parsed_vtab::run_parser_substitutes_the_absolute_path_and_the_root: the root is std::env::temp_dir() instead of /tmp, which does not exist on Windows (os error 267).

Windows failure count

Before (run 35995035941 on #1178): 99. After (run 36432881839): 63.

Every remaining failure belongs to another issue:

E2E Verification

  • Ran e2e suites locally for every affected SDK
  • Python SDK e2e: pass
  • TypeScript SDK e2e: pass
  • Rust core e2e (if applicable): affected integration targets pass locally on Linux
  • packages/python/e2e-attestations/<branch>.json receipt written (just e2e-attest-python)
  • packages/ts/e2e-attestations/<branch>.json receipt written (just e2e-attest-ts)
  • Command(s) run: just e2e-attest-python, just e2e-attest-ts, cargo test --features cli on the touched targets, just preflight
  • Result summary: all pass. The receipts exist only because the path-based gate counts #[cfg(test)] edits under packages/rust/src.

Changelog / Migrations

  • skip-changelog: on a commit: test-only change
  • Migration fragment not required

A Windows path embedded raw in a TOML basic string is an invalid
escape, and raw in a command template shlex strips its backslashes.
Serialize with toml and shlex instead. Open files writable before
set_modified, which Windows refuses on a read-only handle.
Hook fixtures derived basename and root-relative path by splitting on
'/', so on Windows the whole backslash path landed unescaped in the
JSON payload. Normalize separators in the hook before splitting, keep
{path} out of JSON in the run_on_file test, compute the watch helper's
relative path with '/' against either root form, and give run_parser a
cwd that exists on every OS.

skip-changelog: test-only change inside #[cfg(test)] modules
@thekevinbot
thekevinbot force-pushed the claude/1186-win-test-harness branch from 8fa9965 to 1f7d4eb Compare October 2, 2026 00:03
@thekevinbot
thekevinbot changed the base branch from claude/1175-windows-ci to main October 2, 2026 00:03
@thekevinbot thekevinbot closed this Oct 2, 2026
@thekevinbot thekevinbot reopened this Oct 2, 2026
@thekevinbot
thekevinbot force-pushed the claude/1186-win-test-harness branch from 1f7d4eb to ba7a360 Compare October 2, 2026 00:40
@thekevinscott
thekevinscott merged commit a03e981 into main Oct 2, 2026
82 checks passed
@thekevinscott
thekevinscott deleted the claude/1186-win-test-harness branch October 2, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: Rust test fixtures assume Unix paths and file handles

2 participants