You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(client): preserve canonical format options in get_products #1005
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.
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:
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.
Classification: Bug Bucket(s): client (label not in repo; gap noted in run summary) Status: ready-to-implement
What the experts said:
code-reviewer: Root cause confirmed — LegacyProductFormatDeclaration carries extra='ignore' so Pydantic silently drops format_kind/params before projection; the canonical fast-path must also call _remember_canonical_product_routes() and set metadata["projection"] = {"diagnostics": []} for shape consistency; regression test required
dx-expert: Silent result.success=True with empty products is a foot-gun; fix direction (canonical-first, legacy fallback) matches the existing dialect-branching pattern already used in list_creatives() and get_media_buys() — and the _creative_dialect() return value at line 1717 is currently discarded rather than branched on, which is the missing wire-up
My take: Clear v7 regression — _canonicalize_get_products_result() unconditionally routes every wire response through the lossy legacy model, stripping canonical fields before project_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:
In _canonicalize_get_products_result() (src/adcp/client.py:1503): parse raw_result as GetProductsResponse first; on success, call self._remember_canonical_product_routes(list(canonical.products)) and set metadata["projection"] = {"diagnostics": []} before returning
On ValidationError, fall through to the existing LegacyGetProductsResponse projection path unchanged — legacy sellers are unaffected
The async polling callsite at client.py:4854 delegates to _canonicalize_get_products_result() directly, so no separate change is needed there; note this in the PR body
Add a regression test asserting format_kind and params survive round-trip through _canonicalize_get_products_result() with a canonical wire shape; run pytest -m 'not integration', mypy src/, ruff check ., black --check .
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