Skip to content

fix(training-agent): inventory get_products filters by format_option_refs and pages - #9155

Merged
bokelley merged 1 commit into
mainfrom
fix/inventory-products-pagination
Nov 21, 2026
Merged

bokelley merged 1 commit into
mainfrom
fix/inventory-products-pagination

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

On the inventory tenants (/inventory-adserver, /inventory-content), get_products ignored filters.format_option_refs and pagination. So get_products_pagination_integrity's capped first page (max_results: 1) got every product, unfiltered.

What changes in get_products:

  • format_option_refs filter. A product passes if one of its format_options matches a ref. A product-scope ref matches by format_option_id; a publisher-scope ref matches by format_option_id and publisher_domain.
  • Pagination, the same as the sales tenant, using the shared offset cursor in pagination.ts:
    • max_results defaults to 50, at most 100;
    • the response carries has_more and total_count, plus a cursor while more remain;
    • a malformed cursor gets INVALID_REQUEST.
  • Without pagination, the response is exactly as before: every match, and no pagination block.

This is the third quick gap found when #9150's seed_* scenarios let get_products_pagination_integrity run 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

  • New test on /inventory-adserver:
    • the display_300x250_image ref returns exactly its three products;
    • max_results: 2 returns two of them with has_more: true and total_count: 3;
    • the cursor returns the third with has_more: false;
    • a malformed cursor gets INVALID_REQUEST;
    • without pagination there is no pagination block.
    • It fails without the fix.
  • Inventory suite: 26/26.

🤖 Generated with Claude Code

…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]>

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bokelley
bokelley enabled auto-merge (squash) November 21, 2026 08:39
@bokelley
bokelley merged commit e3622cf into main Nov 21, 2026
56 checks passed
@bokelley
bokelley deleted the fix/inventory-products-pagination branch November 21, 2026 08:39
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 21, 2026
…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).
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