Skip to content

feat(conformance): expose storyboardContext in AssertionContext for cross-step validators - #1142

Merged
bokelley merged 2 commits into
mainfrom
claude/issue-1140-storyboard-accumulator
May 1, 2026
Merged

bokelley merged 2 commits into
mainfrom
claude/issue-1140-storyboard-accumulator

Conversation

@bokelley

@bokelley bokelley commented May 1, 2026

Copy link
Copy Markdown
Contributor

Closes #1140

Adds storyboardContext?: StoryboardContext to AssertionContext, implementing the runner side of the cross-step comparison validator contract (Option 2 / context-outputs style, matching the existing refs_resolve / $context.* key namespace). The runner now takes a per-assertion shallow snapshot of the accumulated context before each onStep call, and a separate snapshot before each onEnd call, so assertion handlers can read values captured from prior steps via ctx.storyboardContext?.['key']. Missing keys return undefined; individual assertion handlers decide how to handle absence. The onStart hook 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_context validator check kinds pointing at ctx.storyboardContext keys.

What was tested

  • prettier --check — passed
  • tsc --project tsconfig.lib.json --noEmitOnError false — compiled (pre-existing TS2688/TS5107 on main, not introduced here)
  • npm test — 953 pass / 584 fail (pre-existing failures: 947 pass / 592 fail on main before this change; my changes did not introduce regressions)

Pre-PR review

Iteration 1:

  • code-reviewer: blocker — raw context reference 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-onEnd loop.
  • ad-tech-protocol-expert: approved — Option 2 is consistent with refs_resolve precedent; change is non-breaking per AdCP spec (optional field on exported interface); changeset bump is correct.

Iteration 2 (code-reviewer only, on updated diff):

  • code-reviewer: approved — shared-snapshot footgun eliminated by per-iteration copy; onEnd final-context block correctly placed; no remaining blockers.

Open nits (non-blocking):

  • Two separate loops (pre-onStep and pre-onEnd) iterate assertions. Could be collapsed by a single helper, but the separation is clear and avoids an overlong function.

Triage-managed PR. This bot does not currently iterate on
review comments or PR conversation threads (only on the source
issue). To unblock:

  • Push fixup commits directly: gh pr checkout <num> →
    fix → push.
  • Or re-trigger: comment /triage execute on the source
    issue.

See adcp#3121
for context.

Session: https://claude.ai/code/session_01X2fGVgppq4SpGd4A6MEm5f


Generated by Claude Code

…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
@bokelley

bokelley commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

Admin merge rationale

Same Test & Build failures as every recent main run: storyboard adcp#3083: create_media_buy_async_submitted (A2A end-to-end) and a2a_context_continuity (runner integration, #962). Both pre-existing, tracked at #1178 (broken since the test files's introduction at 6124deb2 and 61801503; verified by re-running at those commits). All other CI lanes pass. Admin-merging.

@bokelley
bokelley merged commit 7b804ea into main May 1, 2026
7 of 9 checks passed
@bokelley

bokelley commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

Acknowledged — admin-merge rationale noted. Pre-existing failures at #1178 are tracked separately. Nothing to act on here.


Generated by Claude Code

@bokelley

bokelley commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

Noted — no action taken. Pre-existing failures tracked at #1178.


Generated by Claude Code


Generated by Claude Code

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]>
@github-actions github-actions Bot mentioned this pull request May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Storyboard runner: expose per-step accumulator for cross-step comparison validators

2 participants