Repository navigation
feat(api): delivery Idempotency-Key replay and an explicit upsert mode (#1011) - #1267
Merged
Merged
Conversation
#1011) Both delivery routes (records/ingest and imports) accept an Idempotency-Key header scoped to the dataset and source. A retry with the same key and the same bytes returns the original 202 receipt — same delivery_id and job, Idempotent-Replayed: true — and queues nothing; the replay's published copy is discarded. The same key with different bytes is a 409 naming the delivery that owns it. The key rides the jobs table's existing (org, idempotency_key) upsert, so a concurrent retry also converges on one job. Deliveries upsert by record key and never delete what they omit; mode=full_refresh is refused by name rather than ignored. The docs now describe the receipt-to-result states, limits and retry guidance. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
The marketing preview was removed because this PR is closed or merged. |
athvin
temporarily deployed
to
marketing-preview
November 26, 2026 19:44 — with
GitHub Actions
Inactive
This was referenced Nov 27, 2026
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 #1011
What
POST …/records/ingestandPOST …/importsaccept anIdempotency-Keyheader (scoped to dataset + source). Same key + same bytes → the original 202 receipt (samedelivery_id, same job,Idempotent-Replayed: true), nothing new queued; same key + different bytes → 409 naming the owning delivery. An explicitmode(upsertonly;full_refreshrefused by name). Docs: receipt→job→result states, limits, retry guidance.Why
#1011: a customer retrying after a timeout created a second delivery and a second run; there was no idempotency contract at all, and nothing said that deliveries never delete what they omit.
Proof
pg_delivery_replay(new): JSON push and file upload replay, 409 on changed bytes, per-source key scope, no-key behaviour unchanged, the replay's copy discarded (one.csvon disk),full_refresh/bad key 422 — passes against local Postgres.make check: exit 0.Risk & rollback
Additive: requests without the header behave exactly as before.
git revert <merge-sha>.Post-merge ledger
Closed by: agent · session
Claude Code:24d16c2e-fec6-49d8-9797-060338df4848onbrians-MacBook-Pro· 2026-11-26T19:54:34Zmainis 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:
f1c883c2— rust 45885900062, frontend 45885900061, infra/devcontainer/marketing preview successimagesbuilt, or correctly never ran because nothing that goes intoan image changed: 45885900206 success
deployconverged — proved by a line the running process emitted, notby the image digest and not by the workflow conclusion: deploy 45886241170 success (dev + prod); the live process at https://dupezero.com/docs serves the new retry section (
Idempotent-Replayedpresent, probed 19:54Z)deploy,drift,kind's nightly leg) is green, or knowingly red for a reason that is notthis change: deploy green; drift/kind red before this merge for known reasons (Confirm the er-alerts email subscription and prove alert delivery #1056 SNS subscriber, kind probe red since 2026-11-10: KeyError 'token_hash' after the credential-omission fix #1106 kind probe)
Donethrough the automation rather than byhand, and the issue closed: API: durable JSON and file delivery with receipts and replay semantics #1011 CLOSED, card Done via the merge automation
(a skill, a reference, memory) — or nothing new was learned: memory
new-pg-test-needs-skills-regenrecords the regen order this PR re-hitSpecific to this change
Context — plan, discoveries, measurements, files
Plan
Discoveries
pg::enqueueis an upsert on(org_id, idempotency_key)returning the original job, so the client key reuses it (client-delivery:{dataset}:{source}:{key}) with no new table, and concurrent retries converge.run_id,error_class,error_detail, so the receipt (delivery_id+ job id) correlates to run and result throughGET …/jobs/{id}— documented rather than adding a new receipt route.Measurements
Files
🤖 Generated with Claude Code