test(creative): universal_macro_translation cross-SDK conformance vectors#5650
Merged
Merged
Conversation
… vectors Pins the universal_macro_translation helper contract (value RFC-3986 unreserved-encoded, native raw, unmapped-macro params dropped, minted params untouched, single-pass no re-expansion) as language-neutral test vectors. Both @adcp/sdk and the Python adcp SDK validate against this file so the two encoders cannot drift — the conformance storyboard only exercises alphanumeric IDs, so cross-language drift is otherwise invisible. Refs adcontextprotocol/adcp-client#2263, adcontextprotocol/adcp-client-python#956 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Contributor
There was a problem hiding this comment.
Clean additive fixture. Right call to pin a helper that no conformance storyboard can observe — the only enforcement is unit tests, and alphanumeric-ID storyboards make cross-language encoder drift invisible.
Things I checked
- All 7 vectors verified by hand against the RFC-3986
unreservedwhitelist (ALPHA / DIGIT / - . _ ~).value-unreserved-encodedis correct: space→%20,/→%2F,&→%26,=→%3Dgivesmb%20spring%2F2025%26x%3D1. This is exactly theurllib.quote()-leaves-/-unescaped trap the PR body calls out — the vector catches it. no-re-expansion-of-substituted-value:{PACKAGE_ID}→%7BPACKAGE_ID%7D, braces encoded, underscore survives. Single-pass injection defense holds.native-inserted-raw:%%CACHEBUSTER%%passes through verbatim. Correct — encoding it would break GAM/Kevel/Xandr literal replacement.unmapped-macro-param-droppedandalready-minted-param-untouchedhave the rightdropped_params/unmapped_macrosshapes;pkg_123is not re-encoded.- Scope vectors (
no-query-string-url-unchanged,fragment-left-untouched) match the documented query-params-only limitation; the mapped{CREATIVE_ID}in the fragment is correctly NOT reported inunmapped_macros. - No changeset required:
static/test-vectors/**is not a wire surface (notstatic/schemas/source/**ordocs/reference/**), and the PR body's own argument — the helper is never serialized on any AdCP surface — holds. No spec drift to schemas. - Envelope matches the sibling
static/test-vectors/catalog-macro-substitution.json. Single-location rationale (SDK unit tests, not theexpect_substitution_safestoryboard runner) is sound.
Follow-ups (non-blocking — file as issues)
- Dangling
spec_referenceanchor. The fixture points atdocs/creative/universal-macros.mdx#implementing-translation-with-the-sdk, but that anchor does not exist — the doc has### Macro Translation Approach/### Translation Examplesand never documents theuniversal_macro_translationhelper, its{ url, dropped_params, unmapped_macros }return, or thevalue/nativemapping. The contract this fixture pins is currently SDK-internal with no normative doc home. Either add the section the anchor names or repointspec_referenceat#macro-translation-approach. Worth resolving before a third SDK ports against a pointer that goes nowhere.
LGTM. Follow-up noted.
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.
Adds
static/test-vectors/universal-macro-translation.json— language-neutral conformance vectors pinning theuniversal_macro_translationhelper contract so the JS (@adcp/sdk) and Python (adcp) implementations cannot drift.Why
The helper's substitution is the seller's internal pixel-translation step — it is never serialized on any AdCP wire surface, so no conformance storyboard can observe it (see the split discussion on #5646). Its only enforcement is unit tests. And the conformance storyboard only ever exercises alphanumeric IDs, which encode identically under every encoder — so a Python port that diverges on reserved characters (e.g.
urllib.quote()defaults leaving/unescaped) would pass everything while silently producing different pixels. This fixture is the cross-SDK source of truth that catches that.Contract pinned
Each vector's
expectedis the full helper return{ url, dropped_params, unmapped_macros }:valueentries → RFC-3986 unreserved-whitelist percent-encodednativeentries → inserted raw (ad-server token survives){MACRO}inside a substituted value is encoded as data, never re-expandedMatches the envelope of the existing
static/test-vectors/catalog-macro-substitution.json. Single location (not mirrored intostatic/compliance/source/test-vectors/) because — unlike the catalog fixture — this is consumed by SDK unit tests, not theexpect_substitution_safestoryboard runner.Refs adcontextprotocol/adcp-client#2263, adcontextprotocol/adcp-client-python#956, and the Live Integration RFC #5649.
🤖 Generated with Claude Code