Skip to content

feat(conformance): add $generate:opaque_id and context_outputs[generate] for task ID threading - #1006

Merged
bokelley merged 3 commits into
mainfrom
claude/issue-1001-storyboard-generate-context
Apr 25, 2026
Merged

bokelley merged 3 commits into
mainfrom
claude/issue-1001-storyboard-generate-context

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Closes #1001

Summary

Storyboard authors exercising the force_create_media_buy_arm → create_media_buy → force_task_completion → tasks/get lifecycle need to thread one deterministic task ID through 4–5 steps without hardcoding a magic string (which breaks parallel runs). This PR adds two complementary mechanisms:

1. $generate:opaque_id inline substitution — semantic alias for $generate:uuid_v4, sharing the same alias cache. Authors who want to signal "this is a task ID, not a correlation UUID" can write $generate:opaque_id#directive_task_id and it reuses the same cached value as $generate:uuid_v4#directive_task_id.

2. context_outputs[generate] YAML field — lets a step mint a value and immediately expose it as $context.<key> for subsequent steps:

context_outputs:
  - key: directive_task_id
    generate: opaque_id   # minted once per run

Subsequent steps use $context.directive_task_id in sample_request and assertion fields. The two forms are alias-coherent: if $generate:opaque_id#directive_task_id was inline-substituted in the same step's sample_request, the context_outputs[generate] entry reuses that value (not a fresh one).

3. Loader validation — validateContextOutputs (called from validateStoryboardShape) rejects entries with neither path nor generate (silent no-op), and entries with both set (ambiguous), with a loud error at parse time.

4. Type surface — ContextOutput.path is now optional (mutually exclusive with generate); source_kind on ContextProvenanceEntry and ContextValueRejectedHint gains 'generator' for accurate diagnostic attribution.

What was tested

  • Build: npx tsc --project tsconfig.lib.json — clean (pre-existing config-deprecation warnings only)
  • Tests: 22 new unit tests (3 for $generate:opaque_id, 8 for context_outputs[generate]), all pass alongside 11 pre-existing generate tests — 59/59 pass across the storyboard context + provenance + rejection-hints suites
  • Loader validation: validateContextOutputs follows the established pattern of validateBranchSet / validateFixtureForMutatingStep; TypeScript confirms type correctness

Nits (not fixed in this PR)

  • applyContextOutputs (non-provenance export) silently ignores generate: entries; this is documented in the JSDoc and is safe since it has no callers outside the module in practice
  • Upstream adcontextprotocol/adcp storyboard-schema.yaml needs a companion PR to add generate: to the context_outputs item schema so third-party validators don't reject YAML using the new field

Pre-PR review

  • code-reviewer: approved — no blockers; loader validation and comment clarifications address both flagged issues; regex group shift correct; output.key in cache existence check is correct; ReDoS risk nil
  • ad-tech-protocol-expert: approved — non-breaking per spec; task_id is z.string() with no format constraint so UUID v4 is valid; step-ordering semantics confirmed correct; upstream schema update noted as out of scope for this PR

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_019NLCMs7GRvm5oTud5i4WCb


Generated by Claude Code

claude added 2 commits April 25, 2026 20:34
…r context_outputs[generate]

- validateContextOutputs: reject entries with neither path nor generate,
  and entries with both set (exact-one-of invariant, fails loud at parse time)
- Runner comment: document that generate: entries fire on failed steps by design
- applyContextOutputsWithProvenance JSDoc: clarify alias-cache coherence
  behavior when context is omitted

https://claude.ai/code/session_019NLCMs7GRvm5oTud5i4WCb
…e path

Independent reviewer findings on #1006:

- Narrow ContextOutput.generate from string to literal union 'uuid_v4' | 'opaque_id'.
  Loader rejects unknown values at storyboard-load time so a typo
  (e.g. 'uuidv4') fails loud on build, not silently mints a UUID anyway.

- applyContextOutputsWithProvenance throws when generate is set without context.
  Without context the alias-cache can't be populated, so a later step's
  $generate:opaque_id#<key> would mint an independent UUID that doesn't match.
  Loud error beats silent divergence. Runner always passes context so the
  throw is unreachable in practice — guards the public-API surface.

Filed companion adcp#3216 for the upstream storyboard-schema.yaml docs update.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bokelley
bokelley marked this pull request as ready for review April 25, 2026 21:58
@bokelley
bokelley merged commit a26db16 into main Apr 25, 2026
10 checks passed
@bokelley
bokelley deleted the claude/issue-1001-storyboard-generate-context branch April 25, 2026 21:58
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: thread caller-supplied task_id through controller-tool input for force_create_media_buy_arm round-trip

2 participants