Repository navigation
feat(conformance): expose storyboardContext in AssertionContext for cross-step validators - #1142
Merged
Merged
Conversation
…ross-step validators Adds optional `storyboardContext?: StoryboardContext` to `AssertionContext`. The runner threads the accumulated context (from `context_outputs` and convention extraction) into each assertion before `onStep` fires, using Option 2 (context-outputs style) which matches the existing `refs_resolve` precedent in the storyboard validator pipeline. Cross-step comparison assertions (e.g. `field_less_than`, `field_equals_context` targeted by adcontextprotocol/adcp#2642) can now read prior-step captured values via `ctx.storyboardContext?.['key']`. Missing keys return `undefined`; assertion handlers decide how to proceed. Closes #1140 https://claude.ai/code/session_01X2fGVgppq4SpGd4A6MEm5f
Contributor
Author
Admin merge rationaleSame |
Contributor
Author
|
Acknowledged — admin-merge rationale noted. Pre-existing failures at #1178 are tracked separately. Nothing to act on here. Generated by Claude Code |
Contributor
Author
|
Noted — no action taken. Pre-existing failures tracked at #1178. Generated by Claude Code Generated by Claude Code |
This was referenced May 1, 2026
bokelley
added a commit
that referenced
this pull request
May 1, 2026
Reverts #1142. The field was preemptive surface with no consumer: - None of the bundled invariants (`status.monotonic`, `idempotency.conflict_no_payload_leak`, `context.no_secret_echo`, `governance.denial_blocks_mutation`) read `ctx.storyboardContext`. - Programmatic assertions already accumulate cross-step state through `ctx.state` (which is how `status.monotonic`'s `history` works). - Issue #1140 was about YAML validators (the `check:` clause), not assertion handlers — that scope is fully covered by #1141, which reads from `ValidationContext.storyboardContext` (a separate interface that already existed). The asymmetry is correct: declarative validators need context exposure, imperative assertions don't. Custom invariants that need cross-step state should continue using `ctx.state`. Breaking-shape change shipped as minor while 6.x is in its breaking phase. Window-of-removal is hours old — #1142 landed in 6.4.0, no docs advertised it, no third-party consumer has had time to depend. This reverts commit 7b804ea. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Merged
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 #1140
Adds
storyboardContext?: StoryboardContexttoAssertionContext, implementing the runner side of the cross-step comparison validator contract (Option 2 / context-outputs style, matching the existingrefs_resolve/$context.*key namespace). The runner now takes a per-assertion shallow snapshot of the accumulated context before eachonStepcall, and a separate snapshot before eachonEndcall, so assertion handlers can read values captured from prior steps viactx.storyboardContext?.['key']. Missing keys returnundefined; individual assertion handlers decide how to handle absence. TheonStarthook is deliberately not populated — no steps have run yet.Once this merges, the schema-side PR (adcontextprotocol/adcp#2642) can land
field_less_than/field_equals_contextvalidator check kinds pointing atctx.storyboardContextkeys.What was tested
prettier --check— passedtsc --project tsconfig.lib.json --noEmitOnError false— compiled (pre-existingTS2688/TS5107onmain, not introduced here)npm test— 953 pass / 584 fail (pre-existing failures: 947 pass / 592 fail onmainbefore this change; my changes did not introduce regressions)Pre-PR review
Iteration 1:
contextreference assigned to all assertions; a mutating handler could corrupt the live accumulator and peer assertions. Fixed by using per-assertion{ ...context }shallow copies in both the per-step loop and the pre-onEndloop.refs_resolveprecedent; change is non-breaking per AdCP spec (optional field on exported interface); changeset bump is correct.Iteration 2 (code-reviewer only, on updated diff):
onEndfinal-context block correctly placed; no remaining blockers.Open nits (non-blocking):
onStepand pre-onEnd) iterateassertions. Could be collapsed by a single helper, but the separation is clear and avoids an overlong function.Session: https://claude.ai/code/session_01X2fGVgppq4SpGd4A6MEm5f
Generated by Claude Code