feat(compare): compare load-test reports and enforce regression budgets (#37) + release v1.6.0 - #45
Merged
Conversation
…ts (#37) + release v1.6.0 Flux produced a report per run, but nothing could say whether a change made things worse. This adds a `compare` subcommand that reads a baseline and a candidate JSON report and decides against configured budgets, so a performance regression can fail a CI job. - reporter/metrics: reports carry a `schema_version` and the status-code distribution; comparison reads reports written before either existed as schema v0 and says what it could not compare instead of guessing; - compare: aggregate and per-scenario deltas for request counts, throughput, error rate, mean and p50/p90/p95/p99 latency, plus the status distribution with explicit shares; scenarios are matched by name and the ones added or removed between runs are listed; - budgets are relative (`10%`) or absolute (`25ms`), error-rate budgets are percentage points, and `--per-scenario-budgets` extends them to each shared scenario. Exit code 1 means a budget was exceeded, 2 that the comparison could not be made at all; - percentage change always uses the baseline as the denominator and reports `n/a` rather than a fabricated number when that denominator is zero; - `--output-json` and `--output-markdown` write CI artifacts, and every rendering carries the caveat that two runs differ by more than code does. Also releases v1.6.0 and documents the workflow with a GitHub Actions example. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #37.
Flux produced a report per run, but nothing could say whether a change made things worse. This adds a
comparesubcommand that reads a baseline and a candidate JSON report and decides against configured budgets, so a performance regression can fail a CI job.What changed
schema_version: 1and astatus_codesdistribution in the summary. Comparison reads reports written before either existed as schema v0, and rejects a report from a newer schema with a message telling the user to upgrade Flux. When one side predates status recording, the status table is skipped with a note instead of reporting every status as new.--max-{mean,p50,p90,p95,p99}-regressionand--max-throughput-droptake either a percentage of the baseline (10%) or an absolute movement in the metric's own unit (25ms).--max-error-rate-increaseis in percentage points.--per-scenario-budgetsextends the same budgets to every scenario present in both reports.0every configured budget met (or none configured),1a budget was exceeded,2the comparison could not be made at all (missing or unreadable report, unparseable budget, unknown schema).n/a (baseline 0)rather than a fabricated number, and a percentage budget treats any movement in the bad direction from zero as exceeded. Status shares printn/awhen a run made no requests.--output-jsonwrites the full comparison,--output-markdownwrites tables ready for a job summary or PR comment. Both are written before the exit code is decided, so they exist even when the run fails.Example terminal output:
Release
Bumps
vars/versiontov1.6.0.Cargo.tomlmoves from0.1.0to1.6.0as well, soflux --versionreports something true — earlier releases left it at the default.Docs
README gains a "Comparing Reports and Regression Budgets" section: the workflow, a budget flag table, denominator and added/removed-scenario semantics, exit codes, a GitHub Actions example that fails the job and publishes the Markdown comparison to the step summary, and guidance on picking budgets wide enough to clear observed run-to-run noise. The JSON report example now shows
schema_versionandstatus_codes.Testing
cargo fmt --check,cargo clippy --all-targets --all-features -- -D warningsclean.cargo test: 111 passing, up from 90. New coverage for schema parsing (legacy, current, newer-than-supported, malformed), percentage calculation, threshold decisions in both directions, zero and empty baselines, added/removed scenarios, per-scenario budget opt-in, status-code deltas, and the JSON/Markdown renderings.schema_versionand nostatus_codes, confirming exit code1on a breach and0on a pass.IMPLEMENTATION.mdis untouched — it was already stale before this change (missingdashboard.rs,prometheus.rs,redact.rs,cancel.rs) and refreshing it belongs in its own change.🤖 Generated with Claude Code
https://claude.ai/code/session_012ATPLmE2H9oRipANby2d9H
Generated by Claude Code