@@ -41,12 +41,8 @@ def test_render_html(tmp_path, minimal_report_data):
4141 assert "realVmCpuEfficiency" in text
4242 assert "How process runtime is measured" in text
4343 assert "How task timing is measured" in text
44- assert "How savings attribution is measured" in text
45- assert "How savings layers are defined" in text
46- assert "runs without a Scheduler compute environment" in text
47- assert "Scheduler rightsize will be zero by construction" in text
48- # VM metric charts
49- assert 'id="chart-vm-alloc-cpu"' in text
44+ # Performance gains section — hidden when no VM telemetry
45+
5046 assert 'id="chart-vm-alloc-mem"' in text
5147 assert 'id="chart-vm-real-cpu"' in text
5248 assert 'id="chart-vm-real-mem"' in text
@@ -58,19 +54,31 @@ def test_render_html(tmp_path, minimal_report_data):
5854 assert "Real VM CPU eff %" in text
5955 assert "Real VM Mem eff %" in text
6056 assert "fmtPct(r.realVmCpuEfficiency)" in text
61- # Performance gains section
57+ # Performance gains section — hidden when no VM telemetry
58+ assert 'id="performance-gains"' not in text
59+ assert 'href="#performance-gains"' not in text
60+ assert 'id="chart-pg-cpu-mix"' not in text
61+ assert 'id="chart-pg-cpu-savings"' not in text
62+ assert 'target="_blank" rel="noopener noreferrer"' in text
63+ assert "r.runUrl ? '<a href=\" ' + r.runUrl" in text
64+
65+
66+ def test_render_performance_gains_with_vm_data (tmp_path , minimal_report_data ):
67+ data = dict (minimal_report_data )
68+ data ["run_metrics" ] = [{"group" : "cpu" , "run_id" : "run1" , "vmCpuH" : 10.0 }]
69+ out = tmp_path / "report.html"
70+ render_html (data , out )
71+ text = out .read_text ()
6272 assert 'id="performance-gains"' in text
6373 assert 'href="#performance-gains"' in text
6474 assert 'id="chart-pg-cpu-mix"' in text
65- assert 'id="chart-pg-mem-mix"' in text
6675 assert 'id="chart-pg-cpu-savings"' in text
67- assert 'id="chart-pg-mem-savings"' in text
76+ assert "How savings attribution is measured" in text
77+ assert "How savings layers are defined" in text
78+ assert "runs without a Scheduler compute environment" in text
79+ assert "Scheduler rightsize will be zero by construction" in text
6880 assert "CPU capacity mix" in text
6981 assert "Savings attribution (CPU) by layer" in text
70- assert "schedulerRightsizedCpuH" in text
71- assert "vmPackingSlackCpuH" in text
72- assert 'target="_blank" rel="noopener noreferrer"' in text
73- assert "r.runUrl ? '<a href=\" ' + r.runUrl" in text
7482
7583
7684def test_render_includes_combined_runtime_section (tmp_path , minimal_report_data ):
0 commit comments