Skip to content

feat: add user locking to isolation reservation table#185

Closed
porcellus wants to merge 11 commits into
feat/isolation-reservation-tablefrom
feat/isolation-reservation-table-locking
Closed

feat: add user locking to isolation reservation table#185
porcellus wants to merge 11 commits into
feat/isolation-reservation-tablefrom
feat/isolation-reservation-table-locking

Conversation

@porcellus
Copy link
Copy Markdown
Collaborator

Summary of change

(A few sentences about this PR)

Related issues

  • Link to issue1 here
  • Link to issue1 here

Checklist for important updates

  • Changelog has been updated
  • Changes to the version if needed
    • In build.gradle
  • Had installed and ran the pre-commit hook
  • Issue this PR against the latest non released version branch.
    • To know which one it is, run find the latest released tag (git tag) in the format vX.Y.Z, and then find the
      latest branch (git branch --all) whose X.Y is greater than the latest released tag.
    • If no such branch exists, then create one from the latest released branch.

Remaining TODOs for this PR

  • Item1
  • Item2

porcellus and others added 9 commits January 25, 2026 02:12
- Add LockedUser interface for compile-time lock enforcement
- Add LockedUserPair DTO for linking operations
- Add UserLockingStorage interface with lockUser/lockUsers methods
- Add UserNotFoundForLockingException for missing users
- Add AccountInfoStorage skeleton interface for future ISO tickets

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…tInfoStorage

Add method signature that requires LockedUser parameters to ensure proper
locking has been acquired before linking operations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…e interface

Add the LockedUser-enforced version of updateAccountInfo_Transaction method
to the AccountInfoStorage interface. This method requires a LockedUser parameter
to ensure proper row-level locking has been acquired before updating account info.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…foStorage

Add interface method that requires LockedUser parameter to ensure proper
locking when a user becomes a primary user, preventing race conditions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…tionForPrimaryUserForUnlinking

Add removeAccountInfoReservationForPrimaryUserForUnlinking_Transaction method to
AccountInfoStorage interface that requires LockedUser parameters for both recipeUser
and primaryUser. This ensures proper row-level locking before removing account info
reservations during unlink operations, preventing race conditions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ignature

- Remove redundant AppIdentifier parameter (TenantIdentifier extends AppIdentifier)
- Simplify signature to (TenantIdentifier, TransactionConnection, LockedUser)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…foStorage with LockedUser

Move addTenantIdToPrimaryUser_Transaction from AuthRecipeSQLStorage to
AccountInfoStorage and change the parameter from String userId to LockedUser
primaryUser.

This ensures proper row-level locking has been acquired before adding
account info reservations for a tenant association, preventing race
conditions during concurrent tenant association and linking operations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The recipe ID is now fetched from app_id_to_user_id during lock acquisition
and stored in LockedUser. This ensures the recipe ID is always available
even when a user has been removed from all tenants (when all_auth_recipe_users
has no row for them).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
porcellus and others added 2 commits February 19, 2026 11:28
…' into feat/isolation-reservation-table-locking
…tionForPrimaryUserForUnlinking_Transaction

The primary user ID can be derived from recipeUser.getPrimaryUserId() since
lockUser() already acquires locks on both the recipe user and their primary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@porcellus
Copy link
Copy Markdown
Collaborator Author

Superseded by #199, which consolidates feat/isolation-reservation-table, feat/isolation-reservation-table-locking, feat/isolation-reservation-table-migration, and refactor/performance_improvements into a single PR targeting master. Closing in favor of that PR — please re-route review there.

@porcellus porcellus closed this May 28, 2026
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.

2 participants