Skip to content

ci: full-stack CI run for the #9025 inventory-sim PRs (do not merge) - #9042

Closed
bokelley wants to merge 10 commits into
mainfrom
inventory-sim/ci-full-stack
Closed

bokelley wants to merge 10 commits into
mainfrom
inventory-sim/ci-full-stack

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

CI only. Do not review or merge.

This PR runs the full CI suite, including the storyboard jobs, on the whole #9025 inventory-sim stack at once. The stacked PRs #9038–#9041 target each other rather than main, so they get no storyboard run until they are retargeted.

The head is inventory-sim/ci-full-stack at dee4a087c8, the same commit as the tip of #9041. It contains:

Review each slice in its own PR. I'll close this PR once CI has run.

Refs #9025

🤖 Generated with Claude Code

Part B of #9025, slice 1: the engine behind the two inventory tenants.
It lives in server/src/training-agent/inventory-sim/engine/ with no
imports from the rest of the training agent, so it can move into
@adcp/sdk later.

- A season seed defines regions, non-overlapping audience profiles,
  segments, properties, placements (with formats, floors and rates),
  products, collections, traffic shape, forecast error and scripted
  events.
- Traffic is generated once per seed as cells (day x region x property
  x placement x profile, plus installment for content placements), in a
  forecast table and an actual table that differs by keyed noise and
  events.
- Each simulated day serves bookings confirmed by the end of the
  previous day; share-of-voice first, then impression goals by the
  high-water mark method, then a first-price auction above the floor;
  installments run, postpone or cancel; delivery is recorded per
  booking and per cell.
- Forecasts subtract guaranteed reservations and come out in AdCP's
  forecast shape. Delivery is released at each product's reporting lag.
- Two seeds: an ad server (display, video, takeover, a scripted outage
  and a traffic spike) and a content platform (podcast, newsletter,
  creator series, a cancelled episode and a postponed video).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bokelley
bokelley marked this pull request as ready for review November 15, 2026 18:46

@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: Escalate to human review

Escalate — gated path requires human/CODEOWNERS approval.

This PR modifies .github/workflows/deploy.yml, which matches the deterministic gated-path glob .github/workflows/** (gated_paths: true), and review_decision is REVIEW_REQUIRED (not APPROVED). Per decision rule row 2, this must escalate until a human/CODEOWNERS approval lands.

No blocking (critical/high) findings were identified. The reviewer surfaced one Medium and one Low:

Medium findings

  • server/src/training-agent/tenants/inventory.ts:67 — reset_state unpins the shared sandbox clock but discards only the current tenant's market, freezing the other tenant's market ahead of the clock so its delivery reports zero.

(Low finding omitted per severity model.)

The Medium finding is not in a data-loss/schema/infra category and would not independently change the outcome, but it is worth the human reviewer's attention when approving the workflow change.

Escalation reasons

  • .github/workflows/deploy.yml is under a hard approval gate (.github/workflows/**); human/CODEOWNERS review is required before merge (review_decision: REVIEW_REQUIRED).

Medium findings

  • server/src/training-agent/tenants/inventory.ts:67 — reset_state unpins shared clock but discards only one tenant's market

Why human review

  • Modifies .github/workflows/deploy.yml, a gated path (.github/workflows/**), and review_decision is REVIEW_REQUIRED — human/CODEOWNERS approval required before merge
  • This PR touches a path under a hard, non-overridable approval gate (.github/workflows/deploy.yml (modified) matches .github/workflows/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.

@aao-secretariat aao-secretariat Bot added the ladon/needs-human-review Ladon has escalated this PR for human review. label Nov 15, 2026
bokelley and others added 9 commits November 15, 2026 19:24
…#9025)

Ladon nit on #9037: the scarce-seed fixture named the field format_ids;
SeedPlacement calls it formats. The engine never reads it, and the
server tsconfig excludes tests, so nothing caught it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ine (#9025)

Part B of #9025, slice 2: a simulated ad server inventory agent at
/inventory-adserver/mcp, serving the engine's adserver-2027 seed.

- get_products returns the seed's products with engine forecasts for the
  requested flight (filters.start_date/end_date, default 30 days),
  narrowed by filters.countries, delivery_type and channels.
- create_media_buy books each package into the caller's market:
  guaranteed packages take an impression goal (or what the budget buys),
  the takeover takes share of voice, auction packages bid above the
  floor. update_media_buy pauses, cancels and changes budget, goal, bid
  and end time. get_media_buys and get_media_buy_delivery read the
  bookings; delivery is released at each product's reporting lag.
- One market per caller and tenant, kept beside the caller's sandbox
  document in the session store and caught up to the caller's sandbox
  clock on every call.
- Mounted beside the other tenants but outside TENANT_IDS, so brand.json,
  adagents.json and the /mcp-strict routes are unchanged; not served on
  the 3.0 compat route. A failed inventory registration is logged and
  leaves the other tenants up.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… clock (#9025)

Review on #9042: a caller's sandbox clock is shared by every tenant, and
any tenant's reset_state unpins it (back to the wall clock). A market that
had already run days the clock now has not reached would keep its buys
but report no delivery, since every recorded day lies in the clock's
future. Such a market belongs to the discarded timeline, so openMarket
and advanceMarket now start it fresh, as they do for a changed seed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…#9025)

Part A of #9025, scoped to the inventory tenants: a comply_test_controller
scenario that reads and moves the caller's one sandbox clock.

  { "scenario": "sandbox_clock", "params": { "operation": "get" } }
  { "scenario": "sandbox_clock", "params": { "operation": "advance_time", "to": "2027-01-15T00:00:00Z" } }
  { "scenario": "sandbox_clock", "params": { "operation": "advance_time", "by": "P30D" } }

- It moves the same per-caller simulated_now that
  reporting_subscription_probe advance_time moves, so there is one clock.
  It only moves forward, refuses months and years in durations, and is
  listed in list_scenarios and compliance_testing.scenarios.
- Advancing catches up every inventory market the caller has (the
  engine's day steps for each day crossed) and runs the same
  post-advance hooks as the probe (runSandboxClockAdvanceHooks).
- reset_state on an inventory tenant unpins the clock, as the probe's
  reset does, and discards the caller's market on that tenant.
- The router answers sandbox_clock and list_scenarios for the inventory
  tenants, because the SDK's controller config has no slot for a scenario
  of our own; reset_state goes through the SDK.
- Tests only: setSandboxWallClockForTesting moves where an unpinned clock
  starts, so the seeds' scripted 2027 events stay reachable whenever the
  suite runs.

The existing probes and tenants are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ck (#9025)

Review on #9042 and #9038:

- reset_state on an inventory tenant unpins the caller's sandbox clock,
  which every tenant shares, so it now discards the caller's market on
  every inventory tenant, not only the one it was called on.
- sandbox_clock now advances only the market of the tenant it is called
  on, so its write stays under the router's lock for that tenant (which
  serializes a tenant's requests from transport through session flush).
  The caller's other markets run the same days on their next read, with
  the same results. The response reports days_crossed, the UTC days the
  clock moved across, instead of days_run.
- A test unpins the clock the way /sales reset_state does and shows the
  inventory market starting fresh rather than reporting nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ments (#9025)

Part B of #9025, slice 4: a simulated content platform inventory agent at
/inventory-content/mcp, serving the engine's content-2027 seed (a weekly
podcast, a weekly newsletter and a fortnightly creator series).

- Each product is an exclusive sponsorship of one collection. get_products
  carries the product's collections and the installments scheduled in the
  requested flight, with their status as known at the caller's sandbox
  time: scheduled, then published, postponed (with the new date) or
  cancelled once the date passes.
- A package buys every installment of its product scheduled in its flight,
  and serves until their audience has built up over the channel's curve
  (newsletter 3 days, podcast 30, video 42) plus a two-week allowance for
  postponement. A second sponsor of the same installments is refused as
  PRODUCT_UNAVAILABLE.
- The forecast counts each installment's expected audience; delivery
  counts what ran, so the seed's cancelled 2027-01-18 episode delivers
  nothing and its postponed 2027-01-18 video delivers from 2027-01-23.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… their own clock (#9025)

- reset_state on /inventory-content discards the caller's
  /inventory-adserver market too (the shared clock it unpins would leave
  that market on a discarded timeline).
- The postponed-installment test now moves the clock itself instead of
  relying on the clock an earlier test left behind (Ladon low on #9040).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#9025)

Slice 5 of #9025 part B: a non-normative page on connecting to
/inventory-adserver/mcp and /inventory-content/mcp, moving the clock with
sandbox_clock, what each simulated day does, and the season's scripted
events, with a month-long walkthrough. The page joins the nav with the
next 3.3-beta docs snapshot (tests/docs-nav-validation.test.cjs lists it
as awaiting one).

The post-deploy smoke now probes both tenants, so a production-only
registration failure fails the deploy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… walkthrough (#9025)

- sandbox_clock returns days_crossed; the tenant called runs the days at
  once, the other on the next call to it.
- reset_state on either inventory tenant discards the caller's buys on
  both; a market left on a timeline the clock no longer reaches starts
  fresh.
- The month walkthrough books two buys, as the tested flow does, so each
  one's daily_breakdown stays separate: five calls (Ladon low on #9041).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bokelley
bokelley force-pushed the inventory-sim/ci-full-stack branch from dee4a08 to 26757fb Compare November 15, 2026 19:39

@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: Escalate to human review

Escalate — gated path requires human/CODEOWNERS approval.

This PR modifies .github/workflows/deploy.yml, which is under a hard, non-overridable approval gate (.github/workflows/**), and review_decision is REVIEW_REQUIRED, not APPROVED. Per decision rule row 2, the outcome must be escalate until a human/CODEOWNERS approval is recorded — regardless of how clean the diff is.

Escalation reasons

  • .github/workflows/deploy.yml (modified) matches the gated-path glob .github/workflows/**, and review_decision is REVIEW_REQUIRED. Human/CODEOWNERS approval is required before merge.

Prior-finding resolution (credit to developer)
The prior Medium (server/src/training-agent/tenants/inventory.ts:67 — reset_state discarding only one tenant's market) is resolved: resetInventoryCaller now unpins the shared clock and loops all INVENTORY_TENANT_IDS via resetMarket, verified by a new cross-tenant reset test.

Current findings
None. The delta (platform.ts control flow, account isolation, per-principal market keying, SDK-delegated idempotency, and the test suite) surfaced no new Critical/High/Medium findings. No static/schemas/source/** changes, so no changeset is required.

The only remaining blocker is the deterministic gated-path gate, which only a human/CODEOWNERS approval can lift.

Why human review

  • .github/workflows/deploy.yml (modified) is under a hard approval gate (.github/workflows/**) and review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS approval required before merge.
  • This PR touches a path under a hard, non-overridable approval gate (.github/workflows/deploy.yml (modified) matches .github/workflows/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.

@bokelley

Copy link
Copy Markdown
Contributor Author

CI-only run is complete. All 61 checks passed on 26757fbb98, the tip of the #9025 stack after the review fixes, and all 25 storyboard jobs ran. Closing as planned; review the slices in #9037–#9041.

@bokelley bokelley closed this Nov 15, 2026
@bokelley
bokelley deleted the inventory-sim/ci-full-stack branch November 15, 2026 20:18
bokelley added a commit that referenced this pull request Nov 15, 2026
… clock (#9025)

Review on #9042: a caller's sandbox clock is shared by every tenant, and
any tenant's reset_state unpins it (back to the wall clock). A market that
had already run days the clock now has not reached would keep its buys
but report no delivery, since every recorded day lies in the clock's
future. Such a market belongs to the discarded timeline, so openMarket
and advanceMarket now start it fresh, as they do for a changed seed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bokelley added a commit that referenced this pull request Nov 15, 2026
…ine (#9025) (#9038)

* feat(training-agent): inventory-adserver tenant over the delivery engine (#9025)

Part B of #9025, slice 2: a simulated ad server inventory agent at
/inventory-adserver/mcp, serving the engine's adserver-2027 seed.

- get_products returns the seed's products with engine forecasts for the
  requested flight (filters.start_date/end_date, default 30 days),
  narrowed by filters.countries, delivery_type and channels.
- create_media_buy books each package into the caller's market:
  guaranteed packages take an impression goal (or what the budget buys),
  the takeover takes share of voice, auction packages bid above the
  floor. update_media_buy pauses, cancels and changes budget, goal, bid
  and end time. get_media_buys and get_media_buy_delivery read the
  bookings; delivery is released at each product's reporting lag.
- One market per caller and tenant, kept beside the caller's sandbox
  document in the session store and caught up to the caller's sandbox
  clock on every call.
- Mounted beside the other tenants but outside TENANT_IDS, so brand.json,
  adagents.json and the /mcp-strict routes are unchanged; not served on
  the 3.0 compat route. A failed inventory registration is logged and
  leaves the other tenants up.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(training-agent): discard an inventory market run past the sandbox clock (#9025)

Review on #9042: a caller's sandbox clock is shared by every tenant, and
any tenant's reset_state unpins it (back to the wall clock). A market that
had already run days the clock now has not reached would keep its buys
but report no delivery, since every recorded day lies in the clock's
future. Such a market belongs to the discarded timeline, so openMarket
and advanceMarket now start it fresh, as they do for a changed seed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
bokelley added a commit that referenced this pull request Nov 15, 2026
…ck (#9025)

Review on #9042 and #9038:

- reset_state on an inventory tenant unpins the caller's sandbox clock,
  which every tenant shares, so it now discards the caller's market on
  every inventory tenant, not only the one it was called on.
- sandbox_clock now advances only the market of the tenant it is called
  on, so its write stays under the router's lock for that tenant (which
  serializes a tenant's requests from transport through session flush).
  The caller's other markets run the same days on their next read, with
  the same results. The response reports days_crossed, the UTC days the
  clock moved across, instead of days_run.
- A test unpins the clock the way /sales reset_state does and shows the
  inventory market starting fresh rather than reporting nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bokelley added a commit that referenced this pull request Nov 15, 2026
…#9025) (#9039)

* feat(training-agent): sandbox_clock scenario on the inventory tenants (#9025)

Part A of #9025, scoped to the inventory tenants: a comply_test_controller
scenario that reads and moves the caller's one sandbox clock.

  { "scenario": "sandbox_clock", "params": { "operation": "get" } }
  { "scenario": "sandbox_clock", "params": { "operation": "advance_time", "to": "2027-01-15T00:00:00Z" } }
  { "scenario": "sandbox_clock", "params": { "operation": "advance_time", "by": "P30D" } }

- It moves the same per-caller simulated_now that
  reporting_subscription_probe advance_time moves, so there is one clock.
  It only moves forward, refuses months and years in durations, and is
  listed in list_scenarios and compliance_testing.scenarios.
- Advancing catches up every inventory market the caller has (the
  engine's day steps for each day crossed) and runs the same
  post-advance hooks as the probe (runSandboxClockAdvanceHooks).
- reset_state on an inventory tenant unpins the clock, as the probe's
  reset does, and discards the caller's market on that tenant.
- The router answers sandbox_clock and list_scenarios for the inventory
  tenants, because the SDK's controller config has no slot for a scenario
  of our own; reset_state goes through the SDK.
- Tests only: setSandboxWallClockForTesting moves where an unpinned clock
  starts, so the seeds' scripted 2027 events stay reachable whenever the
  suite runs.

The existing probes and tenants are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(training-agent): reset every inventory market with the shared clock (#9025)

Review on #9042 and #9038:

- reset_state on an inventory tenant unpins the caller's sandbox clock,
  which every tenant shares, so it now discards the caller's market on
  every inventory tenant, not only the one it was called on.
- sandbox_clock now advances only the market of the tenant it is called
  on, so its write stays under the router's lock for that tenant (which
  serializes a tenant's requests from transport through session flush).
  The caller's other markets run the same days on their next read, with
  the same results. The response reports days_crossed, the UTC days the
  clock moved across, instead of days_run.
- A test unpins the clock the way /sales reset_state does and shows the
  inventory market starting fresh rather than reporting nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ladon/needs-human-review Ladon has escalated this PR for human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant