You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scenario validator does not check literal option compatibility in 'when' expressions #118
Scenario validation checks expression syntax and unknown attribute names, but does not validate that compared string literals are valid categorical options for the referenced attribute.
This allows case/value mismatches (e.g., urban_rural == 'urban' when option is Urban) to pass validation and silently no-op at runtime.
Why This Matters
This is a major source of "looks valid but behavior is wrong" bugs. Incorrect conditions don’t throw hard errors during simulation; they just fail to match and flatten dynamics.
Current Behavior (Code)
In /Users/adithyasrinivasan/Projects/extropy/extropy/scenario/validator.py:
syntax check: validate_expression_syntax(...)
reference check: extract_names_from_expression(...) vs known attrs
no check that literals used in comparisons are present in attribute option domains
By contrast, population semantic validation already has this concept via AST comparison extraction.
Proposed Fix
Add AST-based comparison extraction for scenario when clauses:
Closing as fixed. Scenario validation now checks literal-option compatibility in expressions using AST comparison extraction and attribute option lookup. See in .
Activity
fix(scenario): validate condition literals against categorical options (
RandomOscillations commentedon Feb 20, 2026
Implemented on branch
codex/steps1-3-hardening(see PR #124). Keeping this issue open until merge + integration verification completes.RandomOscillations commentedon Feb 23, 2026
Closing as fixed. Scenario validation now checks literal-option compatibility in expressions using AST comparison extraction and attribute option lookup. See in .