WSL port 4/7: stop the harness lying, and stop demo.sh needing bc
Stacked on #9. Four things, all of them the tooling misreporting rather than
the editor misbehaving.
demo.sh needed bc
Called once per keystroke, once per caption and once per pause. bc is not
installed by default on Debian or Ubuntu, so not on most WSL images — and there
is no set -e here, so the failure is silent-ish and total. On unmodified main:
./demo.sh: line 213: bc: command not found
./demo.sh: line 176: bc: command not found
...
Every $( ) came back empty, every sleep "" errored, and the demo raced
through at full speed printing sleep: missing operand instead of recording
anything. awk ships with macOS and every Linux and returns the same numbers.
tests/bin/timeout shadowed the real one
It is put first on PATH so timeout 20 nvim … works verbatim on a Mac, which
has no coreutils. On Linux that meant it shadowed the real timeout(1), quietly
downgrading every guard in the suite: no -k, no process-group kill, and
SIGALRM (rc 142) where GNU sends SIGTERM (rc 124).
| scenario | expect | got |
|---|---|---|
real GNU timeout present | 124 | 124 |
no timeout anywhere (the macOS case) | 142 | 142 |
| command exits normally | 7 | 7 |
Written with no dirname, no cd, no pwd — it runs first on a PATH that is
sometimes trimmed to almost nothing, and an unresolved $0 made it re-exec
itself forever. I found that the hard way while testing the fallback, hence
also the DRILL_TIMEOUT_SHIM guard.
run.sh reported the wrong number
It summed exit codes and called the result failing cases, so 30 broken timer
cases came out as 2 FAILING CASE(S) — small enough to read as a flake when a
whole feature was gone. It now counts suites and says suites. It also warns up
front when no clipboard provider is installed, because without one the cases
asserting register + fail for a reason that has nothing to do with the mapping
they are named after.
demo.sh --check cried wolf on every Linux box
It failed its Ctrl+Shift+Q case and advised recording with --keys socket —
the mode it was already in. Isolated:
is <C-S-q> mapped: yes
line after CS-q : x = 1 <- unchanged
mode after CS-q : i <- mapping never fired
line after 'c' : cx = 1
--remote-send feeds keys through the legacy encoding, where Shift is dropped
from a control chord and <C-S-q> collapses to <C-q>; that mapping's
literal-insert then eats the c meant to cancel the prompt, landing cx = 1.
It is the exact collapse CSI-u exists to solve, so socket mode cannot ask
this question at all. It now skips it and says why:
skip Ctrl+Shift+Q prompts --remote-send has no CSI-u to send
all chords arrive intact -- safe to record.
(1 not checkable in this key mode, see above)
System Events sends a real chord, so on macOS the check runs exactly as
before.
Verification
./tests/run.sh→ ALL SUITES PASSED, 556/556, exit 0./demo.sh --check→ clean, one honest skip- the
bc-free timings produce identical numbers (0.09*1 → 0.0900,1.8*2 → 3.6000)
🤖 Generated with Claude Code
https://claude.ai/code/session_01WveBqAyhoM49p9gWfwBDBx
Summary by CodeRabbit
- Improvements
- Improved demo timing consistency across different locales and speed settings.
- Enhanced handling of command timeouts, including environments without the standard timeout utility.
- Added clearer diagnostics when no usable clipboard provider is available.
- Linux checks now explain when the
Ctrl+Shift+Qvalidation is skipped in socket mode. - Test results now report the number and names of failing suites for clearer troubleshooting.
Greptile Summary
The PR improves portability and accuracy in the demo and test tooling.
- Replaces
bc-based timing calculations with locale-stableawk. - Delegates the timeout shim to the platform timeout implementation when available.
- Adds clipboard-provider diagnostics and reports failed suites accurately.
- Aligns the quit preflight with the input path used during recording and avoids claiming CSI-u coverage it does not provide.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains; the previously reported socket-preflight mismatch is resolved because preflight and the recorded quit chapter now use the same key-dispatch path and verify both cancellation and editor survival.
Important Files Changed
| Filename | Overview |
|---|---|
| demo.sh | Replaces timing arithmetic with locale-stable awk and corrects the quit preflight description while preserving its mapping and cancellation checks. |
| tests/bin/timeout | Delegates to another executable timeout on PATH while retaining the Perl fallback for systems without one. |
| tests/run.sh | Adds active clipboard-provider diagnostics and counts failing suites rather than summing their exit codes. |
| TODO.md | Marks the fourth WSL-port checkpoint complete and records the tooling changes. |
Reviews (18): Last reviewed commit: "Name the check after what it proves, not..." | Re-trigger Greptile