fix(email): resolve Gmail email server-side to fix masked credential crash#563
Merged
zbigniewsobiecki merged 1 commit intodevfrom Feb 27, 2026
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cascade email verify <project-id>crashed with a Zodinvalid_stringerror because the CLI read the masked credential value (****xyz) fromcredentials.listand passed it directly as theemail: z.string().email()field to theverifyGmailmutation — the server's schema then rejected the masked stringemail: z.string().email()withgmailEmailCredentialId: z.number()in theverifyGmailinput schema; resolve the email address server-side via the existingresolveCredentialValue()helper, consistent withverifyImapand every other credential field in this routergmailCredsvalue lookup fromverify.ts— the CLI now passes only the credential ID, just likeverifyImapdoesTest plan
verifyGmail— auth (UNAUTHORIZED), success path resolves all 4 credentials server-side and returns email, schema guard rejects oldemailstring shape, token refresh failure → BAD_REQUEST, IMAP connection failure → BAD_REQUESTverifyImap— auth (UNAUTHORIZED), success path, invalid port → BAD_REQUEST, IMAP connection failure → BAD_REQUESTnpm run lint— no issuesnpm run typecheck— no issues🤖 Generated with Claude Code