Skip to content

fix(training-agent): inventory tenants work behind a storefront (#9025) - #9076

Merged
bokelley merged 1 commit into
mainfrom
inventory-sim/storefront-fixes
Nov 17, 2026
Merged

bokelley merged 1 commit into
mainfrom
inventory-sim/storefront-fixes

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Fixes the four things the market simulator ran into when it connected both inventory tenants as inventory sources behind a storefront (#9025 comment).

Finding Change
Buying modes. Both tenants declared buying_modes: ["brief"] only. Both now declare ["brief", "wholesale"], set through the platform's buyingModes capability (which the SDK projects). get_products already served every mode the same way.
Cache scope. An account-less wholesale get_products returned cache_scope: "account". It now returns public. The get-products response schema requires this: "When the request did NOT include account, the seller MUST return cache_scope: 'public'." The public card forecasts against an empty market, so it is the same for every caller at the same simulated time. A read that names an account keeps account and nets out the caller's own bookings.
Operator auth. Both tenants advertised require_operator_auth: true, which is the SDK default. requireOperatorAuth: false: a storefront calls with its own credential, not a per-buyer operator. false is the schema default, so the field may now be omitted from the response.
Domains. The publishers use .example domains. The docs page now says so, and that a registry or DNS check of their properties fails in this sandbox. It also explains the public and account-scoped forecasts.

Tests

training-agent-inventory-tenants.test.ts:

  • get_adcp_capabilities declares the wholesale buying mode and no operator auth.
  • An account-less wholesale read is schema-valid and returns cache_scope: "public", with a forecast that ignores the caller's earlier 100,000-impression booking.
  • A read that names an account returns account and nets that booking out.

Checks run locally

  • Typecheck, the format lint and both inventory suites pass (36 tests).
  • check-owned-links passes.
  • docs-nav-validation fails here only because this worktree's sparse checkout of dist/ omits the 3.3.0-rc.0 docs snapshot. That snapshot is on main and already includes this page.

Committed with HUSKY=0, under the approval for this series. No changeset: this touches only the training agent and non-normative docs.

Refs #9025

🤖 Generated with Claude Code

Four findings from the market simulator connecting both inventory
tenants as inventory sources behind a storefront (#9025 comment
6952387186):

- Both declare buying_modes ['brief', 'wholesale'] (via the platform's
  buyingModes), so a storefront can read them as a wholesale catalogue.
  get_products already served every mode the same way.
- An account-less get_products now returns cache_scope 'public', as the
  get-products response schema requires, with forecasts against an empty
  market so the card is the same for every caller. A read that names an
  account keeps cache_scope 'account' and nets out the caller's bookings.
- requireOperatorAuth is false: a storefront calls with its own
  credential, not a per-buyer operator. The SDK had defaulted it to true.
- The docs page says the publishers use .example domains, so registry
  and DNS checks of their properties fail in this sandbox, and explains
  the public and account-scoped forecasts.

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 spec-conformance fix with no blocking or medium findings.

This PR fixes a get_products spec-conformance bug in the training-agent inventory sim: an account-less read previously returned cache_scope: 'account', violating get-products-response.json's MUST ("when the request did NOT include account, the seller MUST return cache_scope: 'public'"). The fix forecasts against a fresh empty-market InventorySimulation when no account is present (→ 'public') and the live per-credential market when it is (→ 'account'). It adds buying_modes ['brief','wholesale'] and require_operator_auth:false capabilities, documents them, and tests the public/account split with a netting assertion (expectCanonical validates the public response against the real schema).

Checks performed:

  • No schema source under static/schemas/source/** touched → no spec-drift or changeset requirement (server/training-agent operational code).
  • Docs ↔ schema ↔ code cohere; the type→value import of InventorySimulation is correct.
  • No high-risk paths, no gated paths, no deletions.
  • No no-auto-approve team match.

Decision table: no critical/high/medium findings (rows 1,4-6,8 don't fire), gated_paths false (row 2 skipped), high_risk false (rows 3,5 skipped), no prior escalate (row 6), no team gate (row 7). Falls through to row 9 → approve.

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