Skip to content

docs(development): wire-version compat playbook - #1191

Merged
bokelley merged 4 commits into
mainfrom
bokelley/wire-version-playbook
May 1, 2026
Merged

bokelley merged 4 commits into
mainfrom
bokelley/wire-version-playbook

Conversation

@bokelley

@bokelley bokelley commented May 1, 2026

Copy link
Copy Markdown
Contributor

Capstone for the v2.5 series. Codifies the recipe future contributors will need when adding a new legacy compat shim — most concretely, when the SDK pin moves to v4 and v3 sellers need ongoing support.

What's in this PR

  • docs/development/WIRE-VERSION-COMPAT.md — the playbook itself. Covers what's already wired, the nine-step recipe for adding a new wire version (one commit per step), the N=1 vs N×M framing, the current compatibility matrix, the testing checklist, and when N=1 isn't enough.
  • CLAUDE.md — index hook so AI contributors discover the doc when touching src/lib/adapters/legacy/, src/lib/types/v*-*/, or schemas/cache/<version>/.
  • AGENTS.md — same hook in the schema-generation section.

What it codifies

Everything that landed in the v2.5 series this round:

Why N=1, not N×M

The directory tree is legacy/v2-5/, not v3-to-v2-5/. That's intentional and the doc explains why: real ad-tech compat layers (OpenRTB, Prebid, GAM) carry one active legacy shim with a deprecation runway, not a matrix. Encoding a matrix would larp a maintenance burden nobody staffs. When the SDK pin moves to v4, the v2.5 shim sunsets and a new v3 shim joins — two active shims briefly, dropping back to one when v2.5 hits end-of-support.

Test plan

  • npx prettier --check docs/development/WIRE-VERSION-COMPAT.md — clean
  • All cross-references verified against actual files (copy-schemas-to-dist.ts, resolveBundleKey, package.json#exports, the registry index, etc.)
  • No changeset (docs-only, per CLAUDE.md no-changeset criteria)

🤖 Generated with Claude Code

bokelley and others added 4 commits May 1, 2026 09:01
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]>
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]>
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]>
@bokelley
bokelley merged commit 0a411c5 into main May 1, 2026
1 check passed
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]>
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