Summary
Convert the frozen config dataclasses in core_solver.py to Pydantic BaseModel:
RunConfig (L194)
DtControllerConfig (L148)
AdaptiveConfig (L162)
OperatorSpecs (L177)
Motivation
These are user-facing configuration objects with no validation at construction time. Validation currently lives downstream in CoreSolver._resolve_run_plan(), meaning invalid configs only surface at solve time. Pydantic adds:
- Field constraints —
method validated against MethodName literal (currently str), numeric bounds (ge=0, gt=0) on tolerances, safety factors, dt limits.
- Serialization — YAML/JSON round-tripping for config persistence and reproducibility.
- Immutability —
model_config = ConfigDict(frozen=True) replaces @dataclass(frozen=True).
- Consistency — Matches the flepimop2 provider config (
OpEngineEngineConfig) which is already Pydantic.
Scope
- Convert 4 dataclasses → Pydantic
BaseModel with frozen=True
- Add field validators / constraints matching current downstream checks
- Update
_resolve_run_plan() to rely on config-level validation
- Update all tests constructing these objects
Constraints
- Must not change
RunPlan (internal-only, never user-constructed)
- Must not change mutable parameter bundles (
StepIO, ImplicitStageParams, etc.) — hot-path structures
- Must pass
ruff check --preview and mypy --strict
Related
Summary
Convert the frozen config dataclasses in
core_solver.pyto PydanticBaseModel:RunConfig(L194)DtControllerConfig(L148)AdaptiveConfig(L162)OperatorSpecs(L177)Motivation
These are user-facing configuration objects with no validation at construction time. Validation currently lives downstream in
CoreSolver._resolve_run_plan(), meaning invalid configs only surface at solve time. Pydantic adds:methodvalidated againstMethodNameliteral (currentlystr), numeric bounds (ge=0,gt=0) on tolerances, safety factors, dt limits.model_config = ConfigDict(frozen=True)replaces@dataclass(frozen=True).OpEngineEngineConfig) which is already Pydantic.Scope
BaseModelwithfrozen=True_resolve_run_plan()to rely on config-level validationConstraints
RunPlan(internal-only, never user-constructed)StepIO,ImplicitStageParams, etc.) — hot-path structuresruff check --previewandmypy --strictRelated