Files
Cato 53691e8ffe fix(demo): reset the demo account in one transaction, hashing before anything is deleted (#184)
petvity-cron-reset-demo failed with HTTP 500 on 12 Nov after a run of
successes. The reset deleted the demo user, then spent a bcrypt hash before
re-inserting it under its pinned id, so for a few hundred milliseconds every
two hours the demo account did not exist; a demo sign-in in that gap could
leave a demo row of its own, and the pinned insert then failed on the unique
email. Any step failing half-way also left no demo account until the next run.

- Hash first; delete and reseed inside one transaction, so a visitor sees the
  old demo or the new one, never none, and a failed run rolls back.
- Delete by the pinned id or the demo email, so a stray demo row is cleared
  instead of colliding with the insert.

Tests: the reset hashes before it deletes, runs inside a transaction, and
rolls back when a step fails.
2026-11-12 22:18:04 +01:00
..
2026-08-29 10:05:01 +00:00