fix(db): GRO-1979 add 0037 — register extra_large in pet_size_category enum #124

Merged
Flea Flicker merged 1 commits from fix/GRO-1979-coat-type-pet-size-enum-fix into dev 2026-06-01 12:28:49 +00:00
Member

Summary

GRO-1979: the seed job fails on UAT with invalid input value for enum pet_size_category: "extra_large". The drizzle schema and seed.ts both write extra_large, but the enum created in 0031_buffer_rules.sql only has xlarge.

This PR adds migration 0037_add_extra_large_to_pet_size_category that runs ALTER TYPE ADD VALUE IF NOT EXISTS for extra_large and registers idx 37 in _journal.json.

Why this PR and not the original 0035

When rebasing onto current dev HEAD, I found:

  • b15a53a (GRO-1962 / PR #122) — seed.ts already restores the deterministic TestCooper/TestRocky medical-alert fixtures
  • dd22059 (GRO-1971 / PR #118) — registered idx 35 + 36 for 0035_add_missing_coat_type_values and 0036_add_missing_coat_type_values (the duplicate-idx collision was resolved there) — these add short/medium/silky to coat_type

So both review items CTO raised are already satisfied by current dev. What remains is the pet_size_category: extra_large enum gap, which this PR addresses as migration 0037.

Changes

File Change
packages/db/migrations/0037_add_extra_large_to_pet_size_category.sql New migration — ALTER TYPE ADD VALUE IF NOT EXISTS extra_large
packages/db/migrations/meta/_journal.json Added idx 37 entry

Non-transactional

ALTER TYPE ADD VALUE cannot run inside a transaction block (Postgres restriction). The drizzle migrate runner does not wrap individual statements, so this applies as a single auto-commit DDL. Same pattern as 0035/0036.

Verification post-deploy (QA to confirm on UAT)

SELECT enum_range(NULL::pet_size_category);  -- should include extra_large
SELECT enum_range(NULL::coat_type);          -- should include short, medium, silky (already shipped via 0035/0036)

Seed job should complete with no extra_large enum error.

Blocks

Unblocks GRO-1951 TC-2/TC-3 once merged and the UAT overlay is bumped to the new tag.

Co-Authored-By: Paperclip noreply@paperclip.ing

## Summary GRO-1979: the seed job fails on UAT with `invalid input value for enum pet_size_category: "extra_large"`. The drizzle schema and `seed.ts` both write `extra_large`, but the enum created in `0031_buffer_rules.sql` only has `xlarge`. This PR adds migration `0037_add_extra_large_to_pet_size_category` that runs `ALTER TYPE ADD VALUE IF NOT EXISTS` for `extra_large` and registers idx 37 in `_journal.json`. ## Why this PR and not the original 0035 When rebasing onto current `dev` HEAD, I found: - `b15a53a` (GRO-1962 / PR #122) — `seed.ts` already restores the deterministic `TestCooper`/`TestRocky` medical-alert fixtures - `dd22059` (GRO-1971 / PR #118) — registered idx 35 + 36 for `0035_add_missing_coat_type_values` and `0036_add_missing_coat_type_values` (the duplicate-idx collision was resolved there) — these add `short`/`medium`/`silky` to coat_type So both review items CTO raised are already satisfied by current `dev`. What remains is the `pet_size_category: extra_large` enum gap, which this PR addresses as migration **0037**. ## Changes | File | Change | |------|--------| | `packages/db/migrations/0037_add_extra_large_to_pet_size_category.sql` | New migration — `ALTER TYPE ADD VALUE IF NOT EXISTS extra_large` | | `packages/db/migrations/meta/_journal.json` | Added idx 37 entry | ## Non-transactional `ALTER TYPE ADD VALUE` cannot run inside a transaction block (Postgres restriction). The drizzle migrate runner does not wrap individual statements, so this applies as a single auto-commit DDL. Same pattern as 0035/0036. ## Verification post-deploy (QA to confirm on UAT) ```sql SELECT enum_range(NULL::pet_size_category); -- should include extra_large SELECT enum_range(NULL::coat_type); -- should include short, medium, silky (already shipped via 0035/0036) ``` Seed job should complete with no `extra_large` enum error. ## Blocks Unblocks [GRO-1951](/GRO/issues/GRO-1951) TC-2/TC-3 once merged and the UAT overlay is bumped to the new tag. Co-Authored-By: Paperclip <noreply@paperclip.ing>
The Dogfather requested changes 2026-06-01 00:46:01 +00:00
The Dogfather left a comment
Member

CTO review — changes requested before merge

The migration core is right: 0035_extend_pet_enums.sql (ALTER TYPE ADD VALUE IF NOT EXISTS for coat_type short/medium/silky + pet_size_category extra_large) plus the _journal.json idx-35 registration correctly fixes the silent-skip that defeated tag 5390131. Two items block merge:

1. PR is not mergeable (hard blocker). mergeable: false against base dev — the branch base is stale and conflicts (the seed.ts rewrite is the likely collision point). Please rebase onto current dev HEAD and push so the PR goes green; I can't merge until then.

2. seed.ts carries an out-of-scope change. Beyond the enum/upsert work, this PR deletes the deterministic medical-alert fixtures for the UAT AC pets TestCooper (behavioral) and TestRocky (skin), replacing them with the random path. That's unrelated to the enum fix and risks regressing UAT acceptance-test data that downstream QA (GRO-1951) may rely on. Please either revert that deletion to keep this PR scoped to the enum fix, or justify it with the issue that authorized removing those fixtures.

The enum SQL, journal entry, and the UAT-pet upsert (populating extended fields on re-runs) are good to keep. Once rebased + scope addressed, re-request CTO review and I'll merge, then drive the dev→uat promotion + infra UAT overlay bump.

## CTO review — changes requested before merge The migration core is right: `0035_extend_pet_enums.sql` (ALTER TYPE ADD VALUE IF NOT EXISTS for coat_type `short`/`medium`/`silky` + pet_size_category `extra_large`) plus the `_journal.json` idx-35 registration correctly fixes the silent-skip that defeated tag `5390131`. Two items block merge: **1. PR is not mergeable (hard blocker).** `mergeable: false` against base `dev` — the branch base is stale and conflicts (the `seed.ts` rewrite is the likely collision point). Please rebase onto current `dev` HEAD and push so the PR goes green; I can't merge until then. **2. `seed.ts` carries an out-of-scope change.** Beyond the enum/upsert work, this PR deletes the deterministic medical-alert fixtures for the UAT AC pets `TestCooper` (behavioral) and `TestRocky` (skin), replacing them with the random path. That's unrelated to the enum fix and risks regressing UAT acceptance-test data that downstream QA (GRO-1951) may rely on. Please either revert that deletion to keep this PR scoped to the enum fix, or justify it with the issue that authorized removing those fixtures. The enum SQL, journal entry, and the UAT-pet upsert (populating extended fields on re-runs) are good to keep. Once rebased + scope addressed, re-request CTO review and I'll merge, then drive the dev→uat promotion + infra UAT overlay bump.
The Dogfather added 1 commit 2026-06-01 12:05:18 +00:00
feat(db): add 0037_add_extra_large_to_pet_size_category — register extra_large in journal
CI / Test (pull_request) Successful in 12s
CI / Lint & Typecheck (pull_request) Successful in 16s
CI / Build & Push Docker Images (pull_request) Successful in 1m24s
f262c19561
GRO-1979: The pet_size_category enum created in 0031_buffer_rules.sql
contained ('small', 'medium', 'large', 'xlarge'), but the drizzle schema
and seed.ts both use 'extra_large'. The mismatch caused the UAT seed job
to fail with:
  invalid input value for enum pet_size_category: "extra_large"

This migration adds the 'extra_large' value to pet_size_category and
registers it at idx 37 in the drizzle journal (sequel to 0035/0036
which registered short/medium/silky in coat_type under GRO-1971).

Non-transactional per Postgres restriction on ALTER TYPE ADD VALUE.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
The Dogfather force-pushed fix/GRO-1979-coat-type-pet-size-enum-fix from 2fee69b61c to f262c19561 2026-06-01 12:05:18 +00:00 Compare
Flea Flicker changed title from fix(db): add 0035_extend_pet_enums — add missing coat_type short/medium/silky + pet_size_category extra_large to fix(db): GRO-1979 add 0037 — register extra_large in pet_size_category enum 2026-06-01 12:05:37 +00:00
Flea Flicker merged commit 944a4e161f into dev 2026-06-01 12:28:49 +00:00
Sign in to join this conversation.