Skip to content

refactor(client): drop unnecessary debug_logs cast at v2.5 drift merge sites - #1133

Merged
bokelley merged 1 commit into
mainfrom
bokelley/v2.5-debug-surface
May 1, 2026
Merged

bokelley merged 1 commit into
mainfrom
bokelley/v2.5-debug-surface

Conversation

@bokelley

@bokelley bokelley commented May 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The surface v2.5 drift via result.debug_logs feature 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 on TaskResultBase, so result.debug_logs is 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.executeTask returns; if the executor throws, pre-call drift is dropped, matching the executor's own debug-log behavior.

Test plan

  • npm run typecheck clean
  • NODE_ENV=test node --test test/lib/v2-5-drift-surfacing.test.js — 3/3 pass

…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
bokelley force-pushed the bokelley/v2.5-debug-surface branch from 68380f6 to fc20eaa Compare May 1, 2026 09:10
@bokelley bokelley changed the title feat(client): surface v2.5 drift via result.debug_logs refactor(client): drop unnecessary debug_logs cast at v2.5 drift merge sites May 1, 2026
@bokelley
bokelley merged commit 3a4c9da into main May 1, 2026
10 checks passed
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
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]>
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