Repository navigation
Let a re-authorization win over the repair sweeps - #2130
Merged
Merged
Conversation
ppXD
changed the base branch from
fix/let-an-owner-reconnect-their-own-credential
to
main
October 19, 2026 03:05
The repair of stranded bindings, the connect-time carry-forward and the departed-member retirement each judge a credential dead and act on that verdict a moment later. An in-place re-authorization that lands in between revives the credential, yet the move or the retirement went on: the bindings left a credential that was healthy again, or its new token was blanked and the person had been told the re-authorization worked. Both sweeps now take the credential's refresh lock, the one every rewrite of its token takes, without waiting. A credential somebody is writing is skipped and met again on a later pass; otherwise the verdict is taken again under the lock, by the same query that picked the candidate, so a credential revived since the page was read moves nothing. The successor is the one that verdict names. The refresh lock is taken by the writers of the token only, and the hourly health probe writes a refused credential back to Active, when its provider accepts it again, without it. So the repair also holds the dead credential's row (FOR NO KEY UPDATE, in a transaction of its own per credential) and judges it under that hold: a verdict recorded since the page was read is seen, and one that arrives later waits for the commit and finds the bindings already moved. A connect cannot hold the lock to the end of its unit of work without leaking it on a rollback, so it holds the dead credential's row for the transaction instead and drops any whose status or payload is no longer what it read. A re-authorization that arrives after waits for the commit and finds the bindings already moved. Skipping a busy credential is not a failure: it never counts toward the sweep's back-off, which the tests pin by skipping more passes than the back-off tolerates before the lock is released. No schema, API or lock-key change: the advisory key is the one the refresher and the previous build already use, so pods of either build exclude each other.
ppXD
force-pushed
the
fix/let-a-reauthorization-win-over-the-repair-sweep
branch
from
October 19, 2026 03:05
90c3126 to
2dcd2be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FOR NO KEY UPDATE, in a transaction of its own per credential) while it judges and moves, so a verdict recorded since the page was read is seen, and one that arrives later waits for the commit and finds the bindings already moved. The connect path holds the rows it read the same way for its unit of work and drops any whose status or payload changed.ScopedTransactionInventoryTestsas owned by design (a sweep has no transaction to join).Test plan
CredentialSweepLockE2ETests): a real HTTP reconnect queued behind a lock another pod holds, a repair pass in between, then the next pass; a real departed-member retirement against a held lock.credential-binding-repairanddeparted-credential-retirementlogs for "is being written ... stays a candidate" and for deadlock errors on the credential/repository rows after deploy.