Repository navigation
fix(training-agent): list only the served release's compliance scenarios - #8258
Conversation
An explicit `adcp_version: "3.0"` get_adcp_capabilities call on the main /sales/mcp route listed 16 scenarios that 3.0 does not have, for example force_create_media_buy_arm, seed_product and compact_product_lifecycle_probe. The 3.0 capabilities schema closes compliance_testing.scenarios to six values, so the response failed the 3.0 schema. The tenant router's capabilities projection gated the sales list on reliable reporting and the account change feed only. Only the frozen 3.0 storyboard facade (storyboardCompat) used the legacy list. The allowed set now comes from the served release's own get_adcp_capabilities response schema. Releases with a closed enum (3.0) are filtered to it; 3.1 and 3.2 accept any scenario name and keep every scenario. It applies: - as a final gate in projectTenantCapabilities, for every tenant route, whichever projection or SDK derivation contributed the scenarios; - to the sales capability list, replacing the storyboardCompat special case; - to the v5 handler (/mcp and /mcp-strict*), replacing its hard-coded six-scenario 3.0 list. The output is identical. comply_test_controller list_scenarios is unchanged. Tests: every tenant route's 3.0 response validates against the canonical 3.0 schema (fails on main for sales), 3.2 still lists every sales scenario, and helper unit tests cover the 3.0 enum and the open 3.1/3.2 lists. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean schema-driven fix with no blocking or medium findings.
This PR replaces two hand-maintained 3.0 compliance-scenario lists with a schema-driven filter (complianceScenariosForServedVersion) that reads the served release's own get_adcp_capabilities enum, closing the drift where /sales/mcp advertised 20 scenarios to explicit 3.0 callers against a 6-value closed enum. Behavior preservation was verified at all three sites (sales 3.0 → legacy four in order; v5 → identical six in order; new projectTenantCapabilities gate at function top-level covers every tenant). Error case left uncached to allow retry; open releases cached as null and unchanged.
Scope is server-only under training-agent/ with no protocol surface touched (no static/schemas/source/**, docs, or dist artifacts), so no changeset is correctly required. Tests validate each tenant's explicit-3.0 response against the canonical 3.0 schema.
Gate checks: no critical/high findings; gated_paths false; high_risk false; no no-auto-approve team match; no medium findings. review_decision is REVIEW_REQUIRED, but with gated_paths false and no blocking findings, none of rows 1–8 fire. Falls through to row 9 → approve.
Summary
With an explicit
adcp_version: "3.0",get_adcp_capabilitieson/sales/mcplisted 20compliance_testing.scenarios. Sixteen of them are not in 3.0, for exampleforce_create_media_buy_arm,seed_productandcompact_product_lifecycle_probe. The 3.0 schema closes that enum to six values, so the response failed the 3.0 schema.Root cause: the tenant router's
projectTenantCapabilitiesmergedsalesComplyScenarios(servedVersion)into the list. That function gates on reliable reporting and the account change feed, not on the 3.0 enum. Only the frozen 3.0 storyboard facade (storyboardCompat) used the legacy list.Fix
New
server/src/training-agent/compliance-scenarios.tsreads the allowed set from the served release's ownget_adcp_capabilitiesresponse schema, viagetToolResponseSchemafrom@adcp/sdk/schemas. When that schema has a closed enum (3.0), the list is filtered to it. 3.1 and 3.2 accept any scenario name, so their lists are unchanged. If a release's bundle cannot be loaded, the list is also left unchanged.The filter is applied in three places:
projectTenantCapabilities, for every tenant route. It applies no matter which projection or SDK derivation contributed the scenarios. If the filtered list is empty, the block is dropped; that does not happen on any current tenant.storyboardCompatspecial case, with the same output.handleGetAdcpCapabilities(/mcp,/mcp-strict*). It replaces the hard-coded six-scenario 3.0 list, with identical output and order.comply_test_controllerlist_scenariosis not filtered.Other tenants
I probed every tenant's
/mcpand/mcp-strictroute at 3.0, 3.1 and 3.2 before the fix:sales/mcpat 3.0 had scenarios outside the 3.0 enum.get_adcp_capabilitiesschema.sales/mcplists 4 scenarios at 3.0, and still lists 20 at 3.1 and 25 at 3.2.Tests
tenant-smoke.test.ts: each tenant route's explicit-3.0 response validates against the canonical 3.0 schema. The sales 3.0 list equals the legacy four, and 3.2 still lists every sales scenario, including the post-3.0 ones. It fails on main forsales(/compliance_testing/scenarios/4 must be equal to one of the allowed values).server/tests/unit/training-agent-compliance-scenarios.test.ts: the closed 3.0 set is read from the schema, a filtered list validates and an unfiltered one does not, 3.1 and 3.2 keep every scenario, and an unknown release is left unchanged.Verification
npm run typecheck: passnpm run test:unit: pass (75 files)npm run test:server-unit -- --shard=N/3: 1/3 4614 passed; 2/3 3314 passed, 31 skipped; 3/3 4688 passedserver/tests/integration/training-agent-3-0-compat-tools.test.ts: 8 passed🤖 Generated with Claude Code