Repository navigation
Add a read-only report of custodial take-ownership marker state - #599
Merged
Merged
Conversation
When a custodial user resets their PDS password, the API has to end custody and clear the stored credential in the same request. This script reports how many custodial identities sit in each marker state, per tenant schema, so a stuck state is visible. The script is read only. It finds tenant schemas itself, so it does not need editing when a tenant is added. The encrypted credential column is only tested for null, never selected. A count of identities with no marker is not a count of broken accounts. The column was added after the fix shipped, and only the new code path writes it, so every identity that predates the fix has no marker whether it is healthy or not.
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.
What this adds
scripts/atproto-custodial-marker-counts.sql, a read only report of how many custodial AT Protocol identities sit in each take-ownership marker state, broken down per tenant schema.Why
When a custodial user resets their PDS password, the API has to end custody and clear the stored credential in the same request. If it does not, the API keeps a password that no longer works and that user's events stop publishing. The marker column records how far a reset got. This script makes a stuck state visible without anyone having to write the query again.
A non-zero
confirmedcount means the automatic repair is not draining. That is worth raising on its own.How to run it
It discovers tenant schemas itself, so it does not need editing when a tenant is added. On a database with no tenant schemas it prints the header and stops.
Safety
SELECT. There is noUPDATE,INSERTorDELETE.pdsCredentialsholds an encrypted password. It is only tested for null. Its value is never selected.One thing to read carefully
The count of identities with no marker is not a count of broken accounts. The column was added after the password reset fix shipped, and only the new code path writes it, so every identity that predates the fix has no marker whether it is healthy or not. A healthy custodial row and a stranded one are identical in this schema. The only thing that tells them apart is whether the stored credential still works at the PDS, and that is not recorded. The script comments say this too, so the number is hard to misread later.