Skip to content

Replace nb-scenarios with scenario playlist in scenario-scope#206

Open
aoustry wants to merge 8 commits intodevelopfrom
claude/design-scenario-playlist-8E4M5
Open

Replace nb-scenarios with scenario playlist in scenario-scope#206
aoustry wants to merge 8 commits intodevelopfrom
claude/design-scenario-playlist-8E4M5

Conversation

@aoustry
Copy link
Copy Markdown
Collaborator

@aoustry aoustry commented May 2, 2026

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

claude added 3 commits May 2, 2026 13:24
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
@aoustry aoustry changed the base branch from main to develop May 2, 2026 17:16
claude added 5 commits May 2, 2026 18:25
- _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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants