refactor(optim-config): split parsing (reading) from cross-validation - #265
Merged
Juliette-Gerbaux merged 3 commits intoAug 12, 2026
Merged
Conversation
Move validate_optim_config and its _check_* helpers out of parsing.py into a new validation.py, mirroring the convention of separating input-reading from business-rule validation. Update all call sites that imported validate_optim_config directly from .parsing. Also mark the same mixing pattern with TODOs where it recurs elsewhere (resolve_components.py, resolve_library.py, study.py) for a future pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
aoustry
approved these changes
Aug 12, 2026
tbittar
approved these changes
Aug 12, 2026
Juliette-Gerbaux
deleted the
refactor/optim-config-parsing-validation-split
branch
August 12, 2026 14:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Process ID
Process: GP-02
Description
Splits
gems_craft/optim_config/parsing.pyinto a reading module and a validation module:parsing.pykeeps the Pydantic schema (OptimConfig,ScenarioScopeConfig,ResolutionConfig, etc.) andload_optim_config().validation.pyholdsvalidate_optim_config()and its_check_*helpers, which cross-validate a parsedOptimConfigagainst a resolvedSystem.All call sites that imported
validate_optim_configdirectly from.parsing(gems_runner/study/runner.pyand three test files) were updated to import it from.validationinstead; the package's__init__.pyre-exports are unchanged.Also adds
TODOmarkers where the same reading/validation mixing recurs elsewhere in the codebase, for a future follow-up pass:study/resolve_components.py:consistency_check()and the inline missing-parameter/property checks in_resolve_component()model/resolve_library.py: the_forbid_*expression-validation helpers embedded in the resolution passstudy/study.py:Study.check_consistency()duplicates/overlaps withresolve_components.consistency_check()without being consolidatedImpact Analysis
optim_config/(split), plusstudy/andmodel/(TODO comments only, no behavior change).Checklist
pytest)mypy)black,isort)pyproject.tomlversion bumped if applicableAGENTS.mdreviewed for impact and updated if needed