Skip to content

feat: CatalogReadPort — public-safe catalog reads (ADR 0023) - #6

Merged
DanMat merged 1 commit into
mainfrom
feat/catalog-read-port
Aug 31, 2026
Merged

DanMat merged 1 commit into
mainfrom
feat/catalog-read-port

Conversation

@DanMat

@DanMat DanMat commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

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/out from 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_items list/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

…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>
@DanMat
DanMat merged commit 07eab10 into main Aug 31, 2026
2 checks passed
@DanMat
DanMat deleted the feat/catalog-read-port branch August 31, 2026 01:08
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.

1 participant