|
13 | 13 | //! This drives the real `JsonFileIngestSource → PrecomputeEngine → sink` |
14 | 14 | //! path, not `Worker` directly, to catch wiring gaps the `worker.rs` unit |
15 | 15 | //! test (`wall_clock_fallback_does_not_close_a_pane_still_receiving_samples`) |
16 | | -//! can't — e.g. `PrecomputeEngineConfig` not actually reaching the workers. |
17 | | -//! That unit test remains the precise, fully deterministic proof of the |
18 | | -//! fallback's behavior; this test is a wiring sanity check on top, and |
19 | | -//! relies on two things to be deterministic-by-construction rather than |
20 | | -//! best-effort: |
| 16 | +//! can't |
21 | 17 | //! |
22 | | -//! 1. `PrecomputeEngine::with_now_ms_fn` (a real, not `#[cfg(test)]`-gated, |
23 | | -//! test-only hook) — used here with an *unscaled* real clock (no |
| 18 | +//! 1. `PrecomputeEngine::with_now_ms_fn` — used here with an *unscaled* real clock (no |
24 | 19 | //! multiplier). An earlier version of this test scaled real elapsed time |
25 | 20 | //! up 50x to reach a multi-second-equivalent deadline in tens of real |
26 | 21 | //! milliseconds, but that amplifies ordinary scheduling jitter right |
|
31 | 26 | //! delays (below) avoids that: jitter stays a small fraction of the |
32 | 27 | //! margin instead of dominating it. |
33 | 28 | //! 2. `JsonFileIngestConfig::batch_delay_ms` — an ordinary throttling knob |
34 | | -//! (not test-only; it just has no other caller yet) set here to a real, |
35 | | -//! explicit delay after each batch send, so ingest is *guaranteed* (not |
36 | | -//! merely likely, given incidental scheduling overhead) to span real |
37 | | -//! wall-clock time. Combined with a short `flush_interval_ms`, the |
38 | | -//! periodic flush timer is given many real chances to land mid-ingest, |
39 | | -//! not just one narrow shot. |
40 | | -//! |
41 | | -//! Timing margins (deliberately generous, not tight): |
42 | | -//! - deadline (window_size_ms + wall_clock_grace_period_ms) = 3000ms. |
43 | | -//! - batch_delay_ms = 400ms nominal per-gap, ~7.5x under the deadline — even |
44 | | -//! a few hundred ms of scheduling jitter on any single gap is absorbed. |
45 | | -//! - 10 batches x 400ms ≈ 4000ms total ingest span, comfortably past the |
46 | | -//! 3000ms deadline, so the old birth-time bug (were it still present) |
47 | | -//! would have real room to force-close mid-stream and drop later batches. |
| 29 | +//! set here to a real, explicit delay after each batch send, so ingest is *guaranteed* to span real |
| 30 | +//! wall-clock time. |
48 | 31 | //! |
49 | 32 | //! This trades test runtime (~4-5 real seconds) for robustness against jitter. |
50 | 33 |
|
|
0 commit comments