Skip to content

Commit b05bde4

Browse files
bokelleyclaude
andcommitted
fix(protocol): align rc.10 codegen artifacts and the build_creative task type
Follow-ups surfaced by the full test gate after the rc.10 regen: - post_generate_fixes.restore_format_asset_numbered_aliases: detect the repeatable asset group by its Literal['repeatable_group'] annotation, not only by an already-injected default. The fix runs before inject_literal_discriminator_defaults, and rc.10's codegen emits the discriminator without a default — so the prior Constant-value check missed the class and the Assets94 back-compat alias was dropped, breaking tests/test_forward_compat_assets.py. - decisioning.webhook_emit.SPEC_WEBHOOK_TASK_TYPES: add build_creative. The rc.10 task-type enum widened to include it and BuildCreativeRequest now carries push_notification_config, so it is an async webhook-emitting task. The constant is pinned to the on-disk enum by a CI test. - tests/fixtures/public_api_snapshot.json: regenerate for the intended GeoPostalArea -> PostalArea public rename. Note for the TS SDK: bump its SPEC_WEBHOOK_TASK_TYPES for build_creative in lockstep (cross-repo, out of scope here). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 2bbeb62 commit b05bde4

5 files changed

Lines changed: 23 additions & 4 deletions

File tree

scripts/post_generate_fixes.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2150,7 +2150,19 @@ def restore_format_asset_numbered_aliases() -> None:
21502150
continue
21512151
if not isinstance(stmt.target, ast.Name) or stmt.target.id != "item_type":
21522152
continue
2153-
if isinstance(stmt.value, ast.Constant) and stmt.value.value == "repeatable_group":
2153+
# Match the discriminator either by its already-injected default
2154+
# value or by its ``Literal['repeatable_group']`` annotation. The
2155+
# default is added by ``inject_literal_discriminator_defaults``,
2156+
# which runs after this fix in the registry — so when the codegen
2157+
# emits the discriminator without a default (rc.10 shape), only the
2158+
# annotation is available here.
2159+
has_const_default = (
2160+
isinstance(stmt.value, ast.Constant) and stmt.value.value == "repeatable_group"
2161+
)
2162+
has_literal_annotation = (
2163+
_extract_single_literal_value(stmt.annotation) == "repeatable_group"
2164+
)
2165+
if has_const_default or has_literal_annotation:
21542166
repeatable_class = node.name
21552167
break
21562168
if repeatable_class is not None:

src/adcp/decisioning/webhook_emit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"create_media_buy",
7575
"update_media_buy",
7676
"media_buy_delivery",
77+
"build_creative",
7778
"sync_creatives",
7879
"activate_signal",
7980
"get_products",

src/adcp/types/_generated.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
DO NOT EDIT MANUALLY.
1111
1212
Generated from: https://github.com/adcontextprotocol/adcp/tree/main/schemas
13-
Generation date: 2026-06-07 22:49:28 UTC
13+
Generation date: 2026-06-07 23:11:03 UTC
1414
"""
1515

1616
# ruff: noqa: E501, I001
@@ -845,6 +845,7 @@
845845
Assets51,
846846
Assets52,
847847
Assets53,
848+
Assets94,
848849
BaseGroupAsset,
849850
BaseIndividualAsset,
850851
Dimensions,
@@ -2232,6 +2233,7 @@
22322233
"Assets51",
22332234
"Assets52",
22342235
"Assets53",
2236+
"Assets94",
22352237
"AssignedPackage",
22362238
"Assignment",
22372239
"Assignments",

src/adcp/types/generated_poc/core/format.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: core/format.json
3-
# timestamp: 2026-06-07T22:46:16+00:00
3+
# timestamp: 2026-06-07T23:07:52+00:00
44

55
from __future__ import annotations
66

@@ -629,3 +629,7 @@ class Format(AdCPBaseModel):
629629
description="**DEPRECATED in 3.1. Removed at 4.0.** Use `v1_format_ref` on the v2 `ProductFormatDeclaration` instead — the seller authors a v2 declaration (in `Product.format_options` or `creative.supported_formats`) and links it back to this v1 format via `v1_format_ref: { agent_url, id }`. The directional link from v2 → v1 is the same fact as `canonical_parameters` without the parallel-shape drift surface (v1 file and `canonical_parameters` were two declarations of the same thing; hand-authored, drifting silently).\n\nMigration: every seller currently authoring `canonical_parameters` SHOULD migrate to authoring a v2 declaration on the corresponding product (or capability) with `v1_format_ref` pointing back at this v1 format. v1 files become pure v1 again — no v2-shape mirroring.\n\n*Legacy behavior, retained for 3.1–3.x backward compatibility:* When `canonical` is set, this field carries the full ProductFormatDeclaration that the SDK projects this v1 format into. The `format_kind` MUST equal the `canonical` field value (validators enforce). When set, this is the authoritative source for SDK v1→v2 projection — the registry's structural-match parameter inference is bypassed. SDKs reading 3.1 catalogs MUST continue to honor `canonical_parameters` when present; 4.0+ SDKs MAY reject the field. New code SHOULD NOT emit this field.\n\n**Drift contract (still normative while supported).** Hand-authored `canonical_parameters` MUST satisfy the *narrows* relation against this v1 format's `requirements` and `assets[*]` shape (see canonical-formats.mdx 'Narrows — formal definition'). SDKs that read this v1 file SHOULD lint-time check the equivalence at build/load and emit `FORMAT_PROJECTION_FAILED` if the two disagree.",
630630
),
631631
] = None
632+
633+
634+
# Backward compatibility for the pre-beta3 generated repeatable group name.
635+
Assets94 = Assets39

tests/fixtures/public_api_snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,6 @@
733733
"GeneratedTaskStatus",
734734
"GeoCountry",
735735
"GeoMetro",
736-
"GeoPostalArea",
737736
"GeoRegion",
738737
"GetAccountFinancialsErrorResponse",
739738
"GetAccountFinancialsRequest",
@@ -919,6 +918,7 @@
919918
"PolicyHistory",
920919
"PolicyRevision",
921920
"PolicySummary",
921+
"PostalArea",
922922
"Preview",
923923
"PreviewCreativeBatchResponse",
924924
"PreviewCreativeFormatRequest",

0 commit comments

Comments
 (0)