Repository navigation
fix(training-agent): inventory get_products filters by format_option_refs and pages - #9155
Conversation
…refs and pages get_products on the inventory tenants ignored filters.format_option_refs and pagination, so get_products_pagination_integrity's capped first page got every product. Filter wire products by the referenced format options (product scope by id; publisher scope by id and publisher domain), and page with max_results and an offset cursor like the sales tenant: 50 by default, at most 100, has_more and total_count, INVALID_REQUEST on a malformed cursor. A request without pagination is answered exactly as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean fix with no blocking findings.
This PR adds filters.format_option_refs and pagination support to get_products on the inventory tenants, closing the third gap exposed by #9150's seed_* storyboards. The pagination shape (offset cursor via pagination.ts, max_results default 50/cap 100, has_more/total_count/conditional cursor, malformed→INVALID_REQUEST) matches the sales-tenant implementation exactly, and the no-pagination path preserves the pre-change response shape. servesFormatOptionRef filters before paging so total_count reflects match count, and the publisher-scope branch correctly matches nothing for product-local catalogs. The malformed-cursor check fires before product build. New test covers filter, two-page cursor walk, and malformed cursor.
No protocol surface touched (static/schemas/source/** untouched), so no changeset is required. No Critical/High/Medium findings.
Decision table: high_risk is false; gated_paths is false (row 2 does not apply despite review_decision=REVIEW_REQUIRED); no no-auto-approve team match; zero findings. Falls through to row 9 → approve.
…fs and pages (adcontextprotocol#9155) No conflicts. server/tests/unit/training-agent-inventory-tenants.test.ts changed on both sides; main adds one test and no imports, setup or environment reads, and git's merge keeps both. Resolution ledger: - mechanical: none - semantic: none; the auto-merged test file was read Check: typecheck passes, and the full server unit suite passes (867 files, 14,707 tests, 31 skipped; main adds 1 test).
Summary
On the inventory tenants (
/inventory-adserver,/inventory-content),get_productsignoredfilters.format_option_refsandpagination. Soget_products_pagination_integrity's capped first page (max_results: 1) got every product, unfiltered.What changes in
get_products:format_option_refsfilter. A product passes if one of itsformat_optionsmatches a ref. Aproduct-scope ref matches byformat_option_id; apublisher-scope ref matches byformat_option_idandpublisher_domain.pagination.ts:max_resultsdefaults to 50, at most 100;has_moreandtotal_count, plus acursorwhile more remain;INVALID_REQUEST.pagination, the response is exactly as before: every match, and nopaginationblock.This is the third quick gap found when #9150's
seed_*scenarios letget_products_pagination_integrityrun on these tenants. Today's CI doesn't run that storyboard here, so no floor moves; #9150's floors will include this fix.Test plan
/inventory-adserver:display_300x250_imageref returns exactly its three products;max_results: 2returns two of them withhas_more: trueandtotal_count: 3;has_more: false;INVALID_REQUEST;paginationthere is nopaginationblock.🤖 Generated with Claude Code