Repository navigation
fix(compliance): backport the storyboard $context resolution lint and comparand fixes to 3.2.x (#8327, #8334) - #8411
Merged
Conversation
…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]>
…#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]>
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]>
Contributor
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean compliance-tooling PR with no blocking or medium findings.
Checked:
- Two genuine assertion fixes:
geo_place_targeting(field_contains previously comparedsupported_versions[*]to the literal"$context.place_system_version"— always failed) andvendor_metric_accountability(committed_atvs literal"$context.confirmed_at"). Both now resolve against captured comparands via a later stateless read. buyer_monitoringseedsmedia_buy_id: "mb_monitoring_001"matchingfixtures.fixture_publisher.active_buy.media_buy_id.- New
scripts/lint-storyboard-context-resolution.cjsfaithfully mirrors the runner (collects assertion reads + sample_request injection before folding step captures), correctly enforcing "a step cannot assert against a key it captures itself"; fail-open-aware oncontext_key. - Test ratchets immutable
dist/**bundles with exact set-equality both directions. - Changesets are
patchand in-scope forstatic/compliance/source/**. No schema touched (no drift), no oneOf change, no dist/** mutation. Non-breaking.
Decision path: no critical/high/medium findings; gated_paths false; high_risk false; no author team gate. Falls through to row 9 → approve.
This was referenced Oct 23, 2026
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.
Summary
Backport of #8327 (main
8c262e3b6, closes #8317) and #8334 (main4fe087610, closes #8328) to3.2.x, so the 3.2.6 cut ships a clean bundle.Without these, main's
tests/lint-storyboard-context-resolution.test.cjsfails on the 3.2.6 forward merge. That test requires every bundled release outside its frozen defects table to be clean. Main's lint run against current 3.2.x source finds 4 problems:buyer_monitoring:get_media_buy_deliveryreads$context.media_buy_id, which nothing writes (No CI coverage for sync_governance context binding in 3.0 governance storyboards #8317).geo_place_targeting: theget_adcp_capabilitiesassertion compares against$context.place_system_version, which the same step captures (Unresolved $context tokens in storyboard validation values can make assertions pass vacuously #8328).vendor_metric_accountability: thecreate_media_buyassertion compares against$context.confirmed_at, which the same step captures (Unresolved $context tokens in storyboard validation values can make assertions pass vacuously #8328).What comes over:
scripts/lint-storyboard-context-resolution.cjs(byte-identical to main), wired as a hard gate innpm run build:complianceand asnpm run test:storyboard-context-resolutioninnpm test.buyer_monitoringseed ofmedia_buy_idfromfixtures.fixture_publisher.active_buy.geo_place_targetingandvendor_metric_accountabilityassertions moved to read-back steps where the comparand is already in context.storyboard-authoring.mdguidance.patch).Each cherry-pick is its own commit (
-x). The third commit holds the 3.2.x adaptations.Adaptations for 3.2.x
package.jsonconflict. Thetestchain differs on 3.2.x, so the cherry-pick conflicted there. I kept 3.2.x's chain and made only test(compliance): fail the build when a storyboard leaves a $context token unresolved #8327's two edits: the newtest:storyboard-context-resolutionscript, and its slot intestright aftertest:storyboard-context-output-paths. Everything else inpackage.jsonis 3.2.x's.Test: the pinned-key guard. On main, this test parses
server/src/compliance/hosted-multi-agent-routing.ts. That file comes from hosted grading of governance-aware sellers (feat(compliance): hosted grading of governance-aware sellers #7808), which is 3.3-only, so it doesn't exist on 3.2.x. On this line the guard instead checksRUNNER_PINNED_CONTEXT_KEYSagainstGOVERNED_AGENT_CONTEXT_KEYSinserver/src/compliance/storyboard-runner-options.ts, plusgovernance_agent_url. The check is still set equality in both directions.governance_agent_urlin the pinned set because the hosted grader on main pins it for every 3.2 bundle it grades.pinnedGovernanceUrlsource assertion, since 3.2.x has no server-side governance seed to check.Test: 3.0.27-dependent checks removed.
dist/compliance/3.0.27and3.0.28and theirpublished-versions.jsonentries exist only on main. So I removed:The 3.0.26 half still runs, so 3.0.26 must still reproduce 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, and the existing seeded-
governance_agent_urlfixture test covers the resolving direction. I also removed the now-unusedGOVERNANCE_CONTEXT_FIX_VERSIONandPUBLISHED_MANIFESTconstants.Frozen defects table: unchanged. Every version it lists is bundled on 3.2.x, and the bundle guard passes with the table as-is. That includes all the 3.0.x / 3.2.x entries and the 3.1.x bundles, which are clean.
Changeset wording. In
seed-buyer-monitoring-media-buy-id.md, the sentence about "the*_agent_urlkeys hosted grading seeds from server config" now says those governed-agent keys are seeded by the multi-agent runner, which is what happens on 3.2.x.resolve-storyboard-assertion-comparands.mdis unchanged.The lint script,
build-compliance.cjs, the three storyboards andstoryboard-authoring.mdare byte-identical toorigin/main.git diff origin/main HEADon those paths is empty, so only the test file andpackage.jsondiffer from main. On the forward merge,package.jsonand the changesets resolve automatically. The test file will be an add/add conflict; resolve it by taking main's version. The lint'spinned_context_key_capturedmessage still points athosted-multi-agent-routing.ts. That is accurate for 3.2 bundles because main's hosted grader is what grades them, and keeping the lint identical avoids a second forward-merge conflict.Patch eligibility
This is a conformance-harness fix plus build tooling. There are no schema, task or wire-contract changes. Two storyboards now grade the invariant they already claimed, one storyboard seeds a key it already read, and a build-time lint rejects the defect class. Released
dist/**/<semver>/artifacts are untouched; 3.2.0-beta.6 through 3.2.5 stay in the frozen table.Verification (on this branch)
node scripts/lint-storyboard-context-resolution.cjs: every$contextplaceholder resolves.scripts/lint-storyboard-context-resolution.cjs(git show origin/main:…) against this tree: 0 problems. It is byte-identical to the backported script.npm run test:storyboard-context-resolution: 25/25.test:storyboard-*andtest:compliance-*script, plustest:doc-compliance-driftandtest:substitution-vector-names: pass.node scripts/build-compliance.cjs --check: passes, with the context-resolution lint running as a gate.node scripts/check-changeset-protocol-scope.cjs origin/3.2.x: passes.npx --yes @changesets/cli@^3.0.0 status --since=origin/3.2.x:adcontextprotocolpatch.ADCP_SKIP_STORYBOARD_MATRIX=1;training-agent-storyboards.ymlis the authoritative gate.🤖 Generated with Claude Code