fix(seed): restore deterministic alerts for TestCooper/TestRocky (GRO-1962 follow-up) #116

Closed
Lint Roller wants to merge 3 commits from fix/GRO-1962-uat-seed-pet-medicalalerts into dev
Member

Summary

QA found TC-API-3.23/3.24 became flaky after PR #115 moved TestCooper/TestRocky alert logic inside rand()<0.3, making those pets' alerts probabilistic (~30% instead of 100%).

Fix

Restores deterministic alerts for the two named UAT test pets:

  • TestCooper always gets a behavioral alert
  • TestRocky always gets a skin alert
  • All other UAT test pets follow the 30% random distribution

Deterministic alerts on 2 of 507 pets (~0.4%) do not meaningfully shift the overall distribution from the 25–35% target band.

Files changed

  • packages/db/src/seed.ts — medicalAlerts logic for UAT test clients (both insert and onConflictDoUpdate paths)

Testing

  • CI validates lint, typecheck, and tests
  • Manual: re-run seed and verify TestCooper has behavioral alert and TestRocky has skin alert on every run

cc @cpfarhood

## Summary QA found TC-API-3.23/3.24 became flaky after PR #115 moved TestCooper/TestRocky alert logic inside `rand()<0.3`, making those pets' alerts probabilistic (~30% instead of 100%). ## Fix Restores deterministic alerts for the two named UAT test pets: - **TestCooper** always gets a behavioral alert - **TestRocky** always gets a skin alert - All other UAT test pets follow the 30% random distribution Deterministic alerts on 2 of 507 pets (~0.4%) do not meaningfully shift the overall distribution from the 25–35% target band. ## Files changed - `packages/db/src/seed.ts` — medicalAlerts logic for UAT test clients (both insert and onConflictDoUpdate paths) ## Testing - CI validates lint, typecheck, and tests - Manual: re-run seed and verify TestCooper has behavioral alert and TestRocky has skin alert on every run cc @cpfarhood
Lint Roller added 3 commits 2026-05-31 22:24:30 +00:00
Fixes GRO-1962:
- Random pet loop (lines 968-982): removed stale uc.petName references
  that caused runtime ReferenceError (uc declared ~80 lines later at line 1048)
- UAT test clients loop: moved TestCooper/TestRocky deterministic checks
  inside the rand()<0.3 branch so they receive alerts ~30% of the time
  rather than 100% of the time (previously the checks fired before the
  random gate, always triggering)

This gives a true ~30% medicalAlerts distribution across all pets,
well within the TC-API-3.22 acceptance criteria band of 25-35%.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
docs(UAT_PLAYBOOK): add TC-API-3.25 and TC-API-3.26 for pet count and medicalAlerts distribution
CI / Test (pull_request) Successful in 14s
CI / Lint & Typecheck (pull_request) Successful in 14s
CI / Build & Push Docker Images (pull_request) Successful in 1m1s
20d44faec8
Updated UAT_PLAYBOOK.md §3.2 — new test cases for GRO-1962:
- TC-API-3.25: Verify 30+ total pets in UAT DB
- TC-API-3.26: Verify 25-35% medicalAlerts distribution

Co-Authored-By: Paperclip <noreply@paperclip.ing>
fix(seed): restore deterministic alerts for TestCooper/TestRocky (GRO-1962 follow-up)
CI / Test (pull_request) Successful in 12s
CI / Lint & Typecheck (pull_request) Successful in 14s
CI / Build & Push Docker Images (pull_request) Successful in 55s
37c0bb22dd
QA found TC-API-3.23/3.24 became flaky after PR #115 moved
TestCooper/TestRocky alert logic inside rand()<0.3, making those
pets' alerts probabilistic (~30% instead of 100%).

This fix restores deterministic alerts:
- TestCooper always gets a behavioral alert
- TestRocky always gets a skin alert
- All other UAT test pets follow the 30% random distribution

Deterministic alerts on 2 of 507 pets (~0.4%) do not meaningfully
shift the overall distribution from the 25-35% target band.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author
Member

Flea Flicker here — fixing the flaky TC-API-3.23/3.24 tests per QA's review.

Changes:

  • TestCooper now deterministically gets a behavioral alert (always)
  • TestRocky now deterministically gets a skin alert (always)
  • 2 of 507 pets (~0.4%) — negligible impact on overall 25–35% distribution
Flea Flicker here — fixing the flaky TC-API-3.23/3.24 tests per QA's review. **Changes:** - TestCooper now deterministically gets a behavioral alert (always) - TestRocky now deterministically gets a skin alert (always) - 2 of 507 pets (~0.4%) — negligible impact on overall 25–35% distribution
The Dogfather closed this pull request 2026-05-31 22:46:44 +00:00
Some checks are pending
CI / Test (pull_request) Successful in 12s
CI / Lint & Typecheck (pull_request) Successful in 14s
CI / Build & Push Docker Images (pull_request) Successful in 55s

Pull request closed

Sign in to join this conversation.