GRO-1178: client-facing enhanced pet profile editor #21
Reference in New Issue
Block a user
Delete Branch "flea-flicker/pet-profile-editor"
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
Acceptance criteria
cc @cpfarhood
Co-Authored-By: Paperclip noreply@paperclip.ing
Implementation update — branch pushed. API PR #21 created at git.farh.net/groombook/api/pulls/21 targeting dev. Web branch pushed to GitHub (cross-hoster permissions block PR creation). Changes: PetForm (coat type, temperament read-only, medical alerts editor, preferred cuts tags), PetProfiles (tab displays), PetForm.test component tests. Shared types updated. cc @cpfarhood
Changes Requested
CI is failing on both Lint & Typecheck and Test. This PR cannot be merged until all CI checks pass.
1. CI: Tests failing — broken mock in
petsExtendedFields.test.tsapps/api/src/__tests__/petsExtendedFields.test.tsreturnsand,eq,exists,orfrom thevi.mock("../db", ...)factory (lines ~166–169), but these identifiers are never imported or defined in the test file. In strict ES module mode this causes aReferenceErrorat mock-factory evaluation time, causing every test in that file to fail.The correct pattern (used in
petPhotos.test.ts) is to stub them withvi.fn()inside the factory:Also:
petsRoutermust be imported via dynamicawait import(...)AFTER the mock is set up (aspetPhotos.test.tsdoes), not as a top-level import beforevi.mock.2. CI: Typecheck — investigate after test fix
Lint & Typecheck is also failing. After the mock fix above, run
npm run typechecklocally to confirm whether additional errors remain.3.
MedicalAlert.idis inconsistent with schema and Zodtypes/index.tsaddsid: string(required) toMedicalAlert, but:schema.ts'sMedicalAlerthas noid(this is the JSONB column type)idmedical_alertswon't haveidEither wire
idthrough the full stack (Zod schema, DB write, schema.ts), or remove it from the types interface.4.
coatTypevalidation does not enforce theCoatTypeunionCoatType="short" | "medium" | "long" | ...in types, but the route usesz.string().max(100). The test sendscoatType: "smooth"(not valid). Fix: usez.enum([...])matching theCoatTypevalues; update the test to use"double"or similar.5. Missing
UAT_PLAYBOOK.mdupdateThis PR changes client-facing behaviour — extended pet profile fields (
coatType,temperamentScore,temperamentFlags,medicalAlerts,preferredCuts) are now part of the API contract. Section 4.3 has no test cases for these. Add or update the relevant test cases before re-submitting.What is good
buildPetfactory fix correctly adds all extended fields with sensible defaults.CoatTypeunion type is a solid improvement over a plainstring.Approved ✓
All 5 QA findings are resolved:
importOriginalpattern;db.and/eq/exists/ornow use real drizzle helpers, eliminating theReferenceError.types/index.ts; interface now matchesschema.tsand Zod.z.enum([...])is now enforced end-to-end, matching theCoatTypeunion."smooth"→"double"is correct; test now exercises a valid enum value.Note on CI: Remaining CI failures are pre-existing on the
devbase branch (run #352 onff024abalso fails —authProvider.test.ts/setup.test.ts). None of the files modified by this PR are responsible for those failures.PR is approved for merge by QA. Handing to CTO for final review.
87cb4a74a9to5d478e0aabe4b7601de9to42a57121d342a57121d3toa74423c8b4CTO Review — Approved
Correctness: All 5 QA findings resolved correctly.
z.enumconstrainscoatType,MedicalAlert.idremoved, mock usesimportOriginalpattern, test uses valid enum value.Architecture: Clean Zod validation at API boundary.
updatePetSchemaderives correctly fromcreatePetSchema.partial(). Factory defaults match schema.Security: Input validation is solid — length limits, enum enforcement, array size caps (20 flags, 20 cuts, 50 alerts). No injection vectors.
Minor nit (non-blocking):
and:lost indentation in test mock (line 167).Approved for merge to dev.