Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: non existence default category layout when migrating (backport: 6.7.9.x)#16378

Merged
Marcel Kräml (mkraeml) merged 1 commit into
6.7.9.xfrom
fix/non-existence-default-category-layout-backport-6.7.9.x
Apr 22, 2026
Merged

fix: non existence default category layout when migrating (backport: 6.7.9.x)#16378
Marcel Kräml (mkraeml) merged 1 commit into
6.7.9.xfrom
fix/non-existence-default-category-layout-backport-6.7.9.x

Conversation

@shopware-octo-sts-app-2
Copy link
Copy Markdown
Contributor

Backport: #16294


Summary

This PR hardens the handling of core.cms.default_category_cms_page when the configured CMS page no longer exists.

The normal delete protection stays unchanged: if a CMS page is configured as a default, deleting it still throws an exception. This change only targets stale system config data that may already exist because of legacy data, direct DB changes, or other out-of-band inconsistencies.

What Changed

  • validate the configured default category CMS page before using it in CategorySubscriber
  • skip assigning cms_page_id during category writes when the configured default is empty, invalid, or points to a missing CMS page
  • refresh the migration to Migration1776691515SetDefaultCmsPageIdForCategories
  • make the migration backfill categories only when the configured default CMS page is valid and exists
  • keep the migration side-effect free: no automatic recovery or rewriting of system_config
  • add test coverage for invalid UUIDs, missing CMS pages, missing config, and rerun safety
  • add unit/integration coverage to document that deleting a category default CMS page still throws

Why

A stale core.cms.default_category_cms_page can lead to invalid foreign key payloads being written into category.cms_page_id.

This can break:

  • the category write path
  • the migration backfill path

With this change, both paths fail safely instead of trying to persist a non-existent CMS page reference.

Behavior

  • valid configured default CMS page: used as before
  • missing / invalid / stale configured default CMS page: skipped safely
  • deleting a CMS page that is configured as a default: still blocked by exception

@shopware-octo-sts-app-2 shopware-octo-sts-app-2 Bot added the domain/discovery Responsible for enabling the shopper to discover precisely the products that they want label Apr 22, 2026
@shopware-octo-sts-app-2 shopware-octo-sts-app-2 Bot added the domain/discovery Responsible for enabling the shopper to discover precisely the products that they want label Apr 22, 2026
@github-actions github-actions Bot added external-contribution A PR contributed by a community member. milestone/6.7.9.1 labels Apr 22, 2026
@github-actions
Copy link
Copy Markdown

Warnings
⚠️ The Pull Request doesn't contain any release info, if your changes are relevant for external developers please add an entry to the release info file, including the consequences of the change and how it affects external developers. For detailed infos please refer to the [release documentation guide](https://github.com/shopware/shopware/blob/trunk/delivery-process/documenting-a-release.md).

@explore-openapi
Copy link
Copy Markdown

explore-openapi Bot commented Apr 22, 2026

OpenAPI Snapshot

⚠️ shopware/store-api — base 6.7.9.x — 14 changes (4 removals · 10 modifications)

Diff: https://explore-openapi.dev/diff#...

⚠️ shopware/admin-api — base 6.7.9.x — 43 changes (20 removals · 23 modifications)

Diff: https://explore-openapi.dev/diff#...

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 98.38710% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (6.7.9.x@273cde8). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...tion1776691515SetDefaultCmsPageIdForCategories.php 97.82% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             6.7.9.x   #16378   +/-   ##
==========================================
  Coverage           ?   61.09%           
==========================================
  Files              ?     4728           
  Lines              ?   171555           
  Branches           ?     9772           
==========================================
  Hits               ?   104816           
  Misses             ?    63865           
  Partials           ?     2874           
Flag Coverage Δ
jest-admin 63.80% <ø> (?)
jest-storefront 74.24% <ø> (?)
phpunit-migration 92.41% <97.82%> (?)
phpunit-unit 55.08% <25.80%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mkraeml Marcel Kräml (mkraeml) merged commit fb36d27 into 6.7.9.x Apr 22, 2026
87 checks passed
@mkraeml Marcel Kräml (mkraeml) deleted the fix/non-existence-default-category-layout-backport-6.7.9.x branch April 22, 2026 13:30
@github-actions github-actions Bot added this to the 6.7.9.1 milestone Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/discovery Responsible for enabling the shopper to discover precisely the products that they want external-contribution A PR contributed by a community member. milestone/6.7.9.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants