Skip to content

test(policy): pin the membership writes' pending reset and Close's bound - #2352

Merged
Nash0x7E2 merged 1 commit into
mainfrom
test/ai-3574-membership-mutants
Nov 24, 2026
Merged

Nash0x7E2 merged 1 commit into
mainfrom
test/ai-3574-membership-mutants

Conversation

@thesyncim

Copy link
Copy Markdown
Member

Problem
Two rules #2301 added to Enforcer had no test that failed without them. Join resets an app's pending organization once it starts writing it; dropping that reset rewrote the membership forever, and no test noticed, because Close's check of joinsClosed ended the loop anyway. Enforcer.Close stops waiting on memberships after joinTimeout; the test of that bound held a row lock, which the server's 3s lock_timeout released before the test's own deadline, so an unbounded wait passed too.

Fix

  • Tests only.

Tests

  • TestAnAppNamingOrganizationsInTurnHasOneMembershipWrittenAtATimeAndTheLastWins now also checks that the row's seen_at stops moving once the organization named last has landed. It fails when the pending organization is not reset.
  • TestCloseStopsWaitingForAMembershipAfterJoinTimeout runs on a store whose DSN raises lock_timeout, so only Close's own bound ends the wait. It fails when that bound is removed.

Part of AI-3574

@thesyncim
thesyncim marked this pull request as ready for review November 24, 2026 11:21
@thesyncim thesyncim added the data-layer-review: ready Data layer review fix: passed automated review, merges cleanly, ready for a human review label Nov 24, 2026
@Nash0x7E2
Nash0x7E2 merged commit 22448dd into main Nov 24, 2026
14 of 15 checks passed
@Nash0x7E2
Nash0x7E2 deleted the test/ai-3574-membership-mutants branch November 24, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data-layer-review: ready Data layer review fix: passed automated review, merges cleanly, ready for a human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants