test(ffi): de-flake pump_yields_when_queue_full via threshold recalibration#621
test(ffi): de-flake pump_yields_when_queue_full via threshold recalibration#621G4614 wants to merge 1 commit into
Conversation
|
The recalibration to With (Longer term the absolute-tick assertion is inherently timing-fragile under scheduler contention; a relative baseline — e.g. assert cooperative ticks ≫ an in-run busy-spin sample — would be load-independent. But |
…ration `progress >= 10` flaked (~40% first-try failure) because the bulk `boxlite_runtime_drain(rt, 0, …)` empties the queue in ~150-250ms, so a cooperative producer only lets the canary tick ~8-10 times — the threshold sat right on that boundary. Measurement shows `yield_now` does not starve the canary (max_gap ~21ms with or without a timer park), so there is no production bug: the flake was pure threshold miscalibration. Lower to `>= 5`, which keeps margin over the cooperative ~8-10 while still catching the regression it guards — a producer that busy-spins / blocks the single worker collapses the canary to ~2 ticks (verified by injecting std::hint::spin_loop() in place of the yield). No production change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5ab6be4 to
3657eef
Compare
De-flake
pump_yields_when_queue_fullby lowering itsprogress >= 10assertion — which sat right on the boundary of the ~8–10 canary ticks the bulk drain produces — to>= 5, a threshold recalibration with no production change (yield_nowdoesn't actually starve the canary; a worker-monopolizing producer collapses it to ~2, still caught).Test plan
make test:unit:rust FILTER=pump_yields→ 15/15 runs pass, non-flaky.std::hint::spin_loop()in place of the yield (a worker-monopolizing producer) → canary collapses → assertion fails with the named error; restore → passes.>= 10)>= 5)yield_now(current prod code)