merge develop branch into main #212
Merged
Merged
Conversation
* Replace nb-scenarios with scenario playlist in scenario-scope The scenario-scope config now accepts either an inline include/exclude declaration (with support for 1-based integer indices and 'a-b' range strings) or a playlist-file reference pointing to a flat JSON array of 1-based integers. Both forms resolve to a sorted, deduplicated list of 0-based MC scenario indices consumed by the solver. nb-scenarios is removed: the pydantic extra="forbid" policy makes any YAML that still uses it a hard validation error. All test fixtures and inline config strings have been migrated to the new include form. validate_optim_config gains an optional scenario_builder parameter to cross-check playlist indices against every defined scenario group. https://claude.ai/code/session_01EfjU9tBfdyZ9nZmQFCe5uU * Update uv.lock after dependency resolution https://claude.ai/code/session_01EfjU9tBfdyZ9nZmQFCe5uU * Fix black and isort formatting Two lines wrapped to 88 chars in parsing.py; one extra blank line removed after import in the test file. https://claude.ai/code/session_01EfjU9tBfdyZ9nZmQFCe5uU * Improve scenario-scope: string ints, eager cache, missing tests - _expand_entries now accepts string integers like "5" in addition to int 5 and range "1-10", treating them identically after stripping - ScenarioScopeConfig stores scenario_ids in a PrivateAttr cache so resolution happens at most once per instance - load_optim_config triggers eager resolution after path resolution, so the playlist file is read exactly once at load time and I/O errors surface immediately - New tests: string-integer entries, cache identity (file deleted after load), and validate_optim_config ScenarioBuilder cross-check https://claude.ai/code/session_01EfjU9tBfdyZ9nZmQFCe5uU * Fix playlist loading: wrap I/O errors as ValueError, reject JSON booleans FileNotFoundError and json.JSONDecodeError from _load_playlist now surface as ValueError so callers always receive a consistent exception type. JSON boolean values (true/false) are now explicitly rejected — bool is a subclass of int in Python so they previously slipped through the isinstance check silently. Three new tests cover each case. https://claude.ai/code/session_01EfjU9tBfdyZ9nZmQFCe5uU * Update documentation for scenario-scope playlist feature - optim-config.md: replace nb-scenarios section with full description of the inline (include/exclude) and playlist-file forms, with examples, validation rules, and updated Python API snippets - scenario-builder.md: remove stale nb-scenarios reference; link to validate_optim_config cross-check - CHANGELOG.md: add [Unreleased] entry summarising the playlist changes; fix the 0.1.0 entry that still mentioned nb_scenarios https://claude.ai/code/session_01EfjU9tBfdyZ9nZmQFCe5uU * Reject boolean values in inline include/exclude lists Pydantic coerces True/False to 1/0 before _expand_entries sees them, so the check must happen at the field_validator(mode="before") layer. A field_validator on include and exclude now raises ValueError for any bool item, making the behaviour consistent with playlist-file which already rejects JSON booleans. Two new tests cover include=[True] and exclude=[False]. https://claude.ai/code/session_01EfjU9tBfdyZ9nZmQFCe5uU * Switch scenario-scope to 0-based indexing throughout All user-facing scenario index surfaces (optim-config.yml include/exclude and JSON playlist files) now use 0-based indices, consistent with the modeler-scenariobuilder.dat convention. The internal representation is unchanged (already 0-based), so only the boundary conversion code is affected: - _expand_entries: removed the '- 1' offset; lower bound is now >= 0 - _load_playlist: removed the '- 1' offset; lower bound is now >= 0 - _resolve_inline warning: no longer adds 1 back when reporting orphans - Range 'a-b' now means [a, b] inclusive (both 0-based) All test fixtures, inline config strings, unit tests and documentation updated accordingly. 'include: [0]' now means the first scenario (was 1). https://claude.ai/code/session_01EfjU9tBfdyZ9nZmQFCe5uU * Fix CHANGELOG: restore accurate 0.1.0 entry, add inline boolean note - 0.1.0 entry: restore nb_scenarios description (that is what was shipped in 0.1.0; the playlist feature is in [Unreleased]) - [Unreleased] other-changes bullet: broaden boolean rejection note to cover both inline include/exclude lists and JSON playlist files https://claude.ai/code/session_01EfjU9tBfdyZ9nZmQFCe5uU * Allow exclude with playlist-file; update docstrings throughout exclude is no longer restricted to the inline include form — it now applies to both base-set forms (include and playlist-file). The exclude logic was lifted out of _resolve_inline (now removed) into _compute_scenario_ids so it runs uniformly after the base set is built. - _check_constraints: 'exclude' now requires include OR playlist-file - _load_playlist: returns Set[int] instead of List[int]; sorting deferred to _compute_scenario_ids after exclude is applied - _compute_scenario_ids: single unified method handles both forms + exclude - Warning message updated: 'include set' → 'base set' Docstrings updated: - ScenarioScopeConfig: full class docstring documenting both forms, exclude compatibility, caching behaviour, and index convention - _expand_entries: clarified entry formats and boolean handling note - validate_optim_config: enumerated bullet-point list of all checks - ScenarioBuilder.validate_mc_scenarios: documents return contract Four new tests cover playlist-file + exclude (basic, range, all-excluded, orphan warning). Updated test for the relaxed exclude-without-base error. https://claude.ai/code/session_01EfjU9tBfdyZ9nZmQFCe5uU * Fix validate_mc_scenarios error message; update load_optim_config docstring validate_mc_scenarios was still converting indices to 1-based in its error message after the 0-based switch. Error now reports the raw 0-based indices and the correct range (0–N-1). load_optim_config docstring replaced: removes the stale 'components_path' reference and documents the two extra steps the function performs beyond plain YAML parsing (relative path resolution and eager scenario_ids population). https://claude.ai/code/session_01EfjU9tBfdyZ9nZmQFCe5uU --------- Co-authored-by: Claude <noreply@anthropic.com>
* Equality refacto * Add and update tests * Update reference MPS
tbittar
approved these changes
May 29, 2026
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.
No description provided.