Skip to content

fix(types): retain serialization schema fields - #1246

Merged
bokelley merged 1 commit into
mainfrom
fix/serialization-schema-shape
Sep 29, 2026
Merged

bokelley merged 1 commit into
mainfrom
fix/serialization-schema-shape

Conversation

@bokelley

@bokelley bokelley commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

AdCPBaseModel annotated its wrap serializer -> Any, causing subclasses that inherit that serializer to emit {} for their serialization JSON Schema. Removing the return annotation lets Pydantic derive the schema from model fields. The regression checks that NotificationConfig retains subscriber_id, url, and event_types.

Before: NotificationConfig.model_json_schema(mode="serialization") == {}. After: it has an object schema with those properties.

Validation: make lint, make typecheck-all, mypy, Ruff, Black, commit hooks, and focused tests pass. Full make test passed: 12,111 passed, 2,397 skipped, 9 deselected, 1 xfailed; 81.54% coverage. All 52 completed CI checks pass, including PostgreSQL conformance. Independent technical review passed 87 related checks. A separate pre-existing serializer override in canonical_creative.py has the same annotation issue and is outside this fix.

Fixes #1243.

Copy link
Copy Markdown
Contributor Author

Overall technical verdict for 32a0ae4048ad0a8b528290357d46da66571fd950: CLEAR for the inherited AdCPBaseModel serializer fix. No blocking finding in this diff.

  • Independently ran the wire-default, subclass-serialization, canonical-creative, and MCP output-schema tests: 87 passed. Targeted mypy, Ruff, and Black checks passed.
  • Real NotificationConfig, TrustedMatch, and all five vendor-pricing variants retain properties directly, through TypeAdapter, and inside a containing model's $defs. Restoring the old -> Any in a process-local control reproduced {}; removing it restored fields while validation schemas stayed unchanged. The added regression tests actual field presence.
  • The local ignore[no-untyped-def] is appropriate: removing it produces exactly the missing-return-annotation error; an injected assignment error inside the method is still reported with the ignore present. The handler stays typed, and the previously Any return is not made less precise for callers. Omitting the annotation avoids Pydantic's separate return schema, consistent with its serializer contract.

Non-blocking pre-existing companion defect: canonical_creative.py:404-407 separately annotates _serialize_canonical_model -> Any. Public Product, Creative, Format, and GetProductsResponse still produce {} in serialization mode, including nested definitions. This function is unchanged from the parent; removing its annotation in a process-local control restores their fields. Track that override separately, with direct/nested serialization-schema tests that also retain the legacy-field exclusions. The base fix should not be described as repairing every exported model's schema.

CI/full-suite results are still pending with no failures reported. Formal aao review follows ready status.

@bokelley
bokelley marked this pull request as ready for review September 29, 2026 16:22

@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.

Removes the -> Any return annotation from AdCPBaseModel's inherited wrap serializer so Pydantic derives the serialization JSON schema from model fields instead of emitting {}, plus a regression test pinning #1243. Wire output is unchanged (annotation affects schema generation only), so the fix: prefix is the correct semver signal — no public-surface break, no forward-compat regression, no generated-code hand-edit, no import-layering violation. The # type: ignore[no-untyped-def] is a specific-code suppression (allowed; only blanket suppressions are flagged). Reviewer found no blocking or Medium findings.

No decision-table trigger fired: no critical/high/medium findings, gated_paths is false, high_risk is false, no no-auto-approve team match, no prior decision. Falls through to row 9. (review_decision is REVIEW_REQUIRED, but row 2 only applies when gated_paths is true.)

Noted as out of scope: the identical pre-existing -> Any in canonical_creative.py, flagged as a follow-up.

@bokelley
bokelley merged commit 1131abd into main Sep 29, 2026
56 checks passed
@bokelley
bokelley deleted the fix/serialization-schema-shape branch September 29, 2026 16:32
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.

bug(types): AdCPBaseModel's -> Any model_serializer erases every serialization JSON schema

1 participant