Description
The SingleResult dataclass declares example: Example and result: RunResult but defaults both to None. The # type: ignore[assignment] silences the type checker but does not fix the runtime problem: any code that constructs SingleResult() without explicitly setting both fields and then accesses sr.example.name or sr.result.exit_code will crash with AttributeError: 'NoneType' object has no attribute 'name'. The sibling class RunResult demonstrates the correct pattern — every field has a concrete default. Example requires three non-defaulted args (name, path, cwd), so the author punted with None. Callers have no type-level signal that these fields can be absent.
Severity: high
File: sdk/python/validation/models.py
Expected Behavior
The code should handle this case properly to avoid unexpected errors or degraded quality.
Description
The
SingleResultdataclass declaresexample: Exampleandresult: RunResultbut defaults both toNone. The# type: ignore[assignment]silences the type checker but does not fix the runtime problem: any code that constructsSingleResult()without explicitly setting both fields and then accessessr.example.nameorsr.result.exit_codewill crash withAttributeError: 'NoneType' object has no attribute 'name'. The sibling classRunResultdemonstrates the correct pattern — every field has a concrete default.Examplerequires three non-defaulted args (name, path, cwd), so the author punted withNone. Callers have no type-level signal that these fields can be absent.Severity:
highFile:
sdk/python/validation/models.pyExpected Behavior
The code should handle this case properly to avoid unexpected errors or degraded quality.