Skip to content

chore(test): guard lock owners against losing a lock held by the connection made before the lock server started - #65

Merged
yordis merged 1 commit into
yordis/test-postgres-restartfrom
yordis/test-nil-connection-branch
Oct 26, 2026
Merged

yordis merged 1 commit into
yordis/test-postgres-restartfrom
yordis/test-nil-connection-branch

Conversation

@yordis

@yordis yordis commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

@cursor

cursor Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Test-only changes to advisory lock scenarios; no production code in this diff.

Overview
Expands advisory lock coverage for the case where the PostgreSQL lock pool connects before AdvisoryLocks starts, so the server never saw the initial :connected notice.

The "lock connection that connected before the lock server started" describe block now uses shared setup (pre-start connection, first_session, first_connection) and a start_lock_server helper. The existing crash test is unchanged in intent but uses that setup.

Two new tests assert owners still get {AdvisoryLocks, :lock_released, ...} when the pre-registration connection dies: one with without_restarts so only a disconnect notice can notify the owner (no replacement wait), and one where the connection is suspended and killed without a disconnect notice so release must come via replacement/reconciliation. without_reconnects is refactored to call a new without_restarts helper that suspends the connection supervisor.

Reviewed by Cursor Bugbot for commit b69c1b4. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4bc65d56-5a1e-4549-a9bc-7ead1e92d420
Commits

Reviewing files that changed from the base of the PR and between b39e512 and 8a13143.

Files selected for processing: 1
  • test/advisory_locks_test.exs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yordis
yordis added this pull request to stack #73 October 26, 2026 16:00
@yordis
yordis force-pushed the yordis/test-nil-connection-branch branch from b69c1b4 to 42718a4 Compare October 26, 2026 16:16
@yordis
yordis removed this pull request from stack #73 October 26, 2026 16:53
@yordis
yordis force-pushed the yordis/test-nil-connection-branch branch from 42718a4 to 332045e Compare October 26, 2026 16:54
@yordis
yordis added this pull request to stack #74 October 26, 2026 17:10
@yordis
yordis force-pushed the yordis/test-nil-connection-branch branch 2 times, most recently from a5423cb to 46d982f Compare October 26, 2026 17:47
… the connection made before the lock server started

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis
yordis force-pushed the yordis/test-nil-connection-branch branch from 46d982f to 8a13143 Compare October 26, 2026 19:31
@yordis yordis changed the title test(advisory-locks): guard lock owners against losing a lock held by the connection made before the lock server started chore(test): guard lock owners against losing a lock held by the connection made before the lock server started Oct 26, 2026
@yordis
yordis merged commit 92fe689 into main Oct 26, 2026
7 of 8 checks passed
@yordis
yordis deleted the yordis/test-nil-connection-branch branch October 26, 2026 22:05
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.

1 participant