# v0.8.0 — Backup Support and Test Invariant Hardening

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

**Status: ✅ Released** | **Scope: Small** (~2 weeks)

> Stream tables are now fully included in `pg_dump` backups, and the test
> suite gained property-based invariant testing for the differential engine.

---

## What problem does this solve?

Production deployments need reliable backup and restore. Before v0.8.0,
`pg_dump` would capture the source tables but not the pg_trickle catalog
metadata or stream table state — making a restored database unusable with
pg_trickle without manual re-initialisation.

---

## pg_dump Integration

PostgreSQL's standard backup tool `pg_dump` now captures the complete
pg_trickle state alongside the rest of the database:

- The stream table definitions (queries, schedules, refresh modes)
- The catalog metadata
- The current content of each stream table
- The frontier (the point in the change history up to which changes have
  been applied)

A database restored from a `pg_dump` backup will have fully functional
stream tables — the background worker picks up exactly where it left off,
with no full re-initialisation required.

*In plain terms:* your backups now include your stream tables. Restore works
as expected.

---

## `pg_restore` and Upgrade Path Testing

The backup/restore process was integrated into the upgrade test suite.
Upgrading from one pg_trickle version to another, via a backup-and-restore
cycle, is now tested on every release.

---

## Multiset Invariant Testing

The differential engine's core correctness property is the *multiset
invariant*: the contents of a stream table should always match what you
would get from running the defining query on the current source data.

v0.8.0 adds **property-based testing** (using the Rust `proptest` library)
that generates random sequences of INSERT, UPDATE, and DELETE operations,
applies them to source tables, refreshes the stream table differentially, and
then verifies that the stream table result exactly matches a fresh full
recomputation.

*In plain terms:* the test suite now automatically generates thousands of
random scenarios to verify that differential refresh never diverges from
the correct answer. Any subtle bug in the differential engine that produces
even one wrong row will be caught.

---

## Scope

v0.8.0 is a focused quality release. The `pg_dump` integration makes
pg_trickle production-safe from a backup and disaster-recovery perspective.
The multiset invariant testing provides ongoing confidence in differential
correctness.
