fix(seed): update credential password on existing accounts — not skip (GRO-1977) #120
Reference in New Issue
Block a user
Delete Branch "fix/GRO-1977-seed-credential-idempotency"
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
Fix seed.ts credential idempotency bug that caused all UAT persona accounts to return 401 after first seed.
Root cause:
seedKnownUsers()skipped credential account inserts whenexistingAccountwas found, permanently freezing the password hash at first-seed. Re-seeding (e.g. after password rotation) had no effect.Fix: When a credential account already exists, re-hash the current
SEED_UAT_*_PASSWORDenv var and UPDATE the row instead of skipping.Changes:
apps/api/src/db/seed.ts—existingAccountbranch now callsdb.update()with a freshhashPassword()instead of skippingapps/api/src/__tests__/seed-uat-credentials.test.ts— added AC-8 asserting that re-seeding updates the stored hashAcceptance criteria met:
seed.tsupdates (does not skip) the credential password on existing accountsQA handoff: Please run
seed-uat-credentials.test.tsagainst a clean DB and confirm the new AC-8 test asserts the rotation behavior correctly.Part of GRO-1977