Repository navigation
refactor(client): drop unnecessary debug_logs cast at v2.5 drift merge sites - #1133
Merged
Merged
Conversation
This was referenced May 1, 2026
…e sites
debug_logs is already declared on TaskResultBase, so result.debug_logs
is directly typed — the (result as { debug_logs?: any[] }) cast was
redundant. Replaced with direct assignment + nullish coalescing on the
existing read.
Also documented drop-on-error semantics in the changeset: drift is
merged after executor.executeTask returns; if the executor throws,
pre-call drift is dropped, matching the executor's own debug-log
behavior.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
bokelley
force-pushed
the
bokelley/v2.5-debug-surface
branch
from
May 1, 2026 09:10
68380f6 to
fc20eaa
Compare
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]>
Merged
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]>
3 tasks done
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
The
surface v2.5 drift via result.debug_logsfeature shipped as part of #1134's squash merge. After rebasing, the only remaining work on this PR is a small cleanup: drop the redundant(result as { debug_logs?: any[] })cast at the merge sites.debug_logs?: any[]is already declared onTaskResultBase, soresult.debug_logsis directly typed — the cast was unnecessary. Replaced with direct assignment + nullish coalescing on the existing read.Also documented drop-on-error semantics in the changeset: drift is merged after
executor.executeTaskreturns; if the executor throws, pre-call drift is dropped, matching the executor's own debug-log behavior.Test plan
npm run typecheckcleanNODE_ENV=test node --test test/lib/v2-5-drift-surfacing.test.js— 3/3 pass