Mechanisms found by autopsying failing sessions' logs, each fixed with
logging + event-anchored waits instead of sleeps/fixed assumptions:
- Input-consumed acks: new Session.tap_ack/chord_ack snapshot the log
offset BEFORE sending (send-then-snapshot races a descheduled test and
misses its own line) and wait for the existing [kbd] press line.
wait_for_new_after covers release-side effects ([mru] commit).
- Wall-clock repeats displacing exact MRU/cycle/reorder state: a tap whose
press/release processing spans the 600ms repeat delay catches synthesized
repeats (autopsied: 3 preview steps from 1 press). KICK_REPEAT_DELAY_MS
env override (default 600); all test sessions stretch to 60s except the
two hold-to-repeat tests, which get private sessions with real repeats.
- Startup-crown flips (last mapper promotes itself): all crown reads
settled (both maps = quiescence) + relative navigation; black-tab crowns
log [diag] active slot= (no active app= line) -- waited accordingly.
- Title/data decoupling: [title] now emitted at data sources (map-end with
final title, post-refocus destroy, renames, focus promotion, subcycle,
tag-group join), not just overlay draws; premature claim-time hook tried
and reverted (wrong pick poisons the dedup cache).
- Pointer tests: new [cursor] pos= DEBUG line on warp/motion; dump-poll
loops become cursor-line + single-dump asserts. Also fixed a latent
_spawn_standalone bug: env -i dropped KICK_DUMP_DIR, so parallel
standalone sessions shared /tmp/host_N.ppm and read each other's dumps.
- Spawn races: _nested_session/no_args retry instant client death.
- X11/layer/modal: settle+nav, map-anchored claims, content dump-polls,
settle-poll instead of fixed sleeps.
Genuine product race fixed: fork->setpgid window let SIGCHLD-driven
sweep_dead_startup_groups conclude ESRCH on a not-yet-existing group and
drop a LIVE tab (orphaned sleep survivors found on the box). Parent-side
setpgid + pid-liveness double-check before sweeping.
Remaining 9 flaky (wall-clock timers, host-compositor roundtrips):
gestures, hold_alt, fullscreen x3, clipboard host x3, cursor-shape.
Evidence: -n10 clean 5x (150 passed, ~28s), serial clean (150 passed),
flaky set green (9 passed).