# v0.41.0 — DVM Correctness: Structural Cache Keys, Placeholder Safety & WAL Transition Guards

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

**Status: Released** | **Scope: Medium**

> The highest-risk correctness findings from the v0.40 overall assessment —
> structural snapshot cache keys, unresolved placeholder validation, and WAL
> transition TOCTOU guards — addressed as the first priority before any other
> assessment items.

---

## What is this?

The overall assessment identified three P0 correctness risks in the DVM engine
and CDC pipeline that can silently produce wrong results. v0.41.0 fixes all
three and adds the tests needed to prove they stay fixed.

---

## DVM snapshot cache key structural fingerprint

Snapshot CTE cache keys currently use only sorted leaf aliases. Two different
subplans over the same leaves can share a snapshot CTE, which means a delta
branch can read the wrong snapshot in complex join trees. v0.41.0 replaces the
key with a structural fingerprint of the OpTree — operator type, join type,
predicates, projected columns, filters, grouping, and child fingerprints.

---

## Placeholder resolution full-validation assertion

LSN and template placeholder resolvers substitute known tokens but do not
assert that all placeholders are resolved. A missed source OID or new
placeholder family can reach execution as malformed SQL. v0.41.0 adds a strict
unresolved-token check after every substitution pass and returns a typed error
with the stream table name and the unresolved token.

---

## WAL transition eligibility recheck at commit point

WAL CDC transition checks eligibility before the transition is finished, but
does not re-check table shape, replica identity, or primary key status
immediately before committing WAL mode. Concurrent DDL can alter assumptions
between eligibility check and commit. v0.41.0 adds a final eligibility recheck
at the commit point and E2E tests for concurrent DDL during transition.

---

## Also in v0.41.0

- Pool workers now check `pg_trickle.enabled` before claiming each job
- Isolation invariants for singleton, atomic group, and repeatable-read
  execution modes are documented in code-level comments
- Unit tests for placeholder resolution with unknown, mixed, and repeated
  placeholder families

---

## Scope

v0.41.0 is a focused medium release. Every item directly addresses a P0 or
high-severity correctness finding from the assessment. No features, no docs
expansion, no operational tooling — just the fixes that carry the highest risk
of silent wrong results.

> **Source:** [plans/PLAN_OVERALL_ASSESSMENT_9.md](../plans/PLAN_OVERALL_ASSESSMENT_9.md)
> findings COR-01, COR-02, COR-03, COR-06, COR-09, TEST-03, TEST-04.

---

*Previous: [v0.40.0 — Operator Trust, Maintainability & Release Confidence](v0.40.0.md)*
*Next: [v0.42.0 — Documentation Truthfulness & Generated Reference Repair](v0.42.0.md)*
