Skip to content

feat(decisioning): emit UserWarning for sales-* methods required in v6.0 rc.1#434

Closed
bokelley wants to merge 2 commits intomainfrom
claude/issue-423-advance-validate-platform-sales-warnings
Closed

feat(decisioning): emit UserWarning for sales-* methods required in v6.0 rc.1#434
bokelley wants to merge 2 commits intomainfrom
claude/issue-423-advance-validate-platform-sales-warnings

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

@bokelley bokelley commented May 3, 2026

Closes #423

validate_platform() now surfaces the four sales-* methods that the spec promotes to required in v6.0 rc.1 — get_media_buys, provide_performance_feedback, list_creative_formats, list_creatives — as boot-time UserWarnings rather than silently tolerating their absence. A v3 ref seller would have shipped without them; this catches that class of gap at server boot.

What changed

src/adcp/decisioning/dispatch.py

  • Added WARN_IF_MISSING_PER_SPECIALISM constant mapping all six sales-* specialisms to the four rc.1-promoted methods (private _SALES_WARN_IF_MISSING frozenset shared across all six entries)
  • Added warning loop at the end of validate_platform(), after the governance gate, that emits one UserWarning per missing method — deduplicated across multi-specialism claims (e.g., a platform claiming both sales-non-guaranteed and sales-guaranteed warns once per method, not twice)
  • Warning message names the concrete platform subclass via type(platform).__qualname__ so CI logs point at the adopter's file, and describes the consequence (AdcpError(NOT_SUPPORTED) at buyer call time)
  • Updated stale inline comment in REQUIRED_METHODS_PER_SPECIALISM to say "warn-if-absent" instead of "present-or-absent, not enforced here"

src/adcp/decisioning/specialisms/sales.py

  • Module docstring: replaced "Optional methods present-or-absent" section with "Warn-if-absent methods (v6.0 alpha → hard-required in v6.0 rc.1)" and a separate "Specialism-only required methods (already hard-enforced)" section for sync_catalogs
  • # ---- Optional (gated by specialism — present-or-absent) ---- inline comment updated to # ---- Warn-if-absent (required in v6.0 rc.1 — hard-enforced at rc.1) ----
  • Per-method docstrings on all four warn-if-absent methods updated from "Required when claiming any sales-* specialism in v6.0 rc.1+" to "UserWarning at boot / hard-error in v6.0 rc.1"

tests/test_decisioning_dispatch.py

  • _ValidPlatform fixture upgraded from 5 → 9 methods (adds the four warn-if-absent stubs) so the "happy path" fixture is fully compliant and emits no warnings
  • 4 new tests: warns on missing rc.1 methods, no-warn when all present, dedup across dual-specialism claim, contract pin for the new constant

What tested

  • pytest tests/test_decisioning_dispatch.py — 42 passed (38 original + 4 new), 0 failed
  • pytest tests/test_decisioning_advertised_per_specialism.py — 9 passed, 0 failed
  • ruff check src/adcp/decisioning/dispatch.py src/adcp/decisioning/specialisms/sales.py — all checks passed
  • mypy src/adcp/decisioning/dispatch.py src/adcp/decisioning/specialisms/sales.py — no issues found

Pre-PR review

  • code-reviewer: approved — no blockers; nit on stale inline comment in REQUIRED_METHODS_PER_SPECIALISM (fixed in second commit)
  • dx-expert: approved after fixes — two blockers resolved: sync_catalogs moved out of warn-if-absent section, # ---- Optional ---- comment updated; nits on __qualname__ in message and __all__ (both fixed)

Migration path to v6.0 rc.1

When rc.1 ships: move the four methods from WARN_IF_MISSING_PER_SPECIALISM into REQUIRED_METHODS_PER_SPECIALISM and drop them from the warn dict. The existing hard-error path in validate_platform() takes over. No new code needed.

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_01GovN4hXXs27SNeNbBeFRgg


Generated by Claude Code

claude added 2 commits May 3, 2026 02:53
…6.0 rc.1

Adds WARN_IF_MISSING_PER_SPECIALISM constant and a new warning loop in
validate_platform() that surfaces the 4 methods promoted to required in
v6.0 rc.1 (get_media_buys, provide_performance_feedback,
list_creative_formats, list_creatives) as boot-time UserWarnings rather
than silently tolerating their absence.

Closes #423

https://claude.ai/code/session_01GovN4hXXs27SNeNbBeFRgg
- Include platform class name (type(platform).__qualname__) in warning
  message so CI logs point at the concrete subclass
- Remove WARN_IF_MISSING_PER_SPECIALISM from __all__ (migration artifact,
  not stable public API)
- Fix sales.py module docstring: move sync_catalogs to its own
  "hard-enforced" section (it was miscategorized under warn-if-absent)
- Update # ---- Optional ---- inline comment to warn-if-absent
- Update stale REQUIRED_METHODS_PER_SPECIALISM comment

https://claude.ai/code/session_01GovN4hXXs27SNeNbBeFRgg
@bokelley
Copy link
Copy Markdown
Contributor Author

bokelley commented May 3, 2026

Closing in favor of #445 — same issue (#423), broader implementation (proper dedup, regression guards, strict mode env var, 7 tests vs ).

@bokelley bokelley closed this May 3, 2026
@bokelley
Copy link
Copy Markdown
Contributor Author

bokelley commented May 3, 2026

Acknowledged — #445 supersedes this. Nothing further from triage.


Generated by Claude Code

@bokelley
Copy link
Copy Markdown
Contributor Author

bokelley commented May 3, 2026

Understood — noted that #445 supersedes this PR. No further triage action on #434.


Generated by Claude Code

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.

feat(decisioning): advance validate_platform() enforcement of required sales-* methods

2 participants