@@ -1611,32 +1611,8 @@ def __init__(self):
16111611These tests demonstrate that delta_bound convergence mode was incorrectly
16121612comparing IPL complement bounds against the original label's previous bound
16131613instead of the complement's own previous bound.
1614-
1615- Example scenario from bug_log_2.md:
1616- Timestep t-1:
1617- infected(Alice) = [0.1, 0.2]
1618- healthy(Alice) = [0.8, 0.9]
1619-
1620- Timestep t:
1621- Update: infected(Alice) = [0.7, 0.9]
1622- IPL triggers: healthy(Alice) = [0.1, 0.3]
1623-
1624- WRONG calculation (BUG-127):
1625- Comparing healthy [0.1, 0.3] vs infected's previous [0.1, 0.2]
1626- delta = max(|0.1-0.1|, |0.3-0.2|) = 0.1
1627-
1628- CORRECT calculation:
1629- Comparing healthy [0.1, 0.3] vs healthy's previous [0.8, 0.9]
1630- delta = max(|0.1-0.8|, |0.3-0.9|) = 0.7
16311614"""
16321615
1633- import pytest
1634- from unittest .mock import Mock
1635- import inspect
1636-
1637- pytestmark = pytest .mark .usefixtures ("helpers_fixture" )
1638-
1639-
16401616def test_update_node_ipl_complement_delta_bound_bug127 (monkeypatch , helpers_fixture ):
16411617 """
16421618 Test that exposes BUG-127 in _update_node.
@@ -1943,25 +1919,22 @@ def empty_list(self, *args, **kwargs):
19431919 assert world .world [recovered ].lower == pytest .approx (0.7 )
19441920 assert world .world [recovered ].upper == pytest .approx (0.75 )
19451921
1946- # THE CRITICAL ASSERTION for BUG-125 + BUG-127:
1947- # Correct (all three bounds calculated correctly):
1948- # infected: max(|0.25-0.2|, |0.3-0.3|) = 0.05
1949- # healthy: max(|0.7-0.7|, |0.75-0.8|) = 0.05
1950- # recovered: max(|0.7-0.7|, |0.75-0.8|) = 0.05
1951- # Overall: 0.05
1952- #
1953- # WITH THE BUGS (what actually happens on old code):
1954- # BUG-125: In p2 == l branch, appends world.world[p2] instead of world.world[p1]
1955- # updated_bnds should be: [infected, healthy, recovered]
1956- # updated_bnds actually is: [infected, healthy, infected] ← infected duplicated, recovered missing!
1957- #
1958- # BUG-127: All bounds compared against infected's previous [0.2, 0.3]
1959- # infected: max(|0.25-0.2|, |0.3-0.3|) = 0.05
1960- # healthy: max(|0.7-0.2|, |0.75-0.3|) = max(0.5, 0.45) = 0.5 ← WRONG! Should compare to [0.7, 0.8]
1961- # infected (duplicate): max(|0.25-0.2|, |0.3-0.3|) = 0.05
1962- # Overall (WRONG): max(0.05, 0.5, 0.05) = 0.5
1963- #
1964- # The 0.5 comes from BUG-127 comparing healthy [0.7, 0.75] against infected's previous [0.2, 0.3]
1965- # BUG-125 causes recovered's delta to be completely missed (replaced with infected's duplicate)
1922+ '''
1923+ THE CRITICAL ASSERTION for BUG-125 + BUG-127:
1924+ Correct (all three bounds calculated correctly):
1925+ infected: max(|0.25-0.2|, |0.3-0.3|) = 0.05
1926+ healthy: max(|0.7-0.7|, |0.75-0.8|) = 0.05
1927+ recovered: max(|0.7-0.7|, |0.75-0.8|) = 0.05
1928+ Overall: 0.05
1929+
1930+ BUG-127: All bounds compared against infected's previous [0.2, 0.3]
1931+ infected: max(|0.25-0.2|, |0.3-0.3|) = 0.05
1932+ healthy: max(|0.7-0.2|, |0.75-0.3|) = max(0.5, 0.45) = 0.5 ← WRONG! Should compare to [0.7, 0.8]
1933+ infected (duplicate): max(|0.25-0.2|, |0.3-0.3|) = 0.05
1934+ Overall (WRONG): max(0.05, 0.5, 0.05) = 0.5
1935+
1936+ The 0.5 comes from BUG-127 comparing healthy [0.7, 0.75] against infected's previous [0.2, 0.3]
1937+ BUG-125 causes recovered's delta to be completely missed (replaced with infected's duplicate)
1938+ '''
19661939 assert change2 == pytest .approx (0.05 ), \
19671940 f"Expected change=0.05, got { change2 } . BUG-125+BUG-127 give 0.5."
0 commit comments