Skip to content

Serve stock_sources from the stock slice - #31

Merged
paales merged 2 commits into
mainfrom
claude/stock-sources
Oct 13, 2026
Merged

paales merged 2 commits into
mainfrom
claude/stock-sources

Conversation

@paales

@paales paales commented Oct 13, 2026

Copy link
Copy Markdown
Member

This PR serves stock_sources (GraphQL Catalog, graphcommerce-org/magento2-GraphCommerce_GraphQlCatalog#2) from the documents. It is stacked on #30 (followFilters), so merge #30 first.

  • CatalogStorefrontInventory:
    • et_schema field sources (record StockItemSource) on the stock status feed row;
    • Provider/StockSources reads, in one query per batch, the source items of the row's sku in the enabled sources of the row's stock, in priority order, with name, quantity, status, pickup flag and location;
    • the stock writer already stores the whole row as the stock slice, so stock.sources lands without a writer change.
  • CatalogStorefrontInventoryGraphQl:
    • the stock prefiller fills stock_sources from the slice, empty without a slice, as core answers for a product without source items;
    • RoutePrefilledFields routes it, and the sequence adds GraphCommerce_GraphQlCatalogInventory.
  • Parity: new query 37-stock-sources.
  • Docs: CLAUDE.md (layout, and the known gap that the quantity is physical and that a source edit shows after the next export of its rows) and the README field table.

Validated in a workspace of project-catalogreadmodel (107 815 products):

  • Re-export: a full stock feed reindex took 53 s. The et_schema change gives every row a new hash.
  • Parity gate: 29 of 29 identical, 8 skipped. Query 37 runs no SQL on the document path.
  • Poison test: a quantity changed in the OpenSearch document (67 to 4242) showed on the document path only. The core path ran one batched source item search.
  • Unit tests: the inventory and GraphQl modules pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_019nYtEbdpZ5P5wLAoCfD4MX


Generated by Claude Code

…t path serves stock_sources from the stock slice, so store availability costs no SQL on a listing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019nYtEbdpZ5P5wLAoCfD4MX
@paales
paales merged commit 0a42610 into main Oct 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants