Skip to content

Added gift delivery outcome handling - #29969

Open
kevinansfield wants to merge 1 commit into
agent/ber-3853-gift-delivery-portalfrom
agent/ber-3851-gift-delivery-outcomes
Open

Added gift delivery outcome handling#29969
kevinansfield wants to merge 1 commit into
agent/ber-3853-gift-delivery-portalfrom
agent/ber-3851-gift-delivery-outcomes

Conversation

@kevinansfield

Copy link
Copy Markdown
Member

What changed

  • adds delivered, temporary-failure and permanent-failure outcomes to accepted gift deliveries, including provider timestamps and diagnostic details
  • indexes the stored Mailgun message ID used to correlate provider events with delivery records
  • schedules gift analytics collection after Mailgun accepts a delivery and processes matching delivery and failure events through the email analytics service
  • records temporary failures without resending from Ghost
  • sends the buyer a tracking-disabled transactional notification with the original gift link when Mailgun reports a permanent failure and the gift is still valid
  • adds the analytics job, outcome repository behavior, failure email template, translations and behavioral coverage

Why

Mailgun owns delivery and retry behavior after accepting an email, but Ghost still needs to distinguish eventual delivery from temporary and permanent failures. Recording those outcomes provides that visibility without introducing a second retry mechanism that could duplicate Mailgun's work.

When delivery is permanently rejected, notifying the buyer with the existing redemption link gives them a usable fallback without changing or reissuing the gift.

ref https://linear.app/ghost/issue/BER-3851

@coderabbitai

coderabbitai Bot commented Aug 13, 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: QUIET

Plan: Pro

Run ID: a8552334-6f80-4cea-97dd-a6d1cb604b5d

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

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

@github-actions github-actions Bot added the migration [pull request] Includes migration for review label Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

It looks like this PR contains a migration 👀
Here's the checklist for reviewing migrations:

General requirements

  • ⚠️ Tested performance on staging database servers, as performance on local machines is not comparable to a production environment
  • Satisfies idempotency requirement (both up() and down())
  • Does not reference models
  • Filename is in the correct format (and correctly ordered)
  • Targets the next minor version
  • All code paths have appropriate log messages
  • Uses the correct utils
  • Contains a minimal changeset
  • Does not mix DDL/DML operations

Schema changes

  • Both schema change and related migration have been implemented
  • For index changes: has been performance tested for large tables
  • For new tables/columns: fields use the appropriate predefined field lengths
  • For new tables/columns: field names follow the appropriate conventions
  • Does not drop a non-alpha table outside of a major version

Data changes

  • Mass updates/inserts are batched appropriately
  • Does not loop over large tables/datasets
  • Defends against missing or invalid data
  • For settings updates: follows the appropriate guidelines

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@nx-cloud

nx-cloud Bot commented Aug 13, 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 2a569fe

Command Status Duration Result
nx run ghost:test:ci:integration ✅ Succeeded 2m 56s View ↗
nx run @tryghost/admin:test:acceptance ✅ Succeeded 7m 12s View ↗
nx run ghost:test:integration ✅ Succeeded 2m 34s View ↗
nx run-many -t test:unit -p ghost,@tryghost/com... ✅ Succeeded 30s View ↗
nx run ghost:test:legacy ✅ Succeeded 2m 23s View ↗
nx run ghost:test:e2e ✅ Succeeded 2m 16s View ↗
nx run @tryghost/admin:build ✅ Succeeded 21s View ↗
nx run @tryghost/comments-ui:test:acceptance ✅ Succeeded 40s View ↗
Additional runs (4) ✅ Succeeded ... View ↗

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


☁️ Nx Cloud last updated this comment at 2026-08-18 17:34:15 UTC

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from ea544c6 to 7e60f47 Compare August 13, 2026 21:07

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@kevinansfield
kevinansfield marked this pull request as ready for review August 13, 2026 21:15
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.97889% with 182 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (agent/ber-3853-gift-delivery-portal@dac6da8). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ore/server/services/gifts/gift-delivery-service.ts 29.23% 46 Missing ⚠️
...core/core/server/services/email-analytics/index.ts 24.39% 31 Missing ⚠️
...e/core/server/services/gifts/gift-email-service.ts 25.00% 27 Missing ⚠️
...il-analytics/jobs/email-analytics-job-scheduler.ts 20.68% 23 Missing ⚠️
...ces/gifts/email-templates/gift-delivery-failure.ts 43.24% 21 Missing ⚠️
.../core/server/services/gifts/gift-email-renderer.ts 33.33% 10 Missing ⚠️
ghost/core/core/boot.js 0.00% 9 Missing ⚠️
...es/email-analytics/jobs/gift-fetch-latest/index.js 0.00% 7 Missing ⚠️
...core/server/services/email-analytics/jobs/index.js 70.00% 3 Missing ⚠️
...rvices/gifts/gift-delivery-bookshelf-repository.ts 94.73% 2 Missing ⚠️
... and 3 more
Additional details and impacted files
@@                          Coverage Diff                           @@
##             agent/ber-3853-gift-delivery-portal   #29969   +/-   ##
======================================================================
  Coverage                                       ?   75.21%           
======================================================================
  Files                                          ?     1621           
  Lines                                          ?   144404           
  Branches                                       ?    17858           
======================================================================
  Hits                                           ?   108609           
  Misses                                         ?    34791           
  Partials                                       ?     1004           
Flag Coverage Δ
e2e-tests 77.05% <51.97%> (?)

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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e60f47397

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +169 to +170
if (labs.isSet('giftSubCustomization')) {
gifts.init({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Initialize gift analytics independently of the Labs flag

When giftSubCustomization is enabled through Labs after the process has booted, checkout immediately permits emailed gifts, and sendDelivery() schedules the recurring gift job, but this conditional means the gifts wrapper never subscribed to StartGiftEmailAnalyticsJobEvent. The job therefore emits events with no listener, so delivery outcomes and permanent-failure buyer notifications remain disabled until Ghost restarts; initialize the wrapper unconditionally at boot and gate only job scheduling/feature entry points.

AGENTS.md reference: AGENTS.md:L191-L192

Useful? React with 👍 / 👎.

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from 7e60f47 to 414a72c Compare August 13, 2026 21:21

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from 414a72c to 8f939e7 Compare August 13, 2026 21:29

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from 8f939e7 to cfc85b4 Compare August 13, 2026 21:48

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from cfc85b4 to 4b2dff9 Compare August 14, 2026 17:10

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from 4b2dff9 to 24f4843 Compare August 17, 2026 08:31

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from 24f4843 to b12f2fb Compare August 17, 2026 08:51

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from b12f2fb to 703cae6 Compare August 17, 2026 09:21
@github-actions

Copy link
Copy Markdown
Contributor

E2E Tests Failed

To view the Playwright test report locally, run:

REPORT_DIR=$(mktemp -d) && gh run download 32049762915 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR"

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from 236f9b5 to fc42ac8 Compare August 17, 2026 17:57

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from fc42ac8 to 6d94d68 Compare August 17, 2026 18:38
@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from 6d94d68 to 946313a Compare August 18, 2026 08:20

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from 946313a to 3a25d5b Compare August 18, 2026 12:33

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@github-actions

Copy link
Copy Markdown
Contributor

E2E Tests Failed

To view the Playwright test report locally, run:

REPORT_DIR=$(mktemp -d) && gh run download 32137456437 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR"

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from 3a25d5b to 124503f Compare August 18, 2026 13:09

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@github-actions

Copy link
Copy Markdown
Contributor

E2E Tests Failed

To view the Playwright test report locally, run:

REPORT_DIR=$(mktemp -d) && gh run download 32140757906 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR"

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from 124503f to f1bf562 Compare August 18, 2026 13:44

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from ee120f6 to 51dd523 Compare August 18, 2026 15:12

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

ref https://linear.app/ghost/issue/BER-3851

Accepted gift deliveries already store Mailgun's provider message ID. They now schedule analytics collection, which fetches Mailgun events, matches them to delivery records, and stores delivered, temporary-failure or permanent-failure outcomes with timestamps and provider error details.

Temporary failures are recorded without resending because Mailgun remains responsible for retrying them. When Mailgun reports a permanent failure, Ghost sends the buyer a tracking-disabled transactional notification containing the recipient address and original redemption link, provided the gift is still valid.

This adds the outcome schema and provider-message index, analytics processor and recurring job wiring, failure template and translations, narrow tracking-disable support for GhostMailer, and coverage for event processing and buyer notification behavior.
@kevinansfield
kevinansfield force-pushed the agent/ber-3851-gift-delivery-outcomes branch from 51dd523 to 2a569fe Compare August 18, 2026 17:21

@github-actions github-actions Bot 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.

🌐 Automated translation review

Verdict: ⏭️ Skipped — PR is too large for automated review

Reviewed 0 translations across 61 files.

This PR touches 61 translation files, which is beyond the automated reviewer's per-PR limit (max 15 files / 500 lines). A maintainer should review the translations manually.


Advisory review by i18n-review-bot. Non-blocking — a maintainer still owns the merge decision, and the bot cannot approve PRs on its own. Translator expertise wins where there is doubt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

migration [pull request] Includes migration for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant