Repository navigation
fix(compliance): resolve $context comparands in storyboard assertions - #8334
Merged
Merged
Conversation
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]>
Contributor
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean fix for #8328 with no blocking or medium findings.
What I checked:
- Both storyboard assertions (
geo_place_targeting1.0.0→1.0.1,vendor_metric_accountability1.0.1→1.0.2) previously compared against a$contexttoken the same step captured, leaving the comparand literal and unpassable. Fix resolves comparands against prior captures/transitivity correctly; account and media_buy_id pinning guards against decoy-rebind. - New
context_assertion_unresolvedlint rule mirrors the runner's four comparand surfaces (value/allowed_values/context_key/webhook filter) before own-capture; suffix/location handling verified against existing tests. - Changeset present and
patch— no wire-schema change, so changeset-scope and oneOf-discriminator gates are not implicated. - Released-artifact immutability respected: bundles 3.2.0-beta.6…3.2.5 quarantined via the frozen table rather than edited; FROZEN_DEFECT→FROZEN_DEFECTS refactor is sound (deduped+sorted).
- No I/O/worker/async/schema surface touched. Not a breaking-class protocol change.
Gate checks: gated_paths is false (review_decision REVIEW_REQUIRED does not block a non-gated clean diff). high_risk false. No no-auto-approve team match. No critical/high/medium findings → falls through to row 9 (approve).
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 #8328
The defect class
The storyboard runner substitutes
validations[].valueandvalidations[].allowed_values[], and resolvesvalidations[].context_key,against the context as it stood before the step — and substitutes a webhook
step's
filterthe same way. A step's owncontext_outputsare applied ~200lines later in
executeStep. Unlikesample_request, nothing guards thissurface, so a step that asserts against a key it captures itself does not fail
loudly; it quietly stops testing what it says it tests.
I confirmed all three failure modes against the installed SDK (these are now
pinned by tests, not asserted from reading):
value/allowed_values[]"$context.<key>"becomes the comparand — an ordinary comparison failure, nothing names the tokencontext_keyresolveContextComparandreturnsfound: falseand the check passes with acontext_key_absentobservationfilterbuildFilterkeeps the token, so the selector matches nothing:expect_webhooktimes out,expect_no_webhookpasses without observing anythingThe two live instances, and the grading impact
geo_place_targeting/get_place_capabilitiesasserted "current_versionis included in supported_versions" with
value: "$context.place_system_version"— captured by that same step. So the check compared the seller's
supported_versionsarray against the literal string. No seller could everpass that step, so the whole scenario could never go green for any seller
declaring GeoNames NL/city support. That assertion is the only enforcement
anywhere in the repo of
geo-place-catalog-capability.json'sx-adcp-validation.member_of("conformance tooling MUST verify current_versionis present in supported_versions") — so in practice the invariant has been
unenforced and the scenario unpassable at the same time.
vendor_metric_accountability/create_media_buyasserted the day-1committed_atequalsconfirmed_atwithvalue: "$context.confirmed_at",captured by the same step — so no seller could satisfy "day-1 commitment time
equals the media buy
confirmed_at" either.Hosted grades: both defects are in every 3.2 bundle from
3.2.0-beta.6through
3.2.5, and all 14 are registered instatic/compliance/published-versions.json, so any seller graded on a 3.2bundle that declares the gating capability has been failing a step it could not
pass. Both failures are unearned failures, not unearned passes.
Matrix floors do not move. The training agent declares neither
media_buy.features.committed_metrics_supportednor GeoNames support, so bothscenarios gate out with
capability_unsupportedbefore and after this change(verified by running each with
--filteragainst the local/salestenant:0P / 1Sboth times). That is also why neither defect was ever caught — thesetwo scenarios have no executed coverage in CI at all.
The fixes
geo — the step now also captures
supported_versions, and a second,stateless
get_adcp_capabilitiesstep (confirm_place_catalog_membership)settles
member_ofdirectly, at capability scope:current_version == $context.place_system_version(catalog stable across therun, which the rest of the scenario depends on) plus
field_in_context_arrayof
current_versionin the capturedsupported_versions. I first routed thisthrough the
get_media_buysread-back; review pushed back that it made acapability-document invariant conditional on the whole buy flow and on a tool
the seller might not advertise, so it is unconditional now.
vendor — every day-1
committed_aton both packages is captured oncreate, and a new
get_media_buysread-back (read_back_commitment_timestamps)settles the equality against the persisted
confirmed_at, which is normativelystable once set. Composition:
persisted confirmed_at == create.confirmed_atAND
persisted confirmed_at == each day-1 committed_at⇒ the normative rule.The read-back pins
media_buys[0].media_buy_idso a decoy buy at index 0 cannotsatisfy the timestamps (and
get_media_buys' convention extractor rebinds$context.media_buy_idfor the delivery audit that follows, so this matters).This also upgrades the original check, which only covered the first entry of
package 0 — the spec says "each such entry".
Both fixes exist because the SDK has no same-response field-to-field comparison
primitive;
create_media_buyis the only response carrying bothconfirmed_atand
committed_metrics[].committed_at, andget_media_buys'PackageStatusdoes not declare
committed_metrics.The gate
scripts/lint-storyboard-context-resolution.cjs(from #8327) gainscontext_assertion_unresolvedover all four comparand surfaces, using the samebefore-own-capture ordering the request rule already uses. It runs as a hard
gate in
npm run build:compliance.dist/**is immutable, so the 14 defective3.2 bundles are quarantined in the frozen, exact table in
tests/lint-storyboard-context-resolution.test.cjs— a bundle outside the tablemust be clean, and a bundle in it must still carry exactly the listed defects.
context_keyis in scope even though it is a bare key rather than a token: itreads the same pre-step context and is the fail-open member of the family. No
storyboard in the tree uses
context_key,allowed_valuesorfilterthat waytoday, so covering them costs nothing and closes the surface.
Security review verified the companion case the issue flagged: dropping the root
context:block fromgovernance_agent_binding_acceptance.yamlnow producesthree
context_assertion_unresolvedfindings on exactly the"seller persisted the accepted governance binding" checks, so the
unseed-regression-makes-an-echoing-seller-compliant shape is gated.
Proof
Three tests fail if the storyboard fix is reverted: the source-tree guard plus
the two behavioural tests that run the real SDK
runValidationsover theauthored validations and check a conformant seller passes and a violating one
fails.
Known limits (stated, not hidden)
get_media_buysskips the vendor read-back,and the runner grades a skip as a pass, so the equality goes ungraded for that
seller. That is the runner's skip-is-not-a-failure model, not something this
assertion can close —
required_toolsis an any-of gate, so listing the toolthere would widen selection, not tighten it. Before this PR the check was
fail-closed only in the sense that nobody could pass it.
===across two tasks, so aseller that re-serializes
confirmed_atdifferently onget_media_buyswouldfail.
confirmed_atis normatively stable once populated, so I took that asacceptable; flagging it because the first seller it bit would be surprised.
agent), so the new steps are covered by unit tests over the real SDK
validators, not by an end-to-end run.
x-adcp-validationevaluator (hanging offresponse_schema, or inthe fix(compliance): public conformance verifier and served fixtures for provenance truth-of-claim #8218 conformance verifier) would retire the geo storyboard workaround and
cover the other
member_ofsites at once — worth a follow-up, out of scope here.Checks run locally
npm run precommit(full server unit suite + typecheck, exit 0), all 18storyboard lint suites,
npm run build:compliance,node scripts/check-changeset-protocol-scope.cjs origin/main, changesets status.Pushed with
ADCP_SKIP_STORYBOARD_MATRIX=1(documented skip) because thepre-push matrix overruns on this sandbox; it is running separately and the
training-agent-storyboards.ymlworkflow is the authoritative gate.Reviewed before opening by the code-reviewer, security-reviewer and
ad-tech-protocol-expert agents; every finding is either fixed above or answered
under "Known limits".
🤖 Generated with Claude Code
Open workspace in Conductor