mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-29 21:15:16 +02:00
The staleness guard compared a poll against the newest poll STARTED, and only the failure path used it. Two orderings were wrong. An older success settling after a newer one had no guard at all, so it overwrote the newer counts, the canvas label and the announcement with older data. Both paths now check the token. An older failure settling while a newer poll was still in flight was discarded, because a newer poll had merely started. The page then kept the last successful counts and its no-steering message as if they were current. Anchoring the guard to the newest poll that has SETTLED fixes that: the older failure is still the newest thing to have settled, so it lands, and the pending poll restores the view when it answers. That single change covers both orderings, so the guard no longer needs to know which path it is on. Each poll records itself as settled when it finishes, whatever the outcome. A poll also had no timeout, so a request that never answered left the last steering guidance on screen indefinitely. Each poll now aborts after ten seconds through an AbortController, and that abort is what wakes the poll, so a timeout is reported as an outage instead of silently leaving stale guidance. The test harness can now hold a request open indefinitely and fire pending timers on demand, so the timeout is exercised without waiting. New assertions cover an older success losing to a newer one, an older failure landing while a newer poll is in flight and then being recovered by it, and a hung poll timing out into the offline state. Removing the success guard, re-anchoring the guard to the last started poll, and removing the timeout each fail one of those assertions, and the unmutated file passes all of them. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>