mirror of
https://github.com/coder/coder.git
synced 2026-09-21 20:51:01 +08:00
`GetAuditLogsOffset` orders by `"time" DESC` with no tiebreaker, and `dbtime.Now` rounds to microseconds, so two audit logs emitted in quick succession (especially on platforms with coarser clock resolution like Windows) can land in the same microsecond and Postgres is free to return them in either order. The test then assumes positional ordering and breaks. Sort `rows` by `Action` descending before indexing so `rows[0]` is the update log and `rows[1]` is the create log regardless of timestamp collisions. Closes CODAGT-585 Closes https://github.com/coder/internal/issues/1551