Repository navigation
feat(writeback): durable extraction-to-source provenance (#1296) - #1304
Merged
Merged
Conversation
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
temporarily deployed
to
marketing-preview
November 27, 2026 04:17 — with
GitHub Actions
Inactive
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1296
New Postgres entity
source_delivery_provenance(+3 declared statements),pg::record_provenance/provenance_for_runs/ambiguous_provenance_sources, andAdvanceSfCursorrecording 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_provenanceand the updatedpg_delivery_orderingpass against Postgres;er-entity verifyclean;make checkexit 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-060338df4848onMac· 2026-11-27T04:28:32Zmainis green with this change on it — the merge SHA, and the runthat proves it. A later head SHA with this commit as an ancestor counts;
a cancelled run with zero jobs does not:
c56e4af3— rust 45939054155, frontend 45939054074, infra/devcontainer successimagesbuilt, or correctly never ran because nothing that goes intoan image changed: 45939054125 success
deployconverged — proved by a line the running process emitted, notby the image digest and not by the workflow conclusion: deploy 45939438442 success (dev + prod); its pre-upgrade er-schema-migrate hook must succeed for the release to proceed, and it applied the additive
source_delivery_provenancetabledeploy,drift,kind's nightly leg) is green, or knowingly red for a reason that is notthis change: deploy green; drift/kind red for known reasons (Confirm the er-alerts email subscription and prove alert delivery #1056, kind probe red since 2026-11-10: KeyError 'token_hash' after the credential-omission fix #1106)
Donethrough the automation rather than byhand, and the issue closed: E9: durable extraction-to-source provenance for writeback eligibility #1296 CLOSED via the merge
(a skill, a reference, memory) — or nothing new was learned: memory already carried the DATASET_SCOPED rule this PR re-hit; the fix is in the PR history
Specific to this change
source_delivery_provenancein dev and prod — deploy 45939438442 success, whose atomic pre-upgrade hook refuses a release that cannot migrateContext — plan, discoveries, measurements, files
Plan
Discoveries
ControlCtx.clientis 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).string_to_arraynorstrpos; the id list uses the housechr(31)join with aLIKEmembership test.Measurements
Files
🤖 Generated with Claude Code