Skip to content

feat: sync rc.4 schemas + wire update_rights task#199

Merged
bokelley merged 1 commit into
mainfrom
bokelley/issue-185-rc4-schemas
Apr 19, 2026
Merged

feat: sync rc.4 schemas + wire update_rights task#199
bokelley merged 1 commit into
mainfrom
bokelley/issue-185-rc4-schemas

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Closes #185.

Schema sync

Resynced against `adcp-latest`: 564 files updated, 1 removed (`enums/budget-authority-level.json`). The rc.4 spec drops `Budget.authority_level` (enum: agent_full/agent_limited/human_required) in favor of two orthogonal fields on `plan.budget`:

  • `reallocation_threshold: number ≥ 0` — budget-reallocation autonomy denominated in `budget.currency`
  • `reallocation_unlimited: true` — explicit full-autonomy sentinel, mutually exclusive with `reallocation_threshold` (enforced via `oneOf` in the schema)

Plus new `plan.human_review_required` — governs decisions affecting data subjects (targeting, creative, delivery) under GDPR Art 22 / EU AI Act Annex III. Distinct from budget reallocation autonomy.

No hand-written SDK code referenced `authority_level` / `BudgetAuthorityLevel`, so codegen picks up the new shape cleanly.

New task: update_rights

The rc.4 index added `update_rights` (partner to `acquire_rights`). Lets buyers modify an existing rights acquisition — typically extend `end_date`, raise `impression_cap`, pause/unpause, or swap to a compatible `pricing_option_id`. Wired at all 6 spec-coverage sites:

  • `ADCPClient.update_rights` (client.py)
  • `ADCPHandler.update_rights` default stub (server/base.py)
  • `ProtocolAdapter.update_rights` abstract + concrete A2A/MCP impls (protocols/{base,a2a,mcp}.py)
  • CLI dispatch table (main.py)
  • MCP tool definition + BrandHandler tool-filter + TypeAdapter registration (server/mcp_tools.py)
  • `adcp.types` public re-exports for `UpdateRightsRequest` / `UpdateRightsResponse`

All 7 `tests/test_spec_coverage.py` assertions now pass — they were red on main post-sync.

Validation

  • 1499 tests passing
  • mypy clean across 659 source files
  • ruff clean

Out of scope (explicit)

Test plan

  • `pytest tests/ --no-cov -q` — 1499 passed
  • `mypy src/adcp/` — 0 errors
  • `ruff check src/adcp/` — clean
  • Spec-coverage regression suite green (was red after sync on main)

🤖 Generated with Claude Code

Closes #185.

## Schema sync

Resynced against `adcp-latest`: 564 files updated, 1 removed
(`enums/budget-authority-level.json`). The rc.4 spec drops
``Budget.authority_level`` (enum: agent_full/agent_limited/human_required)
in favor of two orthogonal fields on ``plan.budget``:

- ``reallocation_threshold: number ≥ 0`` — budget-reallocation autonomy
  denominated in ``budget.currency``
- ``reallocation_unlimited: true`` — explicit full-autonomy sentinel,
  mutually exclusive with ``reallocation_threshold`` (enforced via
  ``oneOf`` in the schema)

Plus a new ``plan.human_review_required`` flag that governs decisions
affecting data subjects (targeting, creative, delivery) under GDPR Art 22
/ EU AI Act Annex III — distinct from budget reallocation autonomy.

No hand-written SDK code referenced the old ``authority_level`` /
``BudgetAuthorityLevel`` type, so codegen picks up the new shape
automatically.

## New task: update_rights

The rc.4 schema index added a ``update_rights`` task (partner to
``acquire_rights``). Lets buyers modify an existing rights acquisition —
typically extend ``end_date``, raise ``impression_cap``, pause/unpause
via ``paused``, or swap to a compatible ``pricing_option_id``. Wired at
the 6 spec-coverage sites:

- ``ADCPClient.update_rights`` (src/adcp/client.py)
- ``ADCPHandler.update_rights`` default stub (src/adcp/server/base.py)
- ``ProtocolAdapter.update_rights`` abstract + concrete A2A/MCP impls
  (src/adcp/protocols/{base,a2a,mcp}.py)
- CLI dispatch table (src/adcp/__main__.py)
- MCP tool definition + BrandHandler tool-filter set + TypeAdapter
  registration (src/adcp/server/mcp_tools.py)
- ``adcp.types`` public re-exports for ``UpdateRightsRequest`` /
  ``UpdateRightsResponse``

Also registered ``update_rights`` in ``TASK_FEATURE_MAP`` (capabilities.py)
and ``HANDLER_TO_DOMAIN`` (builder.py) so the client-side feature gate
enforces it and decorator-style servers auto-advertise the ``brand``
domain. Added ``test_feature_and_domain_maps_cover_brand_tasks`` regression
test to prevent silent fail-open for future brand tasks.

## Round-trip coverage

New ``tests/test_update_rights_roundtrip.py`` (4 tests):

- A2A partial update reaches the wire with only mutated fields
- A2A response parses through the ``UpdateRightsResponse1 | 2`` Union
- MCP ``call_tool`` receives the right tool name + params
- Default ``ADCPHandler.update_rights`` returns ``NotImplementedResponse``

## Validation

- 1504 tests passing (includes the 4 new round-trip tests + 1 new
  regression test)
- mypy clean across 659 source files
- ruff clean on changed files

## Out of scope

- Release cut to PyPI (4.0.0b2) — separate concern tracked elsewhere.
- PgBackend implementation for ``IdempotencyStore`` — deferred per the
  post-#196 plan.

BREAKING CHANGE: ``Budget.authority_level`` is removed. Migrate to
``reallocation_threshold`` / ``reallocation_unlimited`` on ``plan.budget``,
and set ``plan.human_review_required`` for decisions affecting data
subjects. See the rc.4 migration section in README.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley force-pushed the bokelley/issue-185-rc4-schemas branch from c8de568 to 6c0e0e9 Compare April 19, 2026 10:14
@bokelley bokelley merged commit 67119bf into main Apr 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v3.0.0-rc.4: migrate to reallocation_threshold + human_review_required (breaking)

1 participant