Description
Bug
ADCPClient.get_products() in v7.0.0-rc drops valid canonical format_options and can return an empty product list with FORMAT_PROJECTION_FAILED diagnostics.
Reproduction
Return a valid canonical product from an adapter:
TaskResult(
status=TaskStatus.COMPLETED,
success=True,
data={
"products": [{
"product_id": "p1",
"name": "Product 1",
"description": "A test product",
"publisher_properties": [
{"selection_type": "all", "publisher_domain": "pub.example.com"}
],
"format_options": [{
"format_option_id": "p1-display",
"format_kind": "image",
"params": {"width": 300, "height": 250},
}],
"delivery_type": "non_guaranteed",
"pricing_options": [{
"pricing_model": "cpm",
"pricing_option_id": "po1",
"currency": "USD",
}],
"reporting_capabilities": {
"available_reporting_frequencies": ["daily"],
"expected_delay_minutes": 0,
"timezone": "UTC",
"supports_webhooks": False,
"available_metrics": ["impressions"],
"date_range_support": "date_range",
},
}]
},
)Calling the primary get_products() method produces no usable canonical product. Direct GetProductsResponse.model_validate() of the response succeeds.
Root cause
_canonicalize_get_products_result() first parses every response as LegacyGetProductsResponse. The generated legacy ProductFormatDeclaration does not declare canonical format_kind or params, so Pydantic discards them before project_legacy_product() runs. The projector consequently receives entries such as:
{"format_option_id": "p1-display", "canonical_formats_only": false, "experimental": false}instead of the canonical declaration sent on the wire.
Expected behavior
The primary canonical client should parse a valid canonical GetProductsResponse without passing it through a lossy legacy model. Legacy-only responses should continue through the existing projection path.
Impact
Canonical-only sellers can return a valid wire response while Python v7.0.0-rc buyers silently lose those products. Raw MCP consumers are unaffected; the regression is in the high-level Python client canonicalization path.
Activity
bokelley commentedon Jul 31, 2026
Triage
Classification: Bug
Bucket(s): client (label not in repo; gap noted in run summary)
Status: ready-to-implement
What the experts said:
LegacyProductFormatDeclarationcarriesextra='ignore'so Pydantic silently dropsformat_kind/paramsbefore projection; the canonical fast-path must also call_remember_canonical_product_routes()and setmetadata["projection"] = {"diagnostics": []}for shape consistency; regression test requiredresult.success=Truewith empty products is a foot-gun; fix direction (canonical-first, legacy fallback) matches the existing dialect-branching pattern already used inlist_creatives()andget_media_buys()— and the_creative_dialect()return value at line 1717 is currently discarded rather than branched on, which is the missing wire-upMy take: Clear v7 regression —
_canonicalize_get_products_result()unconditionally routes every wire response through the lossy legacy model, stripping canonical fields beforeproject_legacy_product()runs. The fix is non-breaking and scoped to one method: canonical responses currently fail silently with empty products, so making them work is purely additive.Implementation brief:
_canonicalize_get_products_result()(src/adcp/client.py:1503): parseraw_resultasGetProductsResponsefirst; on success, callself._remember_canonical_product_routes(list(canonical.products))and setmetadata["projection"] = {"diagnostics": []}before returningValidationError, fall through to the existingLegacyGetProductsResponseprojection path unchanged — legacy sellers are unaffectedclient.py:4854delegates to_canonicalize_get_products_result()directly, so no separate change is needed there; note this in the PR bodyformat_kindandparamssurvive round-trip through_canonicalize_get_products_result()with a canonical wire shape; runpytest -m 'not integration',mypy src/,ruff check .,black --check .Triaged by Claude Code. Session: https://claude.ai/code/cse_01AtbrCX2K24YhUf8pR5Mfmi
Generated by Claude Code