fcd4c0bf48
The seed Job `seed-test-data-b5943fb` failed three times on prod with
`duplicate key value violates unique constraint "services_pkey"` after
migrations 0039/0040 landed. Two interlocking bugs in
`packages/db/src/seed.ts` (and the parallel `apps/api/src/db/seed.ts`
tree — both kept in sync per the GRO-2052/2013/2014 lesson):
1. The reset `TRUNCATE` excluded `services`, so a prior
`seedKnownUsers` run that wrote `id=b0000001-…-004, name="Nail Trim"`
survived every reset. The next full `seed()` then tried to insert
`id=b0000001-…-004, name="Full Groom — Large"` and PostgreSQL
raised `services_pkey` (id collision) — the name-targeted
`ON CONFLICT` couldn't fire because the conflict was on a different
column.
2. The `demoSvcs` (used by `seedKnownUsers`) had `id=…-004, name="Nail Trim"`
while `servicesDef` (used by the full `seed()`) has `id=…-004,
name="Full Groom — Large"`. `Nail Trim` was supposed to be
`id=…-005` in the demo subset.
Fix:
* `TRUNCATE services, …` so each reset rebuilds the catalogue from
`servicesDef` (CASCADE handles appointments/invoices FKs).
* Key both services upserts on `schema.services.id` (not `name`) so
deterministic ids always win — defense-in-depth if a future change
drops `services` from the TRUNCATE list again.
* Reconcile the id↔name map: `demoSvcs[3]` is now
`id=…-005, name="Nail Trim"` to match `servicesDef[4]`.
* Update `UAT_PLAYBOOK.md §4.5.1` with regression coverage
(TC-SEED-1..4).
Required for the GRO-2033 close-out: infra PR #605 must repoint to the
new image tag (NOT 2a6242d) and `apps/overlays/prod/reset-cronjob.yaml`
must stay suspended until a one-shot seed Job runs 1/1 against prod.
Co-Authored-By: Paperclip <noreply@paperclip.ing>