Skip to content

feat(decisioning): boot-time validate_capabilities_response_shape against spec invariants#432

Closed
bokelley wants to merge 1 commit intomainfrom
claude/issue-422-validate-capabilities-response-shape
Closed

feat(decisioning): boot-time validate_capabilities_response_shape against spec invariants#432
bokelley wants to merge 1 commit intomainfrom
claude/issue-422-validate-capabilities-response-shape

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

@bokelley bokelley commented May 3, 2026

Closes #422

Adds validate_capabilities_response_shape() called from create_adcp_server_from_platform after validate_platform. Raises AdcpError("INVALID_REQUEST", recovery="terminal") when any claimed specialism maps to media_buy (sales-*, audience-sync) but supported_billing is empty — the projection in PlatformHandler.get_adcp_capabilities silently drops the account block in that case, producing a wire-invalid capabilities response.

Fixes the gap exposed by PR #402 (manual supported_billing fix on the v3 ref seller): non-conformant platforms now fail fast at boot with an actionable diagnostic rather than shipping a broken capabilities wire shape. The check operates on DecisioningCapabilities fields directly (synchronous, no handler invocation, consistent with the existing validate_platform pattern).

Migration note: Existing platforms that claim any sales-* or audience-sync specialism without supported_billing will now raise at boot. The fix is a one-liner: supported_billing=["operator", "agent"] (or a subset) in DecisioningCapabilities. Platforms that were already spec-conformant see no change.

What was tested

  • pytest tests/test_decisioning_dispatch.py — 4 new tests: failing path (sales-non-guaranteed + empty supported_billing), happy path (populated supported_billing), non-media_buy specialism (signals), and audience-sync edge case. All pass.
  • pytest tests/test_decisioning_serve.py — 1 new integration test (test_create_propagates_capabilities_shape_failure), 1 fixture fix (_SalesPlatformWithRequiredMethods now includes supported_billing). All 19 tests pass.
  • ruff check clean
  • mypy src/adcp/decisioning/dispatch.py src/adcp/decisioning/serve.py clean

Pre-PR review:

  • code-reviewer: approved — added __all__ entry and serve-layer integration test per review feedback
  • ad-tech-protocol-expert: approved — message corrected to "SDK-enforced invariant derived from spec intent" (spec uses advisory "should" not a hard JSON Schema conditional); coverage of all media_buy-mapped specialisms confirmed correct

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_01R5BFr24QJGTr9RW74biz7D


Generated by Claude Code

…inst spec invariants

Adds validate_capabilities_response_shape() called from
create_adcp_server_from_platform after validate_platform. Raises
AdcpError("INVALID_REQUEST", recovery="terminal") when any claimed
specialism maps to media_buy (sales-*, audience-sync) but
supported_billing is empty — the projection silently drops the account
block in that case, producing a wire-invalid capabilities response.

Fixes the gap exposed by PR #402 (manual supported_billing fix on the
v3 ref seller): non-conformant platforms now fail fast at boot with an
actionable diagnostic rather than shipping a broken capabilities wire
shape. The check operates on DecisioningCapabilities fields directly
(synchronous, no handler invocation, consistent with validate_platform).

Closes #422

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

bokelley commented May 3, 2026

Closing in favor of #446 — same issue (#422), broader implementation: bundled-schema validation, structured per-issue diagnostics, ripple-effect fixture fixes, 7 tests, full suite passes.

@bokelley bokelley closed this May 3, 2026
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): boot-time validate_capabilities_response_shape against spec invariants

2 participants