Files
alpenwerk-hr/supabase
Maximilian Stubhan 73656461d1 Catch a seed event dated before the entry it belongs to
pruefeInvarianten() checked that no history event falls after an exit, but
not that none falls before an entry — and the database enforces exactly
that, in trg_history_not_before_entry.

That gap explains why the live database holds 852 people and no history at
all. employee_history is the last table the seed writes and insertInChunks
throws on the first rejected chunk, so everything before it was already
committed while every one of the ~950 events was lost. The result did not
look like an aborted run. It looked like an application that shows little
history.

The cause was the timezone bug in isoDate() that this seed already
documents: dates built from local parts but formatted through UTC land a day
early in Austria, which put every "Eintritt" one day before the entry date it
was derived from. That is fixed; the database was simply never rebuilt.

A dry run now reports 951 events and no violation, so the current code is
sound. The check stays because it turns this class of failure into a refusal
before the wipe instead of an abort halfway through it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 13:48:01 +02:00
..