Skip to content

fix(adapters): declare output slot in creative formats per creative-manifest.json:14 - #1511

Merged
bokelley merged 2 commits into
mainfrom
bokelley/fix-asset-key-spec-drift
May 3, 2026
Merged

bokelley merged 2 commits into
mainfrom
bokelley/fix-asset-key-spec-drift

Conversation

@bokelley

@bokelley bokelley commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes the asset-key spec-drift PE flagged in two rounds of expert review on PR #1508.

Per schemas/cache/3.0.5/core/creative-manifest.json:14:

"Each key MUST match an asset_id from the format's assets array."

Both worked creative adapters were violating this:

  • hello_creative_adapter_template.ts — declared input slots (image, headline, script, click_through), then keyed build_creative output as assets['serving_tag'] — never declared.
  • hello_creative_adapter_ad_server.ts — declared zero asset slots in the format, then keyed output as assets['tag'] — also never declared.

Adopters forking either pattern would inherit non-spec-conformant manifests. The previous PR (#1508) added a doc-comment acknowledging the drift; this PR closes it.

Changes

examples/hello_creative_adapter_template.ts

  • New outputSlot(t) helper. Returns the right FormatAsset.{html,javascript,vast,audio}({ asset_id: 'serving_tag', required: false }) based on template.output_kind.
  • templateToFormat appends it to format.assets[] alongside input slots.
  • Doc-comment on projectRenderToManifest tightened — serving_tag is now a declared slot, no longer "adopter-defined."

examples/hello_creative_adapter_ad_server.ts

  • Imported FormatAsset from @adcp/sdk.
  • projectFormat declares FormatAsset.html({ asset_id: 'tag', required: false }) on every format. The ad-server adapter always renders to HTML serving tags in this worked example; video/CTV adopters emitting VAST swap in FormatAsset.vast(...).
  • Doc-comment on buildCreative notes the tag key matches the declared slot.

skills/build-creative-agent/SKILL.md

  • Audio adopter checklist gains a step 2 covering the outputSlot extension. Each step now cites why it's required.

Adopter impact

Pure additive at the wire — formats grow by one required: false slot. Existing input requests don't change shape. Buyers reading get_format see the output slot they didn't see before, which is an improvement (now they can resolve the rendered output's asset_type from the format).

Test plan

  • npm run compliance:fork-matrix — 23/23 in ~10s
  • npm run typecheck clean
  • npm run format:check clean

🤖 Generated with Claude Code

…anifest.json:14

Both worked creative adapters were keying their build_creative output against
asset_ids that weren't declared in the format. Per
creative-manifest.json:14: "Each key MUST match an asset_id from the format's
assets array." Caught by PE in two rounds of expert review on PR #1508.

- hello_creative_adapter_template.ts — new `outputSlot(t)` helper returns the
  right FormatAsset.{html,javascript,vast,audio}({ asset_id: 'serving_tag',
  required: false }) based on template.output_kind. templateToFormat appends
  it to format.assets[] alongside the input slots. Tightened the
  projectRenderToManifest doc-comment now that serving_tag IS declared.
- hello_creative_adapter_ad_server.ts — projectFormat declares
  FormatAsset.html({ asset_id: 'tag', required: false }) on every format
  (ad-server always emits HTML serving tags in this worked example).
  buildCreative response's `tag` key now matches a declared slot.
- skills/build-creative-agent/SKILL.md — audio adopter checklist gains a
  step 2 covering the outputSlot extension.

Pure additive at the wire — formats grow by one `required: false` slot;
input requests don't change shape. Adopters forking either adapter now
inherit a spec-aligned declaration.

Validated: fork-matrix 23/23, typecheck + format clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ss gate

Two single-reviewer findings from the round-1 expert review:

PE: align ad-server's `tag` asset_id with template's `serving_tag` so adopters
across both worked examples see the same contract. The asset_id is declared
by the format, not platform-flavored — divergent names teach the wrong story.
Renamed in projectFormat (output slot declaration), buildCreative response
(`assets['serving_tag']`), and the doc-comment.

CR: outputSlot(t) switch over output_kind had no default. TypeScript
exhaustiveness holds today (closed union of four literals), but adopters
extending the upstream type per the SWAP comment will get a function that
returns undefined and silently push undefined into format.assets[]. Added
an assertNever-style default arm so the next output_kind extension fails
compile, not runtime.

Filed adcontextprotocol/adcp#4021 for the upstream spec gap PE flagged:
format.assets[] doesn't currently distinguish input slots (buyer-provided)
from output-only slots (build_creative-produced). `required: false` is the
closest legal expression today but understates the constraint. When the
spec lands an `output_only` flag or `produced_by` enum, both adapters will
adopt it.

Validated: fork-matrix 23/23, typecheck + format clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bokelley

bokelley commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

Expert review summary (one round, two reviewers)

Per skills/run-by-experts/SKILL.md. Skipped DX since the change is purely adapter+spec correctness with one cosmetic skill-prose update.

No convergent blockers. Two single-reviewer fixes worth doing, both addressed in commit 5736dc8a:

  • protocol-expert: align ad-server's tag asset_id with template's serving_tag so adopters across both worked examples see the same contract. Asset_id is declared by the format, not platform-flavored.
  • code-reviewer: outputSlot(t) switch over output_kind had no default. TypeScript exhaustiveness holds today (closed union of four literals), but adopters extending the upstream type per the SWAP comment would get silent undefined entries in format.assets[]. Added an assertNever-style default arm so the next output_kind extension fails compile, not runtime.

Upstream spec issue filed: adcontextprotocol/adcp#4021 — PE caught that format.assets[] doesn't currently distinguish input slots (buyer-provided) from output-only slots (build_creative-produced). required: false is the closest legal expression today but understates the constraint. When the spec lands an output_only flag or produced_by enum, both adapters will adopt it.

Final state

  • fork-matrix: 23/23 in ~10s
  • typecheck + format clean
  • Ad-server + template adapters now declare output slots and key responses against declared asset_ids per creative-manifest.json:14
  • Both adapters use serving_tag consistently across all four output kinds

@bokelley

bokelley commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

Acknowledged — review summary noted. Both reviewers converged, blockers addressed in 5736dc8a, 23/23 fork-matrix, typecheck + format clean. Upstream spec gap tracked at adcontextprotocol/adcp#4021. No further action needed from triage.


Generated by Claude Code

@bokelley

bokelley commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

Acknowledged — noted, no action taken.


Generated by Claude Code

@bokelley
bokelley merged commit 24dc2a2 into main May 3, 2026
10 checks passed
bokelley added a commit that referenced this pull request May 3, 2026
Pulls in 2 commits:
 - fix(testing/storyboard): symmetric account resolution on update_media_buy enricher (closes #1505) (#1509)
 - fix(adapters): declare output slot in creative formats per creative-manifest.json:14 (#1511)

Conflict resolution:

- test/examples/hello-seller-adapter-guaranteed.test.js: main re-added a
  #1417 entry. 3.0.6 closes #1417 from the fixture side (adcp#3990) and
  the storyboard runs unfiltered against 3.0.6, so the post-bump state
  remains EXPECTED_FAILURES = [].
- test/examples/hello-seller-adapter-non-guaranteed.test.js: kept the
  longer-form `reason` text on the #1416 entry — explains both the SDK
  helper status (shipped in #1427) and the non-guaranteed adopter gap
  (not yet wired) so the next reader knows where the work belongs.

Verified post-merge:
- npm run build clean
- npm run test:lib — 6027/6027 pass
- 6/6 hello-adapter tests for the modified files green
- npm run format:check clean

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@github-actions github-actions Bot mentioned this pull request May 3, 2026
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.

1 participant