Skip to content

feat(writeback): durable extraction-to-source provenance (#1296) - #1304

Merged
athvin merged 2 commits into
mainfrom
feat/1296-delivery-provenance
Nov 27, 2026
Merged

athvin merged 2 commits into
mainfrom
feat/1296-delivery-provenance

Conversation

@athvin

@athvin athvin commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #1296

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

New Postgres entity source_delivery_provenance (+3 declared statements), pg::record_provenance / provenance_for_runs / ambiguous_provenance_sources, and AdvanceSfCursor recording a run's provider provenance. First of two PRs for #993 (previews + approval follow).

#993's precondition: a preview member may acquire a connection/object identity only from durable provenance, not from a source label or the latest cursor.

Proof

pg_delivery_provenance and the updated pg_delivery_ordering pass against Postgres; er-entity verify clean; make check exit 0.

Risk & rollback

Additive table. An extract whose connection row is missing now fails at the provenance step (FK) instead of silently succeeding — intended. Revert leaves the table (harmless).

Post-merge ledger

Closed by: agent · session Claude Code:24d16c2e-fec6-49d8-9797-060338df4848 on Mac · 2026-11-27T04:28:32Z

Specific to this change

  • the deploy's schema-migrate created source_delivery_provenance in dev and prod — deploy 45939438442 success, whose atomic pre-upgrade hook refuses a release that cannot migrate
Context — plan, discoveries, measurements, files

Plan

Discoveries

  • ControlCtx.client is a shared &Client, so the record cannot share the enqueue's transaction as the ticket first said; ordering + idempotent retry + fail-closed gives the same guarantee for the consumer (previews read provenance only after the run succeeded).
  • The SQL analyser plans neither string_to_array nor strpos; the id list uses the house chr(31) join with a LIKE membership test.

Measurements

Files

🤖 Generated with Claude Code

bmoore813 and others added 2 commits November 26, 2026 19:59
A landed record's only link to the Salesforce connection that produced it
was a source label and the best-effort import.extract audit row — neither
can authorize a writeback (#993's findings). source_delivery_provenance
binds each extract run (the job id the lake stamps as ingest_batch_id) to
its delivery, source, connection, object and content digests.

AdvanceSfCursor records it after the idempotent enqueue and before the
cursor advances, failing the task (and so retrying) if it cannot: a retry
re-finds the same job and converges; a conflicting identity for the run or
delivery is refused, never overwritten; a run with no row — an upload, a
push, or a failed record — is simply never writeback-eligible. Reads by
run ids, and the sources more than one connection has delivered as (a
sandbox copy keeps record ids), which make a label ambiguous.

pg_delivery_provenance covers idempotence, conflicts, absence and reuse;
pg_delivery_ordering now runs the extract against a real connection and
asserts each run's provenance.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
pg_schema_replay and pg_schema_race age a store by dropping dataset_id
from every table that has one; a NOT NULL column only heals through
0004_dataset_id_required's list, which the new table was missing.
@athvin
athvin merged commit c56e4af into main Nov 27, 2026
43 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 27, 2026 04:17 — with GitHub Actions Inactive

This branch was previously deployed

1 inactive deployment
marketing-preview — 6dced8d1 Deployed Nov 27, 2026 by athvin via remove closed PR previews #92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E9: durable extraction-to-source provenance for writeback eligibility

2 participants