Skip to content

TypeScriptified email analytics queries module - #29819

Merged
EvanHahn merged 2 commits into
mainfrom
types-for-email-analytics-queries
Aug 10, 2026
Merged

TypeScriptified email analytics queries module#29819
EvanHahn merged 2 commits into
mainfrom
types-for-email-analytics-queries

Conversation

@EvanHahn

@EvanHahn EvanHahn commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

no ref

This change should have no user impact.


Stack created with GitHub Stacks CLIGive Feedback 💬

@coderabbitai

coderabbitai Bot commented Aug 6, 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: CHILL

Plan: Pro Plus

Run ID: a087f971-e0be-4145-bbfe-5e42b7e49c7f

📥 Commits

Reviewing files that changed from the base of the PR and between f46af8a and 8c97d87.

📒 Files selected for processing (8)
  • ghost/core/core/server/services/email-analytics/email-analytics-service-wrapper.js
  • ghost/core/core/server/services/email-analytics/email-analytics-service.js
  • ghost/core/core/server/services/email-analytics/index.ts
  • ghost/core/core/server/services/email-analytics/lib/queries.ts
  • ghost/core/test/integration/services/email-analytics/automation-email-analytics.test.js
  • ghost/core/test/integration/services/email-service/newsletter-email-event-storage.test.js
  • ghost/core/test/integration/services/mailgun-email-suppression-list.test.js
  • ghost/core/test/utils/fixture-utils.js
🚧 Files skipped from review as they are similar to previous changes (8)
  • ghost/core/core/server/services/email-analytics/index.ts
  • ghost/core/test/integration/services/email-analytics/automation-email-analytics.test.js
  • ghost/core/core/server/services/email-analytics/email-analytics-service-wrapper.js
  • ghost/core/test/integration/services/mailgun-email-suppression-list.test.js
  • ghost/core/test/integration/services/email-service/newsletter-email-event-storage.test.js
  • ghost/core/test/utils/fixture-utils.js
  • ghost/core/core/server/services/email-analytics/email-analytics-service.js
  • ghost/core/core/server/services/email-analytics/lib/queries.ts

Walkthrough

The email analytics query module now uses a typed TypeScript named export. Query methods have explicit parameter and return types. Timestamp handling preserves null values and corrects elapsed-time calculation. Error handling safely formats unknown errors. Service wiring, integration tests, and fixture utilities now consume the named queries export.

Possibly related PRs

  • TryGhost/Ghost#29465: Both PRs convert a CommonJS default export to a named TypeScript export and update consumers.
  • TryGhost/Ghost#29473: Both PRs modify email-analytics-service.js constructor JSDoc types.
  • TryGhost/Ghost#29813: Both PRs modify email analytics service files to improve TypeScript and JSDoc typing.

Suggested reviewers: 9larsons

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: converting the email analytics queries module to TypeScript.
Description check ✅ Passed The description states that the change has no user impact, which aligns with the stated objective.
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.
✨ 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 types-for-email-analytics-queries

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.

❤️ Share

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

@EvanHahn
EvanHahn requested a review from troyciesco August 6, 2026 17:11
@nx-cloud

nx-cloud Bot commented Aug 6, 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 8c97d87

Command Status Duration Result
nx run ghost:test:ci:integration ✅ Succeeded 3m 9s View ↗
nx run ghost:test:integration ✅ Succeeded 3m 4s View ↗
nx run ghost:test:legacy ✅ Succeeded 2m 18s View ↗
nx run ghost:test:e2e ✅ Succeeded 2m 37s View ↗
nx run-many -t test:unit -p ghost ✅ Succeeded 34s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded 21s View ↗
nx run-many -t lint -p ghost,ghost-monorepo ✅ Succeeded 19s View ↗
nx run @tryghost/admin:build ✅ Succeeded 2m 8s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded 6s View ↗

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


☁️ Nx Cloud last updated this comment at 2026-08-10 15:12:37 UTC

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.93023% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.40%. Comparing base (f46af8a) to head (8c97d87).

Files with missing lines Patch % Lines
...ore/server/services/email-analytics/lib/queries.ts 69.13% 25 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #29819      +/-   ##
==========================================
- Coverage   75.45%   75.40%   -0.06%     
==========================================
  Files        1605     1605              
  Lines      140388   140399      +11     
  Branches    17401    17389      -12     
==========================================
- Hits       105929   105863      -66     
- Misses      33411    33488      +77     
  Partials     1048     1048              
Flag Coverage Δ
e2e-tests 77.54% <70.93%> (-0.06%) ⬇️

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.

Base automatically changed from remove-unnused-update-member-email-analytics-code to main August 10, 2026 14:29
@cmraible
cmraible force-pushed the types-for-email-analytics-queries branch from 1b289b2 to 38a1943 Compare August 10, 2026 14:29

@troyciesco troyciesco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

one thing worth fixing - ill let you pick how - but otherwise lgtm!

Comment thread ghost/core/core/server/services/email-analytics/email-analytics-service.js Outdated
@EvanHahn
EvanHahn requested a review from 9larsons as a code owner August 10, 2026 14:50
EvanHahn and others added 2 commits August 10, 2026 09:51
no ref

This change should have no user impact.
Co-authored-by: Troy Ciesco <tmciesco@gmail.com>
@EvanHahn
EvanHahn force-pushed the types-for-email-analytics-queries branch from 5f85112 to 8c97d87 Compare August 10, 2026 14:51
@EvanHahn
EvanHahn removed the request for review from 9larsons August 10, 2026 14:52
@EvanHahn
EvanHahn merged commit 98bcfb5 into main Aug 10, 2026
52 checks passed
@EvanHahn
EvanHahn deleted the types-for-email-analytics-queries branch August 10, 2026 15:29
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