Skip to content

Type safety and code quality

Choose a tag to compare

@psarno psarno released this 21 Oct 03:19
· 22 commits to main since this release

Overview

This is a maintenance release focused on improving type safety and code quality throughout the engine.

Type Safety Improvements

Enhanced Type Annotations

  • Improved type hints across debate engine components (context builder, round manager, engine)
  • Added comprehensive TypedDict definitions for better IDE support and type checking
  • Enhanced provider override types in model management system
  • Better typing for OpenRouter generation types with expanded type definitions
  • Improved ensemble judge typing with EnsembleResult TypedDict

Better Type Inference

  • Replaced getattr() calls with direct property access for better type inference
  • Added proper type exports in dialectus.engine.models.__init__ module
  • Fixed import paths to use absolute imports consistently
  • Imported proper OpenAI SDK types instead of custom definitions

Code Quality

Refactoring

  • Consolidated configuration validators in settings module
  • Extracted scoring calculation helper from base judge for better separation of concerns
  • Used named constants instead of magic strings in context builder and utilities
  • Improved formatting of multi-line f-strings for better readability

Testing

  • Fixed and improved OpenAI moderator tests
  • Added proper type annotations to test files
  • Enhanced test coverage for moderation functionality

Breaking Changes

None - this is a fully backward-compatible release.

For Developers

Type safety and maintainability:

  • All changes pass strict Pyright type checking
  • No runtime behavior changes
  • Improved IDE autocomplete and type inference
  • Better foundation for future development