Skip to content

fix(email): resolve Gmail email server-side to fix masked credential crash#563

Merged
zbigniewsobiecki merged 1 commit intodevfrom
fix/email-verify-masked-credential
Feb 27, 2026
Merged

fix(email): resolve Gmail email server-side to fix masked credential crash#563
zbigniewsobiecki merged 1 commit intodevfrom
fix/email-verify-masked-credential

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

  • Root cause: cascade email verify <project-id> crashed with a Zod invalid_string error because the CLI read the masked credential value (****xyz) from credentials.list and passed it directly as the email: z.string().email() field to the verifyGmail mutation — the server's schema then rejected the masked string
  • Fix: replace email: z.string().email() with gmailEmailCredentialId: z.number() in the verifyGmail input schema; resolve the email address server-side via the existing resolveCredentialValue() helper, consistent with verifyImap and every other credential field in this router
  • CLI cleanup: remove the now-redundant gmailCreds value lookup from verify.ts — the CLI now passes only the credential ID, just like verifyImap does

Test plan

  • verifyGmail — auth (UNAUTHORIZED), success path resolves all 4 credentials server-side and returns email, schema guard rejects old email string shape, token refresh failure → BAD_REQUEST, IMAP connection failure → BAD_REQUEST
  • verifyImap — auth (UNAUTHORIZED), success path, invalid port → BAD_REQUEST, IMAP connection failure → BAD_REQUEST
  • Full test suite green (3365 tests)
  • npm run lint — no issues
  • npm run typecheck — no issues

🤖 Generated with Claude Code

…crash

`cascade email verify` was crashing with a Zod `invalid_string` error
because the CLI passed the masked credential value (`****xyz`) returned
by `credentials.list` directly as the `email: z.string().email()` field
on the `verifyGmail` mutation.

Fix: replace `email: z.string().email()` with `gmailEmailCredentialId:
z.number()` in the `verifyGmail` input schema, resolve the email
server-side via `resolveCredentialValue()` (consistent with `verifyImap`
and every other credential in this router), and remove the now-redundant
client-side credential value lookup from the CLI.

Also adds tests for `verifyGmail` (auth, success, schema guard, token
refresh failure, IMAP failure) and `verifyImap` (auth, success, invalid
port, IMAP failure) — neither procedure had test coverage before.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit 56e87c6 into dev Feb 27, 2026
6 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the fix/email-verify-masked-credential branch February 27, 2026 09:32
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