# v0.78.0 — DVM Engine Root-Cause Fixes + Scheduler Intelligence

**Status: Released**
**Release arc:** Assessment-15 Hardening Arc v0.77.0–v0.80.0

## What's in this release?

v0.78.0 delivers the DVM root-cause fixes that v0.77.0 gated behind fallbacks,
plus a set of scheduler intelligence improvements that make pg_trickle faster
and more reliable at scale.

### DVM correctness improvements

- **DVM-1**: CASE/IN-list aggregate drift is resolved for append-only sources —
  queries with `SUM(CASE...)` / `COUNT(CASE...)` against append-only tables now
  run differentially. For mutable sources (where UPDATE can change CASE
  conditions), FULL refresh remains the definitive rejection path until the
  DI-2 UPDATE-split landing.

- **DVM-2 + P-1**: Correlated aggregate subqueries in WHERE are pre-aggregated
  into CTEs and joined once per refresh for safe patterns (single-level, bare-
  column correlation). Unsafe patterns (nested sublinks, dot-qualified
  correlation) continue to fall back with the `CORRELATED_SUBQUERY_DELTA_QUADRATIC`
  reason code.

### Scheduler intelligence

- **P-2**: Query complexity is classified using the parsed OpTree and stored in
  the catalog column `query_complexity_class`. Scheduler logs now show the
  per-ST class instead of re-computing it on every tick.

- **P-3**: Cost model lookups are batched into a precomputed
  `pgtrickle.pgt_cost_model_summary` rolling-average table. The scheduler reads
  from this table once per tick instead of issuing a per-ST
  `pgt_refresh_history` query, dramatically reducing SPI overhead at large
  scale.

- **P-4**: The placeholder resolver Aho-Corasick automaton cache now stores the
  canonical key string alongside the hash, and verifies it before reuse.
  Hash collisions are detected at runtime with a WARNING and the automaton is
  rebuilt, preventing silent template corruption.

### Testing and CI

- **T-2**: A new `test_t2_sf10_tpc_h_latency_regression` test runs a rotating
  SF-10 TPC-H subset and asserts per-query EXPLAIN latency stays under
  configured thresholds.

- **T-3**: A nightly `fuzz-nightly.yml` workflow runs each fuzz target for 300
  seconds and tracks corpus size growth over time.

## Upgrade

This release adds one new column to `pgtrickle.pgt_stream_tables` and one new
catalog table `pgtrickle.pgt_cost_model_summary`. Existing stream tables will
have `query_complexity_class = NULL` until their next refresh cycle, at which
point the column is back-filled automatically.

See [v0.78.0.md-full.md](v0.78.0.md-full.md) for the full implementation status.
