Skip to content

🐛 Improved reliability of email analytics events - #29895

Open
EvanHahn wants to merge 1 commit into
email-analytics-service-wrapper-should-always-have-a-servicefrom
email-analytics-setJobTimestamp-should-actually-insert-the-job
Open

🐛 Improved reliability of email analytics events#29895
EvanHahn wants to merge 1 commit into
email-analytics-service-wrapper-should-always-have-a-servicefrom
email-analytics-setJobTimestamp-should-actually-insert-the-job

Conversation

@EvanHahn

@EvanHahn EvanHahn commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

ref #29890 (review)

Big picture

We sometimes failed to create the job row for the "missing" job. This could cause:

  • unnecessary extra fetches from Mailgun
  • events to be dropped entirely, if the site was off for awhile

Details

There are four jobs for email analytics:

  1. opened
  2. non-opened
  3. scheduled
  4. missing

Before this change, setJobTimestamp failed to upsert the job row. For the first three job types, it turned out that was fine, because they were already created by previous code paths. But not for the "missing" job!

Before this change, we'd only create the "missing" job row when:

  • no missing events were found
  • there was an error processing the batch

Now, we create it at the right time as intended.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 01e6172f-79a4-4380-b13b-8d454eb77edc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@nx-cloud

nx-cloud Bot commented Aug 11, 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 d9e5218

Command Status Duration Result
nx run ghost:test:ci:integration ✅ Succeeded 2m 24s View ↗
nx run ghost:test:integration ✅ Succeeded 2m 2s View ↗
nx run ghost:test:legacy ✅ Succeeded 2m 44s View ↗
nx run ghost:test:e2e ✅ Succeeded 1m 58s View ↗
nx run-many -t test:unit -p ghost ✅ Succeeded 34s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded <1s View ↗
nx run-many -t lint -p ghost,ghost-monorepo ✅ Succeeded 21s View ↗
nx run @tryghost/admin:build ✅ Succeeded 9s 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-11 21:29:34 UTC

ref #29890 (review)

Big picture
-----------

We sometimes failed to create the job row for the "missing" job. This
could cause:

- unnecessary extra fetches from Mailgun
- events to be dropped entirely, if the site was off for awhile

Details
-------

There are four jobs for email analytics:

1. opened
2. non-opened
3. scheduled
4. missing

Before this change, `setJobTimestamp` failed to upsert the job row. For
the first three job types, it turned out that was fine, because they
were already created by previous code paths. But not for the "missing"
job!

Before this change, we'd only create the "missing" job row when:

- no missing events were found
- there was an error processing the batch

Now, we create it at the right time as intended.
@EvanHahn
EvanHahn force-pushed the email-analytics-setJobTimestamp-should-actually-insert-the-job branch from d9e5218 to c5fde44 Compare August 11, 2026 21:18
@EvanHahn
EvanHahn requested a review from cmraible August 11, 2026 21:19
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.43%. Comparing base (0a2917e) to head (c5fde44).

Additional details and impacted files
@@                                      Coverage Diff                                      @@
##           email-analytics-service-wrapper-should-always-have-a-service   #29895   +/-   ##
=============================================================================================
  Coverage                                                         75.43%   75.43%           
=============================================================================================
  Files                                                              1607     1607           
  Lines                                                            140874   140875    +1     
  Branches                                                          17454    17455    +1     
=============================================================================================
+ Hits                                                             106266   106268    +2     
- Misses                                                            33531    33562   +31     
+ Partials                                                           1077     1045   -32     
Flag Coverage Δ
e2e-tests 77.57% <100.00%> (+<0.01%) ⬆️

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