Skip to content

feat(storyboard): field_contains validation — closes adcp#3803 item 2#1313

Merged
bokelley merged 2 commits into
mainfrom
bokelley/field-contains-validation
May 2, 2026
Merged

feat(storyboard): field_contains validation — closes adcp#3803 item 2#1313
bokelley merged 2 commits into
mainfrom
bokelley/field-contains-validation

Conversation

@bokelley

@bokelley bokelley commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a wildcard-aware membership check to the storyboard validator. path may include [*] segments (resolved via the existing resolvePathAll), and the check passes when any resolved value matches value or any of allowed_values.

Lets storyboards write:

```yaml

  • check: field_contains
    path: creatives[0].errors[*].code
    value: PROVENANCE_VERIFIER_NOT_ACCEPTED
    ```

instead of the brittle positional form creatives[0].errors[0].code, which breaks when a seller emits multiple errors per creative or reorders the cascade. When the path has no wildcard segments the check reduces to scalar equality.

What's new

  • StoryboardValidationCheck adds 'field_contains'
  • validateFieldContains in validations.ts — symmetric to validateFieldValue for missing-value / missing-path error paths and JSON pointer emission
  • 8 new test cases in test/lib/storyboard-validations.test.js covering wildcard match, allowed_values, no-match, empty resolution, scalar fallback, missing path, missing value, and JSON pointer correctness

Test plan

  • npm run build — clean
  • node --test test/lib/storyboard-validations.test.js — 30/30 pass (8 new)
  • CI green

Refs

Closes adcontextprotocol/adcp#3803 item 2. Item 1 (required-clean allowlist) shipped in adcp#3837. Item 3 (storyboard run in pre-push hook) lands in a parallel adcp PR.

🤖 Generated with Claude Code

…l/adcp#3803 item 2

Adds a wildcard-aware membership check to the storyboard validator. `path`
may include `[*]` segments (resolved via the existing `resolvePathAll`),
and the check passes when ANY resolved value matches `value` or any of
`allowed_values`.

Lets storyboards write:

  - check: field_contains
    path: creatives[0].errors[*].code
    value: PROVENANCE_VERIFIER_NOT_ACCEPTED

instead of the brittle positional `errors[0].code` form, which breaks
when a seller emits multiple errors or reorders the cascade. When the
path has no wildcard segments the check reduces to scalar equality.

Symmetric to field_value for missing-value/missing-path error paths and
JSON pointer emission. 8 new test cases in test/lib/storyboard-validations.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…er assertion

Apply prettier --write to satisfy CI formatting check and tighten the
JSON-pointer assertion in the new field_contains tests to pin the literal
`*` segment that toJsonPointer emits for `[*]` (per RFC 6901, `*` is not
a forbidden character so it round-trips unescaped).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley merged commit 6967470 into main May 2, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Storyboard conformance: required-clean allowlist + errors[*] predicate + pre-commit gate

1 participant