feat: extend stall timeout and remove sample cap

This commit is contained in:
huojiarong committed 2026-08-19 11:34:31 +00:00
1 parent 27f9f4add8
commit eb6ea70e19
9 files changed
+105 -45

No files matched your search

@@ -475,6 +475,20 @@ class GenericSystemXmlSimulationTests(unittest.TestCase):
"port_a",
)
def test_raw_system_xml_serializes_more_than_legacy_sample_limit(self) -> None:
project = chain_project()
project.simulation.step = 0.0000005
xml = build_reactflow_system_xml(project)
response = asyncio.run(simulate_system_xml(xml_request(xml)))
round_tripped = json.loads(json.dumps(response))
self.assertTrue(round_tripped["success"])
self.assertEqual(round_tripped["diagnostics"]["sampleCount"], 20001)
self.assertEqual(len(round_tripped["series"]["time"]), 20001)
self.assertEqual(round_tripped["series"]["time"][0], 0.0)
self.assertEqual(round_tripped["series"]["time"][-1], 0.01)
def test_streaming_endpoint_events_have_monotonic_progress_and_result(self) -> None:
project = chain_project()
xml = build_reactflow_system_xml(project)
+16 -6
View File
@@ -107,15 +107,22 @@ class SimulationSampleTimeSafetyTests(unittest.TestCase):
[1.0, 1.25],
)
def test_exact_point_limit_is_allowed(self) -> None:
def test_grid_can_exceed_the_legacy_point_limit(self) -> None:
times = simulation_sample_times(
SolveIVPConfig(t_start=0.0, t_stop=1.0),
SolveIVPConfig(t_start=0.0, t_stop=5.0),
0.0001,
)
self.assertEqual(len(times), 10001)
self.assertEqual(len(times), 50001)
self.assertEqual(times[0], 0.0)
self.assertEqual(times[-1], 1.0)
self.assertEqual(times[-1], 5.0)
def test_system_xml_accepts_more_than_the_legacy_point_limit(self) -> None:
report = validate_system_xml_document(
_system_xml(t_start="0", t_stop="5", sample_step="0.0001")
)
self.assertTrue(report.valid, report.issues)
def test_tiny_step_is_rejected_before_an_oversized_grid_is_allocated(self) -> None:
with self.assertRaises(SimulationSampleTimeError) as caught:
@@ -124,7 +131,10 @@ class SimulationSampleTimeSafetyTests(unittest.TestCase):
1.0e-300,
)
self.assertEqual(caught.exception.code, "SIMULATION_SAMPLE_COUNT_EXCEEDED")
self.assertEqual(
caught.exception.code,
"SIMULATION_SAMPLE_COUNT_UNREPRESENTABLE",
)
def test_non_finite_derived_duration_has_a_stable_error(self) -> None:
with self.assertRaises(SimulationSampleTimeError) as caught:
@@ -153,7 +163,7 @@ class SimulationSampleTimeSafetyTests(unittest.TestCase):
cases = (
(
_system_xml(t_start="0", t_stop="1", sample_step="1e-300"),
"SIMULATION_SAMPLE_COUNT_EXCEEDED",
"SIMULATION_SAMPLE_COUNT_UNREPRESENTABLE",
),
(
_system_xml(