Heavy reads need a size-bound approval in Git and must never be the Server's bottleneck
A large Sync read slows the live Source, can fill the Server's disk, and can lock the Warehouse, whatever the Source is. So a Sync table read larger than a per-Project limit (default: more than 1 million rows/documents or 1 GB, measured from the Source's own table statistics without reading) is a Heavy read, and it runs only with a written approval committed through Git: heavy: {reason: …, approved_at_size: 4 GB} on the table's Pipeline entry. adops validate fails a heavy table without one and reports its size. The Assistant must ask the user before writing that line, and merging the PR is the approval for stage and prod. It is a line in Git rather than a terminal prompt because scheduled runs have nobody at a terminal, and it matches how Breaking Changes and skipped Checks are already accepted (ADR-0013, ADR-0015).
What needs approval: a Full Refresh and an Incremental table's first run. Whether a run is heavy is still decided every run: before an Incremental run, adops counts the rows its cursor filter matches (cheap through the cursor's index), and a run over the limit takes the safe path below. An unplanned big Incremental run (a migration touched every row) needs no approval, but it takes the safe path, holds the heavy-read slot, and sends a warning ("orders: 20M changed rows this run"). Blocking it would punish the user for something normal.
Approvals go stale: when a table grows past 3× its approved_at_size, dev and Branch runs stop until the line is renewed in a PR. stage and prod keep running and warn through the existing alerts, because a scheduled prod run failing at 02:00 over growth would hurt more than the read.
The safe path, so adops is never the Server's bottleneck:
- A heavy read is read, flattened, shape-checked and written one batch at a time into a hidden staging copy. The copy replaces the visible table only after every batch has passed. A Breaking Change or failure in any batch discards it and keeps yesterday's table. The Server's disk holds about one batch, memory stays flat, and a Breaking Change still halts before any Warehouse table changes.
- On Postgres the swap is dlt's
staging-optimizedreplace. DuckDB lets only one process open its file, and dlt offers it onlyinsert-from-staging, so its batches load into a separate staging file beside the Warehouse (e.g.warehouse.heavy-orders.duckdb) that locks nothing. That file is then copied in one transaction under the existing Warehouse lock, so the Warehouse is locked for minutes rather than for the hours of the read. The staging file is deleted afterwards and on failure. - Before starting, adops checks free space and refuses with a clear message if it is short: 1× the new copy on a Postgres Warehouse, or about 3× on the Server's own disk for DuckDB.
- Only one heavy Step runs per Server at a time. A waiting Step shows in the run log and fails after 2 hours. Heavy Steps run at low CPU priority, and a table may set
max_docs_per_second.
Branches: Defer already keeps a Branch from re-reading an unchanged Sync. When a PR changes a heavy Sync Step, the Branch reads only a slice of 100,000 rows, spread across the oldest, the newest and random ones, so both old and new shapes are seen. It marks whole-table Checks, such as row count matching the Source, "skipped on Branch: partial read", and stage does the full read after merge.
Rollout: this changes existing Postgres Pipelines, so the release that introduces it only warns about unapproved heavy tables, and the next release fails adops validate.
Considered Options: a terminal prompt on each run (scheduled runs have nobody to answer it); a warning only (nobody approves the cost); approving every first run whatever its size (approvals become routine and go unread); an approval without a size (a table approved at 2M rows silently covers 50M a year later); blocking unplanned big Incremental runs (fails normal nights); holding the DuckDB file for the whole read (the Warehouse is unusable for hours); refusing heavy reads into DuckDB (full DuckDB support is required); reading the whole table on every Branch push.