# v0.53.0 — Unit Test Depth Sweep

> **Full details:** [v0.53.0.md-full.md](v0.53.0.md-full.md)

## What's New

v0.53.0 fills the unit-test coverage gaps identified in the v0.51.0 overall
assessment (Report 11, findings T-2 through T-9). The six scheduler and
parser modules that had zero inline `#[test]` coverage now each have a
`#[cfg(test)]` block covering their pure logic. Property-based testing
(proptest) is extended to the DAG cycle detection and topological sort
invariants. The two fixed sleeps in the buffer-growth E2E tests are replaced
with adaptive polling, making those tests faster and more reliable under CI
load.

### Scheduler Module Unit Tests (T-4)

`dispatch.rs`, `pool.rs`, `watermark.rs`, `citus.rs`, and `scheduler_loop.rs`
all had zero inline unit tests. The new test blocks cover:

- **`dispatch.rs`** — `parse_worker_extra` (format validation, edge cases,
  negative job IDs), `compute_adaptive_poll_ms` (backoff formula, boundary
  conditions, no-inflight fast path).
- **`pool.rs`** — `pool_size_from_config_value` (clamping negative values to
  zero, preserving positive values).
- **`watermark.rs`** — `should_emit_holdback_warning` (rate-limit logic: zero
  threshold disables, age threshold, 60-second rate cap).
- **`citus.rs`** — `record_worker_failure` / `reset_worker_failure` thread-local
  failure counter tracking and reset behavior.
- **`scheduler_loop.rs`** — structural compile-check test.

### DVM Parser Unit Tests (T-6)

`dvm/parser/sublinks.rs` had zero inline unit tests despite containing several
pure helper functions. New tests cover:

- `extract_bare_scalar_subquery_sql` — parenthesised SELECT detection,
  missing paren rejection, whitespace trimming.
- `is_known_aggregate` — known and unknown aggregate names.
- `is_star_only` — single-star detection, non-star cases.
- `rewrite_having_expr` — HAVING aggregate rewrite and identity pass-through.
- `split_exists_correlation` — correlation extraction from AND conjunctions.
- `collect_tree_source_aliases` — alias accumulation across join trees.

### Proptest Extension (T-7)

Two new `proptest!` blocks in `src/dag.rs`:

- **Cycle detection invariant** — randomly constructed acyclic graphs always
  pass `detect_cycles()`, while a graph with a single back-edge always returns
  `CycleDetected`.
- **Topological order invariant** — for any acyclic graph, the topological
  order returned by `topological_order()` is a valid ordering: every edge
  `(A → B)` has A appearing before B in the order.

### Buffer-Growth Sleep Removal (T-8, T-9)

`tests/e2e_buffer_growth_tests.rs` contained two long fixed sleeps:

- **7-second sleep** — awaiting initial auto-refresh in the sustained-write
  test. Replaced with `db.wait_for_auto_refresh("sustained_st", 30s)`.
- **20-second sleep** — awaiting scheduler catch-up after a burst. Replaced
  with `db.wait_for_condition(...)` polling until the stream table count
  matches the source, with a 60-second cap and 500 ms initial backoff.

Both fixes reduce worst-case test time and eliminate the flakiness caused by
scheduler timing variance on loaded CI runners.
