Skip to content

Commit 135cb20

Browse files
karthiknadigCopilot
andcommitted
test: tighten schema-v2 warm P95 budgets (Fixes #511)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ad7ca14 commit 135cb20

3 files changed

Lines changed: 63 additions & 12 deletions

File tree

‎docs/QUALITY_SNAPSHOTS.md‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,20 @@ A metric blocks when it exceeds both its absolute and relative budget:
1717
| Server startup P50 | 5 ms / 100% | 10 ms / 50% | 100 ms / 50% |
1818
| Server startup P95 | 50 ms / 200% | 50 ms / 100% | 750 ms / 100% |
1919
| Full refresh P50 | 25 ms / 30% | 50 ms / 30% | 100 ms / 50% |
20-
| Full refresh P95 | 1,000 ms / 100% | 5,000 ms / 100% | 1,000 ms / 50% |
20+
| Full refresh P95 | 50 ms / 50% | 250 ms / 100% | 300 ms / 100% |
2121
| Time to first environment P50 | 20 ms / 100% | 25 ms / 50% | 150 ms / 50% |
22-
| Time to first environment P95 | 250 ms / 100% | 500 ms / 100% | 750 ms / 100% |
22+
| Time to first environment P95 | 25 ms / 100% | 100 ms / 100% | 250 ms / 100% |
2323
| Cold refresh P50 | 100 ms / 50% | 150 ms / 50% | 250 ms / 50% |
2424

25-
Each cell is `absolute / relative`. The Linux and Windows budgets plus the macOS P50 budgets reflect observed GitHub-hosted runner variance from 11 consecutive main-branch baselines. Tighten them when a noisy path is fixed rather than normalizing a known regression into the baseline.
25+
Each cell is `absolute / relative`. The warm P50 and server-startup budgets reflect observed GitHub-hosted runner variance from 11 consecutive main-branch baselines. Tighten them when a noisy path is fixed rather than normalizing a known regression into the baseline.
2626

27-
The macOS P95 budget recalibration is tracked by issue #507 and follows PR #506's fix for issue #504. It uses three unchanged-content pull-request runs and the exact merged baseline at `f0c62d9`; the resulting absolute headroom is four to six times the observed post-fix run-to-run range.
27+
The macOS server-startup P95 budget recalibration is tracked by issue #507 and follows PR #506's fix for issue #504. It uses three unchanged-content pull-request runs and the exact merged baseline at `f0c62d9`; the resulting absolute headroom is four to six times the observed post-fix run-to-run range.
2828

29-
Schema v2 records `full_refresh` and `time_to_first_env` from the warm member of each pair and adds cold refresh/time-to-first distributions. While the exact base still uses schema v1, cold P50 is checked against explicit absolute ceilings of 500ms on Linux, 750ms on Windows, and 1,000ms on macOS. Once both snapshots use schema v2, the table's dual budgets apply.
29+
The warm refresh and warm time-to-first P95 budgets were recalibrated in issue #511 after PR #510 separated cold and warm samples. Three unchanged-code PR runs plus the exact schema-v2 baseline at `ad7ca14` retain at least 2.5 times the observed absolute run-to-run range.
30+
31+
Schema v2 records `full_refresh` and `time_to_first_env` from the warm member of each pair and adds cold refresh/time-to-first distributions. During its one-time rollout, comparisons against a schema-v1 base checked cold P50 against explicit absolute ceilings of 500ms on Linux, 750ms on Windows, and 1,000ms on macOS. Schema-v2-to-v2 comparisons use the table's dual budgets.
32+
33+
The cold P50 budgets were calibrated in issue #509 using two unchanged-head all-platform runs and the final pull-request validation.
3034

3135
The dual budget avoids failing on tiny percentage changes while still blocking material latency regressions. Warm tail metrics remain mandatory; cold P95 remains diagnostic because a single host event can dominate it, while cold P50 blocks delays that affect the independent cold iterations consistently.
3236

‎scripts/quality_snapshot.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,25 +84,25 @@ def regressed(self) -> bool:
8484
RegressionBudget(5, 100),
8585
RegressionBudget(50, 200),
8686
RegressionBudget(25, 30),
87-
RegressionBudget(1_000, 100),
87+
RegressionBudget(50, 50),
8888
RegressionBudget(20, 100),
89-
RegressionBudget(250, 100),
89+
RegressionBudget(25, 100),
9090
),
9191
'windows': (
9292
RegressionBudget(10, 50),
9393
RegressionBudget(50, 100),
9494
RegressionBudget(50, 30),
95-
RegressionBudget(5_000, 100),
95+
RegressionBudget(250, 100),
9696
RegressionBudget(25, 50),
97-
RegressionBudget(500, 100),
97+
RegressionBudget(100, 100),
9898
),
9999
'macos': (
100100
RegressionBudget(100, 50),
101101
RegressionBudget(750, 100),
102102
RegressionBudget(100, 50),
103-
RegressionBudget(1_000, 50),
103+
RegressionBudget(300, 100),
104104
RegressionBudget(150, 50),
105-
RegressionBudget(750, 100),
105+
RegressionBudget(250, 100),
106106
),
107107
}
108108
PERFORMANCE_METRICS_SCHEMA_VERSION = 2

‎scripts/tests/test_quality_snapshot.py‎

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,53 @@ def test_newer_performance_schema_is_invalid(self):
158158
'Windows',
159159
)
160160

161+
def test_schema_v2_warm_p95_variance_passes_on_all_platforms(self):
162+
cases = (
163+
('Linux', 60, 69, 16, 16),
164+
('Windows', 109, 206, 24, 47),
165+
('macOS', 160, 270, 133, 228),
166+
)
167+
for platform, base_refresh, current_refresh, base_first, current_first in cases:
168+
with self.subTest(platform=platform):
169+
baseline = performance_snapshot(
170+
schema_version=2,
171+
refresh_p95=base_refresh,
172+
first_p95=base_first,
173+
)
174+
current = performance_snapshot(
175+
schema_version=2,
176+
refresh_p95=current_refresh,
177+
first_p95=current_first,
178+
)
179+
180+
_, failures = compare_performance(current, baseline, platform)
181+
182+
self.assertEqual(failures, [])
183+
184+
def test_schema_v2_warm_p95_budgets_reject_multi_second_regressions(self):
185+
cases = (
186+
('Linux', 60, 16),
187+
('Windows', 109, 24),
188+
('macOS', 160, 133),
189+
)
190+
for platform, base_refresh, base_first in cases:
191+
with self.subTest(platform=platform):
192+
baseline = performance_snapshot(
193+
schema_version=2,
194+
refresh_p95=base_refresh,
195+
first_p95=base_first,
196+
)
197+
current = performance_snapshot(
198+
schema_version=2,
199+
refresh_p95=2_000,
200+
first_p95=1_000,
201+
)
202+
203+
_, failures = compare_performance(current, baseline, platform)
204+
205+
self.assertTrue(any('Full refresh P95' in failure for failure in failures))
206+
self.assertTrue(any('Time to first environment P95' in failure for failure in failures))
207+
161208
def test_post_fix_macos_tail_variance_passes(self):
162209
baseline = performance_snapshot(startup_p95=621, refresh_p95=1_343, first_p95=649)
163210
current = performance_snapshot(startup_p95=691, refresh_p95=1_435, first_p95=745)
@@ -168,7 +215,7 @@ def test_post_fix_macos_tail_variance_passes(self):
168215

169216
def test_tightened_macos_tail_budgets_reject_multi_second_regressions(self):
170217
baseline = performance_snapshot(startup_p95=621, refresh_p95=1_343, first_p95=649)
171-
current = performance_snapshot(startup_p95=1_500, refresh_p95=2_500, first_p95=1_500)
218+
current = performance_snapshot(startup_p95=1_500, refresh_p95=3_000, first_p95=1_500)
172219

173220
_, failures = compare_performance(current, baseline, 'macOS')
174221

0 commit comments

Comments
 (0)