Skip to content

Removed markdownToMobiledoc test helper#29075

Merged
sagzy merged 2 commits into
mainfrom
cleanup/markdownToMobiledoc
Jul 3, 2026
Merged

Removed markdownToMobiledoc test helper#29075
sagzy merged 2 commits into
mainfrom
cleanup/markdownToMobiledoc

Conversation

@sagzy

@sagzy sagzy commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

ref https://linear.app/ghost/issue/GVA-816

Follow-up to #28906, which removed mobiledoc rendering and HTML-to-mobiledoc conversion. Test fixtures were still seeding post content as mobiledoc via the markdownToMobiledoc helper — since the model now converts any mobiledoc input to lexical on save, that content ended up stored as lexical anyway, so the helper was just a roundabout way of producing lexical content.

Changes

  • Replaced DataGenerator.markdownToMobiledoc with DataGenerator.markdownToLexical, which produces the exact markdown-card lexical doc that mobiledocToLexical() emitted for these fixtures — stored content and rendered HTML are unchanged, so no snapshot updates are needed.
  • DataGenerator.forKnex.createPost now defaults to lexical content (still accepts an explicit mobiledoc override), and DataGenerator.forModel.posts picks lexical instead of mobiledoc.
  • Tests that deliberately exercise the legacy mobiledoc input path now build their mobiledoc locally, making the legacy intent explicit:
    • importer v1 tests (v1 exports predate lexical)
    • the force_rerender mobiledoc→lexical conversion test in posts-legacy.test.js
  • The post-with-all-media-types-mobiledoc fixture and restoreLegacyMobiledocPosts are untouched — they still cover the legacy mobiledoc read/render paths.

Testing

  • test:unit, test:integration, test:e2e and test:legacy run locally; every changed file passes in isolation (123/123 across the changed e2e files, 76/76 model-posts, 42/42 importer)
  • Remaining local full-suite failures were verified to be pre-existing on the parent commit (hook timeouts / flaky members & trackDb tests reproduce identically on baseline)

🤖 Generated with Claude Code

ref https://linear.app/ghost/issue/GVA-816

- Ghost renders lexical only; content stored as mobiledoc is converted on
  save, so test fixtures seeded via markdownToMobiledoc ended up stored as
  lexical anyway
- replaced the helper with markdownToLexical, which produces the same
  markdown-card lexical doc that the mobiledoc converter emitted, keeping
  stored content and rendered HTML identical
- DataGenerator.forKnex.createPost now defaults to lexical content while
  still accepting explicit mobiledoc for tests covering the legacy input
  path (importer v1, force re-render conversion), which now build their
  mobiledoc locally to make the legacy intent explicit

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 3, 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

Run ID: 0d2a4b90-71b7-4b6e-b41e-d7ea172357ee

📥 Commits

Reviewing files that changed from the base of the PR and between 09e6ade and 657325e.

📒 Files selected for processing (2)
  • ghost/core/test/e2e-webhooks/posts.test.js
  • ghost/core/test/e2e-webhooks/site.test.js

Walkthrough

This PR updates test fixtures and helper utilities to use Lexical content instead of Mobiledoc across admin, content, frontend, webhook, importer, model, and unit test coverage. The shared fixture generator adds markdownToLexical, updates fixture post data and createPost HTML derivation, and returns lexical content in model projections. Most affected tests now send or expect lexical fields, while the importer v1 suite keeps explicit Mobiledoc coverage for legacy conversion paths.

Changes

  • Fixture helpers and generators now produce Lexical content and default new posts to lexical.
  • Many e2e and unit tests switch post/page fixtures from mobiledoc to lexical.
  • The importer v1 tests retain Mobiledoc-specific inputs for legacy conversion assertions.
  • Post model, scheduling, mapper, and frontend helper tests are aligned to Lexical fixtures.

Possibly related PRs

  • TryGhost/Ghost#28824: Gift-links fixture changes here align with the related reader and toast rendering updates.
  • TryGhost/Ghost#28906: This PR’s Lexical fixture migration matches the broader removal of Mobiledoc conversion paths.

Suggested labels: migration

Suggested reviewers: kevinansfield

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed It accurately summarizes the main change: removing the markdownToMobiledoc helper and migrating tests to Lexical.
Description check ✅ Passed It directly describes the fixture migration from Mobiledoc to Lexical and the legacy-path exceptions.
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 cleanup/markdownToMobiledoc

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 Jul 3, 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 657325e

Command Status Duration Result
nx run ghost:test:ci:integration ✅ Succeeded 2m 45s View ↗
nx run ghost:test:integration ✅ Succeeded 2m 50s View ↗
nx run ghost:test:legacy ✅ Succeeded 2m 53s View ↗
nx run ghost:test:e2e ✅ Succeeded 2m 29s View ↗
nx run-many -t lint -p ghost ✅ Succeeded 35s View ↗
nx run-many -t test:unit -p ghost ✅ Succeeded 29s View ↗

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


☁️ Nx Cloud last updated this comment at 2026-07-03 10:46:16 UTC

@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: 09e6adee1a

ℹ️ 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 thread ghost/core/test/utils/fixtures/data-generator.js
@sagzy
sagzy enabled auto-merge (squash) July 3, 2026 10:32
@sagzy
sagzy disabled auto-merge July 3, 2026 10:32
ref https://linear.app/ghost/issue/GVA-816

- the e2e-webhooks tests built API payloads from
  fixtureManager.get('posts', 1).mobiledoc, which is undefined now that
  the fixture stores lexical, so posts were created blank and the
  webhook body snapshots failed in CI
- the rendered html in the snapshots is unchanged as the lexical
  fixture carries the same markdown card the mobiledoc version did

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sagzy
sagzy merged commit 0b98ffe into main Jul 3, 2026
32 checks passed
@sagzy
sagzy deleted the cleanup/markdownToMobiledoc branch July 3, 2026 11:05
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