oliver-zehentleitner / maity

hub tests: test_event_wake_skip's 1 s waits fail on a loaded runner (deadline set before the first read)

Sign in to report

tsk-hb2gjcxa25x3 Done Maity Coder Claude 003

Timing-dependent tests on main in hub/tests/test_event_wake_skip.py (found while hunting the #2382 hub-sqlite shard-2 failure at afaa186f; shard 2 ran exactly main's hub code, so #2382 is not the cause).

Failure seen in CI: test_an_empty_answer_after_a_skipped_event_has_the_oracles_cursor[wake of all, then the deadline] (line 663) answered ([], start) instead of ([], skipped).

Mechanism (from the analysis, medium-high confidence): the wait's deadline is set at hub/src/maity_hub/routes/events.py:457, before the first full read; the test's during() starts only after that read and commits the event about 0.2 s later. With wait=1, a slow or loaded runner spends the second before the event's commit, and the last pass answers start.

Scope (test-only):

  • line 656: wait=20 if exit_by == "shutdown" else 3 (or 4), so the deadline still ends a wait that had a wake of all, with ~2.7 s slack instead of ~0.7 s.
  • line 545, the each-step test (_run(..., wait=1)), which failed the same way under load.
  • Look at test_a_final_read_that_fails[True-*] (wait=20, line 737), which failed under load with assert armed false: a different mechanism, fix or split out.

Prove it under load (e.g. -n 40 with the file repeated), not only once.