Repository navigation
feat(client): default response validation to warn everywhere — closes #1150 - #1172
Merged
Merged
Conversation
…1150 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]>
5 tasks done
bokelley
pushed a commit
that referenced
this pull request
May 1, 2026
…dation Both tests assert the inverse property — a known-broken adapter MUST be detected. PR #1172 changed the default from strict to warn, which caused validateResponseSchema to return {valid:true} on any schema failure, making the regressed adapter appear conformant. Adding validation:{responses:'strict'} restores the abort-and-fail path these tests depend on. https://claude.ai/code/session_01NoBpco1uzkHV4Ei9TFoR49
bokelley
added a commit
that referenced
this pull request
May 1, 2026
#1144) (#1165) * feat(decisioning): AccountToolContext + refreshToken hook (#1145 Gaps 1+2) Gap 1: thread resolved Account<TCtxMeta> into getAccountFinancials via new AccountToolContext<TCtxMeta> (strict superset of ResolveContext). Adopters read ctx.account.ctx_metadata directly — no re-resolve from req.account. Resolves 7-adapter pain point (snap, meta, amazon, citrusad, criteo, pinterest, universalads) that stubbed getAccountFinancials to UNSUPPORTED_FEATURE because the v6 surface didn't thread Account through. Breaking for v6.x adopters who already implemented getAccountFinancials — update the second arg type. Resolve null surfaces ACCOUNT_NOT_FOUND (terminal) before the platform method runs. Gap 2: optional AccountStore.refreshToken(account, 'auth_required') mid-request token refresh. When a platform method throws AdcpError({ code: 'AUTH_REQUIRED' }), framework calls the hook, mutates account.authInfo.token, retries the call exactly once. In-flight scope only — refreshed tokens not echoed to buyer. Refresh-hook failure surfaces correctable AUTH_REQUIRED so buyer re-links via UI. Wired into getAccountFinancials dispatch; broader site wiring is incremental. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(storyboard): peer_substitutes_for declared-substitute opt-in (#1144) Stateful steps can declare peer_substitutes_for: <step_id> | <step_id>[] on the substitute step to opt into substitute-aware cascade deferral. When a stateful step skips with missing_tool / missing_test_controller AND a peer in the same phase declares it as a substitute, the runner defers the cascade decision to phase end and waives it iff the declared substitute passes. Contract hygiene + diagnostic improvement, NOT a fix for the 1/9/0 adopter cluster (those are wrong-storyboard / phase-independence issues tracked separately at adcp-client#1161). Tightens the implicit "phase membership = substitutability" rule the F6 fix relied on so future storyboards with multi-stateful-step phases can't silently rescue non-substitutes. Cascade-detail messages name the declared substitute that didn't pass so 1/9/0 reports show the substitution chain. Loader rejects cross-phase references, self-references, and non-stateful targets at parse time. Legacy not_applicable any-peer rescue unchanged. Companion spec change required at adcontextprotocol/adcp (filed as #3734) before any storyboard exercises the new path. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(decisioning): address review feedback on PR #1165 Security: refresh-failure error message no longer echoes upstream exception text on the wire. Inner exceptions routinely embed refresh- token prefixes, internal hostnames, and OAuth provider error codes; buyer gets a fixed message + correctable recovery, adopters log details server-side. (security-reviewer finding) Correctness: AuthPrincipal.expiresAt? added so the framework's write of the refreshed expiry is reachable to adopters reading the resolved Account. Previously cast to a phantom field. (code-reviewer finding) Docs: - AccountToolContext docstring clarifies it is getAccountFinancials- only and explicitly does NOT apply to reportUsage (multi-account- per-row by wire shape). (protocol-reviewer finding) - refreshToken docstring documents Account-object identity contract (cached Account = bug; return fresh from resolve()), concurrency expectations (adopter coalesces, framework does not), wire-leak policy on refresh failure, and the open-string-union convention for the reason param. - Removed orphaned duplicate doc comment block above ResolvedAuthInfo. (code-reviewer nit) Tests added: - Retry that also throws AUTH_REQUIRED bubbles without a third call (refresh fires exactly once). (code-reviewer gap) - Refresh-failure wire envelope does NOT echo upstream OAuth error text — asserts inner refresh-token prefix, internal hostname, and provider error code are scrubbed. (security-reviewer gap) - Successful refresh writes expiresAt onto account.authInfo (proves the new field is reachable end-to-end). - Loader validation: self-reference, empty-string array entry, non-stateful target, non-stateful substitute — all rejected at parse time. (code-reviewer gap: 4 of 5 rules previously untested) Deferred (raised in review, not blocking merge): - peer_substitutes_for direction vs. AdCP cross-step grammar (provides_state_for vs. peer_substitutes_for naming) — raise on adcp#3734 spec discussion. - RefreshConfig<TCtxMeta> generic propagation so refresh hooks see typed ctx_metadata — minor; follow-up issue. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * test(v2-adapter): update sync_creatives drift fixture post #1118 PR #1118 (a6865c3, "flatten v3 manifest assets to v2.5 single-asset payload") closed the primary manifest-shape leak but the conformance fixture's expected_failures.pointers wasn't updated to match the new drift signature. Fixture comment literally says "If the failure mode changed, update or remove this fixture." Adapter now flattens role-keyed manifest to a single-asset shape, but the flattened shape's flat keys (asset_type, url, width, height, duration_ms) still don't satisfy v2.5's single-asset-payload oneOf — v2.5 expects a different envelope. Pin the fixture to the post-#1118 drift signature so a follow-up adapter fix surfaces as an unexpected pass. Unrelated to this PR's #1144/#1145 work but blocking CI. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * test(runner): opt regression-detector tests into strict response validation Both tests assert the inverse property — a known-broken adapter MUST be detected. PR #1172 changed the default from strict to warn, which caused validateResponseSchema to return {valid:true} on any schema failure, making the regressed adapter appear conformant. Adding validation:{responses:'strict'} restores the abort-and-fail path these tests depend on. https://claude.ai/code/session_01NoBpco1uzkHV4Ei9TFoR49 --------- 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
* docs(development): wire-version compat playbook Codifies the recipe for the v2.5 work that landed this round: * schema cache (sync-v2-5-schemas.ts → schemas/cache/v2.5/) * codegen (generate-v2-5-types.ts → src/lib/types/v2-5/) * adapter registry (src/lib/adapters/legacy/v2-5/, AdapterPair) * version-pinned validation (TaskExecutor.validateResponseSchema) * drift surface (validateAdaptedRequestAgainstV2 → result.debug_logs) * warn-by-default response validation (#1172) * conformance fixtures + smoke harness Future contributors adding a new legacy compat shim — most likely when the SDK pin moves to v4 and v3 sellers need ongoing support — copy the v2.5 directory shape and walk through nine numbered steps. Each step maps to a discrete commit; the doc names the files to touch and the patterns to follow. Also explains the N=1 "active legacy shim" framing (vs N×M matrix) that motivated naming the directory `legacy/v2-5/` rather than `v3-to-v2-5/` — matches OpenRTB / Prebid / GAM precedent and prevents encoding a maintenance burden nobody will staff. Index hooks added in CLAUDE.md and AGENTS.md so future contributors discover the doc when they touch any of the three layered surfaces. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs(development): expert-review fixups on wire-version compat playbook Synthesizes feedback from four parallel reviewers (docs, dx, ad-tech-protocol, code-reviewer): - Fix line citation: TaskExecutor.ts ~1835 → ~1844 (code-reviewer). - Soften N=1 framing: industry precedent is mixed (OpenRTB 2.x and 3.0 coexist for years; Prebid carries multiple version mappings), not the uniform pattern the original draft implied. Re-frame as "we choose N=1 because we can't staff N×M, not because the industry has converged" (protocol expert). - Step 5 (dispatch generalization): replace hand-wavy `selectAdapterRegistry` reference with a concrete map-based pattern + name `get_adcp_capabilities.adcp_version` as the preferred detection channel (string-matching `tools/list` is shape-sniffing, not declaration; AdCP 3.0+ sellers expose the version explicitly). Show the actual function shape so contributors don't hallucinate signatures (DX + protocol). - Step 4: explicitly call out that `utils/*-adapter.ts` files are v2.5-locked despite their unversioned names. Don't add v4 branches — per-version `utils/<tool>-adapter-v<X>.ts` is the right path (DX). - Step 6: replace contradictory ternary fall-through with a map-based validation pin that mirrors step 5's registry map (DX). - Step 8a: add mock-server escape hatch for the common v3→v4 case where no live seller exists yet. Two paths — stand up a `createAdcpServer` fixture under `test/fixtures/`, or round-trip the adapter against the schema bundle. Use both when you can (DX). - AdapterPair asymmetry: add a section on lossy fields, direction inversion for newer-than-pin sellers, and the optional `unsupported?` discriminant to grow into when a real case needs it (protocol). - Deprecation runway: commit to "one major-version overlap or 12 months, whichever longer" rather than leaving "deprecation notice + version" undefined (protocol). - Sunsetting subsection: spell out the four-step deletion mechanic (announce, switch detection to typed rejection, delete the directory, bump major) so future contributors know what "shim sunsets" actually means (docs). - Anti-patterns subsection: name the six common mistakes (branching v2.5 helpers, skipping validation pinning, sharing fixtures across versions, bumping ADCP_VERSION in the same PR, omitting numbered- duplicate dedupe, bypassing _provenance.json) (DX). - Time estimate: ~1 week with live seller, ~2 weeks without (DX). - Cross-link from PROTOCOL_DIFFERENCES.md back to the playbook (docs). Doc grew from ~250 to ~390 lines. The increases are concentrated in the recipe steps and the new "Sunsetting" + "Anti-patterns" sections — all of which are load-bearing for contributors and impossible to infer from the code alone. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs(development): prune dispatch maps when sunsetting a shim One-line nit from docs-expert follow-up — the sunset deletion list needs to mention pruning REGISTRY_BY_VERSION (step 5) and SCHEMA_BUNDLE_BY_VERSION (step 6) entries. A stale map entry pointing at a deleted registry compiles fine but blows up at runtime. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * chore: empty changeset — playbook is docs-only --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
bokelley
added a commit
that referenced
this pull request
May 1, 2026
* docs(development): wire-version compat playbook Codifies the recipe for the v2.5 work that landed this round: * schema cache (sync-v2-5-schemas.ts → schemas/cache/v2.5/) * codegen (generate-v2-5-types.ts → src/lib/types/v2-5/) * adapter registry (src/lib/adapters/legacy/v2-5/, AdapterPair) * version-pinned validation (TaskExecutor.validateResponseSchema) * drift surface (validateAdaptedRequestAgainstV2 → result.debug_logs) * warn-by-default response validation (#1172) * conformance fixtures + smoke harness Future contributors adding a new legacy compat shim — most likely when the SDK pin moves to v4 and v3 sellers need ongoing support — copy the v2.5 directory shape and walk through nine numbered steps. Each step maps to a discrete commit; the doc names the files to touch and the patterns to follow. Also explains the N=1 "active legacy shim" framing (vs N×M matrix) that motivated naming the directory `legacy/v2-5/` rather than `v3-to-v2-5/` — matches OpenRTB / Prebid / GAM precedent and prevents encoding a maintenance burden nobody will staff. Index hooks added in CLAUDE.md and AGENTS.md so future contributors discover the doc when they touch any of the three layered surfaces. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs(development): expert-review fixups on wire-version compat playbook Synthesizes feedback from four parallel reviewers (docs, dx, ad-tech-protocol, code-reviewer): - Fix line citation: TaskExecutor.ts ~1835 → ~1844 (code-reviewer). - Soften N=1 framing: industry precedent is mixed (OpenRTB 2.x and 3.0 coexist for years; Prebid carries multiple version mappings), not the uniform pattern the original draft implied. Re-frame as "we choose N=1 because we can't staff N×M, not because the industry has converged" (protocol expert). - Step 5 (dispatch generalization): replace hand-wavy `selectAdapterRegistry` reference with a concrete map-based pattern + name `get_adcp_capabilities.adcp_version` as the preferred detection channel (string-matching `tools/list` is shape-sniffing, not declaration; AdCP 3.0+ sellers expose the version explicitly). Show the actual function shape so contributors don't hallucinate signatures (DX + protocol). - Step 4: explicitly call out that `utils/*-adapter.ts` files are v2.5-locked despite their unversioned names. Don't add v4 branches — per-version `utils/<tool>-adapter-v<X>.ts` is the right path (DX). - Step 6: replace contradictory ternary fall-through with a map-based validation pin that mirrors step 5's registry map (DX). - Step 8a: add mock-server escape hatch for the common v3→v4 case where no live seller exists yet. Two paths — stand up a `createAdcpServer` fixture under `test/fixtures/`, or round-trip the adapter against the schema bundle. Use both when you can (DX). - AdapterPair asymmetry: add a section on lossy fields, direction inversion for newer-than-pin sellers, and the optional `unsupported?` discriminant to grow into when a real case needs it (protocol). - Deprecation runway: commit to "one major-version overlap or 12 months, whichever longer" rather than leaving "deprecation notice + version" undefined (protocol). - Sunsetting subsection: spell out the four-step deletion mechanic (announce, switch detection to typed rejection, delete the directory, bump major) so future contributors know what "shim sunsets" actually means (docs). - Anti-patterns subsection: name the six common mistakes (branching v2.5 helpers, skipping validation pinning, sharing fixtures across versions, bumping ADCP_VERSION in the same PR, omitting numbered- duplicate dedupe, bypassing _provenance.json) (DX). - Time estimate: ~1 week with live seller, ~2 weeks without (DX). - Cross-link from PROTOCOL_DIFFERENCES.md back to the playbook (docs). Doc grew from ~250 to ~390 lines. The increases are concentrated in the recipe steps and the new "Sunsetting" + "Anti-patterns" sections — all of which are load-bearing for contributors and impossible to infer from the code alone. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs(development): prune dispatch maps when sunsetting a shim One-line nit from docs-expert follow-up — the sunset deletion list needs to mention pruning REGISTRY_BY_VERSION (step 5) and SCHEMA_BUNDLE_BY_VERSION (step 6) entries. A stale map entry pointing at a deleted registry compiles fine but blows up at runtime. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * chore: empty changeset — playbook is docs-only --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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.
Closes #1150.
Summary
Client-side response validation now defaults to
warneverywhere instead ofstrictin dev/test andwarnin prod. With #1137's version-pinned validator, the dev/test default rejected legitimate v2.5-shaped responses on minor schema drift and threw away the actual data — leaving buyers staring at "0 products" with no useful signal.Why
Three things landed today (#1133/#1137/#1143/#1118) that changed the v2.5 client-side picture:
result.debug_logsnow carries every validation drift entry. Adopters can see what went wrong without losing the response payload.pricing_options, enum mismatches), so accurate validation now produces more rejections.In that context, hard-failing on dev/test against schema drift the seller can't realistically avoid is the wrong default. Warn-by-default keeps
result.dataflowing and routes drift todebug_logs.Server-side unchanged
createAdcpServerkeeps itsresponses: 'strict'default in dev/test/CI — that catches our own handler-output bugs (a different concern from "seller wrote a slightly off-spec response"). The change is client-side only.Opt back in
Conformance harnesses, third-party validators, paranoid CI runs:
Explicit config still wins over the new default.
Side fix
adapter-v2-5-conformance.test.jshad a stale expected-failure pointer for sync_creatives — #1118 changed the failure surface. Updated the fixture and added a comment that #1118's flatten direction may be inverted (v2.5creative-asset.jsondeclaresassetsas a role-keyed manifest object, same as v3). Worth a follow-up to confirm seller-runtime expectation vs spec.Test plan
npm run test:lib— 5635/5642 pass / 7 skipped / 0 failresolveValidationModestest updated to verify warn-by-default across all NODE_ENV valuesvalidation: { responses: 'strict' }and override the new default🤖 Generated with Claude Code