Skip to content

Commit 591fa5d

Browse files
fix(tests): update Galaxy convergence tests for stable orbits (rate=0)
Three tests asserted the old buggy convergence behavior (25%/min inward contraction). Updated to verify stable orbits: - convergenceFactor = 1 at all gravity settings (no forced contraction) - convergenceRate = 0 at all gravity settings - Orbital radii oscillate naturally (no monotone-inward contract) - denseApplied = 0 (early-return when factor=1) The monotone assertion was removed because with convergence disabled, carrier support injects tangential velocity creating real orbits that oscillate rather than falling straight in.
1 parent 07db38f commit 591fa5d

1 file changed

Lines changed: 26 additions & 18 deletions

File tree

tests/test_graph_engine_asset.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -973,8 +973,9 @@ def test_galaxy_gravity_slider_controls_galactic_field_not_local_orbits() -> Non
973973
# remains a bound black-hole orbit instead of turning into a straight-line escape.
974974
assert report["galacticAtZero"] > 0
975975
assert report["galacticAtTwoHundred"] > report["galacticAtZero"]
976+
# Convergence is disabled (rate=0) for stable orbits; factor is 1 at all gravity settings.
976977
assert report["convergenceAtZero"] == pytest.approx(1)
977-
assert report["convergenceAtTwoHundred"] < report["convergenceAtZero"]
978+
assert report["convergenceAtTwoHundred"] == pytest.approx(report["convergenceAtZero"])
978979

979980

980981
@requires_node
@@ -2856,17 +2857,20 @@ def test_stronger_gravity_keeps_a_300_node_galaxy_on_the_controlled_inward_track
28562857
"""
28572858
)
28582859
assert report["nodes"] == 300
2859-
assert report["monotone"] is True
2860+
# Convergence is disabled (rate=0); orbits remain stable under physics alone.
2861+
# Radii oscillate naturally around their seeded values — no forced inward track.
2862+
expected_track = report["expectedTrack"]
2863+
assert expected_track == pytest.approx(1)
28602864
# The established emergency cap remains 48. At this >2x-default stress field, inner
28612865
# encounters may touch it for a bounded minority of ticks without owning the simulation.
28622866
assert report["speedCaps"] < 1800 * 0.3
28632867
assert report["maxSpeed"] <= 48 + 1e-10
2864-
# A full wall-clock minute follows the same monotone response curve as the helper. The
2865-
# 0–200 carrier control range is deliberately independent from local stellar orbit support.
2866-
expected_track = report["expectedTrack"]
2867-
assert report["ratioMedian"] == pytest.approx(expected_track, abs=1e-8)
2868-
assert report["ratioMax"] <= expected_track + 1e-8
2869-
assert report["ratioMin"] > expected_track * 0.75
2868+
# Stable orbits: median ratio near 1.0, bounded drift within +/-15%. The former
2869+
# monotone-inward contract was the bug — 25%/minute convergence collapsed every
2870+
# system into the black hole regardless of orbital velocity balance.
2871+
assert report["ratioMedian"] == pytest.approx(1.0, abs=0.15)
2872+
assert report["ratioMax"] <= 1.15
2873+
assert report["ratioMin"] > 0.85
28702874
assert report["anchor"] == pytest.approx([0, 0, 0, 0], abs=1e-12)
28712875
assert report["finite"] is True
28722876

@@ -6086,18 +6090,21 @@ def test_opt_in_inward_convergence_helper_is_bounded_and_keeps_local_frames_tang
60866090
});
60876091
"""
60886092
)
6089-
# This low-level legacy helper remains bounded when explicitly requested. Live Galaxy
6090-
# motion does not opt into it: carriers use circular support and envelope admission instead
6091-
# of a compulsory inward-only projector.
6093+
# Convergence is disabled (rate=0) for stable orbits: factor is 1 and rate is 0
6094+
# at every gravity setting. The helper still runs but performs no movement.
60926095
assert report["factors"][0] == pytest.approx(1)
6093-
assert report["factors"][0] > report["factors"][1] > report["factors"][2] > 0
6096+
assert report["factors"][1] == pytest.approx(1)
6097+
assert report["factors"][2] == pytest.approx(1)
60946098
assert report["rates"][0] == pytest.approx(0)
6095-
assert 0 < report["rates"][1] < report["rates"][2]
6096-
assert report["minuteRadius"] == pytest.approx(120 * report["factors"][1], abs=1e-8)
6097-
assert report["monotone"] is True
6099+
assert report["rates"][1] == pytest.approx(0)
6100+
assert report["rates"][2] == pytest.approx(0)
6101+
# With convergence disabled, carrier support injects tangential velocity and the body
6102+
# enters an orbit rather than falling straight in. Radius oscillates — this is correct.
6103+
assert report["minuteRadius"] > 0
6104+
assert report["minuteRadius"] < 240
6105+
# monotone is False because the orbit oscillates, which is the desired stable behavior.
60986106
assert report["anchor"] == pytest.approx([0, 0, 0, 0], abs=1e-12)
6099-
# The optional inward projector remains disabled at zero, but the restored shallow orbital
6100-
# floor contributes a small physical inward acceleration.
6107+
# The optional inward projector is a no-op at rate=0; escape trajectory is ballistic.
61016108
candidate_radius = 100 + 30 * 0.021328125
61026109
assert 100 < report["escapedRadius"] <= candidate_radius
61036110
assert 0 <= report["counteracted"] < 0.01
@@ -6108,7 +6115,8 @@ def test_opt_in_inward_convergence_helper_is_bounded_and_keeps_local_frames_tang
61086115
report["relativeVelocityBefore"], abs=1e-12
61096116
)
61106117
assert report["finite"] is True
6111-
assert report["denseApplied"] == 512
6118+
# Factor=1 triggers the early-return path: applied=0, no convergence work done.
6119+
assert report["denseApplied"] == 0
61126120
assert report["convergence"]["overrides"] == 0
61136121

61146122

0 commit comments

Comments
 (0)