[PR #4329] [TUI] strata bench compare: say what a standard report is (Fix #4325) #5008

Open
opened 2026-11-07 16:31:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4329
Author: @XiaoBinGan
Created: 10/27/2026
Status: 🔄 Open

Base: main ← Head: fix/strata-bench-compare-standard


📝 Commits (1)

  • bd5ba17 Fix #4325: strata bench compare says what a standard report is

📊 Changes

2 files changed (+30 additions, -0 deletions)

View changed files

📝 strata_cli/cli.py (+9 -0)
📝 tests/terminal/test_bench_standard.py (+21 -0)

📄 Description

Problem and result

strata bench compare BASELINE CANDIDATE reads a folder through bench.load(), which wants the serving-suite
schema (results). A folder from the default strata bench run (suite standard-v1) keeps its numbers
under summaries, so the command answered

$ strata bench compare /runs/shared /runs/exclusive
strata: unsupported benchmark report

— without saying what the folder was, or that strata bench report reads it happily. That is the same
asymmetry #4325 reports on the tool side: _bench() in strata_cli/cli.py branches on the standard loader
for report but went straight to the old reader for compare.

After the change it says which case it is:

# two standard results
strata: this version cannot compare two standard benchmark results yet (#4325); `strata bench report FOLDER` shows each one

# a standard report next to a serving-suite report
strata: comparing a standard benchmark result with another kind of report is not supported: give two standard results
or two serving-suite reports

both with exit status 5, which is what ProfileError already uses for benchmark-report problems in this
command.

#4325 (the reproduction and the comparison feature it asks for). This PR is the part that
cannot be wrong: it removes a dead end from a documented command. The comparison itself is deliberately not
implemented — its shape needs your agreement, and I would write it next to the existing output formats.

Approach

    if a.bench_command == "compare":
        from strata_cli import bench_standard
        old_standard = bench_standard.load_if_standard(Path(a.baseline))
        new_standard = bench_standard.load_if_standard(Path(a.candidate))
        if old_standard is not None or new_standard is not None:
            if old_standard is None or new_standard is None:
                return _error("comparing a standard benchmark result with another kind of report is not supported: "
                              "give two standard results or two serving-suite reports", 5, machine)
            return _error("this version cannot compare two standard benchmark results yet (#4325); "
                          "`strata bench report FOLDER` shows each one", 5, machine)
        result = bench.compare(bench.load(Path(a.baseline)), bench.load(Path(a.candidate)))
  • load_if_standard() was already there and is what report uses for the same job; it returns None for any
    other kind of report and raises only when a standard report is invalid.
  • Two serving-suite reports take exactly the old path, unchanged.
  • No schema is converted and no comparison is guessed: a wrong comparison would be worse than a clear refusal
    (the serving comparison's own guards — same workload, same machine — would have to be re-thought for standard
    reports, which is #4325's scope question).

Validation

Passed: the two new cases in CompareRefusesAStandardReport (tests/terminal/test_bench_standard.py), which
drive the real CLI entry point (main(["bench", "compare", ...])) with load_if_standard patched:

python -m pytest tests/terminal/test_bench_standard.py -q
  with this change:    51 failed, 19 passed
  with cli.py reverted: 53 failed, 17 passed

The two extra passes are the new cases; the 51 failures pre-exist on this Windows checkout (the file drives real
HTTP servers and timing-sensitive suites) and are identical in the two runs. The two new tests fail by name in
the reverted run.

Failed: none of the new cases.

Not run: the same command in the 0.2.7 image against real run folders: the image carries the old cli.py, and
mounting a patched copy over it would test my file rather than the shipped one, which is what the tests above
already do. The reproduction of the old answer on real folders is in #4325.

Limits

  • This is the readable-error half. Comparing two standard-v1 runs still does not exist; when you want it, the
    natural shape is the per-case table strata bench report already prints, side by side with deltas.
  • The exit status is 5 for both cases. If you would rather use 2 (the --out argument errors next to it use 2),
    that is a one-character change.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4329 **Author:** [@XiaoBinGan](https://github.com/XiaoBinGan) **Created:** 10/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/strata-bench-compare-standard` --- ### 📝 Commits (1) - [`bd5ba17`](https://github.com/Niko1221/Strata/commit/bd5ba17f93df6b5233dc513af6b59f65c46b7f74) Fix #4325: `strata bench compare` says what a standard report is ### 📊 Changes **2 files changed** (+30 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `strata_cli/cli.py` (+9 -0) 📝 `tests/terminal/test_bench_standard.py` (+21 -0) </details> ### 📄 Description ## Problem and result `strata bench compare BASELINE CANDIDATE` reads a folder through `bench.load()`, which wants the serving-suite schema (`results`). A folder from the **default** `strata bench run` (suite `standard-v1`) keeps its numbers under `summaries`, so the command answered ```text $ strata bench compare /runs/shared /runs/exclusive strata: unsupported benchmark report ``` — without saying what the folder was, or that `strata bench report` reads it happily. That is the same asymmetry #4325 reports on the tool side: `_bench()` in `strata_cli/cli.py` branches on the standard loader for `report` but went straight to the old reader for `compare`. After the change it says which case it is: ```text # two standard results strata: this version cannot compare two standard benchmark results yet (#4325); `strata bench report FOLDER` shows each one # a standard report next to a serving-suite report strata: comparing a standard benchmark result with another kind of report is not supported: give two standard results or two serving-suite reports ``` both with exit status 5, which is what `ProfileError` already uses for benchmark-report problems in this command. ## Related discussion #4325 (the reproduction and the comparison feature it asks for). This PR is the part that cannot be wrong: it removes a dead end from a documented command. The comparison itself is deliberately not implemented — its shape needs your agreement, and I would write it next to the existing output formats. ## Approach ```python if a.bench_command == "compare": from strata_cli import bench_standard old_standard = bench_standard.load_if_standard(Path(a.baseline)) new_standard = bench_standard.load_if_standard(Path(a.candidate)) if old_standard is not None or new_standard is not None: if old_standard is None or new_standard is None: return _error("comparing a standard benchmark result with another kind of report is not supported: " "give two standard results or two serving-suite reports", 5, machine) return _error("this version cannot compare two standard benchmark results yet (#4325); " "`strata bench report FOLDER` shows each one", 5, machine) result = bench.compare(bench.load(Path(a.baseline)), bench.load(Path(a.candidate))) ``` - `load_if_standard()` was already there and is what `report` uses for the same job; it returns `None` for any other kind of report and raises only when a standard report is invalid. - Two serving-suite reports take exactly the old path, unchanged. - No schema is converted and no comparison is guessed: a wrong comparison would be worse than a clear refusal (the serving comparison's own guards — same workload, same machine — would have to be re-thought for standard reports, which is #4325's scope question). ## Validation **Passed:** the two new cases in `CompareRefusesAStandardReport` (`tests/terminal/test_bench_standard.py`), which drive the real CLI entry point (`main(["bench", "compare", ...])`) with `load_if_standard` patched: ```text python -m pytest tests/terminal/test_bench_standard.py -q with this change: 51 failed, 19 passed with cli.py reverted: 53 failed, 17 passed ``` The two extra passes are the new cases; the 51 failures pre-exist on this Windows checkout (the file drives real HTTP servers and timing-sensitive suites) and are identical in the two runs. The two new tests fail by name in the reverted run. **Failed:** none of the new cases. **Not run:** the same command in the 0.2.7 image against real run folders: the image carries the old `cli.py`, and mounting a patched copy over it would test my file rather than the shipped one, which is what the tests above already do. The reproduction of the old answer on real folders is in #4325. ## Limits - This is the readable-error half. Comparing two standard-v1 runs still does not exist; when you want it, the natural shape is the per-case table `strata bench report` already prints, side by side with deltas. - The exit status is 5 for both cases. If you would rather use 2 (the `--out` argument errors next to it use 2), that is a one-character change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5008
No description provided.