docs/plans/2026-04-21-sso-user-identity-linkage/execution.md
user_identity migrations + LATEST.sql updatesStatus: Completed Files Changed:
store/migration/sqlite/0.28/00__user_identity.sqlstore/migration/postgres/0.28/00__user_identity.sqlstore/migration/mysql/0.28/00__user_identity.sqlstore/migration/sqlite/LATEST.sqlstore/migration/postgres/LATEST.sqlstore/migration/mysql/LATEST.sql
Validation:rg 'CREATE TABLE \?user_identity`?' store/migration` — PASS (hits in all 6 expected files).rg 'UNIQUE \(\?provider`?, `?extern_uid`?)' store/migration` — PASS (6 hits).go build ./... — PASS.
Path Corrections: None.
Deviations: None.store.UserIdentity model, Store methods, and driver interfaceStatus: Completed Files Changed:
store/user_identity.gostore/driver.go
Validation:rg 'CreateUserIdentity|ListUserIdentities' store/driver.go store/user_identity.go — PASS (method declarations present in both files).
Path Corrections: None.
Deviations: None.user_identityStatus: Completed Files Changed:
store/db/sqlite/user_identity.go
Validation:go build ./store/db/sqlite/... — PASS.
Path Corrections: None.
Deviations: None.user_identityStatus: Completed Files Changed:
store/db/postgres/user_identity.go
Validation:go build ./store/db/postgres/... — PASS.
Path Corrections: None.
Deviations: None.user_identityStatus: Completed Files Changed:
store/db/mysql/user_identity.go
Validation:go build ./... — PASS (whole repo compiles; all drivers satisfy the Driver interface).
Path Corrections: None.
Deviations: None.user_identityStatus: Completed Files Changed:
store/test/user_identity_test.go
Validation:DRIVER=sqlite go test ./store/test/ -run TestUserIdentity -count=1 -v — PASS:
TestUserIdentityCreateAndGet — PASSTestUserIdentityListByUserID — PASSTestUserIdentityUniqueConflict — PASSTestUserIdentitySameExternUIDDifferentProviders — PASS
Path Corrections: None.
Deviations: None.Status: Completed Files Changed:
server/router/api/v1/sso_username.go
Validation:go build ./server/router/api/v1/... — PASS.go vet ./server/router/api/v1/... — PASS.
Path Corrections: None.
Deviations: None.user_identity linkageStatus: Completed Files Changed:
server/router/api/v1/auth_service.go
SignIn SSO branch now delegates user resolution to a new resolveSSOUser method.resolveSSOUser does: user_identity lookup → hit path (load user by linked user_id); miss path (registration gate → deriveSSOUsername → create user → create linkage → race recovery on unique(provider, extern_uid)).isUserIdentityUniqueViolation helper (string match on the three backends' unique-constraint error strings, matching the pattern in memo_service.go:103–105).
Validation:go build ./... — PASS.go vet ./... — PASS.DRIVER=sqlite go test ./store/test/ -run TestUserIdentity -count=1 — PASS (regression check).
Path Corrections:identityProvider.UID; the actual protobuf type storepb.IdentityProvider exposes the field as Uid. Used identityProvider.Uid in the implementation. No semantic deviation.
Deviations: None.All tasks completed successfully.