Skip to content

fix(certification): credential recipient no longer becomes "undefined undefined" - #4768

Merged
bokelley merged 3 commits into
mainfrom
bokelley/fix-credential-undefined-name
May 19, 2026
Merged

bokelley merged 3 commits into
mainfrom
bokelley/fix-credential-undefined-name

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

  • Adds buildRecipientName({first_name?, last_name?, email}) helper that trims each field and falls back to email when both are missing. Used by Addie's issueCertifierBadge and the admin backfill route — both previously sent the literal "undefined undefined" to Certifier when WorkOS hadn't yet populated a learner's name (escalation Fix duplicate migration version 039 and add CI check #382, Tom Hespos, https://credsverse.com/credentials/ad5e1781-4f45-4162-b457-6ce3627383aa).
  • Adds updateCredential(id, {recipient,...}) wrapping Certifier PATCH /credentials/{id} so we can correct names after the fact.
  • Adds server/src/scripts/repair-credential-recipient-names.ts — dry-run audit + repair. Joins user_credentials → users, GETs each credential from Certifier, plans a PATCH when the remote name contains "undefined" / "null" or is an email-fallback that we now have real name data to upgrade. Supports --credential-id= and --workos-user-id= filters.

Why the existing fallback didn't catch it

routes/certification.ts had \${first} ${last}`.trim() || email, but "undefined undefined".trim()` is still truthy, so the email-fallback never fired.

Test plan

  • tests/unit/certifier-recipient-name.test.ts — 8 cases incl. explicit "never returns the literal 'undefined undefined'" guard
  • npx tsc --noEmit clean
  • Precommit (unit suite + dynamic-imports + callapi-state-change + typecheck) green
  • Post-merge: dry-run the repair script against prod
    • fly ssh console -a adcp-docs -C 'node /app/dist/scripts/repair-credential-recipient-names.js'
  • Post-merge: --apply once Tom's record is visible in the plan

🤖 Generated with Claude Code

bokelley and others added 3 commits May 19, 2026 04:17
…fined undefined"

When a learner earns a credential before WorkOS has populated their
first_name/last_name, naive `${first} ${last}` interpolation sent the
literal string "undefined undefined" to Certifier (escalation #382,
Tom Hespos). The existing `.trim() || email` fallback in the backfill
path didn't catch it either, because "undefined undefined".trim() is
still truthy.

- Introduce `buildRecipientName({first_name?, last_name?, email})` that
  trims each field independently and falls back to email when both are
  missing/empty.
- Use it in both issuance call sites: Addie's `issueCertifierBadge`
  and the admin backfill route.
- Add `updateCredential(id, {recipient,...})` wrapping Certifier
  PATCH /credentials/{id} for after-the-fact corrections.
- Add `server/src/scripts/repair-credential-recipient-names.ts` —
  dry-run audit + repair script that finds credentials with
  "undefined"/"null" in the remote name (and email-only fallbacks
  that now have real name data to substitute) and PATCHes Certifier.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Server-only bugfix, no published package version change needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…o 10m

The 5-minute step timeout on `check:owned-links` is too tight when
agenticadvertising.org is slow — multiple unrelated branches started
hitting the 5m wall this morning while main passes in <10s when the
site is healthy. Two surgical fixes:

- Filter URLs containing `{` or `}` in `check-owned-links.js`. These
  are documentation placeholders like `/agents/{url-encoded-agent-url}/badge`
  that never resolve to a real route; the script was burning the full
  per-URL retry budget (3 retries × 10s × HEAD+GET) on guaranteed
  timeouts.
- Bump the workflow step timeout from 5 to 10 minutes so a slow-but-
  healthy upstream doesn't tip the job over.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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