Skip to content

Commit 6947870

Browse files
bokelleyclaude
andauthored
revert(preview): remove opt-in v3.1 preview surface (#747) (#755)
Reverts the v3.1.0-beta.1 client surface from PR #747. The Python SDK will follow the TypeScript pattern instead: stay clean on 5.x against AdCP 3.0.x, cut a new major (6.0) when AdCP 3.1 stable lands and run codegen against the clean spec. Hand-rolled 3.1 types in preview.py would diverge from the TS approach and accumulate drift as 3.x evolves; two-surface confusion (``adcp.types`` vs ``adcp.preview``) is exactly what pre-bid / sales-agent adopters can't afford. PR #747 was never released to PyPI — v5.6.0 was tagged before #747 merged, so the preview surface only ever existed on ``main`` between #747 (14:18 UTC) and this revert (~17:30 UTC). No downstream wheel ever carried it. Removes: - src/adcp/preview.py (1079 lines) - tests/test_preview.py, tests/test_preview_e2e.py (914 lines) - ADCPClient.preview property and catalog_change_feed_client() method - README v3.1 preview-surface quick-start section - schemas/cache/3.1.0-beta.1/ (vendored bundle, 40MB, 661 files) The bundle was kept in the initial revert PR as 6.0-prep convenience, but expert review caught a real DX trap: with the bundle on disk but no v3.1 Pydantic types, ``schema_loader._ensure_state`` would route v3.1 wire responses to JSON-Schema validation against 3.1 schemas that then parse through v3.0 types. Silent validate-against-different- types is worse than no validation. Dropping the bundle makes the SDK treat v3.1 like any unknown future version: skip validation, parse through v3.0 with extras preserved (loud failure when an unsupported attribute is accessed). Re-sync at 6.0 prep with one command. Keeps: - src/adcp/validation/version.py wire-format prerelease resolution (pure infrastructure; resolves ``3.1-beta.1`` -> ``3.1.0-beta.1`` bundle key, used generally for any prerelease normalization) - tests/test_validation_version.py - scripts/sync_schemas.py multi-bundle machinery (PREVIEW_VERSIONS = () so no extra bundles sync; flipping it back on is one line when 6.0 prep starts) - README ``## AdCP version support`` tombstone pointing at 6.0 and #741 Codegen workarounds I built while trying to put 3.1.0-beta.1 through codegen are captured in .context/codegen-prep/ for 6.0 prep (not in this PR — they're prep notes, not production code). Companion upstream issues filed at: - koxudaxi/datamodel-code-generator#3158 (allOf+oneOf drops oneOf) - koxudaxi/datamodel-code-generator#3159 (nested $ref via allOf) - koxudaxi/datamodel-code-generator#3160 (fabricated Literal['reuse']) - adcontextprotocol/adcp#4859 (bundled mega-schema inlining) Expert reviews (code-reviewer-deep, security-reviewer-deep, adtech- product-expert, dx-expert) recommended dropping the bundle and adding the tombstone; both addressed here. Test plan: - ruff check src/ -> clean - mypy src/adcp/ -> clean (806 source files) - pytest tests/ -> 4883 passed, 0 failed, 26 skipped, 1 xfailed Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e973864 commit 6947870

667 files changed

Lines changed: 18 additions & 554359 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 9 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -207,54 +207,15 @@ async with ADCPMultiAgentClient(
207207
# Connections automatically cleaned up here
208208
```
209209

210-
## Quick Start: v3.1 catalog-sync preview (opt-in)
211-
212-
The `adcp.preview` module exposes the three v3.1 catalog-sync proposals
213-
([adcontextprotocol/adcp#4761](https://github.com/adcontextprotocol/adcp/issues/4761),
214-
[#4762](https://github.com/adcontextprotocol/adcp/issues/4762),
215-
[#4763](https://github.com/adcontextprotocol/adcp/issues/4763))
216-
as opt-in client features. The SDK's default AdCP pin stays on the
217-
current stable line — importing `adcp.preview` does not change wire
218-
behaviour for any other call, and adopters who never import it pay
219-
nothing. Use it against v3.1.x agents during the beta.
220-
221-
```python
222-
from adcp import ADCPClient, AgentConfig, Protocol
223-
from adcp.preview import CatalogVersionCache, GetProductsRequest
224-
225-
cache = CatalogVersionCache()
226-
227-
async with ADCPClient(AgentConfig(
228-
id="seller",
229-
agent_uri="https://seller.example",
230-
protocol=Protocol.MCP,
231-
)) as client:
232-
request = GetProductsRequest(buying_mode="wholesale")
233-
234-
# First call: full catalog payload + a catalog_version token cached.
235-
result = await client.preview.get_products(request, cache)
236-
# Second call: SDK auto-attaches if_catalog_version. If the seller's
237-
# catalog is unchanged, the response is `unchanged: true` and the
238-
# cached payload is returned without re-fetching the inventory.
239-
result = await client.preview.get_products(request, cache)
240-
241-
# Capability probe + change-feed poll for near-real-time mirroring.
242-
async with client.catalog_change_feed_client() as feed:
243-
page = await feed.poll(cursor=None)
244-
for event in page.events:
245-
print(event.event_type, event.entity_id)
246-
```
247-
248-
`adcp.preview` re-exports `GetProductsRequest` / `GetSignalsRequest`
249-
(plus matching response types) as subclasses of the v3.0 generated
250-
models — they accept the same fields plus the v3.1 conditional-fetch
251-
tokens (`if_catalog_version`, `if_pricing_version`) and `discovery_mode`
252-
for `get_signals`. Wholesale enumeration: `GetSignalsRequest(discovery_mode="wholesale")`
253-
or `GetProductsRequest(buying_mode="wholesale")`.
254-
255-
For details on the cache scoping rules, two-layer (`public` / `account`)
256-
safety invariant, and webhook subscription endpoint, see the inline docs
257-
on [`src/adcp/preview.py`](src/adcp/preview.py).
210+
## AdCP version support
211+
212+
The 5.x line targets AdCP 3.0 stable. v3.1 support lands in SDK 6.0 against
213+
the 3.1 stable spec — there is no opt-in preview surface in 5.x. If you talk
214+
to a v3.1+ agent from 5.x, the SDK parses the response through v3.0 types
215+
(unknown fields are preserved on the model but not surfaced as typed
216+
attributes) and schema validation is skipped for that version. Track
217+
[#741](https://github.com/adcontextprotocol/adcp-client-python/issues/741)
218+
for 6.0 progress.
258219

259220
## Documentation
260221

schemas/cache/3.1.0-beta.1/a2ui/bound-value.json

Lines changed: 0 additions & 70 deletions
This file was deleted.

schemas/cache/3.1.0-beta.1/a2ui/component.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)