From 1aab3bf4e868df4682a0e2da5fb2a86be3a7afb9 Mon Sep 17 00:00:00 2001 From: Flea Flicker Date: Sat, 30 May 2026 04:40:08 +0000 Subject: [PATCH 1/2] GRO-1955: remove broken uc.petName refs in random pet batch medicalAlerts IIFE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The uc reference in the random pet batch (lines 970/973) is a regression from GRO-1949 — uc is only defined in the UAT client loop context (line 1056), not in the surrounding random pet generation loop. Deterministic UAT pet alerts are already correctly implemented in the uatClients loop (lines 1073-1078) where uc is in scope. This removes the undefined uc references from the random batch IIFE, restoring typecheck compliance. The deterministic UAT seeding for TestCooper/TestRocky remains intact in the uAT client loop. --- packages/db/src/seed.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/packages/db/src/seed.ts b/packages/db/src/seed.ts index 985ecf0..0264c19 100644 --- a/packages/db/src/seed.ts +++ b/packages/db/src/seed.ts @@ -966,14 +966,6 @@ async function seed() { temperamentScore: randInt(1, 5), temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)), medicalAlerts: (() => { - // Deterministic alerts for UAT AC pets - 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() })); - } - // Other UAT pets: random if (rand() < 0.3) { const count = rand() < 0.7 ? 1 : 2; return pickN(medicalAlertPool, count).map((a) => ({ ...a, id: uuid() })); @@ -1101,14 +1093,6 @@ async function seed() { temperamentScore: randInt(1, 5), temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)), medicalAlerts: (() => { - // Deterministic alerts for UAT AC pets - 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() })); - } - // Other UAT pets: random if (rand() < 0.3) { const count = rand() < 0.7 ? 1 : 2; return pickN(medicalAlertPool, count).map((a) => ({ ...a, id: uuid() })); -- 2.52.0 From 56b20a34571e2d1c2658588d952fcb097ca7a852 Mon Sep 17 00:00:00 2001 From: Flea Flicker Date: Sun, 31 May 2026 21:51:09 +0000 Subject: [PATCH 2/2] GRO-1961: populate extended fields on UAT Pup Alpha/Beta on re-runs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit seedUatStaffAccounts() inserted UAT Pup Alpha/Beta but only INSERTed —if the rows already existed (from a prior partial seed run) the UPSERT branch skipped them, leaving all 6 extended fields null. Fix: flip the branch to INSERT + onConflictDoUpdate both paths so extended fields (temperamentScore, coatType, petSizeCategory, temperamentFlags, preferredCuts, medicalAlerts) are always populated, whether the row is new or already present. Co-Authored-By: Paperclip --- packages/db/src/seed.ts | 47 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/packages/db/src/seed.ts b/packages/db/src/seed.ts index 0264c19..a2f77f2 100644 --- a/packages/db/src/seed.ts +++ b/packages/db/src/seed.ts @@ -609,8 +609,45 @@ async function seedUatStaffAccounts(db: ReturnType) { .from(schema.pets) .where(eq(schema.pets.id, pet.id)) .limit(1); + if (existing) { - console.log(`✓ UAT Pet '${existing.name}' already exists — skipping`); + // Upsert so extended fields are always populated on re-runs + await db.insert(schema.pets) + .values({ + id: pet.id, + clientId: uatCustomerClientId, + name: pet.name, + species: pet.species, + breed: pet.breed, + weightKg: pet.weight, + dateOfBirth: new Date(`${pet.dob}T00:00:00Z`), + image: pet.image, + temperamentScore: randInt(1, 5), + temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)), + medicalAlerts: [], + preferredCuts: pickN(preferredCutPool, randInt(1, 2)), + coatType: pick(coatTypePool), + petSizeCategory: pick(petSizeCategoryPool), + }) + .onConflictDoUpdate({ + target: schema.pets.id, + set: { + clientId: uatCustomerClientId, + name: pet.name, + species: pet.species, + breed: pet.breed, + weightKg: pet.weight, + dateOfBirth: new Date(`${pet.dob}T00:00:00Z`), + image: pet.image, + temperamentScore: randInt(1, 5), + temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)), + medicalAlerts: [], + preferredCuts: pickN(preferredCutPool, randInt(1, 2)), + coatType: pick(coatTypePool), + petSizeCategory: pick(petSizeCategoryPool), + }, + }); + console.log(`✓ Upserted UAT pet '${pet.name}' with extended fields`); } else { await db.insert(schema.pets).values({ id: pet.id, @@ -621,8 +658,14 @@ async function seedUatStaffAccounts(db: ReturnType) { weightKg: pet.weight, dateOfBirth: new Date(`${pet.dob}T00:00:00Z`), image: pet.image, + temperamentScore: randInt(1, 5), + temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)), + medicalAlerts: [], + preferredCuts: pickN(preferredCutPool, randInt(1, 2)), + coatType: pick(coatTypePool), + petSizeCategory: pick(petSizeCategoryPool), }); - console.log(`✓ Created UAT pet '${pet.name}'`); + console.log(`✓ Created UAT pet '${pet.name}' with extended fields`); } } } -- 2.52.0