Skip to content

ops(certification): add --skip-personal-email-fallback flag to credential repair script - #4882

Merged
bokelley merged 1 commit into
mainfrom
bokelley/4753-skip-personal-email-fallback
May 20, 2026
Merged

bokelley merged 1 commit into
mainfrom
bokelley/4753-skip-personal-email-fallback

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Adds a flag to `server/src/scripts/repair-credential-recipient-names.ts` that skips credentials whose backfill value would be the user's email AND the email domain is a personal-email provider (gmail, hotmail, yahoo, icloud, etc.).

Why

Dry-run against prod surfaced 20 credentials with broken recipient names ("undefined undefined" or "Davide undefined"). 11 of them have real names available in `users.first_name` / `users.last_name` and will write a proper name. The other 9 fall back to the email — fine for corporate addresses (publicly listed on the user's LinkedIn anyway), problematic for personal addresses (`gmail.com`, `hotmail.co.uk`) on a publicly-linkable certificate artifact.

This flag lets us repair the 18-of-20 cases (real names + corporate emails) and leave 2 personal-email-fallback cases until the user provides their name via Addie's `set_my_name` recovery flow (#4799), at which point a re-run picks them up cleanly.

Validation

  • `tsc --project server/tsconfig.json --noEmit` — clean
  • Dry-run against prod confirmed 20 candidates before the change; with this flag the 2 personal-email-fallback users ([email protected], [email protected]) are surfaced as skipped.

Cleanup operation

After merge, runbook:
```bash

1. Dry-run with the new flag to verify scope

fly ssh console -a adcp-docs -C 'node /app/dist/scripts/repair-credential-recipient-names.js --skip-personal-email-fallback'

2. Apply

fly ssh console -a adcp-docs -C 'node /app/dist/scripts/repair-credential-recipient-names.js --skip-personal-email-fallback --apply'
```

Closes the cleanup loop for #4753 (geneticallymodifiedfoodforthought) and #4760 (THespos). Tom Hespos's two credentials in #4760 are unaffected by the new flag — we have his real name in the users table, so the script writes "Tom Hespos".

Follow-up

  • Personal Workspace users whose AAO profile setup doesn't capture first/last name (separate issue to file).

…tial repair

The repair script in server/src/scripts/repair-credential-recipient-names.ts
now accepts a flag that skips credentials whose backfill value would be the
user's email AND the email domain is a personal-email provider (gmail,
hotmail, yahoo, icloud, etc.).

Avoids surfacing personal-email PII on a publicly-shareable credential
artifact. Corporate-email users still get repaired — their email is already
public on business cards / LinkedIn. Personal-email users wait for the
NAME_REQUIRED gate + set_my_name recovery flow (#4799) to populate their
name in users.first_name; re-running the backfill then picks them up.

Closes the cleanup loop for #4753 and #4760. Tom Hespos's two credentials
in #4760 are unaffected — we have his real name in the users table, so the
script writes "Tom Hespos" not his email.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bokelley
bokelley merged commit a28ca37 into main May 20, 2026
10 checks passed
@bokelley
bokelley deleted the bokelley/4753-skip-personal-email-fallback branch May 20, 2026 19:05

@aao-release-bot aao-release-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Skip branch is correctly scoped to the post-needsRepair path, default behavior is unchanged, and the dry-run prod numbers (20 → 18 + 2 skipped) line up with the new flag's intent.

Things I checked

  • isPersonalEmailFallback at server/src/scripts/repair-credential-recipient-names.ts:94-99. buildRecipientName (server/src/services/certifier-client.ts:32-35) returns user.email verbatim when both trimmed name fields are empty, so desired === email is the precise signal for the fallback path. Both sides come from the same row.email reference, so casing/whitespace can't desync the equality.
  • The skip fires inside the needsRepair === true branch at repair-credential-recipient-names.ts:177. All three repair triggers (undefined-literal, null-literal, email-with-real-name) interact correctly: the email-with-real-name path can never reach desired === email because that requires first_name || last_name, which means desired is a real name. Logic is tight.
  • Domain extraction at line 98 uses lastIndexOf('@') (handles RFC-legal quoted locals) and lowercases the domain. Set entries are all lowercase. Right shape.
  • Default fail-mode-on-omission. Forgetting the flag preserves prior behavior. No CI/cron invokes this — manual fly ssh console only per the docstring. Fail-closed beats fail-open.
  • Logging. Skip path appends to skipped[] (line 178-183) which prints count only at line 209. The plan path's email log at line 215 is unchanged from baseline. No new PII surface.
  • Changeset. Empty frontmatter matches existing ops-only convention (.changeset/2303-policy-attribution-pattern.md, .changeset/2383-test-vector-index-scope-update.md).
  • PATCH payload at line 234 is unchanged — diff is strictly narrower data flow.

Follow-ups (non-blocking — file as issues)

  • PERSONAL_EMAIL_DOMAINS is the obvious 23-domain set but misses the long tail that, for the stated PII goal, is exactly the population least likely to want their email on a public certificate: major US ISPs (comcast.net, att.net, verizon.net, cox.net, sbcglobal.net), German freemail (web.de, t-online.de, gmx.net, freenet.de), French (orange.fr, free.fr, wanadoo.fr, laposte.net), Yahoo regional TLDs beyond .co.uk (.fr/.de/.co.jp), mail.ru, yandex.com, naver.com, qq.com, 163.com. Non-blocking because the operator sees the repair plan in dry-run before --apply and can spot ISP fallbacks then — but worth expanding before the next cleanup wave so the dry-run is doing less manual eyeballing.

code-reviewer: sound. security-reviewer: sound with one Low defense-in-depth note (the domain-list gap, captured as the Follow-up above).

LGTM. Follow-ups noted below.

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