Conversation
…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
3 tasks
Contributor
Author
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.
Closes #422
Adds
validate_capabilities_response_shape()called fromcreate_adcp_server_from_platformaftervalidate_platform. RaisesAdcpError("INVALID_REQUEST", recovery="terminal")when any claimed specialism maps tomedia_buy(sales-*,audience-sync) butsupported_billingis empty — the projection inPlatformHandler.get_adcp_capabilitiessilently drops theaccountblock in that case, producing a wire-invalid capabilities response.Fixes the gap exposed by PR #402 (manual
supported_billingfix 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 onDecisioningCapabilitiesfields directly (synchronous, no handler invocation, consistent with the existingvalidate_platformpattern).Migration note: Existing platforms that claim any
sales-*oraudience-syncspecialism withoutsupported_billingwill now raise at boot. The fix is a one-liner:supported_billing=["operator", "agent"](or a subset) inDecisioningCapabilities. 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+ emptysupported_billing), happy path (populatedsupported_billing), non-media_buyspecialism (signals), andaudience-syncedge case. All pass.pytest tests/test_decisioning_serve.py— 1 new integration test (test_create_propagates_capabilities_shape_failure), 1 fixture fix (_SalesPlatformWithRequiredMethodsnow includessupported_billing). All 19 tests pass.ruff checkcleanmypy src/adcp/decisioning/dispatch.py src/adcp/decisioning/serve.pycleanPre-PR review:
__all__entry and serve-layer integration test per review feedbackSession: https://claude.ai/code/session_01R5BFr24QJGTr9RW74biz7D
Generated by Claude Code