Skip to content

feat(v2.5): schema cache + warn-only post-adapter validation + conformance suite - #1121

Merged
bokelley merged 6 commits into
mainfrom
bokelley/v2.5-schemas
May 1, 2026
Merged

bokelley merged 6 commits into
mainfrom
bokelley/v2.5-schemas

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

First of ~5 PRs landing v2.5 wire support. This one's foundation: pulls the v2.5.3 schema bundle in, adds a warn-only post-adapter validation pass, lays down a conformance test suite. Two real adapter drift items surface as known-failures here; tracked at #1115 and #1116, fixed in follow-up PRs.

Summary

  • scripts/sync-v2-5-schemas.ts (npm run sync-schemas:v2.5): pulls v2.5.3 schemas from adcontextprotocol/[email protected] at a pinned SHA. Necessary because v2.5.2 and v2.5.3 were never tagged or released upstream despite shipping in package.json and CHANGELOG.md — filed at adcontextprotocol/adcp#3689. Pulling from the published spec site would silently regress to v2.5.1, missing additionalProperties: true forward-compat, the error.json typing fix, and the impressions / paused package-request fields. Tarball SHA-256 pinned alongside the commit SHA; symlinks rejected at extraction; provenance file written to schemas/cache/v2.5/_provenance.json.
  • schemas/cache/v2.5/ populated (158 schemas, gitignored — refresh via the script). Existing resolveBundleKey('v2.5') legacy alias and copy-schemas-to-dist.ts legacy-prerelease path both already routed v2.5 correctly without resolver changes — bundle ships at dist/lib/schemas-data/v2.5/.
  • src/lib/validation/schema-loader.ts narrowed ensureCoreLoaded from "skip all fileIndex entries" to "skip only response tool files." v2.5's source tree ships flat (no pre-bundled bundled/ subtree) with cross-fragment \$refs; the previous rule left fragments like media-buy/package-request.json unregistered and AJV emitted MissingRefError on cross-fragment lookups. v3's bundled-schemas path is unaffected (refs were already inlined). Regression test pinned in test/lib/schema-loader-per-version.test.js.
  • TaskExecutor.validateAdaptedRequestAgainstV2(taskName, adaptedParams, debugLogs?) — new public seam. Always warn-only, version-pinned to v2.5. SingleAgentClient.executeAndHandle and SingleAgentClient.executeTask both call it after adaptRequestForServerVersion when serverVersion === 'v2'. Symmetric to PR refactor: validate v3 request shape before v2 wire adaptation #1106's pre-adapter v3 pass: that one catches "user wrote bad v3", this one catches "adapter produced bad v2.5".
  • test/lib/adapter-v2-5-conformance.test.js — pins canonical v3 fixtures through every v2 adapter, asserts each adapted output validates against schemas/cache/v2.5/. Tools with known drift have explicit expected_failures entries pointing at the tracking issue and pinning failure-mode pointers — so a fix that closes the gap surfaces as an unexpected pass and prompts the entry to be removed. A "every v2-adapted tool has a fixture" guard ensures new adapters can't ship without conformance coverage.

Conformance state at this PR

Tool v2.5 conformance
get_products ✓ clean
create_media_buy × known drift at /buyer_ref + /packages/0/buyer_ref (#1115)
update_media_buy ✓ clean
sync_creatives × known drift at /creatives/0/assets/video (#1116)

Expert review

Three parallel reviews: code-reviewer, ad-tech-protocol-expert, security-reviewer. Convergent must-fix items addressed in 7b8316fd:

  • Tarball SHA-256 pin (defense against MITM / force-push substitution)
  • Symlink defense for cpSync post-extract
  • Provenance file
  • sync-schemas:all umbrella so CI can pull both bundles in one command
  • v3 ensureCoreLoaded regression test

Deferred per expert advice: AJV strict: true (broader change), \$id-driven file classification (filename-suffix heuristic limitation; tracking issue worth filing later), tempdir to os.tmpdir (cosmetic).

Behavior change

Today, this PR is foundation — minimal user-visible behavior change. The warn-only post-adapter pass runs but doesn't surface drift to user-visible logs (SingleAgentClient call sites pass no debugLogs; warn mode without debugLogs writes nowhere). The published npm package may not include the v2.5 bundle until the build pipeline is wired — separate follow-up PR.

The real value lands in the follow-up PRs:

CI signal for adapter drift IS available now via the conformance test suite — a developer touching any v2 adapter gets immediate feedback whether their change broke or fixed something.

Test plan

  • npm run sync-schemas:v2.5 populates the bundle, sha256 verifies, provenance written
  • npm run build:lib ships both bundles in dist/lib/schemas-data/
  • node --test test/lib/schema-loader-per-version.test.js — 18 pass, including the new ensureCoreLoaded regression test
  • node --test test/lib/post-adapter-v2-5-validation.test.js — 5 pass
  • node --test test/lib/adapter-v2-5-conformance.test.js — 5 pass (2 expected-failures, 3 clean conformance, 1 fixture-coverage guard)
  • node --test test/lib/*.test.js — 5541 pass / 7 pre-existing skipped / 0 fail

Related

  • Filed: adcontextprotocol/adcp#3689 (upstream tag/release pipeline)
  • Filed: adcontextprotocol/adcp-client#1115 (buyer_ref derivation — next PR)
  • Filed: adcontextprotocol/adcp-client#1116 (sync-creatives manifest flatten — follow-up PR)

🤖 Generated with Claude Code

bokelley and others added 4 commits April 30, 2026 19:28
Pulls the AdCP 2.5.3 schema bundle from a pinned commit on
adcontextprotocol/adcp's 2.5-maintenance branch (since v2.5.2 / v2.5.3
were never tagged upstream — adcontextprotocol/adcp#3689). Lands at
schemas/cache/v2.5/, ships in dist/lib/schemas-data/v2.5/.

Existing resolveBundleKey('v2.5') legacy-alias and
copy-schemas-to-dist.ts legacy-prerelease path already routed correctly
without resolver changes.

schema-loader's ensureCoreLoaded narrows from "skip all fileIndex
entries" to "skip only response tool files" so cross-fragment $refs in
flat-tree bundles (where v2.5 ships) resolve at compile time. v3's
pre-bundled path is unaffected — refs were already inlined.

Surfaced via getValidator(tool, direction, 'v2.5'). Internal only;
buyer-facing API unchanged. Foundation for upcoming warn-only
post-adapter validation pass and adapter-conformance test suite.

Pinned source: adcontextprotocol/adcp@4e553ad9 (2.5-maintenance HEAD,
2026-01-23). Refresh by editing SOURCE_SHA in scripts/sync-v2-5-schemas.ts
and re-running npm run sync-schemas:v2.5.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Symmetric to the existing pre-adapter v3 pass (PR #1106): when the v2
adapter rewrites a request for a v2-detected agent, validate the adapted
shape against the cached v2.5 schema bundle. Surfaces drift between
adapter output and the v2.5 wire contract.

Always warn-only — adapter bugs shouldn't break user requests, and the
v3 pre-send pass already vouched for the user-facing input. The pass
exists primarily as CI signal for the upcoming adapter-conformance
test suite.

TaskExecutor.validateAdaptedRequestAgainstV2(taskName, adaptedParams,
debugLogs?) is the public seam; mirrors validateRequest's shape.
SingleAgentClient.executeAndHandle and SingleAgentClient.executeTask
both call it after adaptRequestForServerVersion when serverVersion
is 'v2'.

Initial baseline against canonical adapter outputs surfaced two real
drift items worth follow-up:
- adaptCreateMediaBuyRequestForV2 doesn't emit buyer_ref (v2.5 requires
  top-level + per-package)
- adaptSyncCreativesRequestForV2's assets.video shape fails a oneOf

These will be addressed alongside the adapter-conformance suite.

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

Three reviewers (code-reviewer, ad-tech-protocol-expert, security-reviewer)
converged on actionable items for the v2.5 schema-cache + warn-only
post-adapter passes. Addressed in this commit:

- **Tarball SHA-256 pin** (sec M2 / code reviewer Q2): the codeload URL
  is content-addressed by GitHub but TLS substitution / a compromised
  CI runner could still swap bytes. Now verifies bytes against
  SOURCE_TARBALL_SHA256 before any extraction; mismatch fails loud
  with refresh instructions.
- **Symlink defense** (sec M1): cpSync follows symlinks by default,
  which would let an upstream link copy through to anywhere on disk.
  Walk the source tree post-extract and refuse any symlinks; pass
  verbatimSymlinks:true to cpSync as belt-and-suspenders. tar.x now
  also runs with strict:true to upgrade suspicious entries from
  warning to throw.
- **Provenance file** (protocol expert Q1): write
  schemas/cache/v2.5/_provenance.json after sync — source repo, branch,
  pinned SHA, tarball sha256, upstream-declared adcp_version, sync
  timestamp. Lets downstream consumers diff bundles across refreshes.
- **sync-schemas:all umbrella** (code reviewer Q5): single command
  pulls both v3 and v2.5 bundles. Avoids developer-memory failure mode.
- **v3 ensureCoreLoaded regression test** (code reviewer Q1): pins
  the invariant that bundled-path validators win over flat-tree paths
  after the narrowing in 036047c. Bundled and flat-tree request
  schemas have distinct $ids so no AJV-side collision; the test
  asserts the bundled $id flows through getValidator.

Two follow-up issues filed (not in this commit, will be locked in by
the upcoming adapter-conformance test suite):
- #1115 — adaptCreateMediaBuyRequestForV2
  should derive buyer_ref from idempotency_key
- #1116 — adaptSyncCreativesRequestForV2
  needs to flatten v3 manifest to v2.5 single-asset payload

Deferred per expert advice: AJV strict:true (would touch all schemas;
broader change), $id-driven file classification (filename-suffix
heuristic limitation worth a tracking issue but not urgent), tempdir
move to os.tmpdir (cosmetic). DebugLogs plumbing for warn-pass
surfacing also deferred — conformance suite is the right consumer
for now.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Pins the canonical v3 fixtures through adaptRequestForServerVersion and
asserts each adapted output validates against schemas/cache/v2.5/. CI
signal for "the v2 wire adapters produce v2.5-conformant output."

Tools with known drift have explicit expected_failures entries pointing
at the tracking issue AND pinning the failure-mode pointers. A fix that
closes the gap surfaces as an unexpected pass and prompts the entry to
be removed.

A "every v2-adapted tool has a fixture" guard ensures new adapters
can't ship without conformance coverage.

Initial state:
  get_products        ✓ conforms clean
  create_media_buy    × known drift at /buyer_ref (#1115)
  update_media_buy    ✓ conforms clean
  sync_creatives      × known drift at /creatives/0/assets/video (#1116)

Lib regression: 5541 pass / 7 skipped (pre-existing) / 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bokelley
bokelley force-pushed the bokelley/v2.5-schemas branch from 78392b2 to 426ea19 Compare April 30, 2026 23:29
bokelley added a commit that referenced this pull request Apr 30, 2026
…a_buy

Closes #1115.

v2.5's create_media_buy schema requires buyer_ref top-level + per-package
as the buyer's reference for THIS media buy. v3 doesn't model buyer_ref
directly, but idempotency_key carries the same
client-controlled-unique-identity contract. Reusing it preserves the
seller-side dedupe contract on replays — the same v3 input always
produces the same v2.5 buyer_ref values.

Derivation precedence:
- Top-level: caller-supplied → idempotency_key → omitted
- Per-package: caller-supplied → package.idempotency_key →
  ${parent_buyer_ref}-${index}

adaptPackageRequestForV2 gains an optional second argument
PackageAdapterContext ({ parentBuyerRef?, index? }) so callers threading
per-package derivation supply the parent's reference + index.
Backward-compatible — existing single-argument callers (update_media_buy
adapter, third parties) continue to work without derivation.

The v2.5 adapter-conformance test suite (#1121) flips create_media_buy
from a known-drift expected_failures fixture to a passing fixture. 7
new unit tests pin the derivation rules, including a replay-stability
test that asserts identical inputs produce identical buyer_refs.

Lib regression: 5485 pass / 7 skipped (pre-existing) / 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
CI failed on the rebased foundation branch because schemas/cache/v2.5/
isn't populated by the existing sync-schemas step (which only fetches
v3). Two fixes:

- ci.yml: switch the sync-schemas step to sync-schemas:all (the
  umbrella that runs both v3 and v2.5)
- package.json prepublishOnly: same — ensures the published npm tarball
  always ships dist/lib/schemas-data/v2.5/ alongside dist/lib/schemas-data/3.0/

For local-dev DX, both v2.5 test suites now check hasSchemaBundle('v2.5')
and skip cleanly with an actionable message ("run npm run sync-schemas:v2.5")
when the bundle isn't present. CI hits the populated path and runs the
tests; a fresh clone without sync gets a skip rather than a confusing AJV
"missing schema" error.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
bokelley added a commit that referenced this pull request May 1, 2026
…a_buy

Closes #1115.

v2.5's create_media_buy schema requires buyer_ref top-level + per-package
as the buyer's reference for THIS media buy. v3 doesn't model buyer_ref
directly, but idempotency_key carries the same
client-controlled-unique-identity contract. Reusing it preserves the
seller-side dedupe contract on replays — the same v3 input always
produces the same v2.5 buyer_ref values.

Derivation precedence:
- Top-level: caller-supplied → idempotency_key → omitted
- Per-package: caller-supplied → package.idempotency_key →
  ${parent_buyer_ref}-${index}

adaptPackageRequestForV2 gains an optional second argument
PackageAdapterContext ({ parentBuyerRef?, index? }) so callers threading
per-package derivation supply the parent's reference + index.
Backward-compatible — existing single-argument callers (update_media_buy
adapter, third parties) continue to work without derivation.

The v2.5 adapter-conformance test suite (#1121) flips create_media_buy
from a known-drift expected_failures fixture to a passing fixture. 7
new unit tests pin the derivation rules, including a replay-stability
test that asserts identical inputs produce identical buyer_refs.

Lib regression: 5485 pass / 7 skipped (pre-existing) / 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Adding `schemas/cache/v2.5/` exposed a latent bug in
generate-wellknown-schemas.ts and generate-zod-schemas.ts: their
`getLatestCacheDir()` does a `.sort().reverse()` on directory names,
and the legacy alias `v2.5` (or `v2.6`) sorts ABOVE `3.0.1` because
'v' > '3' lexically. Result: scripts looking for `brand.json` /
`adagents.json` (which only live in the primary v3 cache) probed the
v2.5 directory and failed with "brand.json not found in
schemas/cache/v2.5".

Fix: restrict candidates to MAJOR.MINOR.PATCH-shaped directories and
sort by parsed numeric components, with stable releases beating
prereleases at the same numeric version. Legacy aliases and the
`latest` symlink are now correctly skipped.

generate-types.ts uses the `latest` symlink directly (set by
sync-schemas to the v3 directory) and was unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
bokelley added a commit that referenced this pull request May 1, 2026
…a_buy

Closes #1115.

v2.5's create_media_buy schema requires buyer_ref top-level + per-package
as the buyer's reference for THIS media buy. v3 doesn't model buyer_ref
directly, but idempotency_key carries the same
client-controlled-unique-identity contract. Reusing it preserves the
seller-side dedupe contract on replays — the same v3 input always
produces the same v2.5 buyer_ref values.

Derivation precedence:
- Top-level: caller-supplied → idempotency_key → omitted
- Per-package: caller-supplied → package.idempotency_key →
  ${parent_buyer_ref}-${index}

adaptPackageRequestForV2 gains an optional second argument
PackageAdapterContext ({ parentBuyerRef?, index? }) so callers threading
per-package derivation supply the parent's reference + index.
Backward-compatible — existing single-argument callers (update_media_buy
adapter, third parties) continue to work without derivation.

The v2.5 adapter-conformance test suite (#1121) flips create_media_buy
from a known-drift expected_failures fixture to a passing fixture. 7
new unit tests pin the derivation rules, including a replay-stability
test that asserts identical inputs produce identical buyer_refs.

Lib regression: 5485 pass / 7 skipped (pre-existing) / 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bokelley
bokelley merged commit e6481ad into main May 1, 2026
10 checks passed
bokelley added a commit that referenced this pull request May 1, 2026
…a_buy

Closes #1115.

v2.5's create_media_buy schema requires buyer_ref top-level + per-package
as the buyer's reference for THIS media buy. v3 doesn't model buyer_ref
directly, but idempotency_key carries the same
client-controlled-unique-identity contract. Reusing it preserves the
seller-side dedupe contract on replays — the same v3 input always
produces the same v2.5 buyer_ref values.

Derivation precedence:
- Top-level: caller-supplied → idempotency_key → omitted
- Per-package: caller-supplied → package.idempotency_key →
  ${parent_buyer_ref}-${index}

adaptPackageRequestForV2 gains an optional second argument
PackageAdapterContext ({ parentBuyerRef?, index? }) so callers threading
per-package derivation supply the parent's reference + index.
Backward-compatible — existing single-argument callers (update_media_buy
adapter, third parties) continue to work without derivation.

The v2.5 adapter-conformance test suite (#1121) flips create_media_buy
from a known-drift expected_failures fixture to a passing fixture. 7
new unit tests pin the derivation rules, including a replay-stability
test that asserts identical inputs produce identical buyer_refs.

Lib regression: 5485 pass / 7 skipped (pre-existing) / 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
bokelley added a commit that referenced this pull request May 1, 2026
…a_buy (#1123)

Closes #1115.

v2.5's create_media_buy schema requires buyer_ref top-level + per-package
as the buyer's reference for THIS media buy. v3 doesn't model buyer_ref
directly, but idempotency_key carries the same
client-controlled-unique-identity contract. Reusing it preserves the
seller-side dedupe contract on replays — the same v3 input always
produces the same v2.5 buyer_ref values.

Derivation precedence:
- Top-level: caller-supplied → idempotency_key → omitted
- Per-package: caller-supplied → package.idempotency_key →
  ${parent_buyer_ref}-${index}

adaptPackageRequestForV2 gains an optional second argument
PackageAdapterContext ({ parentBuyerRef?, index? }) so callers threading
per-package derivation supply the parent's reference + index.
Backward-compatible — existing single-argument callers (update_media_buy
adapter, third parties) continue to work without derivation.

The v2.5 adapter-conformance test suite (#1121) flips create_media_buy
from a known-drift expected_failures fixture to a passing fixture. 7
new unit tests pin the derivation rules, including a replay-stability
test that asserts identical inputs produce identical buyer_refs.

Lib regression: 5485 pass / 7 skipped (pre-existing) / 0 fail.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@github-actions github-actions Bot mentioned this pull request May 1, 2026
bokelley added a commit that referenced this pull request May 1, 2026
The warn-only post-adapter v2.5 validation pass shipped in #1121 ran on
every v2-detected request but its drift entries had nowhere to go —
SingleAgentClient call sites passed no debugLogs array, so the warning
silently dropped on the floor. Adapter regressions could land in
production unnoticed until a v2 seller reported a wire-shape rejection.

Both executeAndHandle and executeTask now collect drift into a local
array, then merge into result.debug_logs after executor.executeTask
returns. Adopters reading result.debug_logs see post-adapter v2.5
warnings alongside the executor's own logs, so a malformed adapted
shape becomes a debuggable signal instead of an invisible bug.

No public API change — executor.validateAdaptedRequestAgainstV2 already
accepted an optional debugLogs parameter; only the call sites changed.

End-to-end test verifies sync_creatives (known-drift, #1116) emits a
warning entry for v2-detected agents, clean payloads emit nothing, and
v3-detected agents never trigger the v2.5 pass.

Closes the observability hole deferred in the v2.5 foundation PR.
Lays groundwork for the broader compatibility-matrix work that needs
reliable drift signal across version pairs.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
bokelley added a commit that referenced this pull request May 1, 2026
* feat(types): TypeScript codegen for AdCP v2.5 wire shape

Adds @adcp/sdk/types/v2-5 — request/response interfaces for every tool
in the v2.5 schema bundle (13 tools across media-buy, creative, signals
protocols). Foundation for the adapter-registry refactor where adapter
signatures become (V3Request) => V25Request and wire-format bugs
become TypeScript errors instead of runtime warnings.

scripts/generate-v2-5-types.ts compiles every v2.5 tool as a single
mega-schema with shared `definitions` and runs json-schema-to-typescript
once. The mega-schema approach naturally deduplicates shared types
(BrandID, FormatID, AssetContentType, etc) instead of producing
per-tool copies that collide at the type level — what tripped up the
first attempt with per-tool compilation.

Output: src/lib/types/v2-5/tools.generated.ts (4226 LOC, 164 exports,
clean tsc check). Checked in alongside src/lib/types/tools.generated.ts
for v3. CI's "Validate generated files in sync" step runs both v3 and
v2.5 generation, so a forgotten regeneration after a schema refresh
fails the build.

scripts/generate-types.ts: enforceStrictSchema is now exported so the
v2.5 generator can apply the same JSON-Schema preprocessing (strip
additionalProperties:true, drop if/then/else conditionals, recurse
into combinators). No v3 behavior change.

package.json:
  - exports./types/v2-5 → dist/lib/types/v2-5/index
  - typesVersions entry for ./types/v2-5
  - generate-types:v2.5 + generate-types:all umbrella

ci.yml: validate-step now also runs generate-types:v2.5 and diffs the
v2-5 directory.

Test: dist artifacts present, declarations include all 13 tools'
request/response, package.json exports the path. 5555 lib tests pass /
7 pre-existing skipped / 0 fail.

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

* feat(client): surface v2.5 drift via result.debug_logs

The warn-only post-adapter v2.5 validation pass shipped in #1121 ran on
every v2-detected request but its drift entries had nowhere to go —
SingleAgentClient call sites passed no debugLogs array, so the warning
silently dropped on the floor. Adapter regressions could land in
production unnoticed until a v2 seller reported a wire-shape rejection.

Both executeAndHandle and executeTask now collect drift into a local
array, then merge into result.debug_logs after executor.executeTask
returns. Adopters reading result.debug_logs see post-adapter v2.5
warnings alongside the executor's own logs, so a malformed adapted
shape becomes a debuggable signal instead of an invisible bug.

No public API change — executor.validateAdaptedRequestAgainstV2 already
accepted an optional debugLogs parameter; only the call sites changed.

End-to-end test verifies sync_creatives (known-drift, #1116) emits a
warning entry for v2-detected agents, clean payloads emit nothing, and
v3-detected agents never trigger the v2.5 pass.

Closes the observability hole deferred in the v2.5 foundation PR.
Lays groundwork for the broader compatibility-matrix work that needs
reliable drift signal across version pairs.

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

* fix(types): collapse numbered duplicate types in v2.5 codegen

json-schema-to-typescript emits Foo, Foo1, Foo2 when the same enum or
type is referenced from multiple places. Reuse the existing
removeNumberedTypeDuplicates pass from generate-types.ts so v2.5 ships
a single canonical export per concept.

32 numbered duplicates collapse — FormatID11 and friends are gone, and
the generated bundle drops ~570 lines of redundant declarations.

Two distinct degenerate fillers (UpdateMediaBuyRequest1 +
ProvidePerformanceFeedbackRequest1) survive because their bodies are
genuinely different from the canonical name; the dedupe pass correctly
preserves them rather than silently merging incompatible types.

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

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
bokelley added a commit that referenced this pull request May 1, 2026
…inned response validation

Two bugs surfaced by smoking the live Wonderstruck v2.5 sales agent.
Both silently broke every v3 buyer calling a v2.5 seller.

1. SingleAgentClient field-stripping aliased brand_manifest → brand
   without checking the destination's declared type. v2.5 sellers
   declare brand as anyOf[object, null] (BrandReference). The v2 adapter
   produces brand_manifest: 'https://...' (string). Aliasing dropped the
   string into the object slot and Wonderstruck rejected with `Input
   should be a valid dictionary or instance of BrandReference`.

   Fix: valueMatchesSchemaType helper introspects the destination's
   declared shape (recursing into anyOf/oneOf) and only applies the
   alias when the value's runtime type is compatible. Legacy v2 sellers
   (brand: type:'string') still route correctly; v2.5 sellers
   (brand: type:'object') skip the alias and let field-stripping drop
   the v2-shaped value cleanly.

2. TaskExecutor.validateResponseSchema always validated against
   this.config.adcpVersion (v3). v2.5 sellers return correctly-shaped
   v2.5 responses; SDK falsely rejected them as malformed v3 with
   errors like `pricing_options must NOT have fewer than 1 items` and
   `reporting_capabilities required`.

   Fix: derive validationVersion from lastKnownServerVersion. v2 →
   validate against 'v2.5'; otherwise default. Symmetric to the
   post-adapter request pass from #1121.

Together: every v3 buyer using getProducts against a v2.5 agent now
goes through end-to-end. Drift between v2.5 spec and seller behavior
still surfaces via result.debug_logs (per #1133) so adopters see real
seller deviations without the SDK conflating them with version
artifacts.

Surfaced by scripts/smoke-wonderstruck-v2-5.ts (not committed; lives in
.context for ongoing testing). Five follow-up issues filed in tracker
for capability-detection drift, supported_macros oneOf cascade, and
list_authorized_properties undefined-return.

Tests: 3 new tests pin both fixes. v2.5 seller schema (anyOf object|null)
gets the alias guard; legacy string-typed brand still aliases. Direct
seam test on validateResponse with version='v2.5' confirms v2.5 shape
validates clean. 5507 lib tests pass / 7 pre-existing skipped / 0 fail
(2 cancelled are pre-existing CLI test flakes, pass clean in isolation).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
bokelley added a commit that referenced this pull request May 1, 2026
…inned response validation (#1137)

Two bugs surfaced by smoking the live Wonderstruck v2.5 sales agent.
Both silently broke every v3 buyer calling a v2.5 seller.

1. SingleAgentClient field-stripping aliased brand_manifest → brand
   without checking the destination's declared type. v2.5 sellers
   declare brand as anyOf[object, null] (BrandReference). The v2 adapter
   produces brand_manifest: 'https://...' (string). Aliasing dropped the
   string into the object slot and Wonderstruck rejected with `Input
   should be a valid dictionary or instance of BrandReference`.

   Fix: valueMatchesSchemaType helper introspects the destination's
   declared shape (recursing into anyOf/oneOf) and only applies the
   alias when the value's runtime type is compatible. Legacy v2 sellers
   (brand: type:'string') still route correctly; v2.5 sellers
   (brand: type:'object') skip the alias and let field-stripping drop
   the v2-shaped value cleanly.

2. TaskExecutor.validateResponseSchema always validated against
   this.config.adcpVersion (v3). v2.5 sellers return correctly-shaped
   v2.5 responses; SDK falsely rejected them as malformed v3 with
   errors like `pricing_options must NOT have fewer than 1 items` and
   `reporting_capabilities required`.

   Fix: derive validationVersion from lastKnownServerVersion. v2 →
   validate against 'v2.5'; otherwise default. Symmetric to the
   post-adapter request pass from #1121.

Together: every v3 buyer using getProducts against a v2.5 agent now
goes through end-to-end. Drift between v2.5 spec and seller behavior
still surfaces via result.debug_logs (per #1133) so adopters see real
seller deviations without the SDK conflating them with version
artifacts.

Surfaced by scripts/smoke-wonderstruck-v2-5.ts (not committed; lives in
.context for ongoing testing). Five follow-up issues filed in tracker
for capability-detection drift, supported_macros oneOf cascade, and
list_authorized_properties undefined-return.

Tests: 3 new tests pin both fixes. v2.5 seller schema (anyOf object|null)
gets the alias guard; legacy string-typed brand still aliases. Direct
seam test on validateResponse with version='v2.5' confirms v2.5 shape
validates clean. 5507 lib tests pass / 7 pre-existing skipped / 0 fail
(2 cancelled are pre-existing CLI test flakes, pass clean in isolation).

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