Skip to content

fix(types): preserve open canonical format kinds - #1142

Merged
bokelley merged 2 commits into
mainfrom
bissau
Sep 11, 2026
Merged

fix(types): preserve open canonical format kinds#1142
bokelley merged 2 commits into
mainfrom
bissau

Conversation

@bokelley

@bokelley bokelley commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve unknown future format_kind values on public consumer creative models while keeping known values as CanonicalFormatKind members
  • enforce the required format_schema for producer-side custom format declarations
  • add runtime and strict static regression coverage for the canonical CreativeAsset binding

Closes #1140
Closes #1141

Validation

  • 7,692 tests passed before updating three now-invalid custom-format fixtures; all 251 affected tests pass after the fixture correction
  • ruff check src/
  • mypy src/adcp/
  • mypy --strict tests/type_checks/
  • generated stub validation

Open workspace in Conductor

class CreativeAsset(CanonicalBoundaryModel):
creative_id: str
format_kind: CanonicalFormatKind
format_kind: CanonicalFormatKind | str

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Medium: Public read-type of format_kind widens from CanonicalFormatKind to CanonicalFormatKind | str on CreativeAsset, Creative, DeliveryCreative, and CreativeManifest — all adcp.* public exports. Runtime is backward-compatible (known values still coerce to the enum arm; the wire gets more permissive, not less). But typed adopters who annotated a read as kind: CanonicalFormatKind = creative.format_kind now fail mypy. This ships under fix(types): — release-please cuts a patch — with no migration note. The repo's semver rule lists "changes the type signature of a public export" as requiring the fix!:/BREAKING CHANGE: signal plus a migration note. Non-blocking, but either add a migration note (CHANGELOG/PR body) documenting the read-type widening, or carry the breaking signal.

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Sep 11, 2026

@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 — forward-compat fix on canonical creative models.

What I checked:

  • _forward_compat.py is flagged high-risk (modified), but the reviewer found no medium-or-higher concern on it. The change opens format_kind to CanonicalFormatKind | str (a left-to-right widening / open-union escape hatch) — this preserves rather than breaks forward-compat deserialization, consistent with the discriminated-union governance rule.
  • Type-system import layering intact; no hand-edits to generated code.
  • New branches (format_schema enforcement for custom Format declarations) are covered by new tests (test_canonical_formats_v2_to_v1, test_creative_asset_regression, test_forward_compat_format_kind, type-check binding).
  • No credentials-in-metadata concerns.

Medium finding (non-blocking): the public read-type widening ships under a fix: prefix with no migration note, which the repo semver rule flags. This is a single medium finding — it does not meet the ≥3 threshold for comment (row 8), no critical/high findings (row 1), gated_paths is false, no (deleted) reason, the high-risk (modified) file carries no medium finding (row 5 requires a medium finding to fire — none exist), no team gate, no prior escalation. Falls through to row 9.

Recommend the author consider whether the read-type widening warrants a migration note, but it is not blocking.

@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 subsequent pass on PR #1142. This delta opens the consumer-boundary format_kind enum (CanonicalFormatKind | str | None, union_mode='left_to_right') — the mandated forward-compat direction — via a new fail-closed, idempotent post_generate_fixes.py patcher whose output matches the committed generated file, plus a synced .pyi stub and a py3.10 UTC fix in tests.

No blocking findings. No medium findings. _forward_compat.py is flagged high-risk (modified), but the change widens the union in the forward-compat direction rather than removing a fallback arm or narrowing a published variant, and the reviewer surfaced no medium-or-higher concerns — presumed safe per the modified-file rule. Prior decision was approve with no findings; this run carries none forward and adds none.

No gated paths, no no-auto-approve team match. Rows 1–8 do not fire → row 9 approve.

@bokelley
bokelley merged commit 0fe7143 into main Sep 11, 2026
23 checks passed
@bokelley
bokelley deleted the bissau branch September 11, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant