Incorrect link between catalog_product_entity and catalog_product_super_link while indexing inventory of configurable products
- Dominant language
- PHP
- Stars
- 357
- Forks
- 262
- PR merge metrics
- No merged PRs in 30d
Description
Hi, After an importing operation, I accidentally find that the row_id and entity_id in product tables have been differentiated. I believe that was a feature which Magento does support, however when I synchronized a batch of inventory data of these products that have different row_id and entity_id from a external endpoint, I found a very weird issue that one product has been updated by the indexer to unsalable. After a deep dig out from the source code, I found
https://github.com/magento/inventory/blob/7516b741e26f5f0050417f04e0981b64fd620896/InventoryConfigurableProductIndexer/Indexer/SourceItem/SiblingSkuListInStockProvider.php#L108
Note: I think the `$linkField` here should be replaced to `entity_id` fixed, the table `catalog_product_super_link` uses two absolutely different foreign keys for product_id and parent_id, and the children ones should use entity_id instead of linkField which in my case is row_id.
Contributor guide
Research direction
Start at InventoryConfigurableProductIndexer/Indexer/SourceItem/SiblingSkuListInStockProvider.php around line 108 and trace how catalog_product_super_link keys are used during configurable-product inventory indexing. Compare the product_id and parent_id relationships with the row_id/entity_id behavior described in the issue. Done means products with differing row_id and entity_id are indexed with the correct salability result, with regression coverage if an appropriate test location is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100