Repository navigation
fix(training-agent): inventory create_media_buy rejects a negative budget before the product lookup - #9153
Merged
Conversation
…dget before the product lookup A package with a negative budget and an unknown product answered PRODUCT_NOT_FOUND. A negative budget is never valid, so report it first, as INVALID_REQUEST on packages[N].budget (error_compliance/negative_budget). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean bug fix in training-agent inventory simulation.
What I checked:
- Reorders package validation in
server/src/training-agent/inventory-sim/platform.tsso the budget guard (!(budget > 0), correctly rejecting negative/zero/NaN) runs before product lookup. An impossible request now fails asINVALID_REQUESTonpackages[].budgetregardless of the product named — sound behavior. - The new test in
server/tests/unit/training-agent-inventory-tenants.test.tsasserts the exact error code and field; the existing unknown-product test usesbudget:100, so it does not regress. - Scope is training-agent simulation only (
server/src/training-agent/**), not the published protocol surface (static/schemas/source/**,docs/reference/**, dist artifacts). No changeset required per repo scope rules. - No schema↔docs coherence, oneOf discriminator, artifact immutability, or 3.1.x patch-eligibility concerns — none of those surfaces are touched.
Gate checks: gated_paths: false, high_risk: false, no no-auto-approve team match, no prior decision. No critical/high/medium findings. review_decision is REVIEW_REQUIRED, but since gated_paths is false, row 2 does not fire. Falls through to row 9.
bokelley
enabled auto-merge (squash)
November 21, 2026 06:15
KonstantinMirin
added a commit
to KonstantinMirin/adcp
that referenced
this pull request
Nov 21, 2026
…et first (adcontextprotocol#9153) No conflicts. server/tests/unit/training-agent-inventory-tenants.test.ts changed on both sides; main's new negative-budget test sits in a describe block this branch doesn't change, 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,706 tests, 31 skipped; main adds 1 test).
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On the inventory tenants (
/inventory-adserver,/inventory-content),create_media_buywith a negative package budget and an unknown product answeredPRODUCT_NOT_FOUND. The storyboard requires a budget error.A negative budget is never valid, whatever product the package names. So the tenant now checks the budget before it looks the product up, answering
INVALID_REQUESTonpackages[N].budget.This is the first of the quick gaps found when #9150's
seed_*scenarios leterror_compliancerun on these tenants: itsnegative_budgetstep failed. Today's CI doesn't run that storyboard on the inventory tenants, so no floor moves here. #9150 sets its floors from its own CI run, which will include this fix.Test plan
INVALID_REQUESTonpackages[0].budget. It fails without the fix (PRODUCT_NOT_FOUND).🤖 Generated with Claude Code