Skip to content

feat(compat): v2.5 list_creative_formats + preview_creative adapters; deprecate spec_compat_hooks (stage 5)#667

Merged
bokelley merged 1 commit into
mainfrom
claude/versioned-schemas-stage-5
May 11, 2026
Merged

feat(compat): v2.5 list_creative_formats + preview_creative adapters; deprecate spec_compat_hooks (stage 5)#667
bokelley merged 1 commit into
mainfrom
claude/versioned-schemas-stage-5

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Stage 5 of the versioned-schema-validation port. Follow-up to #658/#659/#664/#665.

What's in scope

Two more v2.5 adapters + the spec_compat_hooks deprecation warning.

New adapters

  • list_creative_formats — request pass-through. Response rewrites v2.5 top-level width/height/dimensions into the v3 renders: [{render_id, role, dimensions}] array. Handles template formats (no dims), bare-array responses, and v3-already-shape (idempotent).
  • preview_creative — request pass-through. Response renames v2.5 output_id/output_role to v3 render_id/role on every preview render. v3 names win when both present (half-migrated servers don't double-translate). Single-response and batch-response shapes both handled.

Direct ports of src/lib/utils/format-renders.ts and src/lib/utils/preview-normalizer.ts in the JS SDK.

spec_compat_hooks() deprecation

Calling spec_compat_hooks() now emits a DeprecationWarning pointing at adcp.compat.legacy. The implementation moved into a private _spec_compat_hooks_impl so the existing test suite can exercise the legacy behaviour without poisoning pytest's warning filters. Removal target: 6.0.

Stage 5b will

Port the remaining three v2.5 adapters:

  • get_products — relies on pricing-adapter.ts (~400 lines in JS, handles fixed_pricerate, floor_priceprice_guidance.floor, is_fixed discriminator)
  • create_media_buy and update_media_buy — share creative-adapter.ts (~300 lines in JS, handles creative_idscreative_assignments, null-array coercion, proposal-mode lossy handling)

Each deserves its own PR for reviewer audit.

Stage 4b will

Bundle the real v2.5 JSON schemas (pinned GitHub SHA) so the dispatcher can validate buyer input against v2.5 before the adapter runs. Today the dispatcher only validates the adapter output (against v3).

Test plan

  • pytest tests/ -q --ignore=tests/integration — 4475 passed
  • 22 new tests across three new files
  • ruff check + mypy src/
  • DeprecationWarning fires exactly once per spec_compat_hooks() call
  • Existing tests at test_spec_compat_hooks.py migrated to use _spec_compat_hooks_impl (no warning noise)

🤖 Generated with Claude Code

… deprecate spec_compat_hooks

Stage 5 of the versioned-schema-validation port.

Two more v2.5 adapters, plus the deprecation warning on the legacy hook
factory. The remaining three adapters (``get_products``,
``create_media_buy``, ``update_media_buy``) ship in Stage 5b — they
depend on substantial pricing-adapter and creative-adapter helper
ports that warrant their own audit.

New adapters:

* ``list_creative_formats``: request pass-through; response rewrites
  v2.5 top-level ``width``/``height``/``dimensions`` into the v3
  ``renders: [{render_id, role, dimensions}]`` array.
* ``preview_creative``: request pass-through; response renames
  ``output_id``/``output_role`` to ``render_id``/``role`` on every
  preview render.

Direct ports of ``src/lib/utils/format-renders.ts`` and
``src/lib/utils/preview-normalizer.ts`` in the JS SDK.

``spec_compat_hooks()`` now emits a DeprecationWarning pointing at
``adcp.compat.legacy``. The implementation moved into a private
``_spec_compat_hooks_impl`` so the existing test suite can exercise
the legacy behaviour without poisoning pytest's warning filters.
Removal target: 6.0.

Tests:
* 10 list_creative_formats tests
* 10 preview_creative tests
* 2 deprecation tests

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley merged commit fec91d6 into main May 11, 2026
16 checks passed
@bokelley bokelley deleted the claude/versioned-schemas-stage-5 branch May 11, 2026 11:04
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