-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Summary
validate_scenario() builds known_attributes from the base population spec only, and does not add ScenarioSpec.extended_attributes. This causes invalid validation behavior for scenario conditions that legitimately reference extended attributes.
Why This Matters
In the study-folder flow, sampling merges base + extended attributes before generating agents. Scenario rules should be validated against the same effective attribute namespace used downstream. Current mismatch creates false negatives and brittle authoring.
Current Behavior (Code)
In /Users/adithyasrinivasan/Projects/extropy/extropy/scenario/validator.py:
known_attributesis initialized frompopulation_spec.attributesonly (line ~120-123)- references in
seed_exposure.rules[].whenandspread.share_modifiers[].whenare checked against that base-only set (line ~218,line ~295) spec.extended_attributesis not included anywhere in the reference set
Expected Behavior
Attribute reference validation should use:
- base population attributes
- PLUS scenario
extended_attributes
Proposed Fix
- Build
known_attributesas:
- base attr names from
population_spec(if present) - union with
{a.name for a in spec.extended_attributes or []}
-
Apply this unified set to all expression-reference checks in scenario validator.
-
Add tests:
- scenario with
extended_attributes=[foo_bar], and awhenclause referencingfoo_barshould pass - unknown attr should still fail
Acceptance Criteria
- Valid references to extended attributes no longer fail validation.
- Unknown references still produce errors.
- Behavior is consistent across
extropy validateand compile/load validation paths.
Pipeline Impact
Steps 2->3 consistency (scenario -> sample) improves by aligning validator namespace with merged-spec sampling behavior.