Skip to content

Conversation

@VegetarianOrc
Copy link
Collaborator

@VegetarianOrc VegetarianOrc commented Jan 17, 2026

Summary

Input/Output Type Changes

  • Require type equality for operation handler input/output types instead of allowing subtype relationships
  • Remove the is_subtype function which is no longer needed
  • Simplify type mismatch error messages

Various Test Cleanup

  • Replace @dataclass_transform() with @dataclass() decorator in test files
  • Remove some empty base classes for tests

Tests

  • Existing tests updated to reflect stricter type checking
  • Tests for covariant/contravariant type relationships updated to expect errors

🤖 Generated with Claude Code

VegetarianOrc and others added 4 commits January 16, 2026 14:29
   Replace covariant/contravariant type checking with strict identity checks.
   Operation handler implementations must now declare the exact same input and
   output types as the service definition, rather than allowing subtype
   relationships. This simplifies type validation and makes the type contract
   more explicit.

   Also replace dataclass_transform with standard @DataClass decorator in tests.
Remove the now-unused is_subtype function since type checking requires
exact type identity. Also fix import ordering in test files to follow
PEP 8 conventions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@VegetarianOrc VegetarianOrc requested a review from a team as a code owner January 17, 2026 01:58
VegetarianOrc and others added 5 commits January 16, 2026 18:02
- Add missing colon and space in type mismatch error messages
- Fix typo: OutputCovarianceImplOutputCannnotBeStrictSuperclass ->
  OutputCovarianceImplOutputCannotBeStrictSuperclass

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds test cases using parameterized types (list[int], dict[str, bool])
to validate that equality comparison (!=) works correctly for type
checking. This ensures generic types are properly compared since they
create new objects on each evaluation, making identity comparison (is)
unreliable.

Also adds missing InputContravarianceImplInputCannotBeSubclass to the
parametrize list.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix stale docstring that described covariance/contravariance
- Add tests clarifying that Any requires exact match, not wildcard

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@VegetarianOrc VegetarianOrc changed the title Require exact type identity for operation handler input/output types Require type equality for operation handler input/output types Jan 17, 2026
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