Repository navigation
feat(compat)!: semantic 3.3 → 3.2 downgrade rules - #1717
Conversation
Some AdCP 3.3 additions cannot be downgraded by dropping the field. The 3.3-beta.1 → 3.2 step now applies the rules from the 3.2 → 3.3 migration guide, each with a value-free ConversionLoss: - by_spot rows without aired_at (scheduled / preempted) are omitted (row_omitted_not_aired); aired rows lose only the lifecycle fields. - Delivery rows without impressions are omitted, never zeroed (row_omitted_impressions_not_measured). - media_buy.features.catalog_ingestion is dropped: a field the newer schema declares is not a key of an older open map that refuses its value. - A request reporting_webhook / artifact_webhook without authentication, and any daypart with start_time / end_time, fails with ADCPVersionConversionError; no credential is invented, no time rounded. - age_determination_bases moves to ext.adcp.age_determination_bases; an upgrade reads it back into an absent top-level field. - A price_breakdown carrying an operator_fee adjustment is omitted whole. - New error.code values pass 3.2's open vocabulary unchanged. The downgrade's final target check now validates formats like the SDK validators. Without it, a date-time oneOf with a const "asap" sibling made a valid create_media_buy look invalid, so the check was skipped. The downgrade sweep is parametrized by source release and now converts every bundled 3.3-beta.1 example and new 3.3 fixtures to 3.2, 3.1 and 3.0. BREAKING CHANGE: a 3.3 request the 3.2 contract cannot express (a webhook without authentication, a minute-level daypart) now fails with ADCPVersionConversionError / UNSUPPORTED_FEATURE before sending. Earlier SDK 10 betas sent some of these to the peer invalid, for example when the request carried start_time "asap". Closes #1667 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean diff with no blocking or medium findings.
The reviewer traced every new semantic 3.3→3.2 downgrade branch in src/adcp/compat/versions.py (row omission, refused daypart fields, interim ext hoist with upgrade symmetry, Price Breakdown whole-object drop, catalog_ingestion open-map refusal, and the _refusal format-checker fix for start_time "asap") against the assertions in test_version_downgrade_3_3.py and the parametrized sweep. The DR-0032/0033 pathway-back contract is honored with a test per rule, and the breaking behavior (webhook-without-auth / minute dayparts now refused before send) correctly ships under feat(compat)! with a BREAKING CHANGE footer and a migration note (MIGRATION_v9_to_v10.md), satisfying the semver-signal gate.
Decision table: no critical/high/medium findings (rows 1, 4–8 don't fire). gated_paths is false (row 2 n/a). high_risk is true but the only reason is a (modified) entry with no accompanying medium finding, so rows 3 and 5 don't fire. No no-auto-approve team match (row 7 n/a). Falls through to row 9 — approve.
Problem
AdCP 3.3 adds fields and values that 3.2 closes.
compat/versions.pyprojects known newer fields generically, but several 3.3 → 3.2 rules need semantics. Before this change, a 3.3 seller answering a 3.2 buyer failed the whole response withVERSION_UNSUPPORTEDwhen it hit ascheduledspot, an unmeasured delivery row,features.catalog_ingestionor anoperator_feebreakdown. It also droppedage_determination_basesinstead of moving it to the interimext.adcpspelling.Separately, the downgrade's final target check ran without a format checker. In
create_media_buy,start_time: "asap"then matched both arms of a date-time/constoneOf, so the source looked invalid and the check was skipped. A 3.3 request with a webhook missingauthenticationwas sent to a 3.2 seller invalid.Fix, per rule (all on the 3.3-beta.1 → 3.2 step, so they also apply on the way to 3.1 and 3.0)
reasonby_spot[]row withoutaired_at(scheduled/preempted)row_omitted_not_airedfield_unavailableimpressions(by_*,daily_breakdown)impressions: 0row_omitted_impressions_not_measuredmedia_buy.features.catalog_ingestioncatalog_managementstays the 3.2 declaration)field_unavailablereporting_webhook/artifact_webhookwithoutauthenticationADCPVersionConversionErrorat/reporting_webhookor/artifact_webhook; no credential inventeddaypart_targets[].start_time/end_timeADCPVersionConversionErrorin a request or a response; never roundedage_determination_basesext.adcp.age_determination_bases(top-level replaces an interim value); an upgrade reads it back into an absent top-level fieldmoved_to_ext_adcpprice_breakdownwithoperator_feefixed_price; request: errorenum_unavailableon the kind +unrepresentable_in_targeton the breakdownREFERENCE_DEFINITION_CHANGEDand other newerror.codevalueserror.codeis an open stringHow it's implemented in
src/adcp/compat/versions.py:_ROW_OMISSIONScoversaired_atandimpressions. A row is omitted only from response arrays, and only when the 3.2 item requires the field and the 3.3 item does not._REFUSED_FIELDSis keyed by schema title. It currently holds Daypart Targetstart_time/end_time._INTERIM_EXT_FIELDSlists the fields that move toext.adcp._hoist_interim_extreads them back on upgrade._WHOLE_OBJECTScurrently holds Price Breakdown. If the older schema refuses any member, the object is unrepresentable as a whole.catalog_ingestion._refusalnow validates formats with the SDK's own format checker.Buyer side: a client pinned to
3.2with strict validation parses a 3.3 capabilities response (includingcatalog_ingestion) with the packaged models, because discovery is not version-gated. A test covers this.Not in scope: definition pins /
REFERENCE_DEFINITION_CHANGEDmapping (#1641),expected_confirmation_at(#1640) and pixel trackers (#1643).Tests
tests/test_version_downgrade_3_3.pyhas one test per rule. Each asserts the exact payload and losses, validates against the real 3.3 and 3.2 schemas, and includes a server dispatch case and a pinned-buyer discovery case.tests/test_version_conversion_sweep.pyis now parametrized by source release. The existing 3.2 → 3.1 / 3.0 sweep is unchanged. The new 3.3-beta.1 → 3.2 / 3.1 / 3.0 sweep covers every bundled 3.3 example, the 3.3 audience-evidence vectors, the parity cases, the 3.2 fixtures and the newtests/fixtures/version_conversion_sweep_3_3.json. Each expected structured error has a justification comment.docs/cross-version-conversion.md(rules table), inventory rows for AdCP 3.3: semantic downgrade rules for 3.3-only fields toward 3.2 peers #1667, and aMIGRATION_v9_to_v10.mdrow.BREAKING CHANGE: a 3.3 request the 3.2 contract cannot express (a webhook without authentication, a minute-level daypart) now fails with ADCPVersionConversionError / UNSUPPORTED_FEATURE before sending. Earlier SDK 10 betas sent some of these to the peer invalid, for example when the request carried start_time "asap".
Closes #1667
🤖 Generated with Claude Code