Conversation
…helpers, subclass test Closes the final 4 items from salesagent feedback (#4, #5, #6, #11). - python -m adcp.migrate v3-to-v4: new CLI/subpackage. 9 Asset->Content renames with word-boundary regex; flags BrandManifest/DeliverTo/ Pricing/PromotedProducts/PromotedOfferings/FormatCategory/ PackageStatus, numbered Assets<N> imports, and adcp.types. generated_poc imports. Dry-run default; --apply rewrites in place; --json for CI; exit 1 on flagged findings. - ADCP_STRICT_VALIDATION env flag on AdCPBaseModel. Truthy values (1/true/yes/on) flip extra='forbid'; default stays 'ignore' for forward-compat. - get_adcp_spec_version() + get_adcp_sdk_version() split the ambiguous get_adcp_version() helper. Old name kept as an alias. - Subclass passthrough test: locks the exclude=True contract through products_response / signals_response / media_buys_response / list_creatives_response against refactors of _serialize. +49 tests, 2001 passing (1937 -> 2001), mypy clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- migrate/v3_to_v4.py: skip-dirs applied relative to root (repos under CI ancestors like /home/ci/build/repo no longer silently skip). - migrate/v3_to_v4.py: .brand_manifest uses word-boundary regex instead of substring (no false-positive on .brand_manifest_v2 etc.). - migrate/v3_to_v4.py: reads with utf-8-sig + newline="" and writes with newline="" — CRLF preserved, UTF-8 BOM files migrate correctly. Uses open() (not Path.read_text(newline=) — that kwarg is 3.13+). - migrate/v3_to_v4.py: docstring calls out the regex-vs-AST tradeoff (string literals and comments rewrite too). - adcp/__init__.py: get_adcp_version() now emits DeprecationWarning. - adcp/__init__.py: tightened get_adcp_sdk_version() docstring. - types/base.py: explicit warning that ADCP_STRICT_VALIDATION is resolved once at module import time. +7 tests. 2008 passing (2001 → 2008), mypy clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Third of three PRs on salesagent's feedback. Closes the final 4 items. All additive — no breaking changes.
python -m adcp.migrate v3-to-v4— new CLI that rewrites the 9<Type>Asset → <Type>Contentrenames and flags usages of removed types (BrandManifest,DeliverTo,Pricing, etc.) + numberedAssets<N>imports +adcp.types.generated_pocimports. Dry-run default,--applyrewrites in place,--jsonfor CI. Exit 1 on flagged findings. No new runtime deps.ADCP_STRICT_VALIDATION=1env flag onAdCPBaseModel. Flipsextra='forbid'at import time; default stays'ignore'for forward-compat. Use during spec upgrades to surface silently-dropped renamed fields.get_adcp_spec_version()+get_adcp_sdk_version()split the ambiguousget_adcp_version()into two named helpers. Old name kept as a spec-version alias.exclude=Truecontract throughproducts_response/signals_response/media_buys_response/list_creatives_responseso a future_serializerefactor can't silently leak seller internals.Tested
tests/test_migrate_v3_to_v4.py(20): renames, word boundaries, removed-type anchors, numbered-Assets flagging, skip-dirs, CLI exit codes, JSON output, apply-rewrites-and-reports, unreadable-file graceful skip.tests/test_response_builder_subclass.py(5): 4 builders × subclass passthrough + mixed-base-and-subclass.tests/test_strict_validation_env.py(17): all truthy/falsy variants, whitespace handling, unset default, model_config wiring.tests/test_version_helpers.py(4): sdk-matches-dunder, spec non-empty, legacy alias, distinct concepts.2001 passed, 22 skippedlocally (1937 → 2001).ruff,mypyclean across 676 source files.Test plan
MyAudioAsset/AudioAssetExtrastay untouched.)get_adcp_versionemit aDeprecationWarningwhen called, or is a docstring.. deprecated::note enough? Current impl is silent-alias to avoid breaking pre-4.1 callers.ADCP_STRICT_VALIDATIONresolved at import time the right policy, or should it be per-model / per-call? Import-time is simpler; per-model adds flexibility at the cost of surprising runtime behavior.Related
Part of triaging feedback from salesagent (primary downstream of
adcp.server).AccountAwareToolContext+ multi-tenant contract doc (items chore(main): release 0.1.1 #2, fix: correct tool name in list_creative_formats method #10).All 11 feedback items now addressed.
🤖 Generated with Claude Code