mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 15:08:24 +00:00
tests/purgatory_sync.rs and tests/archive_grasp_services.rs still carried 34 fixed sleeps: 500 ms after connecting a client, 200-500 ms after sending an event before checking its side effect, and a 100 ms grace pad after a raw TCP connect to a subprocess relay. The project's fixture policy in docs/how-to/test-fixtures.md reserves fixed sleeps for cases where elapsed time is itself under test. Post-send sleeps are removed outright. The relay runs the GRASP write policy, including bare-repository creation and purgatory parking, inside event admission before it replies, and the client awaits that reply. The accepted or rejected send is therefore the barrier, including for the "repository must not be created" case. Effects that run in spawned tasks (promotion after a push, sync to a peer) already used bounded wait_for_event_served waits, which stay. Post-connect sleeps become connect_client, a shared helper built on try_connect, which awaits the connection attempts themselves and fails the test on refusal. connect().and_wait() was rejected: it checks relay status and then subscribes to status notifications, so a loopback connection that completes in that gap is missed and the caller stalls for the full timeout. The subprocess readiness pad becomes wait_for_http_ready, lifted from TestRelay::probe_http_ready without behaviour change, so readiness means a served HTTP 200 rather than a bound socket. Validation on an 8-core box: 20 unloaded and 20 loaded runs of both suites passed, as did 30 samples with three instances running concurrently under CPU spinners. Per-binary wall time under that contention fell from 14.4 s to 12.2 s (purgatory_sync) and 8.2 s to 6.3 s (archive). Assisted-by: Claude Fable 5.1 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>