Skip to content

📦🔧:keep email validation linear and precise - #101

Merged
openinf-commit-queue[bot] merged 1 commit into
mainfrom
fix/linear-email-validation
Oct 2, 2026
Merged

openinf-commit-queue[bot] merged 1 commit into
mainfrom
fix/linear-email-validation

Conversation

@DerekNonGeneric

@DerekNonGeneric DerekNonGeneric commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

The email guard's backtracking pattern took quadratic time on invalid dotted
domains and could block the event loop. Its value is string return type also
made TypeScript exclude every string after a failed syntax check.

This replaces the pattern with linear scans while preserving its accepted
syntax, introduces a branded Email refinement, and adds compatibility,
narrowing, whitespace, and adversarial-input regressions.

This is a security-sensitive validation fix, so no public vulnerability issue
was opened.

Summary by CodeRabbit

  • Bug Fixes
    • Email validation now handles long invalid addresses in linear time and rejects whitespace, repeated or missing @ symbols, and domains with empty sections around a dot.
  • Developer Experience
    • Successful validation now narrows values to the exported Email type.

Replace the backtracking pattern with bounded scans while preserving
the existing basic syntax. Narrow to a branded Email type so a failed
check does not incorrectly exclude other strings.

Cover accepted syntax, whitespace, long invalid inputs, and narrowing.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Codex:gpt-6-astra
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: d8928d46-52cb-45b6-87a1-bf67893c75d2

📥 Commits

Reviewing files that changed from the base of the PR and between 8177c45 and 1c85392.

📒 Files selected for processing (3)
  • .changeset/linear-email-validation.md
  • packages/util-string/src/guards/is-email.ts
  • packages/util-string/test/guards/is-email.ts

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.


📝 Walkthrough

Walkthrough

isEmail replaces its regular-expression check with explicit syntax checks and returns the exported tagged Email type for accepted values. Tests cover syntax, whitespace, long invalid input, and type narrowing. A major changeset records the update.

Changes

Email validation

Layer / File(s) Summary
Validator and exported type
packages/util-string/src/guards/is-email.ts, .changeset/linear-email-validation.md
isEmail uses explicit checks to reject non-strings, whitespace, malformed @ usage, and domains without nonempty segments around a dot. Its type predicate now narrows to the exported tagged Email type. The major changeset describes these changes.
Validation and type tests
packages/util-string/test/guards/is-email.ts
Tests cover accepted and rejected syntax, whitespace characters, a long invalid address with a two-second expectation, and type narrowing. The test imports isEmail and Email from the package index.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 1c853

The validation change is mergeable after normal checks; no concrete compatibility regression was found.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: linear and precise email validation. It is concise and specific, although the emojis are unnecessary.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

@DerekNonGeneric DerekNonGeneric added the 🚀 Status: Commit Queue Land this pull request when its checks pass label Oct 2, 2026
@openinf-commit-queue openinf-commit-queue Bot removed the 🚀 Status: Commit Queue Land this pull request when its checks pass label Oct 2, 2026
@openinf-commit-queue

Copy link
Copy Markdown

The commit queue did not land this. See https://github.com/OpenINF/sdk/actions/runs/36962272189 — the label has been taken back off, so re-applying it is a deliberate second try.

@DerekNonGeneric DerekNonGeneric added the 🚀 Status: Commit Queue Land this pull request when its checks pass label Oct 2, 2026
@openinf-commit-queue
openinf-commit-queue Bot merged commit e9b38ad into main Oct 2, 2026
11 of 12 checks passed
@openinf-commit-queue openinf-commit-queue Bot removed the 🚀 Status: Commit Queue Land this pull request when its checks pass label Oct 2, 2026
@openinf-commit-queue
openinf-commit-queue Bot deleted the fix/linear-email-validation branch October 2, 2026 03:56
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