Skip to content

feat(conformance): add field_less_than and field_equals_context cross-step validators - #1141

Merged
bokelley merged 3 commits into
mainfrom
claude/issue-1140-cross-step-accumulator-validators
May 1, 2026
Merged

bokelley merged 3 commits into
mainfrom
claude/issue-1140-cross-step-accumulator-validators

Conversation

@bokelley

@bokelley bokelley commented May 1, 2026

Copy link
Copy Markdown
Contributor

Closes #1140

Summary

Implements the runner side of adcp#2642. The storyboard schema is gaining cross-step comparison primitives (field_less_than, field_equals_context), but those check kinds are dead letters until the runner exposes the accumulator contract. This PR nails down option 2 (context-outputs style) and ships it.

Design decision: captured values live in the existing storyboardContext accumulator passed through ValidationContext.storyboardContext. Validators read them via context_key on StoryboardValidation. This matches the established refs_resolve precedent (which already reads ctx.storyboardContext via resolveRefsRoot('context', ctx)) and avoids forking the state channel.

Acceptance criteria from #1140:

  • ✅ Option (2) — context-outputs style — picked and documented via JSDoc on StoryboardValidationCheck
  • ✅ Captured values survive across step boundaries (existing storyboardContext, populated by applyContextOutputsWithProvenance after each step)
  • ✅ When a validator references a key that was never captured: passes with context_key_absent observation — not an error. The prior step may have been legitimately skipped on a branch-set path (same skip-with-observation pattern as validateA2AContextContinuity).

Changes

  • src/lib/testing/storyboard/types.ts — adds field_less_than and field_equals_context to StoryboardValidationCheck; adds context_key?: string to StoryboardValidation (JSDoc scopes it to the two new checks)
  • src/lib/testing/storyboard/validations.ts — resolveContextComparand() helper + validateFieldLessThan() + validateFieldEqualsContext() + two new cases in runValidation() switch
  • test/storyboard-cross-step-validators.test.js — 20 tests covering: pass/fail/observation paths, undefined context values, both-comparand precedence, absent field, non-numeric type errors, missing path/context_key

What was tested

  • npx tsc --project tsconfig.lib.json — pre-existing TS2688/TS5107 errors only (confirmed identical on main before this diff)
  • npm run format:check — clean
  • node --test test/storyboard-cross-step-validators.test.js — 20/20 pass

Nits (not fixed — surfaced for reviewer)

  • field_less_than with a string value (e.g. value: "100") produces a runtime type failure rather than a storyboard-load error. The schema side (adcp#2642) should constrain value to number when check === "field_less_than" via an if/then discriminant — the runner will emit the correct type error in the meantime.
  • No test for field_less_than on an HTTP-probe step (where resolveTarget falls back to httpResult.body). The shared resolveTarget logic is already tested by other checks; adding a probe-target test is a good follow-up.

Pre-PR review

  • code-reviewer: approved — no blockers; two nits noted above; undefined-in-context guard and JSON.stringify(actual ?? null) fixes confirmed
  • ad-tech-protocol-expert: approved — no blockers; option 2 consistent with refs_resolve precedent; skip-with-observation correct per A2A check patterns; two nits: schema-side value type constraint (adcp#2642 scope), and precedence behavior when both context_key and value are set (now covered by test)

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_01D5v3W3pZbs44KaMyCQ7iKV


Generated by Claude Code

claude added 2 commits May 1, 2026 02:48
…-step validators

Implements the runner side of adcp#2642. Storyboard authors can now assert
relationships between the current step's response and a value captured from
an earlier step, without leaving the context_outputs accumulator.

https://claude.ai/code/session_01D5v3W3pZbs44KaMyCQ7iKV
…n cross-step validators

- resolveContextComparand now treats explicit undefined in storyboardContext
  the same as absent (yields context_key_absent observation, not a comparand)
- field_equals_context error message uses JSON.stringify(actual ?? null) so
  absent fields render as "null" not "undefined" in the error string

https://claude.ai/code/session_01D5v3W3pZbs44KaMyCQ7iKV
@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 e76ab7d into main May 1, 2026
7 of 9 checks passed
@bokelley

bokelley commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

Acknowledged — pre-existing failures on #1178 noted. No action needed on this end.


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