Repository navigation
Description
Part of #660. Every latency number attached to #660 and its follow-ups (#662-#668) is reasoned from the reporter's per-spawn figure, not measured, because the one place this repo runs Windows -- the windows-latest leg of .github/workflows/tests.yml -- never executes the hook: 92 modules blanket-skip on win32 (#497), and the two tests #661 added are skipif(sys.platform == "win32") too. The Windows leg is green because it exercises almost nothing about the shell path.
windows-latest ships Git for Windows, so C:\Program Files\Git\bin\bash.exe (MSYS, the same environment Claude Code hooks run under on the reporter's machine) is available on every run. Nothing stops CI from measuring the real thing.
Ask
One test module that runs on Windows only (and is not skipped there):
- Locate Git Bash (
C:\Program Files\Git\bin\bash.exe, falling back towhere bashfiltered to a Git path; skip with a reason naming the miss, never silently pass -- a skipped benchmark on the one leg it exists for is the absence this repo's own rules forbid). - Build a representative fixture store: legacy
.rememberlayout with identity + 4 memory files, arecent.md, alast-save.jsonmarking the previous session saved,installed_plugins.jsonversion 2,jqpresent (Git for Windows does not ship it;choco install jqor a pinned download in the workflow step, so the jq-present and jq-absent paths can both be measured -- run both). - Invoke
scripts/session-start-hook.shunder that bash with a realistic stdin payload, twice (cold, then warm -- the warm run is what SessionStart: cache the injected context, the flattened config and the tool verdicts across starts, validated by mtime (Part of #660) #668's cache targets). - Measure: wall time per run (
time.perf_counteraround the subprocess), and spawn count viaBASH_XTRACEFD+set -x(count trace lines that begin a command; subshell depth fromBASH_SUBSHELLinPS4), written to a file in the fixture. - Emit both as a pytest
record_property/ printed summary line so they show in the job log, and assert a budget: wall time under N seconds and spawns under M. Start with generous values that the current code passes on the runner (measure first, then pin), and tighten them as SessionStart: drop the unconditional python -V probe from the foreground path (Part of #660) #662-SessionStart: cache the injected context, the flattened config and the tool verdicts across starts, validated by mtime (Part of #660) #668 land -- each PR lowers the ceiling to what it measured. - Same test on Linux/macOS with the local bash, so the cross-platform ratio is visible in one log.
Why this and not a timing budget in the hook
A budget inside the hook cannot fail CI. A test that runs on the Windows leg can, and it turns "reasoned" into "observed" for every follow-up under #660 -- the CLAUDE.md bar for cross-platform claims.
Caveats to state in the test
- The runner is an x64 Xeon; the reporter is Windows 11 ARM64. Absolute numbers will differ. The point is the before/after on the same runner per PR, plus the spawn count, which is machine-independent.
- Defender exclusion already exists in the workflow for the checkout and
RUNNER_TEMP; keep the fixture underRUNNER_TEMPso the scanner does not add noise. read -r -t 1atsession-start-hook.sh:92: close stdin properly in the harness so the timeout path is not measured by accident, and add a second variant that leaves it open to measure it on purpose.
[AI-generated]
Activity
Fix make_shim_dir's CRLF shebang on Windows -- real root cause of CI …
Fix #669 round 2: Path.write_text has no newline= before Python 3.10
Add self-describing diagnostics to #669's jq-present/absent benchmark…
Fix #669 root cause (round 5): _HOOK_DIR resolves to "." under a back…
Fix #669 round 6: pass the regression test's fake path through env, n…
Fix #669 round 7: round 6 reintroduced the Python 3.9 write_text(newl…
Skip #669's _HOOK_DIR regression test on windows-latest, tracked as #672
Make the #669 Windows benchmark numbers visible on CI's own Summary t…
Fix jq-less _jq_fallback dropping --arg, spurious recovery re-save on…
Move the #668 flattened-config cache out of the project tree, validat…
Add a Windows/Git-Bash benchmark for session-start-hook.sh (Digital-P…
test(#782): invoke the hook by a forward-slash path in the in-project…
fix: unquote literal quotes, guard the start cache, refuse laundering…
Fix #660: the #669 benchmark summary never reached CI's own log
Fix #660: measure Windows SessionStart warm start via CI, confirm it …