# v0.68.0 — Assessment-13 Correctness & Durability Sprint

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

## What's New

v0.68.0 is the first release of the Assessment-13-Driven Hardening Arc, driven
by the findings in the v0.67.0 overall assessment
([plans/PLAN_OVERALL_ASSESSMENT_13.md](../plans/PLAN_OVERALL_ASSESSMENT_13.md)).
It addresses the six most urgent HIGH-severity findings before any feature work
resumes: fused-refresh audit trail integrity, change-buffer durability
truthfulness, DuckLake timestamp data loss, stale scheduler pool code, and the
tests that prove these fixes are correct.

### COR-001: Fused Refresh Audit Trail (COR-001)

`try_fused_chain_refresh()` previously wrote `initiated_by = 'SCHEDULER_FUSED'`
to `pgt_refresh_history`, but the table's CHECK constraint did not include that
value. The audit insert silently failed after the fused SQL had already run,
leaving fused refresh completely invisible in the history table.

Fix: the `initiated_by` CHECK constraint is extended to include `SCHEDULER_FUSED`
in the SQL schema, the upgrade migration, and every relevant test fixture.
A new `merge_strategy` column records the fusion strategy used
(`single_cte_chain`, `parallel`, or `sequential_fallback`) so operators gain
additional visibility without changing the `initiated_by` semantics.
Audit-insert failures are now treated as errors that abort the scheduler tick
rather than being silently ignored.

### COR-003 / ARCH-001: `change_buffer_durability` Wired into CDC (ARCH-001, COR-003)

The `pg_trickle.change_buffer_durability` GUC was registered and documented
but never read by the CDC buffer-creation path, which continued to consult only
the legacy `pg_trickle.unlogged_buffers` bool. Operators who set the new GUC
received no behaviour change.

Fix: `create_change_buffer_table()` and `create_st_change_buffer_table()` now
read `pg_trickle_change_buffer_durability()` as the authoritative setting.
The legacy bool is mapped into the enum at startup for backward compatibility
and deprecated with a warning in the docs. The `Sync` variant sets
`synchronous_commit = remote_write` around trigger-writes to change buffers.
E2E tests cover all three modes (`unlogged`, `logged`, `sync`).

### COR-004: DuckLake Timestamp Columns No Longer Serialize as NULL (COR-004)

`fetch_stream_table_rows()` fetched all columns as `::text`, then the Parquet
writer attempted to parse those text representations as integer microsecond
epochs. PostgreSQL timestamp text (`2026-05-21 12:34:56+00`) is not an integer,
so every timestamp/timestamptz value silently became NULL in the Parquet output.

Fix: timestamp and timestamptz columns are fetched via
`EXTRACT(EPOCH FROM col) * 1000000` so the Rust side receives an `f64` integer
epoch value that maps directly into the Arrow `Timestamp(Microsecond, UTC)` type.
A new unit test writes a row with a known timestamp value and reads the Parquet
footer back, asserting the value round-trips correctly.

### SCAL-001: Stale Scheduler Pool Path Deleted (SCAL-001)

`src/scheduler/pool.rs` referenced non-existent catalog columns (`db_name`,
`completed_at`), invalid job statuses (`COMPLETED`, `FAILED`), and a defunct
`pgt_scheduler_jobs` schema shape. The file was dead code — no call site
activated it — but its presence was a maintenance liability and a source of
future confusion.

Fix: `pool.rs` and its associated call sites are removed. The code is archived
as a comment in `plans/adrs/PLAN_ADRS.md` documenting the pool-worker design
decision (ADR-004) for historical context.

### TEST-003: Scheduler-Driven Fused Refresh E2E Test (TEST-003)

The existing `test_fused_refresh_tpch_22` test manually refreshed the chain
and did not go through the scheduler or inspect `pgt_refresh_history`. A new
scheduler-driven test:

1. Creates a two-node fused chain and enables `pg_trickle.enable_fused_refresh`.
2. Inserts rows and waits for automatic scheduler dispatch.
3. Queries `pgt_refresh_history` and asserts at least one row with
   `initiated_by = 'SCHEDULER_FUSED'`, `status = 'COMPLETED'`, and a valid
   `merge_strategy`.
4. Asserts that view results are correct.

### TEST-004: `change_buffer_durability` Mode Tests (TEST-004)

Three new E2E tests cover the full durability enum:
- `test_change_buffer_durability_unlogged`: asserts `relpersistence = 'u'`.
- `test_change_buffer_durability_logged`: asserts `relpersistence = 'p'`.
- `test_change_buffer_durability_sync`: asserts `relpersistence = 'p'` and
  verifies that the `synchronous_commit` session variable is set during
  trigger execution.

## Breaking Changes

- The legacy `pg_trickle.unlogged_buffers` GUC is deprecated. It continues to
  work but emits a `WARNING` on first use and will be removed in v1.0. Users
  should migrate to `pg_trickle.change_buffer_durability = 'unlogged'`.
- `pgt_refresh_history.initiated_by` now accepts `'SCHEDULER_FUSED'`. Any
  `CHECK` constraint in application code that mirrors the old allowed set must
  be updated.
