Skip to content

fix: create only one draft version per seeded page - #4119

Merged
tvdeyen merged 1 commit into
mainfrom
page-seeder-draft-overflow
Aug 1, 2026
Merged

fix: create only one draft version per seeded page#4119
tvdeyen merged 1 commit into
mainfrom
page-seeder-draft-overflow

Conversation

@tvdeyen

@tvdeyen tvdeyen commented Aug 1, 2026

Copy link
Copy Markdown
Member

What is this pull request for?

The page seeder created two draft versions for every seeded page instead of one. Alchemy::Page already builds a draft version on initialization through the ensure_draft_version after_initialize callback, but Alchemy::Seeder#create_page also called page.versions.build explicitly. Each seeded page therefore ended up with a redundant duplicate draft version (a demo app with 8 pages produced 23 page versions instead of the expected 15).

Removing the explicit build leaves the model's callback as the single source of the draft version, so exactly one draft version is created per page. Published pages still additionally get their public version via the public_on= setter.

Notable changes (remove if none)

None.

Screenshots

Remove if no visual changes have been made.

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

Alchemy::Page already builds a draft version on initialization via the
ensure_draft_version after_initialize callback. The seeder built a second
one explicitly, so every seeded page ended up with two draft versions.
Removing the redundant build leaves exactly one draft version per page.
@tvdeyen
tvdeyen requested a review from a team as a code owner August 1, 2026 08:06
@tvdeyen tvdeyen added bug backport-to-8.3-stable Needs to be backported to 8.3-stable labels Aug 1, 2026
@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.26%. Comparing base (8f7a74c) to head (6a43153).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4119      +/-   ##
==========================================
- Coverage   98.26%   98.26%   -0.01%     
==========================================
  Files         350      350              
  Lines        9184     9183       -1     
==========================================
- Hits         9025     9024       -1     
  Misses        159      159              

☔ 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.

@tvdeyen

tvdeyen commented Aug 1, 2026

Copy link
Copy Markdown
Member Author

tested with alchemy demo

@tvdeyen
tvdeyen merged commit 5da57a7 into main Aug 1, 2026
30 checks passed
@tvdeyen
tvdeyen deleted the page-seeder-draft-overflow branch August 1, 2026 08:49
@alchemycms-bot

alchemycms-bot Bot commented Aug 1, 2026

Copy link
Copy Markdown

💚 All backports created successfully

Status Branch Result
8.3-stable

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

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

Labels

backport-to-8.3-stable Needs to be backported to 8.3-stable bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant