Conversation
…-only guard (#356) The AdCP v3 spec marks ``BusinessEntity.bank`` as write-only — adopters accept it on inbound ``sync_accounts`` requests for B2B invoicing but MUST omit it from any response payload. The schema *describes* this rule in a docstring, but doesn't structurally enforce it; Pydantic round-trips ``bank`` on ``model_dump()`` like any other field. This PR ships the structural guard. * ``adcp.decisioning.account_projection`` — new module: - ``project_account_for_response(account)`` — returns a copy of Account with ``billing_entity.bank`` cleared. Defensive copy when there's nothing to strip so callers can mutate freely. - ``project_business_entity_for_response(entity)`` — same posture for standalone BusinessEntity payloads (admin APIs, brand-rights flows that don't go through Account). - Original input is never mutated. * ``adcp.types.BusinessEntity`` is now publicly re-exported (was reachable via the internal ``_generated`` path only). Required for adopters to use the projection helper meaningfully. * Both helpers re-exported from ``adcp.decisioning``. * 11 tests covering: ``bank`` strip, no-mutation guarantee, JSON serialization output, idempotent double-projection, all no-op corners. Plus a regression-guard skip that documents the reason this helper exists (Pydantic doesn't enforce the spec's write-only rule structurally). * Public API snapshot regenerated. Closes #356. 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
The AdCP v3 spec marks `BusinessEntity.bank` as write-only. The schema describes the rule in a docstring but doesn't structurally enforce it — `model_dump()` round-trips `bank` like any other field. This PR ships the structural guard.
Closes #356.
Test plan
🤖 Generated with Claude Code