test: make cold-refresh performance snapshots robust (Fixes #509) - #510
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Performance Report (Linux)Result: ✅ Within regression budgets
|
Test Coverage Report (Linux)Result: ✅ Within regression budget
|
Performance Report (macOS)Result: ✅ Within regression budgets
|
Test Coverage Report (Windows)Result: ✅ Within regression budget
|
Performance Report (Windows)Result: ✅ Within regression budgets
|
There was a problem hiding this comment.
Pull request overview
This PR updates PET’s performance snapshot generation and comparison logic to make cold-refresh gating statistically robust by measuring multiple independent cold-cache refreshes and keeping warm-cache metrics independently enforced. It introduces a schema v2 for performance snapshots that adds cold refresh/time-to-first distributions while maintaining legacy schema v1 compatibility via explicit platform ceilings during migration.
Changes:
- Update the Rust E2E performance snapshot to run 10 cold/warm cache pairs with isolated cache directories per pair and add schema-v2 cold distributions.
- Extend the Python comparator to understand schema v2, enforce cold P50 (budgeted when both sides are v2; absolute ceilings when the baseline is still v1), and render legacy-ceiling behavior in reports.
- Update tests and documentation to reflect the new sampling semantics, schema behavior, and gating rules.
Show a summary per file
| File | Description |
|---|---|
| scripts/tests/test_quality_snapshot.py | Adds schema-v2 test coverage for cold metrics, legacy-ceiling behavior, and report rendering. |
| scripts/quality_snapshot.py | Implements schema versioning, cold metric validation, legacy ceiling comparisons, and report formatting for schema-v2 snapshots. |
| docs/QUALITY_SNAPSHOTS.md | Documents paired cold/warm sampling, schema-v2 migration rules, budgets, and diagnostic workload semantics. |
| crates/pet/tests/e2e_performance.rs | Produces schema-v2 performance snapshots with isolated cold/warm cache pairs and cold diagnostic iterations. |
Review details
Tip
Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Suppressed comments (1)
crates/pet/tests/e2e_performance.rs:1485
- Same as the cold path: the warm time-to-first sample is treated as optional, but the test later requires exactly one sample per iteration. Record it unconditionally (and include the iteration index in the panic) so failures are actionable.
if let Some(ttfe) = warm_client.time_to_first_env() {
warm_time_to_first_env_stats.add(ttfe.as_millis());
}
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Make cold-refresh quality snapshots statistically robust by measuring ten independent cache-cold refreshes and ten paired cache-warm refreshes. Cold P50 now catches systematic regressions without allowing one host-cold event to dominate the gate; warm P50/P95 remain independently enforced.
Changes
full_refreshand time-to-first fields as warm compatibility metricsValidation
cargo test -p pet --test e2e_performance(6 passed)python -m unittest discover -s scripts/tests -p 'test_*.py' -v(31 passed)cargo test --all31509651276and31510433777passedFixes #509