feat(GRO-1174): add pet size/coat dropdowns to booking wizard #8
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
Test plan
cc @cpfarhood
CI is failing — changes required
Both the Lint & Typecheck and Test jobs failed on this PR. Below are the specific issues to fix before this can merge.
1. Wrong module import path (TS2307)
src/__tests__/PetForm.test.tsx:4,src/portal/sections/PetForm.tsx:3,src/portal/sections/PetProfiles.tsx:4all import from:That path resolves incorrectly from inside the
webworkspace. Fix the import path to match the tsconfig alias or the correct relative path for the monorepo structure.2.
getByPlaceholderdoes not exist — usegetByPlaceholderTextMultiple lines in
src/__tests__/PetForm.test.tsx(lines 58, 66, 88, 89, 101) callscreen.getByPlaceholder(...)which does not exist in@testing-library/react. Replace all occurrences withscreen.getByPlaceholderText(...).3. Implicit
anytype parameters (TS7006 / TS7031)The following are untyped and cause
noImplicitAnyerrors:PetForm.tsx:27— destructured{ type, description, severity }(in a callback/map)PetForm.tsx:179— parameterflagPetProfiles.tsx:257— parameterflagPetProfiles.tsx:284— parameteralertPetProfiles.tsx:322— parametercutAdd explicit types to all of these.
4. Object possibly undefined (TS2532 / TS2345)
src/__tests__/PetForm.test.tsxlines 79 and 111 pass a value that may beundefinedwhere a non-undefined type is required. Add a null-guard or non-null assertion if the element is guaranteed to exist at that point.5. Test runtime failure — coat type dropdown not accessible
The test
PetForm > allows coat type selection from dropdownfails because no element withrole="combobox"and name matching/coat type/iis found in the rendered output. The ARIA snapshot shows no combobox at all — only headings, buttons, and textboxes. Ensure:<select>elements have an associated<label>with the correct text so testing-library can find them by accessible name, orgetByRole("combobox", { name: ... })requires a proper<label for="...">oraria-label/aria-labelledbyon the<select>.Please fix all five categories above, push to the same branch, and re-request review.
QA Re-Review: Changes Requested
CI is failing on both Lint & Typecheck and Test jobs. Two root causes:
1. TypeScript Errors — Missing Types in
@groombook/typesPetForm.tsxandPetProfiles.tsximportMedicalAlert,CoatType, andAlertSeverityfrom@groombook/types, but these are not exported by the published package. Additionally,Petin@groombook/typesdoes not havecoatType,preferredCuts,medicalAlerts,temperamentScore, ortemperamentFlags.Errors:
Fix required: The
packages/types/src/index.tsschema update (addingcoatType,preferredCuts,medicalAlerts,temperamentScore,temperamentFlagsto thePettype, and exportingMedicalAlert,CoatType,AlertSeverity) must be published to@groombook/typesand the version bumped before this PR can pass typecheck.2. Test Failures —
src/__tests__/PetForm.test.tsxFailure A —
adds a cut when the + button is clicked(line 68–69):The selector
getByRole("button", { name: /add/i })matches the "Add Alert" button instead of the Preferred Cuts "+" button (which has no accessible text label). The click adds a medical alert form, not a cut, so"Teddy Bear"is never rendered.Fix: Add
aria-label="Add"to the + button in the Preferred Cuts section, or use a more specific test selector.Failure B —
displays temperament score as read-only stars(line 151):Test expects
"(/4/5)"but the component renders"(4/5)"— extra/in the test string.Fix: Change
expect(screen.getByText("(/4/5)"))→expect(screen.getByText("(4/5)")).Summary
@groombook/typesMedicalAlert,CoatType,AlertSeverityexports;Petmissing 5 fieldssrc/__tests__/PetForm.test.tsx:68/add/iselectoraria-labelto + button or fix selectorsrc/__tests__/PetForm.test.tsx:151"(/4/5)"should be"(4/5)"The
Book.tsxchanges (acceptance criteria scope for GRO-1174) look correct — the dropdowns, query params, graceful degradation, and buffer hiding are all properly implemented. The failures are all in thePetForm/PetProfilesportal changes and their tests.Please fix and re-push. No need to go through CTO — once CI is green, reassign back to QA for re-review.
QA Re-Review (Round 3): Changes Requested
CI still failing. All remaining errors are well-defined. Here are the exact changes needed — copy-pasteable:
Fix 1 —
packages/types/src/index.ts: makepetSizeCategoryoptionalpetSizeCategoryis currently required (string | null), causingBASE_PETin the test to fail typecheck. It needs?.Fix 2 —
src/portal/sections/PetForm.tsxline 5: remove"single"and"short"from COAT_TYPESCoatTypeis"smooth" | "double" | "curly" | "wire" | "long" | "hairless". The array includes"single"and"short"which are not in the union.Fix 3 —
src/__tests__/PetForm.test.tsx: exact button name matchgetByRole("button", { name: /add/i })now matches both "Add Alert" AND thearia-label="Add"button. Use exact string:Fix 4 —
src/__tests__/PetForm.test.tsx: optional chaining for array accessnoUncheckedIndexedAccess: truemakesarray[0]returnT | undefined. Fix line ~79:Fix 5 —
src/portal/sections/PetProfiles.tsxline ~70: optional chaining on array accessSame
noUncheckedIndexedAccessissue —petsData[0]can bePet | undefined:Summary (all 5 fixes)
packages/types/src/index.tspetSizeCategory: string | null→petSizeCategory?: string | nullsrc/portal/sections/PetForm.tsx:5"single","short"from COAT_TYPESsrc/__tests__/PetForm.test.tsx:~65/add/i→"Add"(exact match)src/__tests__/PetForm.test.tsx:~79.closest()→?.closest()src/portal/sections/PetProfiles.tsx:~70petsData[0].id→petsData[0]?.id ?? ""The
Book.tsxcore changes remain correct — no regressions there. Once CI is green, I will approve immediately.- Make coatType and petSizeCategory optional on Pet (?:) — they may not be set - Remove "single" and "short" from COAT_TYPES (not in CoatType union) - Use { name: "Add" } instead of /add/i to target the + button specifically - Add optional chaining to puppyCutSpans[0]?.closest() (noUncheckedIndexedAccess) - Add optional chaining to petsData[0]?.id ?? "" in PetProfiles Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>CI Failure — Typecheck Error (line 114)
One typecheck error remains after the review #2 fixes:
Root cause: In the
"removes a medical alert"test,removeButtons[0]is typed asHTMLElement | undefinedundernoUncheckedIndexedAccess. The guardif (removeButtons.length === 0) return;does not narrowremoveButtons[0]toHTMLElementfor TypeScript.The fix applied to
puppyCutSpans[0]?.closest()in the "removes a cut" test (also in this file) was the right approach, but the same pattern at line 114 was not updated.Fix needed (one of these):
All other review items look good — types, enum values, button selector, and optional chaining on
puppyCutSpans[0]andpetsData[0]are all correct. Just this one remaining null-guard is blocking CI.CI Failure — Typecheck
The
Lint & TypecheckCI check is failing on this PR.Error:
Root cause: Line 114, the guard
if (removeButtons.length === 0) return;does not narrow the type ofremoveButtons[0]— TypeScript still treats it asHTMLElement | undefined.Required fix — replace the relevant block in the
removes a medical alerttest:All other checks (Tests) pass. Please push the fix and re-request review.