Skip to content

Remove @dataclasses.dataclass from TaskProgressEvent#305

Merged
Abhijeet Prasad (AbhiPrasad) merged 1 commit intobraintrustdata:mainfrom
willfrey:fix/remove-dataclass-from-task-progress-event
Apr 16, 2026
Merged

Remove @dataclasses.dataclass from TaskProgressEvent#305
Abhijeet Prasad (AbhiPrasad) merged 1 commit intobraintrustdata:mainfrom
willfrey:fix/remove-dataclass-from-task-progress-event

Conversation

@willfrey
Copy link
Copy Markdown
Contributor

Summary

Fixes #293.

TaskProgressEvent was decorated with both @dataclasses.dataclass and inherited from TypedDict. These use incompatible metaclass mechanisms — TypedDict uses its own metaclass to build the class dict, while @dataclasses.dataclass expects a regular class and transforms its annotations into dataclass fields. The combination works accidentally at runtime but confuses static type checkers and is unnecessary.

The maintainer confirmed that TypedDict is the intended form. This PR removes the @dataclasses.dataclass decorator, leaving class TaskProgressEvent(TypedDict): unchanged.

Test plan

  • Verify no other @dataclasses.dataclass decorators are affected (only TaskProgressEvent's was removed)
  • Confirm TaskProgressEvent and its subclass SSEProgressEvent continue to work as plain TypedDict classes

Fixes braintrustdata#293. TaskProgressEvent inherits from TypedDict, which uses
an incompatible metaclass with @dataclasses.dataclass. The maintainer
confirmed TypedDict is the intended form and the decorator is
unnecessary.
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) merged commit 173a727 into braintrustdata:main Apr 16, 2026
84 checks passed
@willfrey Will Frey (willfrey) deleted the fix/remove-dataclass-from-task-progress-event branch April 16, 2026 23:39
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.

TaskProgressEvent inherits from both @dataclass and TypedDict

2 participants