Skip to content

test(enterprise/coderd): stabilize TestUserSkillAuditDiffTracksContent#26326

Draft
ethanndickson wants to merge 1 commit into
mainfrom
ethanndickson/fix-user-skill-audit-flake
Draft

test(enterprise/coderd): stabilize TestUserSkillAuditDiffTracksContent#26326
ethanndickson wants to merge 1 commit into
mainfrom
ethanndickson/fix-user-skill-audit-flake

Conversation

@ethanndickson

Copy link
Copy Markdown
Member

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 coder/internal#1551

GetAuditLogsOffset orders by "time" DESC with no tiebreaker, and dbtime.Now
rounds to microseconds, so two audit logs emitted in quick succession can
land in the same microsecond and return in non-deterministic order.

Sort the rows by Action descending before indexing so positional access is
stable regardless of timestamp collisions.
@linear-code

linear-code Bot commented Jun 12, 2026

Copy link
Copy Markdown

CODAGT-585

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flake: TestUserSkillAuditDiffTracksContent

1 participant