Repository navigation
fix(training-agent): inventory tenants work behind a storefront (#9025) - #9076
Conversation
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]>
There was a problem hiding this comment.
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
InventorySimulationis 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.
Fixes the four things the market simulator ran into when it connected both inventory tenants as inventory sources behind a storefront (#9025 comment).
buying_modes: ["brief"]only.["brief", "wholesale"], set through the platform'sbuyingModescapability (which the SDK projects).get_productsalready served every mode the same way.get_productsreturnedcache_scope: "account".public. The get-products response schema requires this: "When the request did NOT includeaccount, the seller MUST returncache_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 anaccountkeepsaccountand nets out the caller's own bookings.require_operator_auth: true, which is the SDK default.requireOperatorAuth: false: a storefront calls with its own credential, not a per-buyer operator.falseis the schema default, so the field may now be omitted from the response..exampledomains.Tests
training-agent-inventory-tenants.test.ts:get_adcp_capabilitiesdeclares thewholesalebuying mode and no operator auth.cache_scope: "public", with a forecast that ignores the caller's earlier 100,000-impression booking.accountand nets that booking out.Checks run locally
check-owned-linkspasses.docs-nav-validationfails here only because this worktree's sparse checkout ofdist/omits the3.3.0-rc.0docs snapshot. That snapshot is onmainand 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