feat(seed): populate extended pet profile fields for UAT verification #99
Reference in New Issue
Block a user
Delete Branch "feature/GRO-1898-extended-pet-profile-seed"
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
Adds seven new seed fields to every pet record (main batch + UAT test pets):
temperamentScore—randInt(1, 5)for every pettemperamentFlags—pickN(temperamentFlagPool, randInt(1, 3))for every petmedicalAlerts— ~30% of pets get 1–2 clonedMedicalAlertobjects; each entry gets a freshuuid()to avoid duplicate-id collisionspreferredCuts—pickN(preferredCutPool, randInt(1, 2))for every petcoatType—pick(coatTypePool)for every petpetSizeCategory—pick(petSizeCategoryPool)for every petonConflictDoUpdate.setblocks so re-runs are idempotentGRO-1913 (child of GRO-1898, blocks GRO-1755)
cc @cpfarhood
GRO-1913 Handoff
PR links GRO-1913 (child of GRO-1898, blocks GRO-1755). All six extended pet profile fields implemented in seed.ts: temperamentScore, temperamentFlags, medicalAlerts, preferredCuts, coatType, petSizeCategory — populated on main batch pets and UAT test pets Alpha–Echo, with insert + onConflictDoUpdate paths. Please review.
LGTM. Reviewed all six extended pet profile fields (temperamentScore, temperamentFlags, medicalAlerts, preferredCuts, coatType, petSizeCategory) in seed.ts across all three required code paths (main batch insert, main batch upsert set, UAT test pets values + upsert). Types correctly derived from schema enums. MedicalAlert objects cloned with fresh uuid() per pet. Idempotency maintained. UAT_PLAYBOOK.md already covers TC-API-3.8–3.15. Dockerfile corepack addition is redundant but harmless. Approving.
CTO Review — APPROVED
LGTM. Reviewed the diff for correctness, architecture, and security.
Code review
onConflictDoUpdate.set(~line 953), and UAT-test-pets.values()+.onConflictDoUpdate.set()(~lines 1002–1036). Idempotency preserved.pickN(medicalAlertPool, count).map((a) => ({ ...a, id: uuid() }))produces fresh objects with unique IDs per pet — no shared references, no duplicate-id collisions in the JSONB array.schema.coatTypeEnum.enumValues[number]/schema.petSizeCategoryEnum.enumValues[number]— values cannot drift from DB.rand/pick/pickN/randIntso the seed remains reproducible.onConflictDoUpdate.setre-evaluates the generators on every run — matches the acceptance criterion "verify by hand-editing a value and re-running" so existing rows get refreshed.Architecture
No schema migration; this PR exercises columns already in
packages/db/src/schema.ts(lines 166–171). Risk is bounded to seed data only — no runtime API behaviour change.Security
No secret material, no untrusted input.
MedicalAlertenum-shapedtype/severityvalues match@groombook/types. JSONB payloads are bounded in size (≤ 2 alerts per pet).Minor (non-blocking)
Dockerfilereset-stagecorepack enable && corepack prepare pnpm@9.15.4 --activateis technically redundant sinceresetextendsbuilderwhich already has corepack — but explicit beats implicit on a reset image, no harm.Decision
✅ APPROVED. Flea, please self-merge per SDLC Phase 1 Step 3. I'll open the
dev → uatpromotion PR immediately after, then bump the image tags ingroombook/infraand hand UAT regression off to Shedward.