Repository navigation
feat(training-agent): sandbox_clock scenario on the inventory tenants (#9025) - #9039
Conversation
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean training-agent change, no blocking or medium findings.
Scope: training-agent only (server/src/training-agent/**), no protocol surface (static/schemas/source/**, docs/reference/**, dist/**), so the omitted changeset is correct.
Checked: parseDuration rejects months/years and empty P/PT (P1M→INVALID_PARAMS test); forward-only guard and 10-year MAX_ADVANCE cap hold; principal plumbing consistent across sandbox_clock, create_media_buy (principalOf), and reset; save-then-reload reads updated simulated_now before advanceMarket; the minimal {mode:'open',principal} ctx is safe for the advance hook; unfiltered list_scenarios vs enum-filtered capabilities faithfully reproduces the established sales pattern (router.ts:306, 901-905) — intentional, not drift.
No gated paths, no high-risk flag, no author team gate, no prior decision. Rows 1–8 do not fire → row 9 approve.
60383cc to
a16afe0
Compare
6f6dd39 to
8c7e6bc
Compare
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean pass, no blocking or medium findings.
Checked: all 7 changed files live under server/src/training-agent/**, an in-memory training/compliance simulator. No protocol surface (static/schemas/source/**, docs/reference/**, dist/**) is touched, so no changeset is required. sandbox-clock.ts is forward-only (INVALID_TRANSITION on backward moves), bounded by MAX_ADVANCE_MS (10y), refuses month/year durations, and fails closed on account.sandbox === false. router.ts orders the inventory comply interceptor before the local one, resolves served version first, and wraps the mutating path in runWithSessionContext + flushDirtySessions. The subscription-probe refactor (runSandboxClockAdvanceHooks) is behavior-preserving.
No critical/high/medium findings. gated_paths is false and review_decision is APPROVED; high_risk is false; no no-auto-approve team match. Prior decision was also approve. Falls through to decision table row 9.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean pass, no blocking or medium findings.
Scope is confined to server/src/training-agent/** app/platform code (sandbox clock, inventory-sim platform, tenant router interceptor, subscription probe, account sandbox, and unit tests). No static/schemas/source/**, docs/reference/**, or dist/** surface is touched, so no changeset is required and none of the spec-coherence / changeset-scope / oneOf / immutable-artifact / 3.1.x-eligibility gates apply.
Checked:
sandbox-clock.ts:parseDurationrejects P/T-only and month/year durations;handleSandboxClockenforces forward-only and the 10-year cap before anynew Date(target).toISOString(), so the success path can't hit a RangeError.router.tsinterceptortryHandleInventoryComplyScenario: correctly gated to inventory tenants, leavesreset_stateto the SDK, wraps the handler in session context + flush.- Capabilities projection: inventory scenarios injected ahead of the served-version enum filter.
- Test coverage present for the new branches.
Gate check: no no-auto-approve team match; gated_paths false; review_decision APPROVED; high_risk false. Prior decision was also approve with no findings. No decision-table rows 1–8 fire → row 9 approve.
a16afe0 to
3846d7b
Compare
The base branch was changed.
…#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]>
8c7e6bc to
84be9e3
Compare
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean pass, no blocking or medium findings.
Checked all 7 changed files. The PR adds a sandbox_clock compliance scenario for inventory training tenants (get / forward-only advance_time via RFC 3339 to or ISO 8601 by), a test-only wall-clock seam in account-sandbox.ts, a shared runSandboxClockAdvanceHooks, and router interception. Validation is forward-only, caps advance at ~10 years, refuses month/year durations; market catch-up is per-caller/per-tenant keyed with timeline-staleness discard; hook refactor is behavior-preserving.
No protocol surface under static/schemas/source/**, docs/reference/**, dist/**, or changeset scope is touched — all changes are confined to server/src/training-agent/** and its unit test, so no changeset is owed and no schema↔docs coherence check applies.
Gate review: high_risk=false; gated_paths=false (so row 2 does not fire despite review_decision=REVIEW_REQUIRED); no no-auto-approve team match; no deletions in sensitive paths. Prior decision was approve with no findings — consistent. No critical/high/medium findings surfaced, so rows 1–8 do not fire; falls through to row 9.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — subsequent pass on PR #9039 (sandbox_clock scenario on inventory training tenants), clean.
Checked all 7 changed files (server/src/training-agent/** + unit test). sandbox-clock.ts duration parsing with fail-closed forward-only/10-year guards; router interception gates sandbox_clock on account.sandbox and runs in-memory under session context (no external I/O, so no timeout surface). No changes to static/schemas/source/, docs/reference/, dist/**, or release scripts — the published protocol surface is untouched, so no changeset is required and the no-changeset justification holds. No schema↔docs drift, no oneOf regression, no released-artifact mutation.
No critical/high/medium findings. Prior pass was also clean (approve) with no blockers to re-surface. Not gated (gated_paths: false), not high-risk, no no-auto-approve team match. Falls through to row 9.
Part A of #9025, slice 3 of 5. This PR adds the
sandbox_clockcontroller scenario, offered on the inventory tenants only, as agreed. It is stacked on #9038.{ "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" } }simulated_nowthatreporting_subscription_probeadvance_timemoves (account-sandbox.ts).INVALID_TRANSITION. Durations given in months or years are refused, because their length depends on the date.list_scenariosand incompliance_testing.scenarios.runSandboxClockAdvanceHooks(the probe now calls it too).reset_stateon an inventory tenant unpins the clock, the same way the probe's reset does, and discards the caller's market on that tenant.sandbox_clockandlist_scenariosfor the inventory tenants (the same wayseed_collectionis handled on/sales).reset_stategoes through the SDK'sresetState.setSandboxWallClockForTestingsets where an unpinned clock starts, so the seeds' scripted 2027 events stay reachable whenever the suite runs. FakingDateinstead makes the SDK re-validate the tenants and refuse traffic.Tests
P31D(days_run: 31). Checked:P1Mduration are refused;reset_stateunpins the clock and clears the caller's buys.comply-test-controller, preview version.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