Skip to content

Tidied email address (de)serializer - #30365

Merged
EvanHahn merged 1 commit into
mainfrom
clean-up-emailaddressparser-module
Aug 28, 2026
Merged

Tidied email address (de)serializer#30365
EvanHahn merged 1 commit into
mainfrom
clean-up-emailaddressparser-module

Conversation

@EvanHahn

Copy link
Copy Markdown
Contributor

no ref

  • EmailAddressParser was a class that only had static methods. This replaces the class with "normal" exported functions.

  • Fully TypeScriptified the module.

  • Because it's just a regular module, changed imports from EmailAddressParser (capital E) to emailAddressParser (lowercase E).

This change should have no user impact.

no ref

- `EmailAddressParser` was a class that only had static methods. This
  replaces the class with "normal" exported functions.

- Fully TypeScriptified the module.

- Because it's just a regular module, changed imports from
  `EmailAddressParser` (capital E) to `emailAddressParser` (lowercase
  E).

This change should have no user impact.
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Pro Plus

Run ID: 06b0b3f9-748c-427e-8163-21e2bb763348

📥 Commits

Reviewing files that changed from the base of the PR and between 21e5c1e and fdb0882.

📒 Files selected for processing (11)
  • ghost/core/core/server/services/email-address/email-address-parser.d.ts
  • ghost/core/core/server/services/email-address/email-address-parser.js
  • ghost/core/core/server/services/email-address/email-address-parser.ts
  • ghost/core/core/server/services/email-address/email-address-service.ts
  • ghost/core/core/server/services/email-service/email-renderer.js
  • ghost/core/core/server/services/gifts/index.ts
  • ghost/core/core/server/services/mail/ghost-mailer.js
  • ghost/core/core/server/services/member-welcome-emails/service.js
  • ghost/core/core/server/services/settings-helpers/settings-helpers.js
  • ghost/core/core/server/services/staff/staff-service-emails.js
  • ghost/core/test/unit/server/services/email-address/email-address-parser.test.ts
💤 Files with no reviewable changes (2)
  • ghost/core/core/server/services/email-address/email-address-parser.js
  • ghost/core/core/server/services/email-address/email-address-parser.d.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (12)
  • GitHub Check: Build E2E Public App Assets
  • GitHub Check: Unit tests (Node 22.23.1)
  • GitHub Check: i18n
  • GitHub Check: Legacy tests (Node 22.23.1, mysql8)
  • GitHub Check: Stripe fixture checks
  • GitHub Check: Acceptance tests (Node 22.23.1, mysql8)
  • GitHub Check: Build Admin
  • GitHub Check: Build Docker Images
  • GitHub Check: Lint
  • GitHub Check: Check migration integrity
  • GitHub Check: Check app version bump
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (10)
Review new or changed service boundaries for explicit dependency ownership,

⚙️ CodeRabbit configuration file

Files:

  • ghost/core/core/server/services/staff/staff-service-emails.js
  • ghost/core/core/server/services/member-welcome-emails/service.js
  • ghost/core/core/server/services/email-service/email-renderer.js
  • ghost/core/core/server/services/email-address/email-address-parser.ts
  • ghost/core/core/server/services/gifts/index.ts
  • ghost/core/core/server/services/mail/ghost-mailer.js
  • ghost/core/core/server/services/settings-helpers/settings-helpers.js
  • ghost/core/core/server/services/email-address/email-address-service.ts
Review whether tests prove changed behaviour, meaningful error/edge paths, and

⚙️ CodeRabbit configuration file

Files:

  • ghost/core/test/unit/server/services/email-address/email-address-parser.test.ts
New source files must be TypeScript: flag new JS files as a required change

⚙️ CodeRabbit configuration file

Files:

  • ghost/core/core/server/services/staff/staff-service-emails.js
  • ghost/core/core/server/services/member-welcome-emails/service.js
  • ghost/core/core/server/services/email-service/email-renderer.js
  • ghost/core/core/server/services/mail/ghost-mailer.js
  • ghost/core/core/server/services/settings-helpers/settings-helpers.js
Review lens: "where does this data become trusted?"

⚙️ CodeRabbit configuration file

Files:

  • ghost/core/core/server/services/email-address/email-address-parser.ts
  • ghost/core/core/server/services/gifts/index.ts
  • ghost/core/test/unit/server/services/email-address/email-address-parser.test.ts
  • ghost/core/core/server/services/email-address/email-address-service.ts
Prioritise concrete correctness, security, data-integrity, compatibility,

⚙️ CodeRabbit configuration file

Files:

  • ghost/core/core/server/services/staff/staff-service-emails.js
  • ghost/core/core/server/services/member-welcome-emails/service.js
  • ghost/core/core/server/services/email-service/email-renderer.js
  • ghost/core/core/server/services/email-address/email-address-parser.ts
  • ghost/core/core/server/services/gifts/index.ts
  • ghost/core/core/server/services/mail/ghost-mailer.js
  • ghost/core/core/server/services/settings-helpers/settings-helpers.js
  • ghost/core/test/unit/server/services/email-address/email-address-parser.test.ts
  • ghost/core/core/server/services/email-address/email-address-service.ts
Boot owns service initialization; do not

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • ghost/core/core/server/services/staff/staff-service-emails.js
  • ghost/core/core/server/services/member-welcome-emails/service.js
  • ghost/core/core/server/services/email-service/email-renderer.js
  • ghost/core/core/server/services/email-address/email-address-parser.ts
  • ghost/core/core/server/services/gifts/index.ts
  • ghost/core/core/server/services/mail/ghost-mailer.js
  • ghost/core/core/server/services/settings-helpers/settings-helpers.js
  • ghost/core/core/server/services/email-address/email-address-service.ts
Type-safe boundaries: Fail only if the PR:

📄 CodeRabbit inference engine (Custom checks)

Files:

  • ghost/core/core/server/services/email-address/email-address-parser.ts
  • ghost/core/core/server/services/gifts/index.ts
  • ghost/core/test/unit/server/services/email-address/email-address-parser.test.ts
  • ghost/core/core/server/services/email-address/email-address-service.ts
New standalone services use TypeScript; keep CommonJS only

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • ghost/core/core/server/services/email-address/email-address-parser.ts
  • ghost/core/core/server/services/gifts/index.ts
  • ghost/core/core/server/services/email-address/email-address-service.ts
New files are TypeScript: Fail if the PR adds a new .js/.jsx/.cjs/.mjs source file, unless it is: a DB

📄 CodeRabbit inference engine (Custom checks)

Files:

  • ghost/core/core/server/services/staff/staff-service-emails.js
  • ghost/core/core/server/services/member-welcome-emails/service.js
  • ghost/core/core/server/services/email-service/email-renderer.js
  • ghost/core/core/server/services/mail/ghost-mailer.js
  • ghost/core/core/server/services/settings-helpers/settings-helpers.js
Always use `pnpm`, never npm or Yarn.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • ghost/core/core/server/services/staff/staff-service-emails.js
  • ghost/core/core/server/services/member-welcome-emails/service.js
  • ghost/core/core/server/services/email-service/email-renderer.js
  • ghost/core/core/server/services/email-address/email-address-parser.ts
  • ghost/core/core/server/services/gifts/index.ts
  • ghost/core/core/server/services/mail/ghost-mailer.js
  • ghost/core/core/server/services/settings-helpers/settings-helpers.js
  • ghost/core/test/unit/server/services/email-address/email-address-parser.test.ts
  • ghost/core/core/server/services/email-address/email-address-service.ts
🔇 Additional comments (9)
ghost/core/test/unit/server/services/email-address/email-address-parser.test.ts (1)

2-7: LGTM!

Also applies to: 17-17, 27-27, 37-97, 107-107

ghost/core/core/server/services/email-address/email-address-parser.ts (1)

1-71: LGTM!

ghost/core/core/server/services/email-address/email-address-service.ts (1)

2-4: LGTM!

Also applies to: 51-51, 87-88

ghost/core/core/server/services/email-service/email-renderer.js (1)

16-16: LGTM!

Also applies to: 340-340, 397-397, 426-426

ghost/core/core/server/services/gifts/index.ts (1)

61-61: LGTM!

Also applies to: 83-83

ghost/core/core/server/services/mail/ghost-mailer.js (1)

20-20: LGTM!

Also applies to: 57-58

ghost/core/core/server/services/member-welcome-emails/service.js (1)

10-10: LGTM!

Also applies to: 155-155, 176-176, 202-205, 221-224

ghost/core/core/server/services/settings-helpers/settings-helpers.js (1)

4-4: LGTM!

Also applies to: 133-133, 146-146, 160-160

ghost/core/core/server/services/staff/staff-service-emails.js (1)

5-5: LGTM!

Also applies to: 596-596


Walkthrough

The email address parser moves from a default EmailAddressParser class to a TypeScript module with EmailAddress, parse, and stringify exports. Server services update their imports and calls. Existing unit tests use the namespace import and retain their parsing and formatting assertions.

Suggested reviewers: 9larsons, kevinansfield

Merge Risk: ⚪ Minimal · up to fdb08

This PR refactors email address parsing and updates its imports without evidence of a user-facing behavior change; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title identifies the email address serializer change. It is concise and related to the replacement of the static parser class with exported functions.
Description check ✅ Passed The description accurately explains the class replacement, TypeScript conversion, import renaming, and expected lack of user impact.
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.
Type-Safe Boundaries ✅ Passed PASS. The commit replaces the pre-existing parser class with equivalent parse and stringify functions. parse still checks the input type and uses Nodemailer's address parser before returning an …
New Files Are Typescript ✅ Passed The pull request adds only ghost/core/core/server/services/email-address/email-address-parser.ts. It deletes the pre-existing .js file and modifies other pre-existing JavaScript files. It adds no …
Full details: Type-Safe Boundaries

Explanation

PASS. The commit replaces the pre-existing parser class with equivalent parse and stringify functions. parse still checks the input type and uses Nodemailer's address parser before returning an address. The changed call sites only rename the imported module and preserve the existing flows. The added TypeScript contains no any, unchecked as, @ts-nocheck, or @ts-ignore. Repository searches found no Zod schema for this EmailAddress shape, so the new type does not duplicate a Zod-described shape. No new boundary consumer or bypass was introduced.

Full details: New Files Are Typescript

Explanation

The pull request adds only ghost/core/core/server/services/email-address/email-address-parser.ts. It deletes the pre-existing .js file and modifies other pre-existing JavaScript files. It adds no .js, .jsx, .cjs, or .mjs source file.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch clean-up-emailaddressparser-module

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

@nx-cloud

nx-cloud Bot commented Aug 28, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit fdb0882

Command Status Duration Result
nx run ghost:test:ci:integration ✅ Succeeded 4m 13s View ↗
nx run ghost:test:legacy ✅ Succeeded 3m 6s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded 16s View ↗
nx run-many -t test:unit -p ghost ✅ Succeeded 32s View ↗
nx run-many -t lint -p ghost,ghost-monorepo ✅ Succeeded 16s View ↗
nx run @tryghost/e2e:test:fixtures ✅ Succeeded 1s View ↗
nx run @tryghost/admin:build ✅ Succeeded 3s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-08-28 14:48:56 UTC

@EvanHahn
EvanHahn enabled auto-merge (squash) August 28, 2026 14:38
@EvanHahn
EvanHahn merged commit 284586a into main Aug 28, 2026
51 checks passed
@EvanHahn
EvanHahn deleted the clean-up-emailaddressparser-module branch August 28, 2026 14:49
@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.04%. Comparing base (21e5c1e) to head (fdb0882).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...ver/services/email-address/email-address-parser.ts 88.73% 7 Missing and 1 partial ⚠️
...er/services/email-address/email-address-service.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #30365      +/-   ##
==========================================
+ Coverage   75.99%   76.04%   +0.04%     
==========================================
  Files        1676     1675       -1     
  Lines      159975   159965      -10     
  Branches    19574    19578       +4     
==========================================
+ Hits       121572   121638      +66     
+ Misses      37382    37336      -46     
+ Partials     1021      991      -30     
Flag Coverage Δ
e2e-tests 77.70% <90.90%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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