Repository navigation
fix: delete order documents before deleting created orders in cleanup - #735
Merged
Merged
Conversation
Documents restrict the deletion of their order (ON DELETE RESTRICT), so a created order with a generated document made the whole cleanup sync fail and left the order and all other priority records in the shop. The cleanup now deletes the documents of all created orders first, dependent documents (credit notes, cancellation invoices) before the documents they reference. The new TestDataService.deleteOrderDocuments() can also be used directly. Related: shopware/shopware#21547 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012HXAuz5s1mTqTrV5HFrfgP
commit: |
Florian Robel (frobel)
approved these changes
Oct 19, 2026
Van Pham (vanpham-sw)
approved these changes
Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: delete order documents before deleting created orders in cleanup
What?
TestDataService.cleanUp()now deletes the documents of all created orders before it deletes the orders themselves.TestDataService.deleteOrderDocuments(orderIds). It deletes dependent documents (credit notes, cancellation invoices) first, then the documents they reference.cleanUp()calls it for every record registered asorderbefore the priority delete runs.tests/TestDataService/OrderDocumentCleanup.spec.tscreates an order with an invoice and a cancellation invoice, runs the cleanup, and checks that both the documents and the order are gone.Why?
document.order_idreferencesorderwithON DELETE RESTRICT, and the order definition has no cascade for documents. Today, when a test registers an order that has a document (generated through the API, through the admin, or by a flow on the shop), the priority_action/syncdelete fails:expect(priorityDeleteOperationsResponse.ok())This shows up as leftover data after the nightly runs (shopware/shopware#21547). The review on shopware/shopware#21548 asked to fix it centrally here instead of in each test.
How to test
npx playwright test tests/TestDataService/OrderDocumentCleanup.spec.tsoxlint --type-aware,oxfmt --checkandtsgo --noEmitpass.Follow-up
After the release, bump
@shopware-ag/acceptance-test-suitein shopware/shopware#21548. That PR then only registers the storefront order for cleanup; the per-test document cleanup is removed.🤖 Generated with Claude Code
https://claude.ai/code/session_012HXAuz5s1mTqTrV5HFrfgP