Conversation
email({ allowMultiple: true }) used a naive input.split(",") that
broke valid quoted local parts (e.g., "a,b"@example.com) and quoted
display names (e.g., "Doe, John" <john@example.com>). Replace with
a quote-aware splitter that tracks double-quote and angle-bracket
context.
Close #320
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
splitEmails() flipped inQuotes on every `"`, so backslash-escaped quotes like `"a\",b"@example.com` caused the splitter to leave quoted context early and misclassify the following comma as a list separator. Track an escaped flag so that `\"` inside a quoted string does not toggle quote state. #320 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@codex review |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! The pull request addresses a bug in the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #606 +/- ##
========================================
Coverage 94.89% 94.90%
========================================
Files 38 38
Lines 17271 17379 +108
Branches 4543 4580 +37
========================================
+ Hits 16390 16494 +104
- Misses 869 873 +4
Partials 12 12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughReplaces a naive comma split used when email(..., allowMultiple: true) with a new internal splitEmails(input: string) helper that respects quoted local-parts, escaped quotes, and angle-bracket display-name syntax. The email parsing path now calls splitEmails(...), trims each fragment, and validates addresses. Adds unit tests covering quoted local parts, escaped quotes, quoted display names, and commas inside display names when allowMultiple is true. No public API or exported signatures were changed. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CHANGES.md`:
- Around line 426-427: Update the CHANGES.md entry for the email() allowMultiple
fix to explicitly state that quoted strings may appear in both the local part
and the display name; reword the bullet for the `email()` fix with
`allowMultiple` to something like "Fixed `email()` with `allowMultiple` to avoid
splitting on commas inside quoted local parts (e.g., \"a,b\"@example.com) and
inside quoted display names (e.g., \"Doe, John\" <john@example.com>), matching
the PR objective." Reference `email()` and `allowMultiple` so the change clearly
documents both quoted local parts and quoted display names.
In `@packages/core/src/valueparser.ts`:
- Around line 2969-3002: Add a short JSDoc above the splitEmails function
describing its purpose, parameters and return value: that splitEmails(input:
string) returns an array of comma-separated email chunks while being aware of
quoted strings, escaped characters, and angle-bracketed addresses; mention how
it treats backslash-escaped characters and that it preserves surrounding
characters (no trimming) and any important edge-cases (e.g., unbalanced
quotes/angles). Reference the function name splitEmails and the key local flags
in the description (inQuotes, inAngleBrackets, escaped) so future readers
understand the state machine and its behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 53b8191b-6f3f-44de-995a-03c981176ac2
📒 Files selected for processing (3)
CHANGES.mdpackages/core/src/valueparser.test.tspackages/core/src/valueparser.ts
There was a problem hiding this comment.
Code Review
This pull request addresses an issue with the email() parser when allowMultiple is enabled, where it would incorrectly split on commas within quoted strings. The fix introduces a new splitEmails helper function that implements a character-by-character state machine to correctly handle quoted local parts, display names in angle brackets, and backslash-escaped characters. This approach is more robust than the previous String.prototype.split(',') method. The changes are well-tested with new regression tests covering various edge cases, ensuring the fix is effective and does not introduce new issues. The implementation is clean and adheres to the project's coding standards.
|
Codex Review: Didn't find any major issues. Delightful! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
#606 (comment) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
#606 (comment) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@codex review |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request effectively fixes the issue with parsing multiple email addresses that contain commas within quoted parts. The new splitEmails function correctly handles quoted local parts, display names, and escaped characters. The added tests are comprehensive and cover the relevant edge cases, ensuring the fix is robust. I have one minor suggestion to improve the readability of the new splitEmails function.
Consolidate duplicated current += char into a single append at the end of the loop body, using an else-if chain for state transitions and continue for the comma separator case. #606 (comment) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3bc1adea6d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request effectively addresses an issue where multiple email addresses were not parsed correctly if they contained commas within quoted strings. The introduction of the splitEmails function, which performs a stateful split, is a robust solution to the problem. The new regression tests are comprehensive and cover various edge cases, including quoted local parts, display names, and escaped characters.
I have one minor suggestion to align the new helper function more closely with the repository's style guide regarding immutability.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e69670e9b3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
splitEmails() toggled inQuotes on every ", so inputs like """@example.com caused the third quote to reopen quoted state, swallowing the following comma separator. validateEmail() accepts such inputs because it uses indexOf to find the first closing quote. Now splitEmails only enters quoted state when the current token is empty (i.e., at the start of a segment), matching the permissive behavior of validateEmail(). #606 (comment) #606 (comment) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Align with the project's immutability style guide. #606 (comment) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@codex review |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request addresses a bug in the email() value parser where multiple email addresses were not split correctly if they contained commas within quoted strings. The fix replaces a naive String.prototype.split() with a more robust, context-aware splitEmails helper function. This new function correctly handles quoted local parts and display names by iterating through the input and tracking whether it's inside quotes or angle brackets. The implementation is sound and is accompanied by a comprehensive set of regression tests covering various edge cases, including escaped quotes. The changes are well-contained and effectively resolve the issue.
Summary
email({ allowMultiple: true })used a naiveinput.split(",")to separate multiple email addresses, which broke valid inputs where commas appear inside quoted local parts or quoted display names. For example:This PR replaces the naive split with a character-by-character splitter that tracks whether the current position is inside double quotes or angle brackets, and only treats commas outside those contexts as address separators. The splitter also respects backslash escapes inside quoted strings, so inputs like
"a\",b"@example.comare handled correctly.Closes #320
Test plan
"a,b"@...)"Doe, John" <...>)"a\",b"@...and"Doe \", John" <...>)mise test:deno(358 passed) andmise check(type check, lint, format, dry-run publish all clean)