Skip to content

Windows support: full test suite, ConPTY, and cross-platform paths#13

Open
saadmanrafat wants to merge 1 commit into
mainfrom
claude/halfhand-action-recording-ji61r5
Open

Windows support: full test suite, ConPTY, and cross-platform paths#13
saadmanrafat wants to merge 1 commit into
mainfrom
claude/halfhand-action-recording-ji61r5

Conversation

@saadmanrafat

Copy link
Copy Markdown
Member

Summary

Elevates Windows from build-only to a fully supported platform (amends SRS §2.2). The full test suite now runs on Windows in CI, exercising portable-pty's ConPTY backend end-to-end. Recorded relative paths are now always /-separated on every platform for cross-platform compatibility (DR-2). Adds comprehensive platform documentation and MSRV enforcement.

Key Changes

Platform Support & CI

  • CI matrix expanded to {ubuntu, macos, windows} × {stable, MSRV} with MSRV (1.75) enforced via a guard that prevents drift from Cargo.toml
  • Windows now runs the full test suite, not build-only; MSRV leg is build-only on all platforms
  • Added docs/platforms.md documenting PTY backends, file locations, permission semantics, ConPTY limitations, and the Claude adapter's Windows behavior

Cross-Platform Path Handling

  • Relative paths in file_changes.path and event summaries now always use / separators on every platform via new rel_to_slash() function in hh-record/src/watcher.rs
  • Enables identical queries and rendering across OSes (e.g., path LIKE 'target/%' works on Windows)
  • Claude Code adapter's slugify() now maps : to - for Windows drive letters (e.g., C:\Users\meC--Users-me)

Windows PTY & Console

  • Added ansi_supported() check in hh/src/render.rs that calls crossterm::ansi_support::supports_ansi() on Windows (enables virtual terminal processing as a side effect); Unix always returns true
  • Color output degrades to plain text on consoles without ANSI support instead of printing escape garbage
  • Added #[cfg(windows)] comment in hh-record/src/runner.rs explaining ConPTY ANSI passthrough

Test Fixtures & Helpers

  • New platform-aware test helpers in hh/tests/cli.rs:
    • python() → returns "python" on Windows, "python3" on Unix
    • true_argv() → returns ["cmd", "/C", "exit", "0"] on Windows, ["true"] on Unix
    • fixture_agent_argv() → returns Python or PowerShell fixture on Windows, POSIX sh on Unix
    • Renamed python3_available() to python_available() for platform-agnostic naming
  • New fixture scripts:
    • fixture_agent.py — Python port of fixture_agent.sh for Windows (terminal output + file write + exit 3)
    • fixture_agent.ps1 — PowerShell variant exercising ConPTY with a native Windows shell
    • pty_probe.py — Proves ConPTY geometry visibility and ANSI passthrough (Windows counterpart to interactive.sh)
  • New test run_records_powershell_fixture_agent() (Windows-only) validating PowerShell fixture agent
  • New test run_provides_a_real_conpty_to_the_child() (Windows-only) validating ConPTY transparency
  • Existing run_provides_a_real_pty_to_the_child() now #[cfg(unix)] with clarified doc comment

Dependency & MSRV Management

  • Cargo.toml workspace now declares rust-version = "1.75" with a comment explaining the policy
  • lru held on 0.16 line (0.17+ requires edition-2024 tooling incompatible with MSRV)
  • time held at 0.3.41 (0.3.47 fix for RUSTSEC-2026-0009 requires rustc 1.88); advisory ignored in deny.toml with exposure justification and revisit note tied to next MSRV bump
  • Cargo.lock kept MSRV-compatible

https://claude.ai/code/session_01QTAqG31TwmwyiGCixMsDPL

Amends SRS §2.2 (Windows was build-only): the full test suite now runs on
windows-latest, and the CI matrix is {ubuntu, macos, windows} × {stable, MSRV}.

Path handling
- file_changes.path and file-change summaries are always /-separated
  (rel_to_slash joins components), so recordings query and render
  identically across platforms (DR-2). No production code hardcoded '/'
  elsewhere; data-dir resolution already goes through `directories`
  (Windows: %APPDATA%\halfhand\{data,config}).
- hh-core config test no longer assumes the platform data dir *ends* with
  "halfhand" (on Windows it's ...\halfhand\data).

Permissions (NFR-4)
- 0600/0700 code was already #[cfg(unix)]-gated (blob.rs, store.rs); the
  non-Unix store branch now propagates create_dir_all errors instead of
  swallowing them, and docs/platforms.md documents the Windows ACL
  reliance (%APPDATA% profile ACLs stand in for 0700).

ANSI
- hh enables Windows virtual terminal processing via
  crossterm::ansi_support at recording start and gates colored output on
  it (use_color/use_color_stderr), falling back to plain text where the
  console can't do ANSI.

PTY / ConPTY tests
- fixture_agent gains behavior-identical .py and .ps1 variants; Windows
  runs the Python variant through the shared end-to-end test plus a
  dedicated PowerShell test, exercising portable-pty's ConPTY backend for
  output capture, file-change capture, and exit-code propagation.
- New pty_probe.py + run_provides_a_real_conpty_to_the_child asserts the
  child sees a real console geometry and ANSI passes through; the raw
  stdin round-trip test stays Unix-only (ConPTY input semantics), tracked
  in #12 and covered by a manual QA checklist.
- Platform helpers in tests: python()/python_available (python3 vs
  python), true_argv() (no `true` on Windows).

Claude Code adapter
- slugify also maps ':' so C:\Users\me\proj → C--Users-me-proj (the
  fallback cwd scan still catches any slug mismatch); unit tests use
  typed PathBuf fixtures for Windows-style cwds, and projects_dir_under
  makes the ~/.claude/projects shape testable without env mutation.

CI / MSRV
- test matrix: {ubuntu, macos, windows} × {stable, 1.75}; the MSRV leg is
  a --locked build on exactly the Cargo.toml rust-version, with a guard
  step that fails if the matrix pin and rust-version drift apart.
- Cargo.lock re-resolved MSRV-aware; lru held on 0.16 (0.17+ needs
  edition-2024 tooling), ignore/globset/blake3/time and friends resolved
  to 1.75-compatible releases. Verified locally: build clean on 1.75 for
  Linux and Windows targets with -D warnings.
- clippy::result_large_err allowed at crate level (fires only on Windows
  targets where error payloads cross the 128-byte budget).

Docs
- docs/platforms.md: per-platform support table, data-dir map, Windows
  ACL note, honest ConPTY limitations with tracking issues #11 (resize
  forwarding) and #12 (interactive stdin CI coverage); README, CHANGELOG,
  and manual-qa updated to match.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTAqG31TwmwyiGCixMsDPL
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.

2 participants