Repository navigation
test(compliance): fail the build when a storyboard leaves a $context token unresolved - #8327
Merged
Merged
Conversation
…token unresolved The storyboard runner substitutes `$context.<key>` only when the key is in the run context. When it isn't, the step comes back skipped with `prerequisite_failed` and a failed `unresolved_substitution` validation — the storyboard can never pass, but it reports as a skip, which is also what legitimate capability gating produces. That is how #7797 shipped: the 3.0.x governance scenarios registered the governance agent with `url: "$context.governance_agent_url"` and never declared the key, so `sync_governance` could only ever skip. On the 3.0-compat tenants that step already skips on `missing_tool`, hiding the difference entirely, and the defect rode every released 3.0 bundle up to 3.0.26 until #7801 added the default. Adds `scripts/lint-storyboard-context-resolution.cjs`, which replays the real `injectContext()` in step order over every `sample_request` and reports any token with no writer. It runs as a hard gate in `npm run build:compliance` — `dist/**` is immutable, so the build is the last place a bad bundle can be stopped — and `npm run test:storyboard-context-resolution` re-checks the source tree plus every bundled release against a frozen table of the defects already frozen into released artifacts. The lint also rejects a `context_outputs` capture of `governance_agent_url` or the `*_agent_url` keys hosted grading seeds from server config: the seed is not a per-step guard, so a capture would let the agent under test redirect the governance agent it is told to trust. Fixes one live instance it found: `buyer_monitoring` polls delivery for a buy no step creates, so `$context.media_buy_id` had no writer. It now seeds the id from `fixtures.fixture_publisher.active_buy`. Closes #8317 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
Author
|
Follow-up for the out-of-scope item in the PR description (validation-value surface, two live storyboard defects): #8328. |
Contributor
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean PR, no blocking or medium findings.
Checked:
- Seeds
media_buy_id: "mb_monitoring_001"into buyer_monitoring's rootcontext:, aligning withfixtures.fixture_publisher.active_buy(index.yaml:65) and fixing the storyboard whereget_media_buy_delivery(index.yaml:113) could only ever skip withprerequisite_failed. - Adds a fail-closed
build:compliancegate vialint-storyboard-context-resolution.cjswith correct substitution-order semantics (request built before the step's own captures/convention keys). - 560 lines of tests pin the #7797 regression and frozen immutable-bundle defects.
- Changeset present (
patch), in-scope; no wire/schema drift, no immutability violations, no oneOf regressions.
No findings surfaced. high_risk false, gated_paths false, no author team gate, no prior decision. Falls through to row 9.
This was referenced Oct 19, 2026
bokelley
added a commit
that referenced
this pull request
Oct 22, 2026
… comparand fixes to 3.2.x (#8327, #8334) (#8411) * test(compliance): fail the build when a storyboard leaves a $context token unresolved (#8327) The storyboard runner substitutes `$context.<key>` only when the key is in the run context. When it isn't, the step comes back skipped with `prerequisite_failed` and a failed `unresolved_substitution` validation — the storyboard can never pass, but it reports as a skip, which is also what legitimate capability gating produces. That is how #7797 shipped: the 3.0.x governance scenarios registered the governance agent with `url: "$context.governance_agent_url"` and never declared the key, so `sync_governance` could only ever skip. On the 3.0-compat tenants that step already skips on `missing_tool`, hiding the difference entirely, and the defect rode every released 3.0 bundle up to 3.0.26 until #7801 added the default. Adds `scripts/lint-storyboard-context-resolution.cjs`, which replays the real `injectContext()` in step order over every `sample_request` and reports any token with no writer. It runs as a hard gate in `npm run build:compliance` — `dist/**` is immutable, so the build is the last place a bad bundle can be stopped — and `npm run test:storyboard-context-resolution` re-checks the source tree plus every bundled release against a frozen table of the defects already frozen into released artifacts. The lint also rejects a `context_outputs` capture of `governance_agent_url` or the `*_agent_url` keys hosted grading seeds from server config: the seed is not a per-step guard, so a capture would let the agent under test redirect the governance agent it is told to trust. Fixes one live instance it found: `buyer_monitoring` polls delivery for a buy no step creates, so `$context.media_buy_id` had no writer. It now seeds the id from `fixtures.fixture_publisher.active_buy`. Closes #8317 Co-authored-by: Claude Opus 5 (1M context) <[email protected]> (cherry picked from commit 8c262e3) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(compliance): resolve $context comparands in storyboard assertions (#8334) The storyboard runner substitutes `validations[].value` and `validations[].allowed_values[]` and resolves `validations[].context_key` against the context as it stood *before* the step, and substitutes a webhook step's `filter` the same way. A step's own `context_outputs` land after its validations run, so a step cannot assert against a key it captures itself — and unlike `sample_request`, nothing guards this surface. An unresolved `value` silently becomes the comparand, an absent `context_key` makes the check *pass* with a `context_key_absent` observation, and a token left in a `filter` yields a selector no delivery can match. Two storyboards read a key their own step captures, so the assertion graded something other than what it claimed: - `geo_place_targeting` asserted "current_version is included in supported_versions" against `$context.place_system_version`, captured by the same `get_adcp_capabilities` step. The check compared the seller's `supported_versions` against the literal token, so the capability step could not pass for any seller and the scenario could never go green. It now captures `supported_versions` too and settles the `geo-place-catalog-capability.json` `x-adcp-validation.member_of` invariant on a second, stateless capabilities read — directly, at capability scope, before any product or buy state exists to make it conditional. - `vendor_metric_accountability` asserted the day-1 `committed_at` equals `confirmed_at` against `$context.confirmed_at`, captured by the same `create_media_buy` step, so no seller could satisfy it. Every day-1 `committed_at` on both packages is now captured on create and settled on a `get_media_buys` read-back that pins the buy under test — "each such entry's `committed_at` MUST equal `confirmed_at`", not just the first entry. Both scenarios are capability-gated out of the training-agent matrix (it declares neither `media_buy.features.committed_metrics_supported` nor GeoNames NL), so no floor moves; the grading impact lands on third-party sellers graded against a 3.2 bundle, all 14 of which are registered in static/compliance/published-versions.json. `scripts/lint-storyboard-context-resolution.cjs` gains a `context_assertion_unresolved` rule over all four comparand surfaces, using the before-own-capture ordering the request rule already uses, so `npm run build:compliance` rejects the class. Released bundles are immutable, so 3.2.0-beta.6 through 3.2.5 keep both defects under the frozen table in tests/lint-storyboard-context-resolution.test.cjs. Closes #8328 Co-authored-by: Claude Opus 5 (1M context) <[email protected]> (cherry picked from commit 4fe0876) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * test(compliance): adapt the context-resolution lint backport to 3.2.x The #8327 test reads server/src/compliance/hosted-multi-agent-routing.ts and the 3.0.27/3.0.28 bundles, none of which exist on 3.2.x: hosted grading of governance-aware sellers (#7808) is 3.3-only, and the fixed 3.0 bundles are registered on main. - Pin RUNNER_PINNED_CONTEXT_KEYS against GOVERNED_AGENT_CONTEXT_KEYS in server/src/compliance/storyboard-runner-options.ts (plus governance_agent_url, which main's hosted grader pins for every 3.2 bundle). - Drop the "published 3.0 bundles from 3.0.27 on are clean" test and the 3.0.27 side of the #7797 bracket; 3.0.26 still reproduces the defect. - Reword the #8327 changeset's pinned-key sentence for this line. The lint script itself is byte-identical to main. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
TekWorx
pushed a commit
to TekWorx/adcp
that referenced
this pull request
Oct 24, 2026
Merge the published v3.2.6 maintenance release (tag v3.2.6, 3523bdc, the adcontextprotocol#8274 Version Packages merge on 3.2.x) into main as a record-only merge, following adcontextprotocol#8278 for 3.2.5. The merge keeps main's tree (ours strategy) and adds only the 3.2.6 release records: - dist/schemas/3.2.6/, dist/compliance/3.2.6/ and the signed dist/protocol/3.2.6.tgz{,.crt,.sha256,.sig} tuple, byte-identical to the tag. - CHANGELOG.md: the 3.2.6 block, verbatim from the tag, inserted below main's 3.3.0-beta.0 section. (The workflow's take-3.2.x rule would have dropped that section.) - static/compliance/published-versions.json: register 3.2.6, matching the 3.2.x manifest. - dist/schemas/index.json and latest.json: regenerated by build:schemas; latest_stable, v3 and v3.2 now 3.2.6. main's 3.3.0-beta.0 entry and v3.0 (3.0.28) are kept; taking 3.2.x's copy would have regressed both. The 3.2.5..3.2.6 source changes are all backports of work already on main in its main form (adcontextprotocol#8335, adcontextprotocol#8402, adcontextprotocol#8218, adcontextprotocol#8216, adcontextprotocol#8341/adcontextprotocol#8387, adcontextprotocol#8327/adcontextprotocol#8334, adcontextprotocol#8260, adcontextprotocol#8261, adcontextprotocol#8263, adcontextprotocol#8244), so no 3.2.x source is taken. The second parent records that reconciliation so the next 3.2.x forward merge does not re-conflict on it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8317
Problem
Nothing in CI exercised
sync_governancein the 3.0 media-buy governance storyboards, so a regression of thegovernance_agent_urlcontext binding fixed in #7797 / #7801 would go unnoticed. The training agent hidessync_governanceon every 3.0-compat tenant except/signals(server/src/training-agent/tenants/tool-catalog.ts), so in the storyboard matrix those steps skip onmissing_toolboth before and after the fix.The underlying defect class is quiet by construction.
injectContext()substitutes a whole-string$context.<key>only when the key is in the run context. When it isn't, the runner refuses to send the request: the step comes backskippedwithskip_reason: prerequisite_failedand a failedunresolved_substitutionvalidation. The storyboard can never pass — but it reports as a skip, which is also what legitimate capability gating produces. On 3.0-compat the same step already skips onmissing_tool, which hides the difference entirely.What this adds
scripts/lint-storyboard-context-resolution.cjs— replays the runner's realinjectContext()in step order over everysample_request. A key is resolvable when the rootcontext:block declares it, when an earlier step captures it viacontext_outputs, or when an earlier step ran a task whose SDK convention extractor writes it. Anything left over is a violation.Two gates:
npm run build:complianceruns it as a hard failure, alongside the other 20 storyboard lints.dist/**release artifacts are immutable, so the build is the last place a bad bundle can be stopped — fix(compliance): populate governance_agent_url in 3.0 governance storyboards #7801 had to ship a whole new patch because 3.0.25 could not be repaired.npm run test:storyboard-context-resolution(wired intonpm test) re-checks the source tree and every bundled release, against a frozen, exact table of the defects already baked into released artifacts.The lint is deliberately stricter than the runtime guard in three places, all documented in the header:
expect_errorsteps (the runner exempts them, so they really do put the literal on the wire), the discovery-account enricher (which drops an unresolvedaccountbefore the guard sees it), and inheritedObjectmembers —$context.constructorresolves at runtime to a Function thatJSON.stringifythen drops, a silently-wrong request with no literal left for the guard to find. The simulated context isObject.create(null)so those are reported.It also adds a second rule,
pinned_context_key_captured: acontext_outputsentry may not writegovernance_agent_urlor the four*_agent_urlkeys that hosted grading seeds from server config. That seed is not a per-step guard — the runner overwrites context on every capture, andhostedMultiAgentRoutingForStoryboardonly compares the authoredsync_governanceURL against the literal"$context.governance_agent_url"— so a capture would let the agent under test redirect the governance agent it is told to trust, with the per-run seller credential stapled on regardless. Not reachable today; the rule keeps it that way.Proving it
3.0.26 leaves $context.governance_agent_url in sync_governance and 3.0.27 resolves itchecks all five storyboards named in the issue (media_buy_seller/governance_{approved,conditions,denied,denied_recovery},brand_rights/governance_denied) on the broken side and asserts 3.0.27 is clean.governance_agent_urlline fromgovernance_approved.yamlfails both the source-tree test andnpm run build:compliance(verified locally, exit 1).(task, key)pair is probed through the SDK's ownextractContext, so a waiver cannot outlive the extractor that justifies it. The pinned-key set is checked for equality againstHOSTED_GOVERNED_AGENT_CONTEXT_KEYSparsed out of the routing module.One live defect it found, fixed here
buyer_monitoringpolls delivery for the buy declared infixtures.fixture_publisher.active_buy, but no step in the storyboard creates one, so$context.media_buy_idhad no writer and both delivery reads could only ever skip. The rootcontext:block now seeds it from the same fixture id. That is astatic/compliance/sourcechange, hence thepatchchangeset.Scope decisions a maintainer should know
dist/**is immutable, and an agent that advertises or pins an exact3.0.x≤ 3.0.26 still gets the broken bundle. The frozen table records that, asserts those bundles carry exactly the 3.0.x media-buy governance storyboards: $context.governance_agent_url is never populated, so sync_governance is skipped for every 3.0 agent #7797 defect and nothing else, and fails if any bundle outside the table is dirty — so the next release cannot reintroduce it. The hosted3.0alias floor (≥ 3.0.27) stays enforced byserver/tests/unit/hosted-compliance-3-0-27.test.ts; a second test asserts every published 3.0 bundle from 3.0.27 on is clean.buyer_monitoringdefect, for the same immutability reason. They are the second row of the frozen table; the source fix reaches a bundle with the next 3.2 cut.validations[].value/allowed_valuesare out of scope. The runner substitutes those too (against the pre-step context) and, unlike requests, does not guard them. Two live instances read a key their own step captures, so they compare against the literal token:geo_place_targeting.yaml:177(place_system_version) andvendor_metric_accountability.yaml:266(confirmed_at). Fixing those changes grading behaviour for storyboards already in the matrix floors, so they belong in their own change — filed separately.tool-catalog.tsandsales.tsare untouched, so the 3.0-compat tenants keep hidingsync_governanceexactly as before.Validation
npm run test:storyboard-context-resolution(17 tests),npm run build:compliance,npm run test:compliance-snippets,npm run test:test-coverage,npm run test:owned-links, docs-nav,lint:schema-links,npm run typecheck, and the fullnpm run precommitall pass locally, as do the sibling storyboard lints. The changeset gates (check-changeset-protocol-scope.cjs,changesets status) pass with thepatchchangeset.Pushed with
ADCP_SKIP_STORYBOARD_MATRIX=1— the documented skip. The local matrix had run for ~35 minutes without finishing one tenant on this sandbox, and two unrelated worker-spawning suites (addie/matched-v4-evaluation,addie/matched-pair-ni/exact-inference) were flaking under the contention; both pass in isolation, and the fullprecommitpassed on the committed tree.training-agent-storyboards.ymlis the authoritative gate, and nothing here touches a tenant or a storyboard the matrix grades (buyer_monitoringis buyer-track and has no matrix tenant).🤖 Generated with Claude Code
Open workspace in Conductor