Repository navigation
fix(client): unblock v2.5 sellers — brand alias type guard + response validation version pin - #1137
Merged
Merged
Conversation
…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
force-pushed
the
bokelley/v2.5-seller-fixes
branch
from
May 1, 2026 09:11
df04566 to
51ce790
Compare
This was referenced May 1, 2026
bokelley
added a commit
that referenced
this pull request
May 1, 2026
scripts/smoke-wonderstruck-v2-5.ts — read-only harness that calls the Wonderstruck v2.5 MCP agent through the SDK and reports any drift the post-adapter validation pass observes via result.debug_logs. Surfaced the three issues filed today: #1148 (list_authorized_properties throws), #1149 (null envelope fields rejected), #1150 (response validation should be warn-only). scripts/probe-wonderstruck-brand-schema.ts — inspects tools/list to pull the actual brand declaration from the agent's tool schema cache. Used while writing the v2.5 brand-alias type guard in #1137. Both scripts read SALES_AGENTS_CONFIG from .env. No tests or new dependencies. Live under scripts/ alongside generate-types and other dev utilities. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
3 tasks done
bokelley
added a commit
that referenced
this pull request
May 1, 2026
…1150 (#1172) Client-side response validation previously defaulted to strict in dev/test and warn in prod. With #1137's version-pinned validator, that asymmetry made v2.5 sellers' perfectly valid v2.5-shaped responses strictly fail in dev/test even though they'd succeed in prod — buyers got `0 products` with the actual data discarded. Flip the dev/test default to match prod: warn everywhere. Drift still surfaces via `result.debug_logs` (the channel #1133 plumbed). Buyers who want hard-stop validation opt in via `validation: { responses: 'strict' }` — explicit config still wins. Server-side `createAdcpServer` is unchanged — handler-side validation stays strict in dev/test/CI to catch our own handler-output bugs. Side fix: update `adapter-v2-5-conformance.test.js` to match the post-#1118 sync_creatives drift surface; pinned the failing pointer to `/creatives/0/assets/asset_type` and noted that #1118's flatten may have inverted the v2.5 schema expectation (creative-asset.json declares `assets` as a role-keyed manifest object, same as v3 — the flat shape #1118 now emits fails patternProperties validation). Worth a follow-up to confirm the seller-runtime expectation vs the spec. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
bokelley
added a commit
that referenced
this pull request
May 1, 2026
scripts/smoke-wonderstruck-v2-5.ts — read-only harness that calls the Wonderstruck v2.5 MCP agent through the SDK and reports any drift the post-adapter validation pass observes via result.debug_logs. Surfaced the three issues filed today: #1148 (list_authorized_properties throws), #1149 (null envelope fields rejected), #1150 (response validation should be warn-only). scripts/probe-wonderstruck-brand-schema.ts — inspects tools/list to pull the actual brand declaration from the agent's tool schema cache. Used while writing the v2.5 brand-alias type guard in #1137. Both scripts read SALES_AGENTS_CONFIG from .env. No tests or new dependencies. Live under scripts/ alongside generate-types and other dev utilities. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
bokelley
added a commit
that referenced
this pull request
May 1, 2026
* chore(scripts): commit v2.5 drift smoke + brand-schema probe scripts/smoke-wonderstruck-v2-5.ts — read-only harness that calls the Wonderstruck v2.5 MCP agent through the SDK and reports any drift the post-adapter validation pass observes via result.debug_logs. Surfaced the three issues filed today: #1148 (list_authorized_properties throws), #1149 (null envelope fields rejected), #1150 (response validation should be warn-only). scripts/probe-wonderstruck-brand-schema.ts — inspects tools/list to pull the actual brand declaration from the agent's tool schema cache. Used while writing the v2.5 brand-alias type guard in #1137. Both scripts read SALES_AGENTS_CONFIG from .env. No tests or new dependencies. Live under scripts/ alongside generate-types and other dev utilities. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * chore: empty changeset — smoke harness scripts are not published * fix(scripts): drop dead listAuthorizedProperties probe — v3 uses getCapabilities The smoke probe was calling agent.listAuthorizedProperties via optional chaining, which returned undefined (the method doesn't exist on AgentClient — list_authorized_properties was replaced by getCapabilities() in v3, see property-crawler.ts:141). Replaced with a direct executeTask('list_authorized_properties') probe so v2.5 sellers that still expose the underlying tool can be tested. Closes #1148. --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Merged
3 tasks done
bokelley
added a commit
that referenced
this pull request
May 1, 2026
…jv (#1149) (#1158) * fix(validation): strip null on optional v2.x envelope fields before Ajv v2.5 sellers (Pydantic-origin) emit errors/context/ext as null instead of omitting them. The v2.5 schemas declare these as type:array/object without a null union, so Ajv spuriously rejects them post-#1137's version-pinned validator. Adds stripEnvelopeNulls() that removes top-level optional fields with null values and non-nullable declared types before the Ajv pass. Gated to v2.x bundles via parseAdcpMajorVersion() — v3 errors is required on failure branches and must not be silently stripped. Closes #1149 https://claude.ai/code/session_01H9wytvzmHPVPdCPUYZVCte * fix(test): add v2.5-required fields to null-stripping fixture minimalGetProductsResponse needs delivery_measurement (top-level required) and is_fixed: true on the cpm pricing option (const discriminator) for the v2.5 schema to pass without stripping. Verified against upstream schemas in adcontextprotocol/[email protected] dist/schemas/2.5.3/. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude <[email protected]>
Merged
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.
Two bugs surfaced by smoke-testing the live Wonderstruck v2.5 sales agent. Both silently broke every v3 buyer calling a v2.5 seller. Highest-impact production fixes from the v2.5 stack — without these, no v3-buyer SDK call against a v2.5 seller works end-to-end.
Findings
After the foundation work (#1121, #1123, #1133, #1134) landed/queued, ran a read-only smoke against Wonderstruck (
scripts/smoke-wonderstruck-v2-5.ts). Hit two issues immediately.Bug 1 —
brand_manifest→brandaliasing dropped string into object slotSingleAgentClient's field-stripping path (added in43e6c972) renamesbrand_manifest(URL string from v2 adapter) back tobrandwhenever the agent's tool schema declaresbrand. Without checking the destination's declared type. v2.5 sellers declarebrandas aBrandReferenceobject (anyOf [{type:'object',required:['domain']}, {type:'null'}]). The string landed in the object slot and Wonderstruck rejected:Fix:
valueMatchesSchemaTypehelper recursesanyOf/oneOfand applies the alias only when the value's runtime type matches the declared shape. Legacy v2 sellers (brand: type:'string') still route correctly; v2.5 sellers (brand: type:'object') skip the alias.Bug 2 — Response validation pinned to v3 even for v2 sellers
TaskExecutor.validateResponseSchemaalways passedthis.config.adcpVersion(the SDK-pinned v3) tovalidateIncomingResponse. v2.5 sellers correctly returned v2.5-shaped responses; SDK falsely rejected:Fix: derive
validationVersionfromlastKnownServerVersion. v2 →'v2.5'; otherwise default. Symmetric to the post-adapter request pass added in #1121.Net effect
Together these unblock real-world v3-buyer ↔ v2.5-seller traffic:
get_productsagainst Wonderstrucklist_creative_formatsReal seller drift (Wonderstruck's
pricing_optionsminItems /supported_macrosoneOfdivergences) still surfaces viaresult.debug_logsper #1133, so adopters see real spec deviations without the SDK conflating them with version-mismatch artifacts.Test plan
test/lib/v2-5-seller-fixes.test.js(3 tests):brand: anyOf[object,null]and adapter produces a URL string.brand: type:'string'(no regression for the original43e6c972use case).validateResponsewithversion='v2.5'validates clean on a v2.5-shaped payload.npm run test:lib— 5507 pass / 7 pre-existing skipped / 0 fail (2 cancelled are pre-existing CLI test flakes; pass clean in isolation).NODE_ENV=production: 3/6 read-only tools work end-to-end with drift visible inresult.debug_logs. The other 3 fail for unrelated reasons (auth header, feature gate, undefined-return) — filed as separate issues.Out of scope (filed for follow-up)
get_adcp_capabilitiesagainst v2.5 sellers always fails v3 validation; SDK silently falls back to "v2 synthetic capabilities." Worse, under prod NODE_ENV the warn-mode hides the failure entirely and SDK declares v2.5 sellers as v3.list_creative_formatssupported_macros[*]fails v2.5oneOfwith ~99 issues per call. v2.5 schema vs Wonderstruck shape mismatch.list_authorized_propertiesreturns undefined and crashes the caller. Method shape needs investigation.🤖 Generated with Claude Code