feat: CatalogReadPort — public-safe catalog reads (ADR 0023) - #6
Merged
Merged
Conversation
…DR 0023) Publishes a read port (ADR 0019) a storefront consumes to render the item master — list(filters)/get(sku)/categories — without touching Inventory's tables. Public-safe by construction: active items only, COARSE availability (in_stock/low/out from summed on_hand−reserved, never raw counts/cost/reserved/location), an allow-listed sort, a bound and %/_-escaped search, and a bounded page. get() on an inactive or unknown SKU returns null (a hidden item is indistinguishable from missing). - Catalog: publicList/publicGet/publicCategories (the public read query, in one place) alongside the existing admin CRUD. - CatalogReadPort interface + CatalogReadAdapter (thin delegate), provided via services() next to ReservationPort. - MCP: an `inventory_items` list/search read tool, so an agent has parity with the catalog query the public gets. Tests: inactive excluded from list + 404 on get; coarse availability + no-leak DTO shape; unknown sort falls back (no injection); bound search (a bare % matches nothing); category slug resolves; the package publishes the port. PHPStan max, 73 tests, cs-fixer green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Foodmart Slice 2, part 2. Publishes a read port (ADR 0019) a storefront consumes to render the item master (ADR 0022) —
list/get/categories— without touching Inventory's tables.Public-safe by construction: active items only, coarse availability (
in_stock/low/outfrom summed on_hand−reserved — never raw counts, cost, reserved, or location), an allow-listed sort, a bound%/_-escaped search, and a bounded page.get()on an inactive/unknown SKU returns null.Also adds an
inventory_itemslist/search MCP read tool so an agent has parity with the catalog query.PHPStan max · 73 tests · cs-fixer — green. (Pairs with core PR for ADR 0023.)
🤖 Generated with Claude Code