fix: catch NoSuchEntityException in InvalidSkuProcessor for bundle products#40883
Open
kapil971390 wants to merge 2 commits into
Open
fix: catch NoSuchEntityException in InvalidSkuProcessor for bundle products#40883kapil971390 wants to merge 2 commits into
kapil971390 wants to merge 2 commits into
Conversation
…oducts productRepository->get($sku) in retrieveInvalidSkuList() had no exception handling for the case where a bundle product is deleted between the initial retrieveProductIdsBySkus() lookup and the repository fetch. This caused an uncaught NoSuchEntityException to propagate up and fail the entire batch when using POST /V1/products/base-prices with bundle products. Apply the same try/catch pattern used in ACP2E-4998 (TierPriceValidator): catch NoSuchEntityException and treat the SKU as invalid so the rest of the batch continues processing. Fixes magento#40882
|
Hi @kapil971390. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
Author
|
@magento run Unit Tests, Static Tests, WebAPI Tests |
Author
|
@magento run Static Tests |
Author
|
All tests passing. Re-triggering CLA check. |
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.
Description
InvalidSkuProcessor::retrieveInvalidSkuList()callsproductRepository->get($sku)without catchingNoSuchEntityExceptionfor bundle products. If a bundle product is deleted between the initialretrieveProductIdsBySkus()lookup and the repository fetch, the exception propagates uncaught and fails the entirePOST /V1/products/base-pricesbatch.Fixes #40882
Root cause
BasePriceStoragealways passes$this->priceTypeAllowed = 1as$allowedPriceTypeValue, so this code path is reached for every bundle product in a batch.Fix
Applied the same try/catch pattern used in ACP2E-4998 (
TierPriceValidator::checkQuantity()):Related
ACP2E-4998 fixed the same pattern in
TierPriceValidator::checkQuantity()butInvalidSkuProcessorwas not updated at the same time.Test plan
POST /V1/products/base-priceswith a batch containing a bundle product that is deleted concurrently — should report the SKU as invalid and continue processing the rest of the batchPOST /V1/products/base-priceswith only valid bundle products — no behavior changePOST /V1/products/base-priceswith only simple products — no behavior change (code path not reached)