Skip to content

test(codegen): lock deprecation-decorator generation on deprecated JSON Schema properties#781

Draft
bokelley wants to merge 2 commits into
mainfrom
claude/issue-778-codegen-deprecation-contract
Draft

test(codegen): lock deprecation-decorator generation on deprecated JSON Schema properties#781
bokelley wants to merge 2 commits into
mainfrom
claude/issue-778-codegen-deprecation-contract

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Closes #778

Adds a CI gate that asserts "deprecated": true in the JSON Schema source propagates to deprecated=True on Pydantic v2 FieldInfo through the pinned datamodel-code-generator==0.56.1 codegen pipeline.

Motivation: The expert review on adcontextprotocol/adcp#4904 (AdCP 3.1 additive-deprecate of CreateMediaBuySuccess.status / UpdateMediaBuySuccess.status) flagged that datamodel-code-generator has historically had uneven deprecated keyword support across versions — older pinned versions silently drop it. This test locks the contract so regressions are caught in CI rather than in production.

What changed:

  • New tests/test_codegen_deprecation_contract.py with 4 assertions covering existing deprecated fields in the 3.0.7 schema bundle:
    • TargetingOverlay.axe_include_segment / .axe_exclude_segment (core schema class)
    • GetSignalsRequest.max_results
    • ProductFilters.required_axe_integrations
  • Shared _assert_field_deprecated() helper with a failure message that points back to the codegen pin
  • Commented-out block documenting the pending AdCP 3.1 anchor cases (CreateMediaBuySuccessResponse.status, UpdateMediaBuySuccessResponse.status) for easy activation after adcp#4904 schema sync

What tested:

  • pytest tests/test_codegen_deprecation_contract.py — 4 passed
  • pytest tests/ — 4734 passed, 1 pre-existing network test skipped (test_real_tls_handshake_still_validates_hostname in the signing conformance suite, unrelated to this change)
  • ruff check — clean
  • python -m mypy src/adcp/ — success, 805 source files, no issues

Pre-PR review:

  • code-reviewer: approved — 2 nits fixed (duplicate docstring bullet removed, pending import updated from adcp.types.aliases to adcp.types)
  • ad-tech-protocol-expert: approved after blocker fixed — corrected inaccurate comment claiming one assertion covers all four bundled schema occurrences (public TargetingOverlay resolves to the core schema class, not the structurally identical bundled variants)

Triage-managed PR. This bot does not currently iterate on
review comments or PR conversation threads (only on the source
issue). To unblock:

  • Push fixup commits directly: gh pr checkout <num>
    fix → push.
  • Or re-trigger: comment /triage execute on the source
    issue.

See adcp#3121
for context.

Session: https://claude.ai/code/session_0169cPJV4qE4hxoLvkJsm2mg


Generated by Claude Code

claude added 2 commits May 21, 2026 16:48
…ON Schema properties

Adds CI gate asserting that JSON Schema ``deprecated: true`` is propagated
to ``deprecated=True`` on Pydantic v2 field metadata by the pinned
datamodel-code-generator==0.56.1.  Catches silent regressions from codegen
pin bumps or schema refreshes that drop the deprecation marker.

Anchor cases (AdCP 3.0 schemas): TargetingOverlay.axe_include_segment /
axe_exclude_segment, GetSignalsRequest.max_results,
ProductFilters.required_axe_integrations.  Commented-out block documents
the pending 3.1 anchor cases (CreateMediaBuySuccessResponse.status,
UpdateMediaBuySuccessResponse.status) for easy activation after adcp#4904
schema sync.

Closes #778

https://claude.ai/code/session_0169cPJV4qE4hxoLvkJsm2mg
…ort in pending block

- Comment now accurately says TargetingOverlay resolves to the core
  schema class, not the bundled variants (per pre-PR expert review)
- Pending 3.1 commented-out block now imports from adcp.types (public
  API) instead of adcp.types.aliases (internal module)

https://claude.ai/code/session_0169cPJV4qE4hxoLvkJsm2mg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(codegen): lock deprecation-decorator generation on deprecated JSON Schema properties

2 participants