# Can we rerun everything without damaging the data?

Prompt · Writes and ingestion · PG08

Imports get retried, schedulers overlap, files are replayed, or runs fail halfway.

## Prompt

```text
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.

**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.

**Changes:** Changes nothing

**Sessions:** Look first, then fix in a new session

## Related

- [Safe to run twice?](https://www.atlasscope.dev/prompts/safe-to-run-twice): Finds actions that do damage when they run twice: double sends, double charges, duplicate rows.
- [Half-finished failures](https://www.atlasscope.dev/prompts/half-finished-failures): Finds what is left behind when something fails halfway.
- [Map every place that writes to the database](https://www.atlasscope.dev/prompts/map-every-place-that-writes-to-the-database): Several jobs, functions, APIs or agents change the same data, or nobody is sure who owns it.
- [Is our ingestion process more complicated than necessary?](https://www.atlasscope.dev/prompts/is-our-ingestion-process-more-complicated-than-necessary): The import pipeline is long, slow to correct, or does the same work at several stages.

Source: https://www.atlasscope.dev/prompts/can-we-rerun-everything-without-damaging-the-data
