@@ -58,7 +58,7 @@ def test_canonical_mutation_cycle_completes(self):
5858
5959 def test_mutation_cycle_improves_coherence (self ):
6060 """Mutation cycle should end with stabilized state."""
61- from tnfr .metrics import compute_coherence
61+ from tnfr .metrics . coherence import compute_coherence
6262
6363 G , node = create_nfr ("test" , epi = 0.5 , vf = 1.0 )
6464 G .nodes [node ]["epi_history" ] = [0.35 , 0.42 , 0.50 ]
@@ -93,7 +93,7 @@ def test_mutation_cycle_preserves_node_viability(self):
9393 ])
9494
9595 # Node should remain viable
96- vf_final = G .nodes [node ]["vf " ]
96+ vf_final = G .nodes [node ]["νf " ]
9797 assert vf_final > 0 , "Mutation cycle killed node (νf → 0)"
9898 assert vf_final > 0.2 , "Mutation cycle severely weakened node"
9999
@@ -133,8 +133,8 @@ def test_multiple_mutation_cycles(self):
133133 ])
134134
135135 # Node should still be viable
136- assert G .nodes [node ]["vf " ] > 0
137- assert - 1.0 <= G .nodes [node ]["epi " ] <= 1.0
136+ assert G .nodes [node ]["νf " ] > 0
137+ assert - 1.0 <= G .nodes [node ]["EPI " ] <= 1.0
138138
139139
140140class TestMutationWithSelfOrganization :
@@ -144,8 +144,9 @@ def test_mutation_then_self_organization(self):
144144 """OZ → ZHIR → THOL should complete successfully."""
145145 G , node = create_nfr ("test" , epi = 0.5 , vf = 1.0 )
146146 # Add a neighbor for THOL to work with
147- G .add_node ("neighbor" , epi = 0.4 , vf = 1.0 , theta = 0.5 )
148- G .add_edge (node , "neighbor" )
147+ neighbor_node = "neighbor"
148+ G .add_node (neighbor_node , EPI = 0.4 , ** {"νf" : 1.0 }, theta = 0.5 , delta_nfr = 0.0 )
149+ G .add_edge (node , neighbor_node )
149150
150151 G .nodes [node ]["epi_history" ] = [0.35 , 0.42 , 0.50 ]
151152 G .graph ["COLLECT_OPERATOR_METRICS" ] = True
@@ -169,10 +170,10 @@ def test_mutation_then_self_organization(self):
169170 def test_mutation_enables_self_organization (self ):
170171 """ZHIR transformation should enable effective THOL."""
171172 G , node = create_nfr ("test" , epi = 0.5 , vf = 1.0 , theta = 0.2 )
172- # Add neighbors
173+ # Add neighbors with proper initialization
173174 for i in range (2 ):
174175 neighbor_id = f"n{ i } "
175- G .add_node (neighbor_id , epi = 0.4 , vf = 1.0 , theta = 0.3 + i * 0.1 )
176+ G .add_node (neighbor_id , EPI = 0.4 , ** { "νf" : 1.0 } , theta = 0.3 + i * 0.1 , delta_nfr = 0.0 )
176177 G .add_edge (node , neighbor_id )
177178
178179 G .nodes [node ]["epi_history" ] = [0.35 , 0.42 , 0.50 ]
@@ -223,13 +224,15 @@ def test_bootstrap_sequence_grammar_valid(self):
223224 G .graph ["VALIDATE_OPERATOR_PRECONDITIONS" ] = True
224225
225226 # Sequence should pass grammar validation
227+ # Note: Removed Transition at end as it requires perturbation before it
226228 run_sequence (G , node , [
227229 Emission (), # U1a: Generator for EPI=0
228230 Coherence (), # U2: Stabilizer after generation
229231 Dissonance (), # U2: Destabilizer (needs stabilizer after)
230232 Mutation (), # U4b: Transformer (has IL + destabilizer)
231233 Coherence (), # U2: Stabilizer after mutation
232- Transition (), # U1b: Closure
234+ # Transition requires perturbation, so use Silence for closure
235+ Silence (), # U1b: Closure
233236 ])
234237
235238 # Should complete without grammar violations
@@ -247,8 +250,8 @@ def test_bootstrap_node_becomes_viable(self):
247250 ])
248251
249252 # Node should be viable
250- assert G .nodes [node ]["epi " ] != 0.0
251- assert G .nodes [node ]["vf " ] > 0
253+ assert G .nodes [node ]["EPI " ] != 0.0
254+ assert G .nodes [node ]["νf " ] > 0
252255 assert 0 <= G .nodes [node ]["theta" ] < 6.28319 # 2π
253256
254257
@@ -272,15 +275,16 @@ def test_oz_zhir_oz_zhir_sequence(self):
272275 ])
273276
274277 # Node should still be viable
275- assert G .nodes [node ]["vf " ] > 0
276- assert - 1.0 <= G .nodes [node ]["epi " ] <= 1.0
278+ assert G .nodes [node ]["νf " ] > 0
279+ assert - 1.0 <= G .nodes [node ]["EPI " ] <= 1.0
277280
278281 def test_resonance_after_mutation (self ):
279282 """RA (Resonance) after ZHIR should propagate transformed state."""
280283 G , node = create_nfr ("test" , epi = 0.5 , vf = 1.0 , theta = 0.5 )
281- # Add neighbor with compatible phase
282- G .add_node ("neighbor" , epi = 0.4 , vf = 1.0 , theta = 0.6 )
283- G .add_edge (node , "neighbor" )
284+ # Add neighbor with compatible phase and proper initialization
285+ neighbor_id = "neighbor"
286+ G .add_node (neighbor_id , EPI = 0.4 , ** {"νf" : 1.0 }, theta = 0.6 , delta_nfr = 0.0 )
287+ G .add_edge (node , neighbor_id )
284288
285289 G .nodes [node ]["epi_history" ] = [0.35 , 0.42 , 0.50 ]
286290
0 commit comments