Skip to content

improvement(emcn): share one emails/domains chip input across share and deploy modals - #6226

Merged
waleedlatif1 merged 3 commits into
stagingfrom
worktree-share-modal-emails-field
Aug 3, 2026
Merged

improvement(emcn): share one emails/domains chip input across share and deploy modals#6226
waleedlatif1 merged 3 commits into
stagingfrom
worktree-share-modal-emails-field

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Extract the emails chip lifecycle out of ChipModalField type='emails' into a standalone ChipEmailsInput — dedupe, normalize, format gate, paste, per-chip error tooltips — with an allowDomains opt-in for bare @domain.tld entries
  • Point the file share modal and the deploy modal's Chat tab at it, deleting both hand-rolled TagInput implementations (add/remove/validate handlers, TagItem mapping, ref mirrors, and the dead emailError state that could only ever be '')
  • Move the shared allowlist policy into validateAllowlistEntry, so disposable-domain/suspicious-pattern checks stay in the app and the design system stays format-only
  • Drop the "Add specific emails or whole domains (@example.com)" hint text from both modals
  • Give OutputSelect a size prop; the deploy modal's Chat tab uses the 30px chip trigger so Output lines up with the Title field above it. Other call sites (API tab, chat panel toolbar) keep the compact pill
  • Drop overflow-y-auto from the chat deploy form — with overflow-x still visible, CSS promoted it to auto, which is where the stray horizontal scrollbar came from. ModalBody already owns the vertical scroll, so the class bought nothing

Type of Change

  • Bug fix
  • Improvement

Testing

bun run lint:check (23/23), tsc --noEmit, check:api-validation, and the 1644 workspace tests all pass. Not yet verified in a running browser.

Note: the emails field in both modals is now the taller block chip surface (the same one the workspace invite modal uses) rather than the previous single-row input.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…nd deploy modals

Extracts the emails chip lifecycle out of ChipModalField type='emails' into a
standalone ChipEmailsInput, and points both the file share modal and the deploy
modal's chat tab at it instead of their hand-rolled TagInput wiring.

- add ChipEmailsInput (dedupe, normalize, format gate, paste, per-chip errors)
  with an allowDomains opt-in for bare @domain.tld entries
- share modal and deploy modal chat tab now use it; drop both hand-rolled
  add/remove/validate implementations and the dead emailError state
- move the shared allowlist policy into validateAllowlistEntry
- drop the "Add specific emails or whole domains" hint text
- give OutputSelect a size prop; the deploy modal chat tab uses the 30px chip
  trigger so it lines up with the Title field above it
- drop overflow-y-auto from the chat deploy form, which was promoting overflow-x
  to auto and rendering a stray horizontal scrollbar
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 3, 2026 9:33pm

Request Review

@cursor

cursor Bot commented Aug 3, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes access-control allowlist UX and validation (domain syntax and policy layering) on file share and chat deploy flows; regressions could let invalid entries through or block legitimate @domain patterns, though tests cover the new syntax and allowlist rules.

Overview
Introduces ChipEmailsInput in the design system and moves email/domain chip handling out of duplicated modal code into one component (dedupe, normalize, paste-safe adds, invalid chips with tooltips, optional allowDomains for @domain entries). ChipModalField type='emails' now delegates to it instead of inlined TagInput logic.

File share and chat deploy modals use ChipModalField type='emails' / ChipEmailsInput with shared validateAllowlistEntry app policy; local TagInput add/remove handlers and related state are removed.

isValidEmailSyntax (with allowDomains) lives in @sim/utils/string; quickValidateEmail uses it. Bare @domain allowlist entries skip disposable/suspicious address checks via validateAllowlistEntry.

OutputSelect gains size='md' (ChipCombobox) on the deploy Chat tab so Output aligns with ChipInput; other call sites stay on the compact sm pill. Chat deploy form drops overflow-y-auto to avoid a stray horizontal scrollbar when ModalBody already scrolls.

Reviewed by Cursor Bugbot for commit a4ba018. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR consolidates email and domain chip handling into a shared format-aware component used by file sharing and chat deployment.

  • Adds reusable normalization, deduplication, validation, paste, and invalid-chip handling.
  • Centralizes allowlist policy while keeping generic syntax validation in shared utilities.
  • Adds a medium OutputSelect trigger variant and removes redundant deploy-form scrolling.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/emcn/src/components/chip-emails-input/chip-emails-input.tsx Introduces the shared controlled email/domain chip input with ref-backed synchronous composition and external-value reconciliation.
packages/emcn/src/components/chip-modal/chip-modal.tsx Replaces the modal-specific email lifecycle with a thin wrapper around ChipEmailsInput.
apps/sim/app/workspace/[workspaceId]/files/components/share-modal/share-modal.tsx Migrates file-share allowlists to the shared email/domain field and centralized policy validator.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/chat/chat.tsx Migrates chat deployment allowlists to ChipEmailsInput and aligns the output selector with neighboring form controls.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.tsx Adds a medium ChipCombobox trigger option while preserving compact Combobox behavior by default.
apps/sim/lib/messaging/email/validation.ts Reuses shared syntax validation and exposes the application-level allowlist policy callback.
packages/utils/src/string.ts Adds bounded format-only validation for full email addresses and optional bare-domain allowlist entries.

Reviews (3): Last reviewed commit: "test(email): pin the allowlist entry rul..." | Re-trigger Greptile

…eholder regex

Audit follow-ups on the emails chip input.

- move EMAIL_SYNTAX_REGEX and the new @Domain pattern into @sim/utils/string as
  isValidEmailSyntax, so emcn and lib/messaging/email/validation.ts stop keeping
  byte-identical copies of the RFC 5322 regex
- allow single-label domains (@intranet) again — requiring a dot rejected
  entries the old startsWith('@') check accepted, which self-hosted
  deployments use. A lone @ and malformed labels stay rejected
- replace derivePlaceholderWithTags' /^Enter\s+(.+?)s?$/i with string ops;
  CodeQL flagged it as polynomial backtracking (js/redos). Verified identical
  output across the placeholder shapes in use
- forward the emails control's props explicitly instead of underscore-discard
  destructuring, matching ChipModalFileControl in the same file
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0a53c88. Configure here.

Covers isValidEmailSyntax's allowDomains branch (single-label domains stay
valid, malformed bare domains that the old startsWith('@') check accepted do
not), the 254-character cap, the DNS label limit, and validateAllowlistEntry
waiving address-level policy for bare domains. Verified both new rules fail
when the behavior is reverted.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a4ba018. Configure here.

@waleedlatif1
waleedlatif1 merged commit 1242301 into staging Aug 3, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the worktree-share-modal-emails-field branch August 3, 2026 21:40
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.

2 participants