@@ -18,11 +18,24 @@ class WorkflowStepMetadata:
1818 step_type: The workflow step class name (e.g., 'CapacityEnvelopeAnalysis').
1919 step_name: The instance name of the step.
2020 execution_order: Order in which this step was executed (0-based).
21+ scenario_seed: Scenario-level seed provided in the YAML (if any).
22+ step_seed: Seed assigned to this step (explicit or scenario-derived).
23+ seed_source: Source for the step seed. One of:
24+ - "scenario-derived": seed was derived from scenario.seed
25+ - "explicit-step": seed was explicitly provided for the step
26+ - "none": no seed provided/active for this step
27+ active_seed: The effective base seed used by the step, if any. For steps
28+ that use Monte Carlo execution, per-iteration seeds are derived from
29+ active_seed (e.g., active_seed + iteration_index).
2130 """
2231
2332 step_type : str
2433 step_name : str
2534 execution_order : int
35+ scenario_seed : Optional [int ] = None
36+ step_seed : Optional [int ] = None
37+ seed_source : str = "none"
38+ active_seed : Optional [int ] = None
2639
2740
2841@dataclass
@@ -61,17 +74,35 @@ def put(self, step_name: str, key: str, value: Any) -> None:
6174 self ._store [step_name ][key ] = value
6275
6376 def put_step_metadata (
64- self , step_name : str , step_type : str , execution_order : int
77+ self ,
78+ step_name : str ,
79+ step_type : str ,
80+ execution_order : int ,
81+ * ,
82+ scenario_seed : Optional [int ] = None ,
83+ step_seed : Optional [int ] = None ,
84+ seed_source : str = "none" ,
85+ active_seed : Optional [int ] = None ,
6586 ) -> None :
6687 """Store metadata for a workflow step.
6788
6889 Args:
6990 step_name: The step instance name.
7091 step_type: The workflow step class name.
7192 execution_order: Order in which this step was executed (0-based).
93+ scenario_seed: Scenario-level seed from YAML, if any.
94+ step_seed: Seed attached to this step (explicit or derived), if any.
95+ seed_source: Source of step seed ("scenario-derived", "explicit-step", or "none").
96+ active_seed: Effective base seed used by the step, if any.
7297 """
7398 self ._metadata [step_name ] = WorkflowStepMetadata (
74- step_type = step_type , step_name = step_name , execution_order = execution_order
99+ step_type = step_type ,
100+ step_name = step_name ,
101+ execution_order = execution_order ,
102+ scenario_seed = scenario_seed ,
103+ step_seed = step_seed ,
104+ seed_source = seed_source ,
105+ active_seed = active_seed ,
75106 )
76107
77108 def get (self , step_name : str , key : str , default : Any = None ) -> Any :
@@ -148,6 +179,10 @@ def to_dict(self) -> Dict[str, Any]:
148179 "step_type" : metadata .step_type ,
149180 "step_name" : metadata .step_name ,
150181 "execution_order" : metadata .execution_order ,
182+ "scenario_seed" : metadata .scenario_seed ,
183+ "step_seed" : metadata .step_seed ,
184+ "seed_source" : metadata .seed_source ,
185+ "active_seed" : metadata .active_seed ,
151186 }
152187 for step_name , metadata in self ._metadata .items ()
153188 }
0 commit comments