A declared identity key matches a fresh sign-in to its existing connection - #305
Merged
czpython merged 2 commits intoAug 22, 2026
Conversation
…ction A Service may name the identity fact that identifies the provider account (identity_key = "sub"). Declared, a fresh sign-in whose identity matches an existing connection for the same owner lands on that row — a live row's tokens are replaced, a revoked row comes back to life under its old id — instead of creating a sibling. A live match outranks revoked history. Undeclared, every fresh sign-in stays a new connection.
czpython
force-pushed
the
commonzenpython/eng-870-service-declared-identity-key-for-connection-dedup-and
branch
from
August 22, 2026 09:44
ee1a935 to
19a6461
Compare
czpython
deleted the
commonzenpython/eng-870-service-declared-identity-key-for-connection-dedup-and
branch
August 22, 2026 09:47
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.
Since #302, a fresh sign-in always creates a new connection. A user can hold two live connections for one provider account. A revoke and a new sign-in always change the connection id. The platform cannot know that two consents are the same account, unless the service tells it.
What changes
Servicegets an opt-inidentity_keyclassvar besideidentity_endpoint. It names the identity fact that identifies the provider account:"sub"for Google,"id"for GitHub. One line per service. There is no cross-provider key list — a generic guess can attach a fresh consent to the wrong row, so Revoking a connection is a state the row keeps, not a deletion #302 deleted one.oauth.connectedwithreconsent=true. That is the flag's documented meaning: the consent replaced an existing connection's tokens.A live match updates the row; it is not refused. The consent already happened, and a refusal would discard a completed grant. The update keeps the connection id stable.
No schema change: the lookup reads the existing
identityJSONB. Documented besideidentity_endpointin writing-an-extension.md.Verification
ruff check/ruff format --check: clean🤖 Generated with Claude Code