Repository navigation
compliance: extend expect_substitution_safe to creative-generative (#2638 follow-up) - #2649
Merged
Merged
Conversation
…2638 follow-up) Second consumer of the substitution_observer_runner contract, now that both prerequisites merged: #2645 added catalog_augmented_generation (with build_creative returning preview_html) and #2647 landed the observer contract. New catalog_substitution_safety phase on creative-generative/index.yaml mirrors the sales-catalog-driven pattern: 1. sync_substitution_probe_catalog — pushes three canonical attacker- shaped values (reserved-character-breakout, nested-expansion- preserved-as-literal, non-ascii-utf8-percent-encoding) as catalog- item sku fields. 2. build_substitution_probe_creative — generates a creative with {SKU} in the impression tracker URL + include_preview: true. 3. expect_substitution_safe — gated on substitution_observer_runner. Uses fixture-lookup shape (catalog_item_id + vector_name) with require_every_binding_observed: true. sales-social deliberately deferred: social platforms substitute at serve time in their own rendering pipeline — no natural AdCP-level preview hook. Forcing preview_creative on required_tools would misalign with real implementations. Separate issue to follow for specialisms without preview surfaces (post-impression observation, dry-run substitution endpoint, or similar). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced Apr 21, 2026
Three reviewers (protocol + security + DX) landed consistent findings: - Extend vector coverage (convergent across protocol + security + DX): the initial phase tested only 3 of 7 canonical fixture vectors. Added crlf_injection and bidi_override items to the probe catalog + matching catalog_bindings. Generative specialism specifically flagged bidi as higher-risk (LLM-generated copy with embedded user text round-trips bidi into attribute contexts). 5 of 7 vectors now bound; mixed-path-and-query (same macro in two URL positions) and url-scheme-injection-neutralized (href-whole-value binding) are template-shape follow-ups. - Fix stale applies_to.specialisms in observer contract (protocol): sales_social was listed as a current consumer but #2649 explicitly deferred it (no preview hook on social platforms). Moved to a "Deferred pending observation-hook design (#2651)" comment; removed from applies_to.specialisms array. - Add diagnostic validation on build step (security): the message field is a natural-language brief; an LLM that ignores the {SKU} directive fails with a generic substitution_binding_missing. Made the brief more explicit ("use the literal `{SKU}` macro (unsubstituted) in at least one impression tracker URL...") to surface the directive more clearly. Narrative now explicitly diagnoses the failure mode. - Narrative tweaks (security + DX): * List all five bound vectors + name the two template-shape follow-ups (mixed-path, url-scheme-injection). * Add explicit scope note — phase validates PREVIEW surface only; serve-time attestation deferred per #2651 and the observer contract's out-of-scope v1. DX copy-paste abstraction (future author friction) and vector_name authoring-time validation are flagged as 3.1 follow-ups, not in-PR. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Two cleanups from round-2 expert reviews:
- Protocol (both reviewers): sales-catalog-driven narrative said
"six canonical" vectors but only three items existed. Narrative
now matches the three actually exercised + explicit cross-reference
to creative-generative for CRLF + bidi coverage + note that mixed-
path-and-query and url-scheme-injection are template-shape
follow-ups (unit-test layer only).
- DX: "unsubstituted" wording in the creative-generative build brief
read contradictorily on first pass. Rephrased to "Include the
{SKU} macro as a literal token in the impression tracker URL —
the platform resolves it per-impression against catalog items."
No functional change. Both reviewers said mergeable with these nits.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
4 tasks
bokelley
added a commit
that referenced
this pull request
May 15, 2026
…ety phase (#4566) sales-social previously deferred runtime substitution-safety checks pending an observation-hook design (#2651, closed). The premise that social platforms have no AdCP-level preview hook didn't hold — Meta creative_preview, TikTok/Snap creative-preview APIs, and Amazon Ads / Walmart Connect previews all exercise catalog-item macro substitution as part of rendering. Wire sales-social to the existing substitution_observer_runner test-kit contract using the same preview surface creative-generative already uses post-#2649. No new capability, no new schema. Changes: - static/compliance/source/specialisms/sales-social/index.yaml - Add preview_creative to required_tools - New catalog_substitution_safety phase: push probe catalog with attacker-shaped values → push DPA creative bound to the probe → call preview_creative → observe substituted URLs via the runner contract - Update catalog_driven_dynamic_ads narrative — drop the deferral - static/compliance/source/test-kits/substitution-observer-runner.yaml - Add sales_social to applies_to.specialisms - Remove the deferred-pending-#2651 comment block Coverage limitation (same as creative-generative): preview-time substitution may diverge from impression-time on platforms with different code paths. Serve-time attestation remains a known gap and is not gated for this phase. Closes #4546. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Second consumer of the
substitution_observer_runnercontract, now that both prerequisites have merged:creative-generativegot acatalog_augmented_generationphase withbuild_creativereturningpreview_htmlThis PR extends the runtime substitution-safety check from
sales-catalog-driventocreative-generative, following the same pattern established by #2647.What changed
static/compliance/source/specialisms/creative-generative/index.yaml— newcatalog_substitution_safetyphase appended aftercatalog_augmented_generation. Three steps:sync_substitution_probe_catalog— pushes three canonical attacker-shaped values (reserved-character-breakout,nested-expansion-preserved-as-literal,non-ascii-utf8-percent-encoding) as catalog-itemskufields.build_substitution_probe_creative— generates a creative whose impression tracker URL binds{SKU}, withinclude_preview: true.expect_substitution_safe— gated onsubstitution_observer_runner. Fixture-lookup shape (catalog_item_id+vector_name) withrequire_every_binding_observed: true.Why
sales-socialis NOT includedsales-socialusessync_creativesto register a DPA template but has no AdCP-level preview hook. Social platforms substitute macros at serve time in their own rendering pipeline; they don't exposepreview_creativeor equivalent. Forcingpreview_creativeontorequired_toolswould misalign with real social-platform implementations (Snap, Meta, TikTok DPA all render server-side, not via AdCP).The
substitution_observer_runnercontract's observation modes (html_inline,url_fetch) assume substitution happens in an AdCP-visible preview surface. For specialisms without one, a different hook is needed — post-impression log introspection, a dedicateddry_run_substitutionendpoint, or an out-of-band conformance-test endpoint. Tracked as a follow-up.Out of scope / follow-ups
sales-socialsubstitution observation — separate issue. Needs new observation mechanism, not just extension of existing phases.sales-retail-media— still a 3.1 placeholder per its specialism file; lands with the retail-media epic.SubstitutionObserver/SubstitutionEncoder— tracked in adcp-client repo.Test plan
npm run test:storyboard-scopingpasses (3/3)npm run test:error-codespasses (pre-existing YAML warning unrelated)npm run test:unitpasses (631 tests)npm run typecheckpasses🤖 Generated with Claude Code