Skip to content

Add inherited dataclass annotation validation - #1

Merged
trissim merged 1 commit into
mainfrom
agent/annotated-dataclass-validation
Jul 30, 2026
Merged

Add inherited dataclass annotation validation#1
trissim merged 1 commit into
mainfrom
agent/annotated-dataclass-validation

Conversation

@trissim

@trissim trissim commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

What changed

  • add a reusable AnnotatedDataclassValidationMixin
  • preserve validation when dataclasses are recreated from their nominal bases
  • release the change as 0.1.7

Why

Annotated Python types are the runtime schema. Dataclass declarations need one generic lifecycle hook instead of repeating per-field or per-package validation code.

Validation

  • 99 passed

@trissim
trissim marked this pull request as ready for review July 30, 2026 17:30
Copilot AI review requested due to automatic review settings July 30, 2026 17:30
@trissim
trissim merged commit c4af757 into main Jul 30, 2026
12 checks passed
@trissim
trissim deleted the agent/annotated-dataclass-validation branch July 30, 2026 17:30

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@augmentcode

augmentcode Bot commented Jul 30, 2026

Copy link
Copy Markdown

PR Risk Analyzer Agent🛡️

👀 Human Input Needed
A pair-review briefing is ready for you.

→ Pair Review Briefing

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

Deep Code Review Agent🐛

Review completed with 1 suggestions.

Fix in Cosmos

the same bases.
"""

def __post_init__(self) -> None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This inherited hook is incompatible with dataclasses that declare InitVar fields because dataclasses pass each InitVar value into __post_init__; with this zero-argument signature those classes fail during construction before validation runs. That makes the mixin unusable for a supported dataclass feature even though it is intended as a generic lifecycle hook.

Severity: medium


🤖 Was this useful? React with 👍 or 👎

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.

2 participants