Replace nb-scenarios with scenario playlist in scenario-scope#206
Open
Replace nb-scenarios with scenario playlist in scenario-scope#206
Conversation
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
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
- _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
…eans 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
- 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
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
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
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.
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