From b15a53a19b398f370edd4fd4b612b254f0f81049 Mon Sep 17 00:00:00 2001 From: The Dogfather <20+gb_dogfather@noreply.git.farh.net> Date: Mon, 1 Jun 2026 00:35:35 +0000 Subject: [PATCH] fix(seed): restore deterministic alerts for TestCooper/TestRocky (GRO-1962) (#122) Co-authored-by: The Dogfather <20+gb_dogfather@noreply.git.farh.net> Co-committed-by: The Dogfather <20+gb_dogfather@noreply.git.farh.net> --- packages/db/src/seed.ts | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/packages/db/src/seed.ts b/packages/db/src/seed.ts index 27500c4..cf65909 100644 --- a/packages/db/src/seed.ts +++ b/packages/db/src/seed.ts @@ -1106,14 +1106,17 @@ async function seed() { temperamentScore: randInt(1, 5), temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)), medicalAlerts: (() => { - // ~30% of pets get alerts; TestCooper/TestRocky get deterministic types + // TestCooper always has a behavioral alert; TestRocky always has 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. + if (uc.petName === "TestCooper") { + return pickN(medicalAlertPool.filter((a) => a.type === "behavioral"), 1).map((a) => ({ ...a, id: uuid() })); + } + if (uc.petName === "TestRocky") { + return pickN(medicalAlertPool.filter((a) => a.type === "skin"), 1).map((a) => ({ ...a, id: uuid() })); + } if (rand() < 0.3) { - if (uc.petName === "TestCooper") { - return pickN(medicalAlertPool.filter((a) => a.type === "behavioral"), 1).map((a) => ({ ...a, id: uuid() })); - } - if (uc.petName === "TestRocky") { - return pickN(medicalAlertPool.filter((a) => a.type === "skin"), 1).map((a) => ({ ...a, id: uuid() })); - } const count = rand() < 0.7 ? 1 : 2; return pickN(medicalAlertPool, count).map((a) => ({ ...a, id: uuid() })); } @@ -1136,14 +1139,17 @@ async function seed() { temperamentScore: randInt(1, 5), temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)), medicalAlerts: (() => { - // ~30% of pets get alerts; TestCooper/TestRocky get deterministic types + // TestCooper always has a behavioral alert; TestRocky always has 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. + if (uc.petName === "TestCooper") { + return pickN(medicalAlertPool.filter((a) => a.type === "behavioral"), 1).map((a) => ({ ...a, id: uuid() })); + } + if (uc.petName === "TestRocky") { + return pickN(medicalAlertPool.filter((a) => a.type === "skin"), 1).map((a) => ({ ...a, id: uuid() })); + } if (rand() < 0.3) { - if (uc.petName === "TestCooper") { - return pickN(medicalAlertPool.filter((a) => a.type === "behavioral"), 1).map((a) => ({ ...a, id: uuid() })); - } - if (uc.petName === "TestRocky") { - return pickN(medicalAlertPool.filter((a) => a.type === "skin"), 1).map((a) => ({ ...a, id: uuid() })); - } const count = rand() < 0.7 ? 1 : 2; return pickN(medicalAlertPool, count).map((a) => ({ ...a, id: uuid() })); }