Skip to content

fix(training-agent): inventory create_media_buy rejects a negative budget before the product lookup - #9153

Merged
bokelley merged 1 commit into
mainfrom
fix/inventory-validation-order
Nov 21, 2026
Merged

bokelley merged 1 commit into
mainfrom
fix/inventory-validation-order

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

On the inventory tenants (/inventory-adserver, /inventory-content), create_media_buy with a negative package budget and an unknown product answered PRODUCT_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_REQUEST on packages[N].budget.

This is the first of the quick gaps found when #9150's seed_* scenarios let error_compliance run on these tenants: its negative_budget step 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

  • New test: a negative budget on an unknown product answers INVALID_REQUEST on packages[0].budget. It fails without the fix (PRODUCT_NOT_FOUND).
  • Inventory suite: 26/26.

🤖 Generated with Claude Code

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

@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 bug fix in training-agent inventory simulation.

What I checked:

  • Reorders package validation in server/src/training-agent/inventory-sim/platform.ts so the budget guard (!(budget > 0), correctly rejecting negative/zero/NaN) runs before product lookup. An impossible request now fails as INVALID_REQUEST on packages[].budget regardless of the product named — sound behavior.
  • The new test in server/tests/unit/training-agent-inventory-tenants.test.ts asserts the exact error code and field; the existing unknown-product test uses budget: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
bokelley enabled auto-merge (squash) November 21, 2026 06:15
@bokelley
bokelley merged commit e5d2945 into main Nov 21, 2026
55 checks passed
@bokelley
bokelley deleted the fix/inventory-validation-order branch November 21, 2026 06:26
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).
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