fix(seed): GRO-2100 run uat-groomer linkage AFTER services seed (regression in #151) #153
Reference in New Issue
Block a user
Delete Branch "flea-flicker/gro-2100-seed-linkage-after-services"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes a regression in PR #151 (GRO-2100) where
seedUatGroomerLinkage()was being called insideseedUatStaffAccounts(), which runs before the services catalogue is seeded. On every fresh reset the helper bailed with:so the deterministic uat-groomer ↔ UAT Pup Alpha appointment never landed, leaving TC-UAT-2/3 un-runnable even with PR #152 + infra #613 deployed.
Change
seedUatGroomerLinkage()is calledseedUatStaffAccounts()seedKnownUsers()andseed()flows, after the services insert completesseedUatStaffAccounts()return typePromise<void>Promise<string | null>(returns the UAT Customer clientId, or null if not in UAT mode)customerClientIdis null, + skips if the linked pet (c0000001-…-0002) is missingWhy both call sites need the post-services call
seedUatStaffAccounts()is invoked from two flows:seedKnownUsers()— followed by a smalldemoSvcslist (Bath & Brush, Full Groom — Small/Medium, Nail Trim) seeded right after. The helper now runs after those.seed()(full branch) — followed by the fullservicesDefcatalogue (10 services). The helper now runs after those.Idempotency
Preserved. The appointment upsert key (
a0000001-0000-0000-0000-000000000001) is short-circuited on re-seed:Verification (post-merge, post-
reset-demo-dataCronJob)GET /api/pets/c0000001-…-0002/profile-summaryasuat-groomerrecentGroomingHistory[]non-empty,visitCount >= 1GET /api/pets/c0000001-…-0003/profile-summaryasuat-groomerUAT_PLAYBOOK.md §3 (TC-UAT-2 / TC-UAT-3) — added in PR #152 commit
bd384bdf.Risk
nullcheck at the top ofseedUatGroomerLinkage()so non-UAT seed profiles don't crashRefs
00dac467)LGTM — the fix is correct and CI is green.
What was reviewed:
seedUatGroomerLinkage()called insideseedUatStaffAccounts()which ran before the services catalogue was seeded —nullclientId guard + service lookup returned 0 rows → silent skip every reset.seedUatStaffAccounts()now returnsuatCustomerClientId. BothseedKnownUsers()andseed()capture the value and callseedUatGroomerLinkage()after the services insert — ordering bug eliminated.nullguard oncustomerClientIdis correct for non-UAT seed profiles.packages/db/src/seed.ts), focused and minimal.CI: Lint & Typecheck ✓ · Test ✓ · Build ✓
Approved. Self-merge when ready.