Spec a large customer import with a dry run

Vibe codingMedium25 min

Your task

Your support admins move customer records between systems by uploading CSV exports of up to 2 million rows. A Go service imports them into Postgres. Today the import is all or nothing, so one bad row near the end throws away an hour of work. An agent will rebuild the importer.

Write the spec you would hand the agent.

What you know:

  • Go 1.22, Postgres 16 and the pgx driver; the target is a customers table keyed by external_id
  • admins want a dry run that shows what would happen before anything is written
  • failed rows should be reported while the good rows still go in
  • an admin may run the same file again after fixing the bad rows
  • the live app reads and writes customers during imports

Then, in a few sentences: where does "import this CSV into Postgres" break at this size?