Skip to content

feat(compat)!: semantic 3.3 → 3.2 downgrade rules - #1717

Merged
bokelley merged 1 commit into
nextfrom
claude/issue-1667-semantic-downgrade-rules
Oct 30, 2026
Merged

bokelley merged 1 commit into
nextfrom
claude/issue-1667-semantic-downgrade-rules

Conversation

@bokelley

@bokelley bokelley commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem

AdCP 3.3 adds fields and values that 3.2 closes. compat/versions.py projects 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 with VERSION_UNSUPPORTED when it hit a scheduled spot, an unmeasured delivery row, features.catalog_ingestion or an operator_fee breakdown. It also dropped age_determination_bases instead of moving it to the interim ext.adcp spelling.

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/const oneOf, so the source looked invalid and the check was skipped. A 3.3 request with a webhook missing authentication was 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)

3.3 field or value Result for a 3.2 peer Loss reason
by_spot[] row without aired_at (scheduled / preempted) Row omitted row_omitted_not_aired
Lifecycle fields on an aired / makegood row Field dropped field_unavailable
Delivery row without impressions (by_*, daily_breakdown) Row omitted, never impressions: 0 row_omitted_impressions_not_measured
media_buy.features.catalog_ingestion Dropped (catalog_management stays the 3.2 declaration) field_unavailable
Request reporting_webhook / artifact_webhook without authentication ADCPVersionConversionError at /reporting_webhook or /artifact_webhook; no credential invented none
daypart_targets[].start_time / end_time ADCPVersionConversionError in a request or a response; never rounded none
age_determination_bases Moved to ext.adcp.age_determination_bases (top-level replaces an interim value); an upgrade reads it back into an absent top-level field moved_to_ext_adcp
price_breakdown with operator_fee Response: breakdown omitted whole, because the remaining adjustments no longer sum to fixed_price; request: error enum_unavailable on the kind + unrepresentable_in_target on the breakdown
REFERENCE_DEFINITION_CHANGED and other new error.code values Kept: 3.2 error.code is an open string none

How it's implemented in src/adcp/compat/versions.py:

  • Row omission: _ROW_OMISSIONS covers aired_at and impressions. 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 fields: _REFUSED_FIELDS is keyed by schema title. It currently holds Daypart Target start_time / end_time.
  • Interim extension: _INTERIM_EXT_FIELDS lists the fields that move to ext.adcp. _hoist_interim_ext reads them back on upgrade.
  • Whole objects: _WHOLE_OBJECTS currently holds Price Breakdown. If the older schema refuses any member, the object is unrepresentable as a whole.
  • Generic map rule: a field the newer schema declares is not treated as a key of an older open map whose value schema refuses it. This is what drops catalog_ingestion.
  • Format checking: _refusal now validates formats with the SDK's own format checker.

Buyer side: a client pinned to 3.2 with strict validation parses a 3.3 capabilities response (including catalog_ingestion) with the packaged models, because discovery is not version-gated. A test covers this.

Not in scope: definition pins / REFERENCE_DEFINITION_CHANGED mapping (#1641), expected_confirmation_at (#1640) and pixel trackers (#1643).

Tests

  • tests/test_version_downgrade_3_3.py has 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.py is 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 new tests/fixtures/version_conversion_sweep_3_3.json. Each expected structured error has a justification comment.
  • Docs: 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 a MIGRATION_v9_to_v10.md row.

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

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]>

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bokelley
bokelley merged commit fab1adf into next Oct 30, 2026
77 of 78 checks passed
@bokelley
bokelley deleted the claude/issue-1667-semantic-downgrade-rules branch October 30, 2026 00:42
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.

1 participant