Repository navigation
feat(training-agent): inventory-content tenant with scheduled installments (#9025) - #9040
Conversation
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — app-only training-agent PR adding the /inventory-content tenant (podcast/newsletter/creator sponsorships over installments).
What I checked:
- Scope: touches only
server/src/training-agent/**and its test. Nostatic/schemas/source/**,docs/reference/**, ordist/**changes, so no changeset is required and no schema↔docs coherence, oneOf, or artifact-immutability concerns apply. - Reviewer verified
installmentsInday-window bounds match the engine'sflightDays, theknown.get(...)!non-null is safe (filtered set is always a subset), the zeroed-forecast branch drops only non-surfaced fields, and the 14-day postponement allowance covers current seeds. - Deterministic in-memory engine, no external I/O — timeout/retry checks N/A.
No blocking findings. Two Low follow-ups noted (order-coupled tests that fail loud if reordered; 14-day allowance truncating any future >14-day postponement seed) — non-blocking.
Gate checks: no no-auto-approve team match; gated_paths false; high_risk false; no prior decision; zero findings. Rows 1–8 do not fire → row 9 approve.
9dbb6ad to
b12525b
Compare
6f6dd39 to
8c7e6bc
Compare
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean pass on training-agent inventory-simulator code.
Checked:
- No findings from the reviewer (no critical/high/medium).
- Diff (4 files, +157/-10) is entirely training-agent inventory-simulator code: the new
/inventory-contenttenant for installment (podcast/newsletter/creator) sponsorships plus its unit tests. - No protocol surface touched (no
static/schemas/source/**,docs/reference/**,dist/**, orpackage.json), so no changeset, wire-shape, oneOf, or immutability concerns apply. - Verified non-null lookups in
platform.tswireInstallments are sound, theaudienceEndMs Math.max(...)is guarded against empty arrays, and new behavior is covered by sell/cancel/delivery-build, cross-tenant reset_state, and postponed-installment tests.
Decision table: no critical/high (row 1 n/a); gated_paths false (row 2 n/a); high_risk false (rows 3/5 n/a); no medium findings (rows 4/8 n/a); no no-auto-approve team match (row 7 n/a); prior decision was approve (row 6 n/a). Falls through to row 9 → approve.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean pass on training-agent inventory-sim code.
The 284-line delta across 4 files is entirely training-agent inventory-sim code (platform.ts installment/sponsorship wiring, two tenant registration files, and a unit test). No protocol schema, docs/reference, dist artifacts, or changeset surface is touched, so no spec-drift, changeset-scope, oneOf-discriminator, or artifact-immutability concerns apply.
Reviewer verified: known.get(id)! assertions in wireInstallments are provably safe (statuses sourced from the full productInstallments set), the empty-installments branch zeroes every metric toAdcpForecast reads, installmentsIn's ceil-based exclusive end bound is correct, and the flight_end→audienceEndMs extension matches the tests. Registration files mirror existing inventory-adserver entries.
No Critical/High/Medium findings. high_risk=false, gated_paths=false (and review_decision=APPROVED regardless), no no-auto-approve team match. Prior decision was also approve with no findings. Rows 1–8 do not fire → row 9 approve.
8c7e6bc to
84be9e3
Compare
The base branch was changed.
…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]>
b12525b to
2482a2d
Compare
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — adds the /inventory-content training tenant (sponsorship sales over scheduled collection installments) plus platform wiring. 4 files, 157 net lines.
Checks performed:
platform.tswireInstallments(L53) non-null assertion is safe:installmentStatusesmaps the sameproductInstallmentslist thatinstallmentsInfilters, so every installment is present.audienceEndMsMath.max(...ends)(L46) never runs on empty — empty installments route to the zeroed-forecast branch (L84) and the booking path throws first (L121). Fail-closed.POSTPONEMENT_ALLOWANCE_DAYS = 14is a documented sim approximation, not a contract.- No
static/schemas/source/**,dist/**, docs/reference, or oneOf surface touched — training-agent is app/operational, so no changeset required. - Deterministic sim internals, no external I/O/workers/queues.
- Tests cover sell/cancel/postpone/delivery-build and cross-tenant reset_state isolation.
No critical/high/medium findings. gated_paths false; no high-risk flag; no no-auto-approve team match. Although review_decision is REVIEW_REQUIRED, row 2 only applies when gated_paths is true (it is false here), so the PR falls through to row 9. Consistent with the prior approve on this PR.
The post-deploy smoke now probes /inventory-adserver/mcp and /inventory-content/mcp, the two simulated inventory tenants merged in #9038 and #9040. An inventory tenant that fails to register is logged and left down without affecting the others, so without this probe a production-only registration failure would go unnoticed; with it, the deploy fails like any other tenant's. Split out of #9041 so the docs can land without the .github/workflows review gate. Co-authored-by: Claude Opus 5.5 <[email protected]>
Part B of #9025, slice 4 of 5. This PR adds a simulated content platform inventory agent at
/inventory-content/mcp, serving the engine'scontent-2027seed: a weekly podcast, a weekly newsletter and a fortnightly creator series. It is stacked on #9039.get_productscarries the product'scollections, and theinstallmentsscheduled in the requested flight. Each installment's status is as known at the caller's sandbox time:scheduled, thenpublished,postponed(with the newscheduled_at) orcancelledonce its date passes.collection_selectionpicks collections, not single episodes.PRODUCT_UNAVAILABLE.Tests
scheduledbefore 2027-01-18 andcancelledafter;maker_studio_006reportsscheduled_at2027-01-23.Checks run locally
npx tsc --project server/tsconfig.json --noEmit: clean.tests/lint-format-identity-boundaries.test.cjs: passes.server/tests/unit/inventory-sim-engine.test.tsandserver/tests/unit/training-agent-inventory-tenants.test.ts(run from the repo root): pass.Committed and pushed with
HUSKY=0, which @bokelley approved for this series. Under host load of 40 to 80, the pre-commit server unit suite timed out in unrelated suites (addie/matched-pair-ni/exact-inference). A local storyboard matrix run against the stack's tip was stopped after 66 minutes, by which point/signalshad passed (57 clean against a floor of 45). CI's storyboard job is the check that existing storyboards still pass.No changeset: this touches only the training agent and docs, not the protocol surface.
Refs #9025, #8993
🤖 Generated with Claude Code