Files
werkrevisor/docs/prs/2026-10-07-PR#45-recent-reviews-per-pr.md
claude-code 2241ea51f3
werkator build succeeded after 00:08
werkator/werkrevisor-statistics build succeeded after 00:25
werkrevisor 0.21.5: the statistics show the recent reviews per pull request (#45)
Co-authored-by: claude-code <claude-code@javagil.de>
2026-10-07 14:59:17 +02:00

62 lines
2.5 KiB
Markdown

# PR#45: the statistics show the recent reviews per pull request
> **WARNING:** This document describes only the change applied in this PR.
> It may already be outdated once the next PR is merged.
> Historic PR documentation is not maintained along with new PRs; treat it as a snapshot.
## The Problem
The list "Recent reviews" on the statistics page shows one row per review run.
A PR with many review rounds fills the list, and nobody sees what the PR cost in total.
E.g. mi/werkrevisor#44 needed several rounds for about 0.16 USD; each row shows only the cost of one round.
The verdicts appear only as color names, e.g. YELLOW.
A reader who does not know werkrevisor does not know what a color means.
## Non-Goals
- No change of the stored records or of the sums.
- No tooltips in the review comments in Gitea: Markdown has no tooltips.
## The Scenarios
#### Scenario#45.01: a pull request with several review runs has one row
So that the reader sees what a PR cost in total.
- **Given** mi/werkrevisor#44 had 5 review runs
- **and** the runs cost 0.16 USD together
- **When** a reader opens the statistics
- **Then** "Recent reviews" shows one row for mi/werkrevisor#44
- **and** the row shows the time, the verdict and the model of the newest run
- **and** the row shows the cost 0.16 USD, 5 reviews and 0.032 USD per review
##### Verified by
- [UsageApiIntegrationTest: recent reviews have one row per pull request](../../statistics/src/test/kotlin/de/hoennig/werkrevisor/statistics/UsageApiIntegrationTest.kt)
#### Scenario#45.02: a verdict explains itself
So that a reader who does not know werkrevisor understands the colors.
- **Given** the statistics show a verdict, e.g. YELLOW
- **When** the reader points at the verdict
- **Then** a tooltip says in one sentence what the verdict means
##### Verified by
- [UsageApiIntegrationTest: each verdict has a tooltip of one sentence](../../statistics/src/test/kotlin/de/hoennig/werkrevisor/statistics/UsageApiIntegrationTest.kt)
## The Solution
- "Recent reviews" has one row per PR, for the 20 PRs with the newest review runs.
- The time, the verdict and the model come from the newest run of the PR.
- The cost is the sum of all runs of the PR; two new columns show the number of reviews and the cost per review.
- A local review of a PR has its own row.
- Each verdict on the statistics page has a tooltip with the meaning from the README.
- werkrevisor 0.21.5.
## Prerequisite PRs
- PR#43: werkrevisor 0.21.3, the statistics show an unknown model cost as a lower bound, merged.