Skip to content

fix missing tiers in previous part of webhook - #29810

Merged
9larsons merged 3 commits into
TryGhost:mainfrom
cathysarisky:fix-member-edited-webhook-previous-tiers
Aug 10, 2026
Merged

9larsons merged 3 commits into
TryGhost:mainfrom
cathysarisky:fix-member-edited-webhook-previous-tiers

Conversation

@cathysarisky

@cathysarisky cathysarisky commented Aug 6, 2026

Copy link
Copy Markdown
Member

closes #29805

Currently, switching between tiers does not cause a webhook to fire. This makes it hard for an integration to detect plan changes without doing a full scan of members.

This PR makes sure that tiers are emitted, and provides a test for the corrected behavior.

AI disclosure: Fable helped find the code responsible for the bug and fix it.

@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 349e09f

Command Status Duration Result
nx run ghost:test:ci:integration ✅ Succeeded 2m 54s View ↗
nx run ghost:test:integration ✅ Succeeded 3m 6s View ↗
nx run ghost:test:legacy ✅ Succeeded 2m 50s View ↗
nx run ghost:test:e2e ✅ Succeeded 2m 43s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded 22s View ↗
nx run-many -t test:unit -p ghost ✅ Succeeded 29s View ↗
nx run-many -t lint -p ghost,ghost-monorepo ✅ Succeeded 21s View ↗
nx run @tryghost/admin:build ✅ Succeeded 7s 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-10 18:16:02 UTC

@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: 43e1ab57-3d7a-4cc6-956b-fc247d266538

📥 Commits

Reviewing files that changed from the base of the PR and between 151d037 and 349e09f.

📒 Files selected for processing (2)
  • ghost/core/core/server/services/webhooks/serialize.js
  • ghost/core/test/unit/server/services/webhooks/serialize.test.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • ghost/core/test/unit/server/services/webhooks/serialize.test.js
  • ghost/core/core/server/services/webhooks/serialize.js

Walkthrough

The webhook serializer maps member products changes to the serialized tiers field when it builds previous data. Other keys keep their original names. A regression test verifies current and previous tier slugs for a paid-to-paid tier switch.

Fixed issue severity: Medium

Possibly related PRs

  • TryGhost/Ghost#29814: This PR also changes webhooks/serialize.js and member webhook serializer tests to preserve previous paid-tier data.

Suggested reviewers: 9larsons

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the fix for missing tier data in webhook previous payloads.
Description check ✅ Passed The description directly explains the tier-switch webhook bug and the regression test added to fix it.
Linked Issues check ✅ Passed The serializer change and regression test satisfy issue #29805 by including the previous tier in member.edited webhooks.
Out of Scope Changes check ✅ Passed The changes remain within scope and support the webhook serialization fix and its regression coverage.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.45%. Comparing base (fadf960) to head (349e09f).
⚠️ Report is 25 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #29810      +/-   ##
==========================================
+ Coverage   75.41%   75.45%   +0.04%     
==========================================
  Files        1606     1605       -1     
  Lines      140372   140458      +86     
  Branches    17394    17423      +29     
==========================================
+ Hits       105859   105988     +129     
+ Misses      33464    33393      -71     
- Partials     1049     1077      +28     
Flag Coverage Δ
e2e-tests 77.61% <100.00%> (+0.04%) ⬆️

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.

ref TryGhost#29805

- hoisted the SERIALIZED_KEYS constant to module scope so it is not rebuilt on every webhook event
- trimmed narrative comments in the serializer and its test down to the essential constraints
@9larsons
9larsons enabled auto-merge (squash) August 10, 2026 18:06
@9larsons
9larsons merged commit 77f2685 into TryGhost:main Aug 10, 2026
49 checks passed
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.

Member.updated webhook previous is missing tiers payload when changed

2 participants