Prompt·Writes and ingestion·PG08
Can we rerun everything without damaging the data?
Imports get retried, schedulers overlap, files are replayed, or runs fail halfway.
Prompt
Examine the ingestion and correction workflows under retries, interrupted runs, duplicate source files, out-of-order arrivals and repeated execution. Demonstrate where these cases produce duplicate records, lost corrections, partial results or unnecessary rewrites. Find the smallest durable approach that makes each operation safely repeatable.
- What it returns
- Replay scenarios with their conflict keys, interrupted-run cases, before-and-after data comparisons and a safe way to resume.
- Skip it when
- Every import runs once, by hand, with nothing to retry.
- Avoid
- Calling an import safe to rerun just because the SQL has ON CONFLICT.
- Changes
- Changes nothing
- Sessions
- Look first, then fix in a new session
- Tools
- Needs: the repository and read-only database access. Helps: an isolated database for replay tests, and pgTAP.
- Works on
- Any PostgreSQL host: Supabase, Neon, RDS, Cloud SQL or self-hosted.
Related prompts
- Safe to run twice?PromptFinds actions that do damage when they run twice: double sends, double charges, duplicate rows.
- Half-finished failuresPromptFinds what is left behind when something fails halfway.
- Map every place that writes to the databasePromptSeveral jobs, functions, APIs or agents change the same data, or nobody is sure who owns it.
- Is our ingestion process more complicated than necessary?PromptThe import pipeline is long, slow to correct, or does the same work at several stages.
More in Writes and ingestion.