Problem
During validation system implementation, I discovered inconsistent predict() method signatures across different Score implementations:
Current Signatures Found:
- Standard signature (intended):
predict(self, context, model_input: Score.Input)
- Legacy signature:
predict(self, model_input: Score.Input)
- Keyword-only signature:
predict(self, *, context, model_input: Score.Input)
Examples in Codebase:
Legacy signature examples:
plexus/processors/RelevantWindowsTranscriptFilter_test.py:19
- Various test mock implementations
Standard signature examples:
- Abstract method definition in
Score.py:576
- Most production Score implementations
Keyword-only signature examples:
- Some test implementations
Impact
- Inconsistent API: Different calling conventions confuse developers
- Maintenance burden: Need to support multiple signatures
- Error-prone: Easy to call methods incorrectly
- Documentation clarity: Unclear which signature is "correct"
Proposed Solution
-
Standardize on: predict(self, context, model_input: Score.Input) -> Union[Score.Result, List[Score.Result]]
- This matches the abstract method definition
- Provides context for future extensibility
- Most implementations already use this
-
Migration plan:
- Update legacy implementations to standard signature
- Add deprecation warnings for old signatures (optional)
- Update tests and documentation
- Consider adding linting rules to prevent regression
-
Files to update:
- Test mock classes in
plexus/processors/RelevantWindowsTranscriptFilter_test.py
- Any other legacy implementations found via codebase search
Current Workaround
The validation system now includes compatibility handling for all three signatures using signature inspection and argument adaptation. While this works, it adds complexity and should be temporary.
Next Steps
- Search codebase for all
predict() method implementations
- Identify which ones need updating
- Create migration plan with backward compatibility considerations
- Update implementations systematically
- Remove compatibility code once migration is complete
This standardization will improve code consistency, reduce maintenance burden, and make the API clearer for developers.
Problem
During validation system implementation, I discovered inconsistent
predict()method signatures across different Score implementations:Current Signatures Found:
predict(self, context, model_input: Score.Input)predict(self, model_input: Score.Input)predict(self, *, context, model_input: Score.Input)Examples in Codebase:
Legacy signature examples:
plexus/processors/RelevantWindowsTranscriptFilter_test.py:19Standard signature examples:
Score.py:576Keyword-only signature examples:
Impact
Proposed Solution
Standardize on:
predict(self, context, model_input: Score.Input) -> Union[Score.Result, List[Score.Result]]Migration plan:
Files to update:
plexus/processors/RelevantWindowsTranscriptFilter_test.pyCurrent Workaround
The validation system now includes compatibility handling for all three signatures using signature inspection and argument adaptation. While this works, it adds complexity and should be temporary.
Next Steps
predict()method implementationsThis standardization will improve code consistency, reduce maintenance burden, and make the API clearer for developers.