feat(decisioning): UserWarning when sales-* required methods missing (#423)#445
Merged
feat(decisioning): UserWarning when sales-* required methods missing (#423)#445
Conversation
…423) The SalesPlatform Protocol docstring (src/adcp/decisioning/specialisms/ sales.py:184-227) marks four methods — get_media_buys, provide_performance_feedback, list_creative_formats, list_creatives — as required for any sales-* specialism in v6.0 rc.1+, but validate_platform only enforced the five-method core. Adopters mid-upgrade could ship a sales-* platform missing the broader surface silently (the v3 ref seller hit exactly this until the deep review caught it). Adds RECOMMENDED_METHODS_PER_SPECIALISM with the four-method recommended set wired to all six sales-* slugs. validate_platform now walks each claimed specialism's recommended set and emits one UserWarning per missing method (deduped across overlapping specialisms) pointing the adopter at the Protocol docstring. Setting ADCP_DECISIONING_STRICT_VALIDATE_PLATFORM=1 flips soft-warn into a hard AdcpError("INVALID_REQUEST") so adopters who have completed the v6.0 rc.1 surface migration can lock the gain in via CI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…icks (#423 fix-pack) The docstring-vs-code consistency test (#424, just merged) caught two issues in this PR: 1. The strict-mode env-var read used os.environ.get(_STRICT_VALIDATE_ENV) indirection, which the consistency test's regex doesn't follow. Inline the literal 'ADCP_DECISIONING_STRICT_VALIDATE_PLATFORM' string so the test sees the read. 2. The docstring wrapped 'INVALID_REQUEST' in backticks on lines near env-var context keywords, tripping the test's SCREAMING_CASE heuristic (it treats backtick-wrapped uppercase tokens as candidate env vars). INVALID_REQUEST is a spec error code, not an env var — drop the backticks so it's plain prose. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
9fa4827 to
16f435f
Compare
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
validate_platformto soft-warn when a sales-* platform claims a specialism but is missing one of the four v6.0 rc.1 required methods (get_media_buys,provide_performance_feedback,list_creative_formats,list_creatives) that the strict-required core (REQUIRED_METHODS_PER_SPECIALISM) doesn't yet enforce. Without this, adopters mid-upgrade could ship a sales-* platform missing four spec-required methods silently — exactly what the v3 ref seller hit until the deep review caught it manually.RECOMMENDED_METHODS_PER_SPECIALISMcovering all six sales-* slugs, deduped warnings across overlapping specialisms, and anADCP_DECISIONING_STRICT_VALIDATE_PLATFORM=1env flag that flips the soft warning into a hardAdcpError("INVALID_REQUEST")for adopters who have completed the migration and want to lock the gain in via CI.src/adcp/decisioning/specialisms/sales.py:184-227).Test plan
tests/test_validate_platform_warnings.py(7 tests):sales-non-guaranteedproduce oneUserWarningper method, all pointing at the Protocol docstring.AdcpError("INVALID_REQUEST")with structureddetails.missing_recommended."1"(not"true"etc.).sales-non-guaranteed+sales-guaranteedwarns once per method, not twice).ruff check src/ tests/clean.mypy src/adcpclean.pytest tests/ -k validate_platform— 35 passed (7 new + 28 pre-existing).pytest examples/v3_reference_seller/tests/— 13 passed (no regression).🤖 Generated with Claude Code