Skip to content

feat: dry-run legacy identity audit report - #116

Open
felixgateru wants to merge 8 commits into
mainfrom
feat/legacy-identity-audit-report
Open

felixgateru wants to merge 8 commits into
mainfrom
feat/legacy-identity-audit-report

Conversation

@felixgateru

@felixgateru felixgateru commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Depends on #115: pendingTokens.emailChange queries the email_change_tokens table introduced there. This diff includes #115's commits until it merges.

Fix

Four read-only, platform-admin-only GraphQL queries, each paginated and filterable by entityId:

  • legacyUnverifiedEmails — live entity_emails rows with verified_at IS NULL
  • legacyCredentialIdentifierMismatches — active password credentials whose identifier disagrees with (or is missing) the canonical email
  • legacyOauthEmailMismatches — OAuth identities whose claimed email doesn't match an active, verified canonical email
  • legacyAttributesEmailMismatches — human entities whose legacy attributes.email disagrees with the canonical row

Every row carries pendingTokens — counts only, never values — so an operator can see a self-service fix may already be in flight before reaching for manual recovery. Nothing here mutates a row.

Tests

  • 7 new tests + 24 existing admin-query tests, no regressions
  • caught and fixed a real edge case along the way: {"email": null} passes the JSONB key-exists check but breaks non-optional string extraction — now excluded explicitly

Part of #110 (workstream B, report half; remediation tooling and the operator runbook remain a separate PR).

… verified email-change flow

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
…contracts

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
…ries

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
…ontracts

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
…port

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
@felixgateru
felixgateru force-pushed the feat/legacy-identity-audit-report branch from 0c7c15c to 79ab807 Compare October 1, 2026 10:38
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
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.

1 participant