diff --git a/README.md b/README.md
index 0bdf31f8a1..250f680603 100644
--- a/README.md
+++ b/README.md
@@ -17,27 +17,27 @@ Numbers below: 11,571 pull requests, 10 repositories, 15,054 AI reviews (oct '26
## Accuracy
-
+
Humans still merge; what reaches them has passed review and CI. Start at "open PRs only"; once you trust it, turn the [setting](src/docs/acmm-policy-matrix.md) up to merge on green, like a merge queue.
-
+
## Security
Hidden instructions in issues or files are screened out before an agent reads them; agents run as a GitHub App, not your PAT.
-
+
## Cost
Tracked like CI minutes; each job's cost is on the dashboard.
-
+
## Also
-
+
Production data, not a lab run; counts regenerate from live records. Reverts are too new to report. [How we count →](src/docs/benchmarks/outcomes-2026-10.md)
@@ -45,7 +45,7 @@ Production data, not a lab run; counts regenerate from live records. Reverts are
## How it works
-
+
## Run it
diff --git a/changelog.d/fixed-outcome-card-fonts.md b/changelog.d/fixed-outcome-card-fonts.md
new file mode 100644
index 0000000000..0855e4860c
--- /dev/null
+++ b/changelog.d/fixed-outcome-card-fonts.md
@@ -0,0 +1 @@
+- Render README outcome cards as PNGs with embedded IBM Plex Mono, flat amber figures and consistent spacing; redraw saved reports without the evidence tree using `hivectl evidence benchmark --from-json` or `src/scripts/outcome-benchmark.sh --rerender`.
diff --git a/src/docs/benchmarks/README.md b/src/docs/benchmarks/README.md
index c5245e3650..250338be7c 100644
--- a/src/docs/benchmarks/README.md
+++ b/src/docs/benchmarks/README.md
@@ -6,9 +6,9 @@ Reproducible comparison of pull requests that went through Hive's review swarm (
| Month | Report | Charts |
|---|---|---|
-| 2026-10 | [outcomes-2026-10.md](outcomes-2026-10.md) | [bars](assets/outcomes-2026-10-bars.svg) · [trend](assets/outcomes-2026-10-trend.svg) · README cards `assets/outcomes-2026-10-card-*.svg` |
+| 2026-10 | [outcomes-2026-10.md](outcomes-2026-10.md) | [bars](assets/outcomes-2026-10-bars.svg) · [trend](assets/outcomes-2026-10-trend.svg) · README cards `assets/outcomes-2026-10-card-*.png` (SVG sources alongside) |
-Each report ships with `outcomes-YYYY-MM.json`, the computed `Report` the markdown, charts, README cards and README block are rendered from, plus the inputs that are not derivable from the evidence tree: `cost-YYYY-MM.json` (saved `GET /api/cost`), `stories-YYYY-MM.json` (curated caught → fixed → merged examples, timestamps taken from the evidence bundles) and `red-team-YYYY-MM.json` (prompt-injection evaluation counts from [ioscan-red-team.md](../ioscan-red-team.md)). `pkg/outcomebench` `TestCommittedReportMatchesReadme` re-renders the newest JSON and fails when the committed markdown, SVGs, cards or the repository README's `…` block differ, so none of them can drift.
+Each report ships with `outcomes-YYYY-MM.json`, the computed `Report` the markdown, charts, README cards and README block are rendered from, plus the inputs that are not derivable from the evidence tree: `cost-YYYY-MM.json` (saved `GET /api/cost`), `stories-YYYY-MM.json` (curated caught → fixed → merged examples, timestamps taken from the evidence bundles) and `red-team-YYYY-MM.json` (prompt-injection evaluation counts from [ioscan-red-team.md](../ioscan-red-team.md)). `pkg/outcomebench` `TestCommittedReportMatchesReadme` re-renders the newest JSON and fails when the committed markdown, SVGs, PNG source hashes and dimensions or the repository README's `…` block differ, so none of them can drift.
## README cards
@@ -16,8 +16,8 @@ The repository README shows this data as plain-language cards (one number, one s
- A production-count card is drawn only when its base is at least `--readme-min-base` (default 200), separate from the n ≥ 10 report threshold. The 43-merge revert bucket, for example, stays in the report.
- The checks-passing card is drawn only when a check result is recorded on at least 80 % of reviewed merges; below that the pass rate would describe a biased subset.
-- No statistical vocabulary (intervals, medians, cohorts, n=) appears in the README or on a card; `TestReadmeVocabulary` enforces the list and `TestReadmeProseBudget` keeps README prose under 600 words and 10 sections.
-- Every card is a real-text SVG in dark and light (`` + `prefers-color-scheme`) using the dashboard's own palette.
+- No statistical vocabulary (intervals, medians, cohorts, n=) appears in the README or on a card; `TestReadmeVocabulary` enforces the list and `TestReadmeProseBudget` keeps README prose under 300 words and 10 sections.
+- Every card has a real-text SVG source and a 2× PNG in dark and light (`` + `prefers-color-scheme`) using the dashboard's own palette. Both formats consume one drawing operation list. The README embeds the PNG, rasterized in Go with embedded regular and bold IBM Plex Mono faces (SIL OFL, bundled under `pkg/outcomebench/fonts/`), so system fonts and browser effects cannot change its layout. Primary stat cards have one large figure, fixed height, and flat amber; secondary figures stay in the copy. PNG drift checks read the embedded source SHA-256 and dimensions instead of comparing pixels.
- The prompt-injection card comes from Hive's own evaluation set, says so on the card, and is not subject to the minimum base because it is not a production count.
Each report's "What the README shows and leaves out" section records, per card, whether it was drawn and on what base.
@@ -35,6 +35,16 @@ src/scripts/outcome-benchmark.sh --root /data/evidence --month 2026-10 \
--readme # also rewrite README.md's outcomes block
```
+To redraw the committed report without its evidence tree or changing its counts/timestamps:
+
+```sh
+src/scripts/outcome-benchmark.sh --rerender --month 2026-10 --readme
+# equivalent from src/:
+go run ./cmd/hivectl evidence benchmark --from-json docs/benchmarks/outcomes-2026-10.json --readme ../README.md
+```
+
+`--from-json` cannot be combined with evidence/computation flags such as `--root`, `--month` or `--readme-min-base`. `--out-dir` and `--readme` still select destinations; `--readme` updates the ladder outside the outcomes block too.
+
The script wraps `hivectl evidence benchmark`; see [hivectl.md](../hivectl.md#evidence--benchmark) for every flag. To take a read-only copy of a spoke's evidence: `kubectl exec deploy/hive -c hive -- tar czf - -C /data evidence | tar xzf -`.
## Metrics
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-dark.png b/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-dark.png
new file mode 100644
index 0000000000..29deedf0ec
Binary files /dev/null and b/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-dark.png differ
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-dark.svg b/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-dark.svg
index 2086db4830..43546dc301 100644
--- a/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-dark.svg
+++ b/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-dark.svg
@@ -1,20 +1,14 @@
-
+
2 in 3 pull requests the review agent sent back came back fixed and were approved; 24 minutes typical from sent back to approved
-
-
-
-
-
-ACCURACY · 563 PULL REQUESTS SENT BACK · (oct '26)
-The review agent sent 563 pull requests
-back. Two in three came back fixed,
-typically in 24 minutes.
-2 in 3
-2 in 3
-came back fixed
-24 min
-24 min
-typical time to fix
-
-563 sent back (oct '26); 140 merged as-is after a second review.
+
+
+
+ACCURACY · 563 PULL REQUESTS SENT BACK · (oct '26)
+The review agent sent 563 pull requests
+back. Two in three came back fixed,
+typically in 24 minutes.
+2 in 3
+came back fixed
+
+563 sent back (oct '26); 140 merged as-is after a second review.
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-light.png b/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-light.png
new file mode 100644
index 0000000000..9794e94980
Binary files /dev/null and b/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-light.png differ
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-light.svg b/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-light.svg
index 664cc66e3a..b477f9ba50 100644
--- a/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-light.svg
+++ b/src/docs/benchmarks/assets/outcomes-2026-10-card-accuracy-light.svg
@@ -1,18 +1,14 @@
-
+
2 in 3 pull requests the review agent sent back came back fixed and were approved; 24 minutes typical from sent back to approved
-
-
-
-
-
-ACCURACY · 563 PULL REQUESTS SENT BACK · (oct '26)
-The review agent sent 563 pull requests
-back. Two in three came back fixed,
-typically in 24 minutes.
-2 in 3
-came back fixed
-24 min
-typical time to fix
-
-563 sent back (oct '26); 140 merged as-is after a second review.
+
+
+
+ACCURACY · 563 PULL REQUESTS SENT BACK · (oct '26)
+The review agent sent 563 pull requests
+back. Two in three came back fixed,
+typically in 24 minutes.
+2 in 3
+came back fixed
+
+563 sent back (oct '26); 140 merged as-is after a second review.
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-also-dark.png b/src/docs/benchmarks/assets/outcomes-2026-10-card-also-dark.png
new file mode 100644
index 0000000000..df3b97f474
Binary files /dev/null and b/src/docs/benchmarks/assets/outcomes-2026-10-card-also-dark.png differ
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-also-dark.svg b/src/docs/benchmarks/assets/outcomes-2026-10-card-also-dark.svg
index 1f8ddbd16f..3d0a910f08 100644
--- a/src/docs/benchmarks/assets/outcomes-2026-10-card-also-dark.svg
+++ b/src/docs/benchmarks/assets/outcomes-2026-10-card-also-dark.svg
@@ -1,37 +1,28 @@
-
+
Also: consistent, readable, efficient, fast
-
-
-
-
-
-ALSO · (oct '26)
-Every pull request gets the same AI
-review. It adds about 15 minutes.
-CONSISTENT
-15,054
-15,054
-reviews, one
-checklist, one
-shared style guide
-READABLE
-4 parts
-4 parts
-to every review:
-what, problem, fix,
-if skipped
-EFFICIENT
-On demand
-On demand
-jobs start on work
-and stop when done
-FAST
-merged without review
-
-12 min
-reviewed by Hive
-
-27 min
-review adds about 15
-minutes
+
+
+
+ALSO · (oct '26)
+Every pull request gets the same AI
+review. It adds about 15 minutes.
+CONSISTENT
+15,054
+reviews, one checklist, one shared
+style guide
+READABLE
+4 parts
+to every review: what, problem, fix,
+if skipped
+EFFICIENT
+On demand
+jobs start on work and stop when done
+FAST
+merged without review
+
+12 min
+reviewed by Hive
+
+27 min
+review adds about 15 minutes
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-also-light.png b/src/docs/benchmarks/assets/outcomes-2026-10-card-also-light.png
new file mode 100644
index 0000000000..81884625c2
Binary files /dev/null and b/src/docs/benchmarks/assets/outcomes-2026-10-card-also-light.png differ
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-also-light.svg b/src/docs/benchmarks/assets/outcomes-2026-10-card-also-light.svg
index 2bdfcc7654..663a52777c 100644
--- a/src/docs/benchmarks/assets/outcomes-2026-10-card-also-light.svg
+++ b/src/docs/benchmarks/assets/outcomes-2026-10-card-also-light.svg
@@ -1,34 +1,28 @@
-
+
Also: consistent, readable, efficient, fast
-
-
-
-
-
-ALSO · (oct '26)
-Every pull request gets the same AI
-review. It adds about 15 minutes.
-CONSISTENT
-15,054
-reviews, one
-checklist, one
-shared style guide
-READABLE
-4 parts
-to every review:
-what, problem, fix,
-if skipped
-EFFICIENT
-On demand
-jobs start on work
-and stop when done
-FAST
-merged without review
-
-12 min
-reviewed by Hive
-
-27 min
-review adds about 15
-minutes
+
+
+
+ALSO · (oct '26)
+Every pull request gets the same AI
+review. It adds about 15 minutes.
+CONSISTENT
+15,054
+reviews, one checklist, one shared
+style guide
+READABLE
+4 parts
+to every review: what, problem, fix,
+if skipped
+EFFICIENT
+On demand
+jobs start on work and stop when done
+FAST
+merged without review
+
+12 min
+reviewed by Hive
+
+27 min
+review adds about 15 minutes
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-dark.png b/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-dark.png
new file mode 100644
index 0000000000..da6b598b6d
Binary files /dev/null and b/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-dark.png differ
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-dark.svg b/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-dark.svg
index fb718cce0b..fab927387b 100644
--- a/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-dark.svg
+++ b/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-dark.svg
@@ -1,20 +1,14 @@
-
+
about $2 of agent spend per merged pull request
-
-
-
-
-
-COST · 2,869 MERGED PULL REQUESTS · (aug–oct '26)
-Agents spent about $6,125 to merge 2,869
-pull requests, about $2 each. It is
-tracked like CI minutes.
-$2
-$2
-per merged pull request
-$6,125
-$6,125
-total agent spend
-
-Estimate from provider list prices (aug–oct '26); some models unpriced.
+
+
+
+COST · 2,869 MERGED PULL REQUESTS · (aug–oct '26)
+Agents spent about $6,125 to merge 2,869
+pull requests, about $2 each. It is
+tracked like CI minutes.
+$2
+per merged pull request
+
+Estimate from provider list prices (aug–oct '26); some models unpriced.
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-light.png b/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-light.png
new file mode 100644
index 0000000000..57f9007aa7
Binary files /dev/null and b/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-light.png differ
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-light.svg b/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-light.svg
index e06263bc04..bf5fe9edc3 100644
--- a/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-light.svg
+++ b/src/docs/benchmarks/assets/outcomes-2026-10-card-cost-light.svg
@@ -1,18 +1,14 @@
-
+
about $2 of agent spend per merged pull request
-
-
-
-
-
-COST · 2,869 MERGED PULL REQUESTS · (aug–oct '26)
-Agents spent about $6,125 to merge 2,869
-pull requests, about $2 each. It is
-tracked like CI minutes.
-$2
-per merged pull request
-$6,125
-total agent spend
-
-Estimate from provider list prices (aug–oct '26); some models unpriced.
+
+
+
+COST · 2,869 MERGED PULL REQUESTS · (aug–oct '26)
+Agents spent about $6,125 to merge 2,869
+pull requests, about $2 each. It is
+tracked like CI minutes.
+$2
+per merged pull request
+
+Estimate from provider list prices (aug–oct '26); some models unpriced.
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-dark.png b/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-dark.png
new file mode 100644
index 0000000000..fd2e7a4eb7
Binary files /dev/null and b/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-dark.png differ
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-dark.svg b/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-dark.svg
index 266edf7b40..303254994b 100644
--- a/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-dark.svg
+++ b/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-dark.svg
@@ -1,47 +1,38 @@
-
+
How Hive works: scan, claim, work, verify, merge, credit
-
-
-
-
-
-HOW IT WORKS · EVERY TASK
-A coding agent does the work. A review
-agent and your CI gate the merge.
-01
-01
-Scan
-Reads open issues, pull requests, failing
-checks.
-like a webhook trigger
-
-02
-02
-Claim
-One agent takes one task.
-one job per task
-
-03
-03
-Work
-A short-lived agent does it, then stops.
-ephemeral runner
-
-04
-04
-Verify
-AI review plus your CI must pass.
-both are required checks
-
-05
-05
-Merge
-Held for a human, or merged on green.
-PRs only → merge on green
-
-06
-06
-Credit
-The issue opener is named on the merge.
-co-author trailer
+
+
+
+HOW IT WORKS · EVERY TASK
+A coding agent does the work. A review
+agent and your CI gate the merge.
+01
+Scan
+Reads open issues, pull requests, failing checks.
+like a webhook trigger
+
+02
+Claim
+One agent takes one task.
+one job per task
+
+03
+Work
+A short-lived agent does it, then stops.
+ephemeral runner
+
+04
+Verify
+AI review plus your CI must pass.
+both are required checks
+
+05
+Merge
+Held for a human, or merged on green.
+PRs only → merge on green
+
+06
+Credit
+The issue opener is named on the merge.
+co-author trailer
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-light.png b/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-light.png
new file mode 100644
index 0000000000..63c8047e36
Binary files /dev/null and b/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-light.png differ
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-light.svg b/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-light.svg
index 55fce31690..8907067ed2 100644
--- a/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-light.svg
+++ b/src/docs/benchmarks/assets/outcomes-2026-10-card-how-it-works-light.svg
@@ -1,41 +1,38 @@
-
+
How Hive works: scan, claim, work, verify, merge, credit
-
-
-
-
-
-HOW IT WORKS · EVERY TASK
-A coding agent does the work. A review
-agent and your CI gate the merge.
-01
-Scan
-Reads open issues, pull requests, failing
-checks.
-like a webhook trigger
-
-02
-Claim
-One agent takes one task.
-one job per task
-
-03
-Work
-A short-lived agent does it, then stops.
-ephemeral runner
-
-04
-Verify
-AI review plus your CI must pass.
-both are required checks
-
-05
-Merge
-Held for a human, or merged on green.
-PRs only → merge on green
-
-06
-Credit
-The issue opener is named on the merge.
-co-author trailer
+
+
+
+HOW IT WORKS · EVERY TASK
+A coding agent does the work. A review
+agent and your CI gate the merge.
+01
+Scan
+Reads open issues, pull requests, failing checks.
+like a webhook trigger
+
+02
+Claim
+One agent takes one task.
+one job per task
+
+03
+Work
+A short-lived agent does it, then stops.
+ephemeral runner
+
+04
+Verify
+AI review plus your CI must pass.
+both are required checks
+
+05
+Merge
+Held for a human, or merged on green.
+PRs only → merge on green
+
+06
+Credit
+The issue opener is named on the merge.
+co-author trailer
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-dark.png b/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-dark.png
new file mode 100644
index 0000000000..b79bbc4c1c
Binary files /dev/null and b/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-dark.png differ
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-dark.svg b/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-dark.svg
index 7717c38fa8..6193d7c7d3 100644
--- a/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-dark.svg
+++ b/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-dark.svg
@@ -1,21 +1,16 @@
-
+
97% of planted text that tries to redirect an agent (prompt injection) was screened out before an agent read it, with 1 false alarm in 12 harmless texts
-
-
-
-
-
-SECURITY · HIVE'S OWN TEST SET · (oct '26)
-We hid 63 texts that try to redirect an
-agent (prompt injection) in issues and
-files. Hive screened out 61 before an
-agent read them.
-97%
-97%
-screened out before an agent read it
-1 in 12
-1 in 12
-harmless texts wrongly flagged
-
-Hive's own test set of 75 texts (oct '26); not production traffic.
+
+
+
+SECURITY · HIVE'S OWN TEST SET · (oct '26)
+We hid 63 texts that try to redirect an
+agent (prompt injection) in issues and
+files. Hive screened out 61 before an
+agent read them.
+97%
+screened out before an agent read it
+
+Hive's own test set of 75 texts (oct '26); not production traffic. 1 in 12 harmless
+texts wrongly flagged.
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-light.png b/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-light.png
new file mode 100644
index 0000000000..49628728fb
Binary files /dev/null and b/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-light.png differ
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-light.svg b/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-light.svg
index 1c574d1ede..a5853e58e2 100644
--- a/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-light.svg
+++ b/src/docs/benchmarks/assets/outcomes-2026-10-card-prompt-injection-light.svg
@@ -1,19 +1,16 @@
-
+
97% of planted text that tries to redirect an agent (prompt injection) was screened out before an agent read it, with 1 false alarm in 12 harmless texts
-
-
-
-
-
-SECURITY · HIVE'S OWN TEST SET · (oct '26)
-We hid 63 texts that try to redirect an
-agent (prompt injection) in issues and
-files. Hive screened out 61 before an
-agent read them.
-97%
-screened out before an agent read it
-1 in 12
-harmless texts wrongly flagged
-
-Hive's own test set of 75 texts (oct '26); not production traffic.
+
+
+
+SECURITY · HIVE'S OWN TEST SET · (oct '26)
+We hid 63 texts that try to redirect an
+agent (prompt injection) in issues and
+files. Hive screened out 61 before an
+agent read them.
+97%
+screened out before an agent read it
+
+Hive's own test set of 75 texts (oct '26); not production traffic. 1 in 12 harmless
+texts wrongly flagged.
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-dark.png b/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-dark.png
new file mode 100644
index 0000000000..9f9f8f870c
Binary files /dev/null and b/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-dark.png differ
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-dark.svg b/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-dark.svg
index fc8a4f4ddd..44858a23fe 100644
--- a/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-dark.svg
+++ b/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-dark.svg
@@ -1,49 +1,47 @@
-
+
Before and after: hivecommons/hive #13523 was sent back once and merged 16 minutes after opening
-
-
-
-
-
-BEFORE / AFTER · ONE REAL PULL REQUEST · (oct '26)
-A coding agent opened a pull request. The
-review agent sent it back once. It
-merged, green, 16 minutes after opening.
-Without Hive
-
-ISSUE
-A failing check or an open issue waits
-for someone to pick it up.
-
-PULL REQUEST
-Someone writes the fix when they have
-time.
-
-REVIEW
-Someone else reads it when they have
-time.
-
-MERGE
-Thursday, maybe.
-With Hive: hivecommons/hive #13523
-
-PULL REQUEST
-A coding agent opened it.
-
-SENT BACK AT 4 MIN
-The changelog note was written as a
-sentence, not a list entry, so the
-release build would have rejected it; a
-second, duplicate note was also added.
-
-FIXED AT 8 MIN
-The coding agent pushed a fix; the
-review agent approved it.
-
-MERGED AT 16 MIN
-CI green, a human merged it.
-
-
-Same shape: hivecommons/pluk #328, sent back at 6 min, fixed at 16, merged at 23. Times
-from Hive's review records.
+
+
+
+BEFORE / AFTER · ONE REAL PULL REQUEST · (oct '26)
+A coding agent opened a pull request.
+The review agent sent it back once. It
+merged, green, 16 minutes after opening.
+Without Hive
+
+ISSUE
+A failing check or an open issue
+waits for someone to pick it up.
+
+PULL REQUEST
+Someone writes the fix when they
+have time.
+
+REVIEW
+Someone else reads it when they have
+time.
+
+MERGE
+Thursday, maybe.
+With Hive: hivecommons/hive #13523
+
+PULL REQUEST
+A coding agent opened it.
+
+SENT BACK AT 4 MIN
+The changelog note was written as a
+sentence, not a list entry, so the
+release build would have rejected
+it; a second, duplicate note was
+also added.
+
+FIXED AT 8 MIN
+The coding agent pushed a fix; the
+review agent approved it.
+
+MERGED AT 16 MIN
+CI green, a human merged it.
+
+Same shape: hivecommons/pluk #328, sent back at 6 min, fixed at 16, merged at 23.
+Times from Hive's review records.
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-light.png b/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-light.png
new file mode 100644
index 0000000000..9fa96f3f5a
Binary files /dev/null and b/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-light.png differ
diff --git a/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-light.svg b/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-light.svg
index 6304fc0559..4f2c3b3bed 100644
--- a/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-light.svg
+++ b/src/docs/benchmarks/assets/outcomes-2026-10-card-stories-light.svg
@@ -1,49 +1,47 @@
-
+
Before and after: hivecommons/hive #13523 was sent back once and merged 16 minutes after opening
-
-
-
-
-
-BEFORE / AFTER · ONE REAL PULL REQUEST · (oct '26)
-A coding agent opened a pull request. The
-review agent sent it back once. It
-merged, green, 16 minutes after opening.
-Without Hive
-
-ISSUE
-A failing check or an open issue waits
-for someone to pick it up.
-
-PULL REQUEST
-Someone writes the fix when they have
-time.
-
-REVIEW
-Someone else reads it when they have
-time.
-
-MERGE
-Thursday, maybe.
-With Hive: hivecommons/hive #13523
-
-PULL REQUEST
-A coding agent opened it.
-
-SENT BACK AT 4 MIN
-The changelog note was written as a
-sentence, not a list entry, so the
-release build would have rejected it; a
-second, duplicate note was also added.
-
-FIXED AT 8 MIN
-The coding agent pushed a fix; the
-review agent approved it.
-
-MERGED AT 16 MIN
-CI green, a human merged it.
-
-
-Same shape: hivecommons/pluk #328, sent back at 6 min, fixed at 16, merged at 23. Times
-from Hive's review records.
+
+
+
+BEFORE / AFTER · ONE REAL PULL REQUEST · (oct '26)
+A coding agent opened a pull request.
+The review agent sent it back once. It
+merged, green, 16 minutes after opening.
+Without Hive
+
+ISSUE
+A failing check or an open issue
+waits for someone to pick it up.
+
+PULL REQUEST
+Someone writes the fix when they
+have time.
+
+REVIEW
+Someone else reads it when they have
+time.
+
+MERGE
+Thursday, maybe.
+With Hive: hivecommons/hive #13523
+
+PULL REQUEST
+A coding agent opened it.
+
+SENT BACK AT 4 MIN
+The changelog note was written as a
+sentence, not a list entry, so the
+release build would have rejected
+it; a second, duplicate note was
+also added.
+
+FIXED AT 8 MIN
+The coding agent pushed a fix; the
+review agent approved it.
+
+MERGED AT 16 MIN
+CI green, a human merged it.
+
+Same shape: hivecommons/pluk #328, sent back at 6 min, fixed at 16, merged at 23.
+Times from Hive's review records.
diff --git a/src/docs/hivectl.md b/src/docs/hivectl.md
index 4479879f79..230eff879a 100644
--- a/src/docs/hivectl.md
+++ b/src/docs/hivectl.md
@@ -292,9 +292,12 @@ Reporting only: nothing here reads into or alters merge eligibility. See
```bash
hivectl evidence benchmark --month 2026-10 --out-dir src/docs/benchmarks --readme README.md
+hivectl evidence benchmark --from-json src/docs/benchmarks/outcomes-2026-10.json --out-dir src/docs/benchmarks --readme README.md
hivectl evidence benchmark --root ./evidence --month 2026-10 --spend cost.json --hub hub.json --source "hive-oke snapshot"
```
+`--from-json` redraws a saved Report JSON without reading evidence or recomputing counts. It is mutually exclusive with evidence/computation flags (`--root`, `--month`, `--now`, `--spend`, `--hub`, `--stories`, `--red-team`, `--readme-min-base`, `--source`). Cards ship as SVG sources and 2× PNGs with embedded IBM Plex Mono; the README embeds the PNGs.
+
`evidence benchmark` folds the schema v1 bundles under `--root` per PR and compares the pull requests Hive's review
swarm touched (**mediated**: at least one verdict or posted review on any head) with those merged without it
(**unmediated**): revert rate and change-failure rate over merges observed ≥ 14 days, median time-to-merge, CI failure
@@ -304,7 +307,7 @@ interval; n < 10 is `not reported`. `--month YYYY-MM` bounds the merge time (def
observation time for maturation, `--hub` adds a saved `GET /api/hub/evidence` response as fleet context, `--source`
names the data in the methodology section. It writes `outcomes-YYYY-MM.{md,json}`,
`assets/outcomes-YYYY-MM-{bars,trend}.svg` and the plain-language README cards
-`assets/outcomes-YYYY-MM-card--{dark,light}.svg` under `--out-dir`, and `--readme FILE` rewrites that file's
+`assets/outcomes-YYYY-MM-card--{dark,light}.{svg,png}` under `--out-dir`, and `--readme FILE` rewrites that file's
`…` block from the same report. The README block carries only the cards
and flat sentences, no intervals: `--readme-min-base N` (default 200) is the smallest base a production-count card
may rest on, separate from the n ≥ 10 report threshold; `--stories FILE` supplies curated caught → fixed → merged
diff --git a/src/go.mod b/src/go.mod
index a787500400..a6e28a734c 100644
--- a/src/go.mod
+++ b/src/go.mod
@@ -67,6 +67,7 @@ require (
go.uber.org/automaxprocs v1.6.0
go.yaml.in/yaml/v3 v3.0.5 // indirect
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect
+ golang.org/x/image v0.43.0
golang.org/x/net v0.62.0
golang.org/x/sys v0.49.0
golang.org/x/text v0.43.0 // indirect
diff --git a/src/go.sum b/src/go.sum
index 7214b2e5f6..463a9870c4 100644
--- a/src/go.sum
+++ b/src/go.sum
@@ -135,6 +135,8 @@ go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA=
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
+golang.org/x/image v0.43.0 h1:FLxcP4ec2350nTfOC8ysKtqYSIFbk/QGjw1ZHNP4tsY=
+golang.org/x/image v0.43.0/go.mod h1:rrpelvGFt+kLPAjPM4HeWPgrl0FtafueU//e5N0qk/Q=
golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY=
golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA=
diff --git a/src/pkg/hivectl/commands/evidence_benchmark.go b/src/pkg/hivectl/commands/evidence_benchmark.go
index 6339771f44..e4a8b16105 100644
--- a/src/pkg/hivectl/commands/evidence_benchmark.go
+++ b/src/pkg/hivectl/commands/evidence_benchmark.go
@@ -22,6 +22,7 @@ var evidenceBenchmarkNow = func() time.Time { return time.Now().UTC() }
const benchmarkReadmeDocDir = "src/docs/benchmarks"
func newEvidenceBenchmarkCommand(_ *commandEnv) *cobra.Command {
+ var fromJSON string
var root, month, now, spendPath, hubPath, storiesPath, redTeamPath, outDir, readme, source string
var readmeMinBase int
cmd := &cobra.Command{
@@ -33,60 +34,74 @@ func newEvidenceBenchmarkCommand(_ *commandEnv) *cobra.Command {
"saved /api/cost response is given with --spend. Every rate carries its n and a 95% Wilson interval; n < 10 is\n" +
"printed as \"not reported\". No telemetry is added and nothing contacts a hive.\n\n" +
"Writes /outcomes-YYYY-MM.md, outcomes-YYYY-MM.json, assets/outcomes-YYYY-MM-{bars,trend}.svg and the\n" +
- "plain-language README cards assets/outcomes-YYYY-MM-card--{dark,light}.svg (one number per card, no\n" +
+ "plain-language README cards assets/outcomes-YYYY-MM-card--{dark,light}.{svg,png} (one number per card, no\n" +
"statistics; cards whose base is under --readme-min-base are not written). --stories supplies curated real PRs\n" +
"for the story card; --red-team the prompt-injection eval summary. --readme rewrites the … block of that README\n" +
- "from the same report, so the README never drifts from the committed report (a test asserts they match).",
+ "from the same report. --from-json redraws a saved Report without the evidence tree, so the README never drifts from the committed report (a test asserts they match).",
Example: " hivectl evidence benchmark --root ./evidence --month 2026-10 --spend cost.json --out-dir src/docs/benchmarks --readme README.md\n" +
" hivectl evidence benchmark --root /data/evidence --month 2026-10 --out-dir /tmp/bench",
Args: argsNone(),
RunE: func(cmd *cobra.Command, _ []string) error {
- var opts outcomebench.Options
- var err error
- if strings.TrimSpace(month) != "" {
- if opts.Since, opts.Until, err = outcomebench.ParseWindow(month); err != nil {
- return &usageError{message: err.Error()}
+ var rep outcomebench.Report
+ if fromJSON != "" {
+ data, err := os.ReadFile(fromJSON)
+ if err != nil {
+ return err
}
- }
- opts.Now = evidenceBenchmarkNow()
- if strings.TrimSpace(now) != "" {
- if opts.Now, err = time.Parse(time.RFC3339, strings.TrimSpace(now)); err != nil {
- return &usageError{message: fmt.Sprintf("invalid --now %q; expected RFC3339", now)}
+ if err := json.Unmarshal(data, &rep); err != nil {
+ return fmt.Errorf("parsing %s: %w", fromJSON, err)
}
- }
- if spendPath != "" {
- if opts.Spend, err = outcomebench.LoadSpend(spendPath); err != nil {
- return err
+ if rep.GeneratedAt.IsZero() {
+ return fmt.Errorf("%s: saved Report needs GeneratedAt", fromJSON)
}
- }
- if hubPath != "" {
- if opts.Hub, err = outcomebench.LoadHub(hubPath); err != nil {
- return err
+ } else {
+ var opts outcomebench.Options
+ var err error
+ if strings.TrimSpace(month) != "" {
+ if opts.Since, opts.Until, err = outcomebench.ParseWindow(month); err != nil {
+ return &usageError{message: err.Error()}
+ }
}
- }
- if storiesPath != "" {
- if opts.Stories, err = outcomebench.LoadStories(storiesPath); err != nil {
- return err
+ opts.Now = evidenceBenchmarkNow()
+ if strings.TrimSpace(now) != "" {
+ if opts.Now, err = time.Parse(time.RFC3339, strings.TrimSpace(now)); err != nil {
+ return &usageError{message: fmt.Sprintf("invalid --now %q; expected RFC3339", now)}
+ }
}
- }
- if redTeamPath != "" {
- if opts.RedTeam, err = outcomebench.LoadRedTeam(redTeamPath); err != nil {
+ if spendPath != "" {
+ if opts.Spend, err = outcomebench.LoadSpend(spendPath); err != nil {
+ return err
+ }
+ }
+ if hubPath != "" {
+ if opts.Hub, err = outcomebench.LoadHub(hubPath); err != nil {
+ return err
+ }
+ }
+ if storiesPath != "" {
+ if opts.Stories, err = outcomebench.LoadStories(storiesPath); err != nil {
+ return err
+ }
+ }
+ if redTeamPath != "" {
+ if opts.RedTeam, err = outcomebench.LoadRedTeam(redTeamPath); err != nil {
+ return err
+ }
+ }
+ opts.ReadmeMinBase = readmeMinBase
+ opts.Source = source
+ if opts.Source == "" {
+ opts.Source = "evidence bundles under " + root
+ }
+ bundles, unreadable, err := outcomebench.Load(root)
+ if err != nil {
return err
}
+ if unreadable > 0 {
+ fmt.Fprintf(cmd.ErrOrStderr(), "skipped %d unreadable or non-v1 bundle(s) under %s\n", unreadable, root)
+ }
+ rep = outcomebench.Compute(bundles, unreadable, opts)
}
- opts.ReadmeMinBase = readmeMinBase
- opts.Source = source
- if opts.Source == "" {
- opts.Source = "evidence bundles under " + root
- }
- bundles, unreadable, err := outcomebench.Load(root)
- if err != nil {
- return err
- }
- if unreadable > 0 {
- fmt.Fprintf(cmd.ErrOrStderr(), "skipped %d unreadable or non-v1 bundle(s) under %s\n", unreadable, root)
- }
- rep := outcomebench.Compute(bundles, unreadable, opts)
paths, err := writeBenchmark(rep, outDir)
if err != nil {
return err
@@ -103,6 +118,12 @@ func newEvidenceBenchmarkCommand(_ *commandEnv) *cobra.Command {
if err != nil {
return fmt.Errorf("%s: %w", readme, err)
}
+ // The ladder is outside the outcomes block and uses the same report.
+ for _, line := range strings.Split(updated, "\n") {
+ if strings.HasPrefix(line, "") && strings.Contains(line, "-card-how-it-works-") {
+ updated = strings.Replace(updated, line, rep.HowItWorksPicture(benchmarkReadmeDocDir), 1)
+ }
+ }
if err := os.WriteFile(readme, []byte(updated), 0o644); err != nil {
return fmt.Errorf("writing %s: %w", readme, err)
}
@@ -112,6 +133,7 @@ func newEvidenceBenchmarkCommand(_ *commandEnv) *cobra.Command {
return nil
},
}
+ cmd.Flags().StringVar(&fromJSON, "from-json", "", "redraw a saved Report JSON without reading evidence")
cmd.Flags().StringVar(&root, "root", ghpkg.ReviewEvidenceRoot, "evidence root holding ///.json bundles")
cmd.Flags().StringVar(&month, "month", "", "only PRs merged in this YYYY-MM month (default: all)")
cmd.Flags().StringVar(&now, "now", "", "observation time (RFC3339) for the maturation window; default now")
@@ -123,10 +145,13 @@ func newEvidenceBenchmarkCommand(_ *commandEnv) *cobra.Command {
cmd.Flags().StringVar(&outDir, "out-dir", "docs/benchmarks", "directory for the report, JSON and assets/")
cmd.Flags().StringVar(&readme, "readme", "", "README whose outcomes block to rewrite from this report")
cmd.Flags().StringVar(&source, "source", "", "how the report names its source (default: the --root path)")
+ for _, flag := range []string{"root", "month", "now", "spend", "hub", "stories", "red-team", "readme-min-base", "source"} {
+ cmd.MarkFlagsMutuallyExclusive("from-json", flag)
+ }
return cmd
}
-// writeBenchmark writes the markdown, JSON and SVG outputs and returns their
+// writeBenchmark writes the markdown, JSON, SVG and PNG outputs and returns their
// paths.
func writeBenchmark(rep outcomebench.Report, outDir string) ([]string, error) {
if err := os.MkdirAll(filepath.Join(outDir, "assets"), 0o755); err != nil {
@@ -155,6 +180,20 @@ func writeBenchmark(rep outcomebench.Report, outDir string) ([]string, error) {
}
}
}
+ pngs, err := rep.CardPNGs()
+ if err != nil {
+ return nil, err
+ }
+ for _, name := range outcomebench.CardNames() {
+ for _, theme := range []string{"dark", "light"} {
+ file := strings.TrimSuffix(rep.CardFile(name, theme), ".svg") + ".png"
+ if data, ok := pngs[file]; ok {
+ p := filepath.Join(outDir, "assets", file)
+ files[p] = data
+ order = append(order, p)
+ }
+ }
+ }
paths := make([]string, 0, len(files))
for _, p := range order {
if err := os.WriteFile(p, files[p], 0o644); err != nil {
diff --git a/src/pkg/hivectl/commands/evidence_benchmark_test.go b/src/pkg/hivectl/commands/evidence_benchmark_test.go
index 9dabea1b63..dd0a92a4e7 100644
--- a/src/pkg/hivectl/commands/evidence_benchmark_test.go
+++ b/src/pkg/hivectl/commands/evidence_benchmark_test.go
@@ -1,9 +1,11 @@
package commands
import (
+ "encoding/json"
"net/http/httptest"
"os"
"path/filepath"
+ "reflect"
"strings"
"testing"
"time"
@@ -86,3 +88,72 @@ func TestEvidenceBenchmarkRejectsBadInput(t *testing.T) {
t.Fatal("unwritable out-dir must fail")
}
}
+
+func TestEvidenceBenchmarkFromJSON(t *testing.T) {
+ server := httptest.NewServer(nil)
+ defer server.Close()
+ root := t.TempDir()
+ source := filepath.Join(root, "saved.json")
+ rep := outcomebench.Report{GeneratedAt: time.Date(2026, 10, 1, 0, 0, 0, 0, time.UTC), Source: "saved sample", PRs: 123}
+ data, err := json.Marshal(rep)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(source, data, 0o644); err != nil {
+ t.Fatal(err)
+ }
+ readme := filepath.Join(root, "README.md")
+ old := rep.HowItWorksPicture(benchmarkReadmeDocDir)
+ old = strings.ReplaceAll(old, ".png", ".svg")
+ if err := os.WriteFile(readme, []byte(old+"\n"+outcomebench.ReadmeStart+"\nold\n"+outcomebench.ReadmeEnd), 0o644); err != nil {
+ t.Fatal(err)
+ }
+ out := filepath.Join(root, "out")
+ stdout, _, err := execute(t, server, "", "evidence", "benchmark", "--from-json", source, "--out-dir", out, "--readme", readme)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !strings.Contains(stdout, "123 PRs") {
+ t.Fatalf("lost saved counts: %s", stdout)
+ }
+ saved, err := os.ReadFile(filepath.Join(out, "outcomes-2026-10.json"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ var got outcomebench.Report
+ if err := json.Unmarshal(saved, &got); err != nil {
+ t.Fatal(err)
+ }
+ if !reflect.DeepEqual(got, rep) {
+ t.Fatalf("rerender changed report: %+v", got)
+ }
+ svg := rep.Cards()[rep.CardFile(outcomebench.CardHowItWorks, "dark")]
+ png, err := os.ReadFile(filepath.Join(out, "assets", "outcomes-2026-10-card-how-it-works-dark.png"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := outcomebench.ValidateCardPNG(png, svg); err != nil {
+ t.Fatal(err)
+ }
+ updated, _ := os.ReadFile(readme)
+ if !strings.Contains(string(updated), rep.HowItWorksPicture(benchmarkReadmeDocDir)) || strings.Contains(string(updated), ".svg") {
+ t.Fatal("ladder embed not updated")
+ }
+ for _, extra := range [][]string{{"--root", root}, {"--month", "2026-10"}, {"--readme-min-base", "1"}} {
+ args := append([]string{"evidence", "benchmark", "--from-json", source, "--out-dir", out}, extra...)
+ if _, _, err := execute(t, server, "", args...); err == nil {
+ t.Errorf("accepted conflicting flags %v", extra)
+ }
+ }
+ for _, body := range []string{"{", "null"} {
+ if err := os.WriteFile(source, []byte(body), 0o644); err != nil {
+ t.Fatal(err)
+ }
+ if _, _, err := execute(t, server, "", "evidence", "benchmark", "--from-json", source, "--out-dir", out); err == nil {
+ t.Errorf("accepted invalid report %s", body)
+ }
+ }
+ if _, _, err := execute(t, server, "", "evidence", "benchmark", "--from-json", filepath.Join(root, "missing"), "--out-dir", out); err == nil {
+ t.Error("accepted missing report")
+ }
+}
diff --git a/src/pkg/outcomebench/cards.go b/src/pkg/outcomebench/cards.go
index 9b3b0ac6fd..f674b8b291 100644
--- a/src/pkg/outcomebench/cards.go
+++ b/src/pkg/outcomebench/cards.go
@@ -9,6 +9,7 @@ import (
"regexp"
"strings"
"time"
+ "unicode/utf8"
)
// The README cards are the plain-language face of the benchmark: one idea
@@ -126,43 +127,40 @@ const minCICardCoverage = 0.8
// rules, warm off-white text, the dashboard's amber for every numeral and
// for "with Hive" bars, a flat warm gray for "without", and green only for
// pass/merged dots. One SVG is written per theme and the README picks one
-// with . The numeral glow is the only decoration and only the dark
-// theme has it.
+// with . Numerals use flat amber in both themes.
type cardTheme struct {
- Name, BG, Border, Rule, Head, Text, Muted, Brand, Brand2, Neutral, OK string
- Glow bool
+ Name, BG, Border, Rule, Head, Text, Muted, Brand, Neutral, OK string
}
var cardThemes = []cardTheme{
- {Name: "dark", BG: "#0f0d0a", Border: "#2a251f", Rule: "#1c1814", Head: "#fffaf0", Text: "#ece5d8", Muted: "#8b949e", Brand: "#f0b429", Brand2: "#ffd166", Neutral: "#3a342c", OK: "#2da44e", Glow: true},
- {Name: "light", BG: "#fbf8f2", Border: "#ddd6c8", Rule: "#e8e2d6", Head: "#1a1612", Text: "#2b2620", Muted: "#6b6459", Brand: "#9a5f0b", Brand2: "#b8741a", Neutral: "#d9d2c5", OK: "#1a7f37"},
+ {Name: "dark", BG: "#0f0d0a", Border: "#2a251f", Rule: "#1c1814", Head: "#fffaf0", Text: "#ece5d8", Muted: "#8b949e", Brand: "#f0b429", Neutral: "#3a342c", OK: "#2da44e"},
+ {Name: "light", BG: "#fbf8f2", Border: "#ddd6c8", Rule: "#e8e2d6", Head: "#1a1612", Text: "#2b2620", Muted: "#6b6459", Brand: "#9a5f0b", Neutral: "#d9d2c5", OK: "#1a7f37"},
}
// Layout constants. Every card spans the README content column and is
-// declared at twice its display size so GitHub downsamples it crisp; the
+// rasterized at twice its display size so GitHub downsamples it crisp; the
// coordinates below are display pixels (the viewBox). Character budgets
// assume a monospace glyph about 0.6 em wide.
const (
- cardFont = "'IBM Plex Mono', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"
+ cardFont = "IBM Plex Mono"
cardW = 880
cardScale = 2
- cardPad = 40
+ cardPad = 48
cardRadius = 16
colX = cardW - 2*cardPad // usable width
eyebrowPx = 11
eyebrowGap = 40 // eyebrow baseline to headline baseline
headPx = 32
headLineH = 42
- headChars = 41
+ headChars = 40
bigPx = 88
- bigPxTight = 64 // three or more stats on one row
bodyPx = 15
bodyLineH = 22
footPx = 12
footLineH = 18
- wideChars = 88
- halfChars = 40 // two columns
- tileChars = 20 // four columns
+ wideChars = 86
+ halfChars = 36 // two columns
+ tileChars = 38 // two columns
)
// Card names; the asset file is -card--.svg.
@@ -200,8 +198,16 @@ func (r Report) Cards() map[string]string {
return out
}
-// Card renders one named card; ok is false when its data is not shown.
+// Card renders the vector source of one named card.
func (r Report) Card(name string, th cardTheme) (string, bool) {
+ d, ok := r.cardDrawing(name, th)
+ if !ok {
+ return "", false
+ }
+ return d.SVG(), true
+}
+
+func (r Report) cardDrawing(name string, th cardTheme) (*drawing, bool) {
switch name {
case CardAccuracy:
return r.accuracyCard(th)
@@ -218,7 +224,7 @@ func (r Report) Card(name string, th cardTheme) (string, bool) {
case CardHowItWorks:
return howItWorksCard(th), true
}
- return "", false
+ return nil, false
}
// HasCard reports whether a card has data to show.
@@ -310,7 +316,7 @@ func wrap(s string, width int) []string {
switch {
case line == "":
line = w
- case len(line)+1+len(w) > width:
+ case utf8.RuneCountInString(line)+1+utf8.RuneCountInString(w) > width:
lines = append(lines, line)
line = w
default:
@@ -330,11 +336,11 @@ func esc(s string) string { return html.EscapeString(s) }
type card struct {
th cardTheme
title string
- b strings.Builder
+ ops []drawOp
}
func (c *card) text(x, y, px int, fill, extra, s string) {
- fmt.Fprintf(&c.b, `%s `+"\n", x, y, fill, px, extra, esc(s))
+ c.ops = append(c.ops, drawOp{Kind: "text", X: x, Y: y, Size: px, Fill: fill, Bold: strings.Contains(extra, `font-weight="700"`), End: strings.Contains(extra, `text-anchor="end"`), Text: s})
}
// lines writes wrapped lines and returns the baseline after the last one.
@@ -345,9 +351,9 @@ func (c *card) lines(x, y, px, lineH int, fill string, lines []string) int {
return y + len(lines)*lineH
}
-// eyebrow is the tracked uppercase line at the top: section, base, window.
+// eyebrow is the uppercase line at the top: section, base, window.
func (c *card) eyebrow(y int, s string) {
- c.text(cardPad, y, eyebrowPx, c.th.Muted, ` font-weight="500" letter-spacing="2.2"`, upperKeepDates(s))
+ c.text(cardPad, y, eyebrowPx, c.th.Muted, "", upperKeepDates(s))
}
var reDateLabel = regexp.MustCompile(`\([A-Z]{3}(?: '\d\d)?(?:–[A-Z]{3})? '\d\d\)`)
@@ -361,20 +367,19 @@ func upperKeepDates(s string) string {
// headline is the finding in one plain sentence; the biggest text after
// the numerals. Returns the baseline after it.
func (c *card) headline(y int, s string) int {
- return c.lines(cardPad, y, headPx, headLineH, c.th.Head, wrap(s, headChars))
+ for i, line := range wrap(s, headChars) {
+ c.text(cardPad, y+i*headLineH, headPx, c.th.Head, ` font-weight="700"`, line)
+ }
+ return y + len(wrap(s, headChars))*headLineH
}
-// numeral draws one big amber figure; in the dark theme a blurred copy
-// underneath gives it a soft glow.
+// numeral draws one flat amber figure.
func (c *card) numeral(x, y, px int, s string) {
- if c.th.Glow {
- fmt.Fprintf(&c.b, `%s `+"\n", x, y, c.th.Brand, px, esc(s))
- }
- c.text(x, y, px, "url(#amber)", ` font-weight="700"`, s)
+ c.text(x, y, px, c.th.Brand, ` font-weight="700"`, s)
}
func (c *card) rule(x1, x2, y int) {
- fmt.Fprintf(&c.b, ` `+"\n", x1, y, x2, y, c.th.Rule)
+ c.ops = append(c.ops, drawOp{Kind: "rect", X: x1, Y: y, W: x2 - x1, H: 1, Fill: c.th.Rule})
}
// foot writes the muted footnote above a hairline; y is the hairline.
@@ -383,68 +388,39 @@ func (c *card) foot(y int, s string) int {
return c.lines(cardPad, y+footLineH+4, footPx, footLineH, c.th.Muted, wrap(s, wideChars))
}
-// String closes the card at height h.
-func (c *card) String(h int) string {
- var out strings.Builder
- fmt.Fprintf(&out, `
-%s
-
-
-
-
-
-`, cardW*cardScale, h*cardScale, cardW, h, esc(c.title), cardFont, esc(c.title), c.th.Brand, c.th.Brand2, cardW-1, h-1, cardRadius, c.th.BG, c.th.Border)
- out.WriteString(c.b.String())
- out.WriteString(" \n")
- return out.String()
+// finish adds the surface behind the shared drawing operations.
+func (c *card) finish(h int) *drawing {
+ ops := []drawOp{{Kind: "rect", W: cardW, H: h, Radius: cardRadius, Fill: c.th.Border}, {Kind: "rect", X: 1, Y: 1, W: cardW - 2, H: h - 2, Radius: cardRadius - 1, Fill: c.th.BG}}
+ return &drawing{Title: c.title, Height: h, Ops: append(ops, c.ops...)}
}
// stat is one numeral with the words under it.
type stat struct{ Big, Under string }
-// statCard is the shared anatomy: eyebrow, headline, a row of numerals
-// each with its base under it, footnote.
-func statCard(th cardTheme, title, eye, head string, stats []stat, foot string) string {
+// statCard gives every primary stat the same height and one hero figure.
+func statCard(th cardTheme, title, eye, head string, st stat, foot string) *drawing {
c := &card{th: th, title: title}
- y := cardPad + eyebrowPx
- c.eyebrow(y, eye)
- y = c.headline(y+eyebrowGap, head)
- px := bigPx
- if len(stats) > 2 {
- px = bigPxTight
- }
- colW := colX / len(stats)
- underChars := (colW - 28) / 9 // 15px mono ≈ 9px per glyph, with a gutter
- base := y - headLineH + 36 + px
- maxUnder := 0
- for i, st := range stats {
- x := cardPad + i*colW
- c.numeral(x, base, px, st.Big)
- under := wrap(st.Under, underChars)
- c.lines(x, base+30, bodyPx, bodyLineH, th.Text, under)
- if len(under) > maxUnder {
- maxUnder = len(under)
- }
- }
- y = base + 30 + maxUnder*bodyLineH + 12
+ c.eyebrow(cardPad+eyebrowPx, eye)
+ c.headline(cardPad+eyebrowPx+eyebrowGap, head)
+ c.numeral(cardPad, 412, bigPx, st.Big)
+ c.lines(cardPad, 448, bodyPx, bodyLineH, th.Text, wrap(st.Under, wideChars))
if foot != "" {
- y = c.foot(y, foot) - footLineH
+ c.foot(504, foot)
}
- return c.String(y + cardPad - 4)
+ return c.finish(600)
}
-func (r Report) accuracyCard(th cardTheme) (string, bool) {
+func (r Report) accuracyCard(th cardTheme) (*drawing, bool) {
f := r.Followup
fa, ta := f.FixedAndApproved, f.TimeToApproval
if !fa.Reported || fa.K <= 0 || fa.N < r.MinBase() {
- return "", false
+ return nil, false
}
words := strings.ToUpper(shareWords(fa.Rate)[:1]) + shareWords(fa.Rate)[1:]
- stats := []stat{{share(fa.Rate), "came back fixed"}}
+ st := stat{share(fa.Rate), "came back fixed"}
title := fmt.Sprintf("%s pull requests the review agent sent back came back fixed and were approved", share(fa.Rate))
head := fmt.Sprintf("The review agent sent %s pull requests back. %s came back fixed.", commas(fa.N), words)
if ta.Reported && ta.N >= r.MinBase() {
- stats = append(stats, stat{fmt.Sprintf("%d min", minutes(ta.Value)), "typical time to fix"})
title += fmt.Sprintf("; %d minutes typical from sent back to approved", minutes(ta.Value))
head = fmt.Sprintf("The review agent sent %s pull requests back. %s came back fixed, typically in %d minutes.", commas(fa.N), words, minutes(ta.Value))
}
@@ -454,51 +430,45 @@ func (r Report) accuracyCard(th cardTheme) (string, bool) {
}
return statCard(th, title,
fmt.Sprintf("Accuracy · %s pull requests sent back · %s", commas(fa.N), r.windowLabel()),
- head, stats, foot+".",
+ head, st, foot+".",
), true
}
-func (r Report) checksGreenCard(th cardTheme) (string, bool) {
+func (r Report) checksGreenCard(th cardTheme) (*drawing, bool) {
c := r.Mediated
if !r.SplitSupported() || !c.CIFailureAtHead.Reported || c.CIFailureAtHead.N < r.MinBase() || !c.CICoverage.Reported || c.CICoverage.Rate < minCICardCoverage {
- return "", false
+ return nil, false
}
pass := int(math.Round(100 * (1 - c.CIFailureAtHead.Rate)))
return statCard(th,
fmt.Sprintf("%d in 100 reviewed pull requests merged with every check passing", pass),
fmt.Sprintf("Accuracy · %s reviewed merges · %s", commas(c.CIFailureAtHead.N), r.windowLabel()),
fmt.Sprintf("%d in 100 reviewed pull requests merged with every check green.", pass),
- []stat{{fmt.Sprintf("%d in 100", pass), "merged with every check green"}},
+ stat{fmt.Sprintf("%d in 100", pass), "merged with every check green"},
fmt.Sprintf("%s reviewed merges with a recorded check result %s.", commas(c.CIFailureAtHead.N), r.windowLabel()),
), true
}
-func (r Report) promptInjectionCard(th cardTheme) (string, bool) {
+func (r Report) promptInjectionCard(th cardTheme) (*drawing, bool) {
rt := r.RedTeam
if rt == nil || rt.Attacks <= 0 {
- return "", false
+ return nil, false
}
pct := int(math.Round(100 * float64(rt.Caught) / float64(rt.Attacks)))
- fa := fmt.Sprintf("%d in %d", rt.FalseAlarms, rt.Benign)
- if rt.FalseAlarms == 0 {
- fa = "0"
- }
+
return statCard(th,
fmt.Sprintf("%d%% of planted text that tries to redirect an agent (prompt injection) was screened out before an agent read it, with %d false alarm in %d harmless texts", pct, rt.FalseAlarms, rt.Benign),
fmt.Sprintf("Security · Hive's own test set · %s", monthLabel(rt.RunAt)),
fmt.Sprintf("We hid %d texts that try to redirect an agent (prompt injection) in issues and files. Hive screened out %d before an agent read them.", rt.Attacks, rt.Caught),
- []stat{
- {fmt.Sprintf("%d%%", pct), "screened out before an agent read it"},
- {fa, "harmless texts wrongly flagged"},
- },
- fmt.Sprintf("Hive's own test set of %d texts %s; not production traffic.", rt.Attacks+rt.Benign, monthLabel(rt.RunAt)),
+ stat{fmt.Sprintf("%d%%", pct), "screened out before an agent read it"},
+ fmt.Sprintf("Hive's own test set of %d texts %s; not production traffic.", rt.Attacks+rt.Benign, monthLabel(rt.RunAt))+fmt.Sprintf(" %d in %d harmless texts wrongly flagged.", rt.FalseAlarms, rt.Benign),
), true
}
-func (r Report) costCard(th cardTheme) (string, bool) {
+func (r Report) costCard(th cardTheme) (*drawing, bool) {
per, ok := r.Spend.PerMergedPR()
if !ok || r.Spend.MergedPRs < r.MinBase() {
- return "", false
+ return nil, false
}
big := fmt.Sprintf("about $%.0f", per)
if per < 1 {
@@ -509,10 +479,7 @@ func (r Report) costCard(th cardTheme) (string, bool) {
big+" of agent spend per merged pull request",
fmt.Sprintf("Cost · %s merged pull requests · %s", commas(r.Spend.MergedPRs), window),
fmt.Sprintf("Agents spent about $%s to merge %s pull requests, %s each. It is tracked like CI minutes.", commas(int(math.Round(r.Spend.USD))), commas(r.Spend.MergedPRs), big),
- []stat{
- {strings.TrimPrefix(big, "about "), "per merged pull request"},
- {"$" + commas(int(math.Round(r.Spend.USD))), "total agent spend"},
- },
+ stat{strings.TrimPrefix(big, "about "), "per merged pull request"},
fmt.Sprintf("Estimate from provider list prices %s; some models unpriced.", window),
), true
}
@@ -521,9 +488,9 @@ func (r Report) costCard(th cardTheme) (string, bool) {
// path without Hive, in plain words and without invented numbers; the right
// column is one real pull request with its recorded timings. A second real
// pull request, if present, is summarised in the footnote.
-func (r Report) storiesCard(th cardTheme) (string, bool) {
+func (r Report) storiesCard(th cardTheme) (*drawing, bool) {
if len(r.Stories) == 0 {
- return "", false
+ return nil, false
}
s := r.Stories[0]
c := &card{th: th, title: fmt.Sprintf("Before and after: %s #%d was sent back once and merged %d minutes after opening", s.Repo, s.Number, s.MergeMinutes())}
@@ -534,11 +501,11 @@ func (r Report) storiesCard(th cardTheme) (string, bool) {
top := y + 8
col := func(i int, label, labelFill string, steps [][2]string, dot []string) int {
x := cardPad + i*(colW+cardPad)
- c.text(x, top, bodyPx+2, labelFill, ` font-weight="700"`, label)
- yy := top + 36
+ c.lines(x, top, bodyPx+2, bodyLineH, labelFill, wrap(label, 34))
+ yy := top + 58
for j, st := range steps {
- fmt.Fprintf(&c.b, ` `+"\n", x+4, yy-4, dot[j])
- c.text(x+18, yy, eyebrowPx, th.Muted, ` font-weight="500" letter-spacing="2.2"`, strings.ToUpper(st[0]))
+ c.ops = append(c.ops, drawOp{Kind: "rect", X: x, Y: yy - 8, W: 8, H: 8, Radius: 4, Fill: dot[j]})
+ c.text(x+18, yy, eyebrowPx, th.Muted, "", strings.ToUpper(st[0]))
yy = c.lines(x+18, yy+bodyLineH, bodyPx, bodyLineH, th.Text, wrap(st[1], halfChars)) + 12
}
return yy
@@ -559,21 +526,20 @@ func (r Report) storiesCard(th cardTheme) (string, bool) {
if right > bottom {
bottom = right
}
- x := cardPad + colW + cardPad
- fmt.Fprintf(&c.b, ` `+"\n", esc(s.URL()), x, top-20, colW, right-top+20)
- foot := "Times from Hive's review records; the right column links to the pull request."
+
+ foot := "Times from Hive's review records; see the pull request in the report."
if len(r.Stories) > 1 {
t := r.Stories[1]
foot = fmt.Sprintf("Same shape: %s #%d, sent back at %d min, fixed at %d, merged at %d. Times from Hive's review records.", t.Repo, t.Number, t.CaughtMinutes(), t.CaughtMinutes()+t.FixMinutes(), t.MergeMinutes())
}
y = c.foot(bottom, foot) - footLineH
- return c.String(y + cardPad - 4), true
+ return c.finish(y + cardPad), true
}
-// tile is one column of the "also" strip.
+// tile is one cell of the "also" grid.
type tile struct{ Head, Big, Text string }
-// alsoTiles are the four secondary properties. Tiles with a number take it
+// alsoTiles are the first three secondary properties. Tiles with a number take it
// from the report; the others are plain statements of how Hive works.
func (r Report) alsoTiles() []tile {
return []tile{
@@ -594,9 +560,9 @@ func (r Report) speedBars() (with, without int, ok bool) {
return minutes(m.Value), minutes(u.Value), true
}
-func (r Report) alsoCard(th cardTheme) (string, bool) {
+func (r Report) alsoCard(th cardTheme) (*drawing, bool) {
if r.Verdicts < r.MinBase() {
- return "", false
+ return nil, false
}
c := &card{th: th, title: "Also: consistent, readable, efficient, fast"}
y := cardPad + eyebrowPx
@@ -607,36 +573,37 @@ func (r Report) alsoCard(th cardTheme) (string, bool) {
}
y = c.headline(y+eyebrowGap, head) + 8
tiles := r.alsoTiles()
- cols := len(tiles) + 1
- tileW := colX / cols
+ tileW := colX / 2
top := y
bottom := top
for i, t := range tiles {
- x := cardPad + i*tileW
- c.text(x, top, bodyPx, th.Muted, ` font-weight="500" letter-spacing="2.2"`, strings.ToUpper(t.Head))
- c.numeral(x, top+52, 30, t.Big)
- yy := c.lines(x, top+80, bodyPx-1, bodyLineH-2, th.Text, wrap(t.Text, tileChars))
+ x := cardPad + (i%2)*tileW
+ rowTop := top + (i/2)*190
+ c.text(x, rowTop, bodyPx, th.Muted, "", strings.ToUpper(t.Head))
+ c.numeral(x, rowTop+52, 30, t.Big)
+ yy := c.lines(x, rowTop+80, bodyPx-1, bodyLineH-2, th.Text, wrap(t.Text, tileChars))
if yy > bottom {
bottom = yy
}
}
- // Fourth column: the speed comparison as two thin bars.
- x := cardPad + 3*tileW
- c.text(x, top, bodyPx, th.Muted, ` font-weight="500" letter-spacing="2.2"`, "FAST")
+ // Fourth tile: the speed comparison as two thin bars.
+ x := cardPad + tileW
+ top += 190
+ c.text(x, top, bodyPx, th.Muted, "", "FAST")
if with, without, ok := r.speedBars(); ok {
barW := tileW - 76 // room for the value at the bar end
- longest := with
+ longest := max(1, with)
if without > longest {
longest = without
}
bar := func(yy int, label string, val int, fill string) {
w := barW * val / longest
c.text(x, yy, footPx, th.Muted, "", label)
- fmt.Fprintf(&c.b, ` `+"\n", x, yy+9, w, fill)
+ c.ops = append(c.ops, drawOp{Kind: "rect", X: x, Y: yy + 9, W: w, H: 8, Radius: 4, Fill: fill})
c.text(x+w+8, yy+17, footPx+1, th.Head, ` font-weight="700"`, fmt.Sprintf("%d min", val))
}
bar(top+28, "merged without review", without, th.Neutral)
- bar(top+68, "reviewed by Hive", with, "url(#amber)")
+ bar(top+68, "reviewed by Hive", with, th.Brand)
d := with - without
note := "typical minutes, open to merge"
if d > 0 {
@@ -652,7 +619,7 @@ func (r Report) alsoCard(th cardTheme) (string, bool) {
bottom = yy
}
}
- return c.String(bottom + cardPad - 8), true
+ return c.finish(bottom + cardPad - 8), true
}
// rung is one step of the Hive loop for the how-it-works card.
@@ -668,25 +635,25 @@ var hiveLoop = []rung{
{"Credit", "The issue opener is named on the merge.", "co-author trailer"},
}
-func howItWorksCard(th cardTheme) string {
+func howItWorksCard(th cardTheme) *drawing {
c := &card{th: th, title: "How Hive works: scan, claim, work, verify, merge, credit"}
y := cardPad + eyebrowPx
c.eyebrow(y, "How it works · every task")
y = c.headline(y+eyebrowGap, "A coding agent does the work. A review agent and your CI gate the merge.")
- const stepX, textX = cardPad + 48, cardPad + 48 + 96
+ const stepX, textX = cardPad + 48, cardPad + 230
y += 6
for i, r := range hiveLoop {
- what := wrap(r.What, 42)
+ what := wrap(r.What, 54)
rowH := 20 + len(what)*bodyLineH + 14
base := y + 26
c.numeral(cardPad, base, 24, fmt.Sprintf("%02d", i+1))
c.text(stepX, base, bodyPx, th.Head, ` font-weight="700"`, r.Step)
c.lines(textX, base, bodyPx, bodyLineH, th.Text, what)
- c.text(cardW-cardPad, base, footPx+1, th.Muted, ` text-anchor="end"`, r.Outcome)
+ c.text(textX, base+len(what)*bodyLineH, footPx, th.Muted, "", r.Outcome)
y += rowH
if i < len(hiveLoop)-1 {
c.rule(cardPad, cardW-cardPad, y)
}
}
- return c.String(y + cardPad - 10)
+ return c.finish(y + cardPad)
}
diff --git a/src/pkg/outcomebench/cards_test.go b/src/pkg/outcomebench/cards_test.go
index 806de4c45d..888e8834cd 100644
--- a/src/pkg/outcomebench/cards_test.go
+++ b/src/pkg/outcomebench/cards_test.go
@@ -44,13 +44,18 @@ func TestCardsRespectMinimumBase(t *testing.T) {
t.Error("checks-green drawn with CI coverage below the floor")
}
svg, _ := rep.Card(CardAccuracy, cardThemes[0])
- for _, want := range []string{"", `3 in 4<", ">20 min<", "15 sent back (oct '26); 4 merged as-is", `filter="url(#glow)"`, `width="1760"`, `viewBox="0 0 880 `} {
+ for _, want := range []string{"", `3 in 4<", "typically in 20 minutes.", "15 sent back (oct '26); 4 merged as-is", `font-weight="700"`, `width="1760"`, `viewBox="0 0 880 `} {
if !strings.Contains(svg, want) {
t.Errorf("accuracy card missing %q:\n%s", want, svg)
}
}
- if light, _ := rep.Card(CardAccuracy, cardThemes[1]); strings.Contains(light, `filter="url(#glow)"`) {
- t.Error("light theme must not glow")
+ for _, th := range cardThemes {
+ svg, _ := rep.Card(CardAccuracy, th)
+ for _, bad := range []string{"filter=", "linearGradient", "url(#"} {
+ if strings.Contains(svg, bad) {
+ t.Errorf("card contains %s", bad)
+ }
+ }
}
if len(rep.Cards()) != 2*5 { // accuracy, checks-green, cost, also, how-it-works × dark/light
t.Errorf("Cards() = %d files: %v", len(rep.Cards()), rep.Cards())
@@ -111,7 +116,7 @@ func TestLoadStoriesAndRedTeam(t *testing.T) {
}
rep := Report{RedTeam: rt, GeneratedAt: now}
svg, ok := rep.Card(CardPromptInjection, cardThemes[1])
- if !ok || !strings.Contains(svg, ">97%<") || !strings.Contains(svg, ">1 in 12<") || !strings.Contains(svg, "We hid 63 texts that try to redirect an") || !strings.Contains(svg, "TEST SET · (oct '26)") || !strings.Contains(svg, "75 texts (oct '26)") || !strings.Contains(svg, "not production traffic") {
+ if !ok || !strings.Contains(svg, ">97%<") || !strings.Contains(strings.Join(strings.Fields(reHTMLTag.ReplaceAllString(svg, " ")), " "), "1 in 12 harmless texts wrongly flagged.") || !strings.Contains(svg, "We hid 63 texts that try to redirect an") || !strings.Contains(svg, "TEST SET · (oct '26)") || !strings.Contains(svg, "75 texts (oct '26)") || !strings.Contains(svg, "not production traffic") {
t.Fatalf("prompt-injection card:\n%s", svg)
}
}
diff --git a/src/pkg/outcomebench/drawing.go b/src/pkg/outcomebench/drawing.go
new file mode 100644
index 0000000000..44483404f2
--- /dev/null
+++ b/src/pkg/outcomebench/drawing.go
@@ -0,0 +1,218 @@
+package outcomebench
+
+import (
+ "bytes"
+ "crypto/sha256"
+ _ "embed"
+ "encoding/binary"
+ "fmt"
+ "hash/crc32"
+ "image"
+ "image/color"
+ "image/draw"
+ "image/png"
+ "strings"
+ "sync"
+
+ "golang.org/x/image/font"
+ "golang.org/x/image/font/opentype"
+ "golang.org/x/image/math/fixed"
+ "golang.org/x/image/vector"
+)
+
+// IBM Plex Mono is distributed under the SIL OFL in fonts/OFL.txt.
+//
+//go:embed fonts/IBMPlexMono-Regular.ttf
+var regularTTF []byte
+
+//go:embed fonts/IBMPlexMono-Bold.ttf
+var boldTTF []byte
+
+var cardFonts = sync.OnceValue(func() [2]*opentype.Font {
+ var fonts [2]*opentype.Font
+ for i, data := range [][]byte{regularTTF, boldTTF} {
+ f, err := opentype.Parse(data)
+ if err != nil {
+ panic(err)
+ } // embedded, reviewed font assets
+ fonts[i] = f
+ }
+ return fonts
+})
+
+type drawOp struct {
+ Kind string
+ X, Y, W, H, Radius, Size int
+ Fill, Text string
+ Bold, End bool
+}
+
+type drawing struct {
+ Title string
+ Height int
+ Ops []drawOp
+}
+
+// SVG and PNG consume the same ordered operations, in display pixels.
+func (d *drawing) SVG() string {
+ var b strings.Builder
+ fmt.Fprintf(&b, ``+"\n%s \n", cardW*cardScale, d.Height*cardScale, cardW, d.Height, esc(d.Title), cardFont, esc(d.Title))
+ // Font changes also invalidate PNG source hashes. Version the raster recipe
+ // here if its rendering changes without changing the drawing operations.
+ fmt.Fprintf(&b, "\n", sha256.Sum256(regularTTF), sha256.Sum256(boldTTF))
+ for _, op := range d.Ops {
+ switch op.Kind {
+ case "text":
+ extra := ""
+ if op.Bold {
+ extra += ` font-weight="700"`
+ }
+ if op.End {
+ extra += ` text-anchor="end"`
+ }
+ fmt.Fprintf(&b, `%s `+"\n", op.X, op.Y, op.Fill, op.Size, extra, esc(op.Text))
+ case "rect":
+ fmt.Fprintf(&b, ` `+"\n", op.X, op.Y, op.W, op.H, op.Radius, op.Fill)
+ }
+ }
+ b.WriteString(" \n")
+ return b.String()
+}
+
+func ink(hex string) *image.Uniform {
+ var r, g, b uint8
+ if _, err := fmt.Sscanf(hex, "#%02x%02x%02x", &r, &g, &b); err != nil {
+ panic(err)
+ }
+ return image.NewUniform(color.RGBA{r, g, b, 255})
+}
+
+func (d *drawing) PNG() ([]byte, error) {
+ dst := image.NewRGBA(image.Rect(0, 0, cardW*cardScale, d.Height*cardScale))
+ type faceKey struct {
+ size int
+ bold bool
+ }
+ faces := map[faceKey]font.Face{}
+ defer func() {
+ for _, face := range faces {
+ _ = face.Close()
+ }
+ }()
+ for _, op := range d.Ops {
+ switch op.Kind {
+ case "rect":
+ roundedRect(dst, op)
+ case "text":
+ key := faceKey{op.Size, op.Bold}
+ face := faces[key]
+ if face == nil {
+ idx := 0
+ if op.Bold {
+ idx = 1
+ }
+ var err error
+ face, err = opentype.NewFace(cardFonts()[idx], &opentype.FaceOptions{Size: float64(op.Size * cardScale), DPI: 72, Hinting: font.HintingNone})
+ if err != nil {
+ return nil, err
+ }
+ faces[key] = face
+ }
+ pen := font.Drawer{Dst: dst, Src: ink(op.Fill), Face: face, Dot: fixed.P(op.X*cardScale, op.Y*cardScale)}
+ if op.End {
+ pen.Dot.X -= pen.MeasureString(op.Text)
+ }
+ pen.DrawString(op.Text)
+ }
+ }
+ var b bytes.Buffer
+ if err := png.Encode(&b, dst); err != nil {
+ return nil, err
+ }
+ // Insert a standard ancillary tEXt chunk before IEND, leaving pixels alone.
+ raw := b.Bytes()
+ payload := []byte(fmt.Sprintf("outcomebench-source\x00%x", sha256.Sum256([]byte(d.SVG()))))
+ chunk := make([]byte, len(payload)+12)
+ binary.BigEndian.PutUint32(chunk, uint32(len(payload)))
+ copy(chunk[4:], "tEXt")
+ copy(chunk[8:], payload)
+ binary.BigEndian.PutUint32(chunk[len(chunk)-4:], crc32.ChecksumIEEE(chunk[4:len(chunk)-4]))
+ out := append([]byte{}, raw[:len(raw)-12]...)
+ out = append(out, chunk...)
+ return append(out, raw[len(raw)-12:]...), nil
+}
+
+func roundedRect(dst *image.RGBA, op drawOp) {
+ x, y, w, h, r := float32(op.X*cardScale), float32(op.Y*cardScale), float32(op.W*cardScale), float32(op.H*cardScale), float32(op.Radius*cardScale)
+ if w <= 0 || h <= 0 {
+ return
+ }
+ if r > w/2 {
+ r = w / 2
+ }
+ if r > h/2 {
+ r = h / 2
+ }
+ z := vector.NewRasterizer(dst.Bounds().Dx(), dst.Bounds().Dy())
+ const k = 0.55228475
+ z.MoveTo(x+r, y)
+ z.LineTo(x+w-r, y)
+ z.CubeTo(x+w-r+k*r, y, x+w, y+r-k*r, x+w, y+r)
+ z.LineTo(x+w, y+h-r)
+ z.CubeTo(x+w, y+h-r+k*r, x+w-r+k*r, y+h, x+w-r, y+h)
+ z.LineTo(x+r, y+h)
+ z.CubeTo(x+r-k*r, y+h, x, y+h-r+k*r, x, y+h-r)
+ z.LineTo(x, y+r)
+ z.CubeTo(x, y+r-k*r, x+r-k*r, y, x+r, y)
+ z.ClosePath()
+ z.DrawOp = draw.Over
+ z.Draw(dst, dst.Bounds(), ink(op.Fill), image.Point{})
+}
+
+// CardPNGs renders the README raster assets without a browser or system fonts.
+func (r Report) CardPNGs() (map[string][]byte, error) {
+ out := map[string][]byte{}
+ for _, th := range cardThemes {
+ for _, name := range CardNames() {
+ if d, ok := r.cardDrawing(name, th); ok {
+ data, err := d.PNG()
+ if err != nil {
+ return nil, err
+ }
+ out[strings.TrimSuffix(r.CardFile(name, th.Name), ".svg")+".png"] = data
+ }
+ }
+ }
+ return out, nil
+}
+
+// ValidateCardPNG checks provenance and size, not rasterizer-specific pixels.
+func ValidateCardPNG(data []byte, svg string) error {
+ cfg, err := png.DecodeConfig(bytes.NewReader(data))
+ if err != nil {
+ return err
+ }
+ var w, h int
+ if _, err := fmt.Sscanf(svg, ` len(data)-pos-12 {
+ return fmt.Errorf("truncated PNG chunk")
+ }
+ chunk := data[pos+4 : pos+8+n]
+ if string(chunk[:4]) == "tEXt" && string(chunk[4:]) == want {
+ if binary.BigEndian.Uint32(data[pos+8+n:pos+12+n]) != crc32.ChecksumIEEE(chunk) {
+ return fmt.Errorf("invalid source chunk CRC")
+ }
+ return nil
+ }
+ pos += n + 12
+ }
+ return fmt.Errorf("PNG source hash missing or stale")
+}
diff --git a/src/pkg/outcomebench/drawing_test.go b/src/pkg/outcomebench/drawing_test.go
new file mode 100644
index 0000000000..5c2fe715f2
--- /dev/null
+++ b/src/pkg/outcomebench/drawing_test.go
@@ -0,0 +1,109 @@
+package outcomebench
+
+import (
+ "bytes"
+ "encoding/json"
+ "image"
+ "image/png"
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+
+ "golang.org/x/image/font"
+ "golang.org/x/image/font/opentype"
+ "golang.org/x/image/math/fixed"
+)
+
+func TestCardPNGProvenance(t *testing.T) {
+ d := statCard(cardThemes[0], "Example", "Accuracy", "One figure, drawn with the embedded font.", stat{"3 in 4", "came back fixed"}, "Test data.")
+ data, err := d.PNG()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := ValidateCardPNG(data, d.SVG()); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := png.Decode(bytes.NewReader(data)); err != nil {
+ t.Fatal(err)
+ }
+ if err := ValidateCardPNG(data, strings.Replace(d.SVG(), "3 in 4", "2 in 3", 1)); err == nil {
+ t.Error("accepted stale source")
+ }
+ if err := ValidateCardPNG(data[:20], d.SVG()); err == nil {
+ t.Error("accepted truncated PNG")
+ }
+ var plain bytes.Buffer
+ if err := png.Encode(&plain, image.NewRGBA(image.Rect(0, 0, cardW*cardScale, d.Height*cardScale))); err != nil {
+ t.Fatal(err)
+ }
+ if err := ValidateCardPNG(plain.Bytes(), d.SVG()); err == nil {
+ t.Error("accepted PNG without source hash")
+ }
+ if err := ValidateCardPNG(data, strings.Replace(d.SVG(), `height="1200"`, `height="1202"`, 1)); err == nil {
+ t.Error("accepted wrong dimensions")
+ }
+ bad := append([]byte{}, data...)
+ i := bytes.Index(bad, []byte("outcomebench-source"))
+ bad[i] = 'X'
+ if err := ValidateCardPNG(bad, d.SVG()); err == nil {
+ t.Error("accepted corrupt source chunk")
+ }
+}
+
+// Measure using the actual embedded faces: a fallback font must never decide
+// whether committed card copy fits. Also exercise all optional stat cards.
+func TestCardLayout(t *testing.T) {
+ data, err := os.ReadFile(filepath.Join("..", "..", "docs", "benchmarks", "outcomes-2026-10.json"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ var committed Report
+ if err := json.Unmarshal(data, &committed); err != nil {
+ t.Fatal(err)
+ }
+ since, until, _ := ParseWindow("2026-10")
+ fixture := Compute(fixture(), 0, Options{Since: since, Until: until, Now: now, ReadmeMinBase: 10, Spend: &Spend{USD: 26, MergedPRs: 13}})
+ for _, rep := range []Report{committed, fixture} {
+ for _, th := range cardThemes {
+ for _, name := range CardNames() {
+ d, ok := rep.cardDrawing(name, th)
+ if !ok {
+ continue
+ }
+ heroes := 0
+ for _, op := range d.Ops {
+ if op.Kind != "text" {
+ continue
+ }
+ if op.Size == bigPx {
+ heroes++
+ }
+ idx := 0
+ if op.Bold {
+ idx = 1
+ }
+ face, err := opentype.NewFace(cardFonts()[idx], &opentype.FaceOptions{Size: float64(op.Size), DPI: 72})
+ if err != nil {
+ t.Fatal(err)
+ }
+ width := font.MeasureString(face, op.Text)
+ _ = face.Close()
+ left := fixed.I(op.X)
+ if op.End {
+ left -= width
+ }
+ if left < fixed.I(cardPad) || left+width > fixed.I(cardW-cardPad) || op.Y-op.Size < cardPad || op.Y > d.Height-cardPad {
+ t.Errorf("%s/%s: text outside padding: %+v, width=%v, height=%d", name, th.Name, op, width, d.Height)
+ }
+ }
+ switch name {
+ case CardAccuracy, CardChecksGreen, CardPromptInjection, CardCost:
+ if heroes != 1 || d.Height != 600 {
+ t.Errorf("%s: %d hero figures, height=%d", name, heroes, d.Height)
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/pkg/outcomebench/drift_test.go b/src/pkg/outcomebench/drift_test.go
index ed90d45ceb..196d7c4685 100644
--- a/src/pkg/outcomebench/drift_test.go
+++ b/src/pkg/outcomebench/drift_test.go
@@ -12,7 +12,7 @@ import (
// TestCommittedReportMatchesReadme regenerates the newest committed report
// from its JSON and asserts the README outcomes block, the markdown and the
// SVG assets are exactly what the generator emits, so none of them can
-// drift from the data. Fix with: src/scripts/outcome-benchmark.sh --readme
+// drift from the data. Fix with: src/scripts/outcome-benchmark.sh --rerender --month 2026-10 --readme
// (or hivectl evidence benchmark … --readme README.md).
func TestCommittedReportMatchesReadme(t *testing.T) {
docDir := filepath.Join("..", "..", "docs", "benchmarks")
@@ -41,7 +41,7 @@ func TestCommittedReportMatchesReadme(t *testing.T) {
t.Fatal(err)
}
if got != want {
- t.Errorf("README outcomes block drifted from %s; regenerate with src/scripts/outcome-benchmark.sh --readme\n--- README\n%s\n--- regenerated\n%s", latest, got, want)
+ t.Errorf("README outcomes block drifted from %s; regenerate with src/scripts/outcome-benchmark.sh --rerender --month 2026-10 --readme\n--- README\n%s\n--- regenerated\n%s", latest, got, want)
}
// The ladder card sits outside the generated block but is still generated.
if !strings.Contains(string(readme), rep.HowItWorksPicture("src/docs/benchmarks")) {
@@ -63,11 +63,23 @@ func TestCommittedReportMatchesReadme(t *testing.T) {
check(filepath.Join(docDir, "assets", rep.AssetBase()+"-trend.svg"), rep.TrendSVG())
for file, svg := range rep.Cards() {
check(filepath.Join(docDir, "assets", file), svg)
+ pngPath := filepath.Join(docDir, "assets", strings.TrimSuffix(file, ".svg")+".png")
+ data, err := os.ReadFile(pngPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := ValidateCardPNG(data, svg); err != nil {
+ t.Errorf("%s: %v", pngPath, err)
+ }
}
// A card the generator no longer emits must not linger as a stale asset.
- stale, _ := filepath.Glob(filepath.Join(docDir, "assets", rep.AssetBase()+"-card-*.svg"))
+ stale, _ := filepath.Glob(filepath.Join(docDir, "assets", rep.AssetBase()+"-card-*.*"))
for _, p := range stale {
- if _, ok := rep.Cards()[filepath.Base(p)]; !ok {
+ file := filepath.Base(p)
+ if strings.HasSuffix(file, ".png") {
+ file = strings.TrimSuffix(file, ".png") + ".svg"
+ }
+ if _, ok := rep.Cards()[file]; !ok {
t.Errorf("%s is not emitted by the generator any more; delete it", p)
}
}
diff --git a/src/pkg/outcomebench/fonts/IBMPlexMono-Bold.ttf b/src/pkg/outcomebench/fonts/IBMPlexMono-Bold.ttf
new file mode 100644
index 0000000000..17b406d221
Binary files /dev/null and b/src/pkg/outcomebench/fonts/IBMPlexMono-Bold.ttf differ
diff --git a/src/pkg/outcomebench/fonts/IBMPlexMono-Regular.ttf b/src/pkg/outcomebench/fonts/IBMPlexMono-Regular.ttf
new file mode 100644
index 0000000000..0c9770d518
Binary files /dev/null and b/src/pkg/outcomebench/fonts/IBMPlexMono-Regular.ttf differ
diff --git a/src/pkg/outcomebench/fonts/OFL.txt b/src/pkg/outcomebench/fonts/OFL.txt
new file mode 100644
index 0000000000..670c6c04ec
--- /dev/null
+++ b/src/pkg/outcomebench/fonts/OFL.txt
@@ -0,0 +1,93 @@
+Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+
+This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/src/pkg/outcomebench/fonts/README.md b/src/pkg/outcomebench/fonts/README.md
new file mode 100644
index 0000000000..0fc5267692
--- /dev/null
+++ b/src/pkg/outcomebench/fonts/README.md
@@ -0,0 +1,11 @@
+# IBM Plex Mono
+
+Regular and Bold faces from the IBM Plex project, distributed under the SIL
+Open Font License 1.1 in [OFL.txt](OFL.txt). The copyright and reserved font
+names are recorded in that license. The generator embeds these unmodified
+files; it never loads fonts from the network or the host.
+
+Source mirror: https://github.com/google/fonts/tree/main/ofl/ibmplexmono
+
+The SVG source includes each font's SHA-256; changing a font invalidates the
+PNG source hash and requires rerendering the cards.
diff --git a/src/pkg/outcomebench/outcomebench_test.go b/src/pkg/outcomebench/outcomebench_test.go
index f21e0ce0d8..68bd8f7cc6 100644
--- a/src/pkg/outcomebench/outcomebench_test.go
+++ b/src/pkg/outcomebench/outcomebench_test.go
@@ -228,7 +228,7 @@ func TestReadmeBlockRoundTrip(t *testing.T) {
RedTeam: &RedTeam{Attacks: 10, Caught: 9, Benign: 5, FalseAlarms: 1, RunAt: now}})
block := rep.ReadmeBlock("src/docs/benchmarks")
for _, want := range []string{ReadmeStart, ReadmeEnd, "## Accuracy", "## Security", "## Cost", "## Also", "46 pull requests, 2 repositories", "(oct '26)", "Humans still merge", "open PRs only", "src/docs/benchmarks/outcomes-2026-10.md",
- "card-accuracy-dark.svg", "card-accuracy-light.svg", "card-stories-dark.svg", "card-prompt-injection-light.svg", "card-cost-dark.svg", "card-also-light.svg", "prefers-color-scheme: dark", "How we count"} {
+ "card-accuracy-dark.png", "card-accuracy-light.png", "card-stories-dark.png", "card-prompt-injection-light.png", "card-cost-dark.png", "card-also-light.png", "prefers-color-scheme: dark", "How we count"} {
if !strings.Contains(block, want) {
t.Errorf("block missing %q:\n%s", want, block)
}
diff --git a/src/pkg/outcomebench/readme.go b/src/pkg/outcomebench/readme.go
index 0b2e27776d..42c7fa0a5e 100644
--- a/src/pkg/outcomebench/readme.go
+++ b/src/pkg/outcomebench/readme.go
@@ -17,7 +17,7 @@ var ErrNoMarkers = errors.New("README has no " + ReadmeStart + " … " + ReadmeE
// ReadmeBlock renders the README evidence section for a general reader:
// one line of scale, then Accuracy / Security / Cost / Also, each a card
-// (a with a dark and a light SVG) and at most two flat sentences,
+// (a with a dark and a light PNG) and at most two flat sentences,
// one of which states the limit of the number. No statistical vocabulary
// appears here; it lives in the report. docDir is the path from the README
// to the benchmark directory.
@@ -85,7 +85,7 @@ func (r Report) HeroLine() string {
return s + " " + monthLabel(r.GeneratedAt) + "."
}
-// picture is the GitHub-flavoured that swaps the card SVG with
+// picture is the GitHub-flavoured that swaps the card PNG with
// the reader's colour scheme; the alt text is the card's title sentence.
func (r Report) picture(docDir, card string, width int) string {
alt := card
@@ -95,7 +95,7 @@ func (r Report) picture(docDir, card string, width int) string {
}
}
return fmt.Sprintf(` `,
- docDir, r.CardFile(card, "dark"), alt, width, docDir, r.CardFile(card, "light"))
+ docDir, strings.TrimSuffix(r.CardFile(card, "dark"), ".svg")+".png", alt, width, docDir, strings.TrimSuffix(r.CardFile(card, "light"), ".svg")+".png")
}
// HowItWorksPicture is the ladder card for the README's own section.
diff --git a/src/scripts/outcome-benchmark.sh b/src/scripts/outcome-benchmark.sh
index 7931141c4e..129f920766 100755
--- a/src/scripts/outcome-benchmark.sh
+++ b/src/scripts/outcome-benchmark.sh
@@ -4,6 +4,9 @@
#
# src/scripts/outcome-benchmark.sh --root ./evidence --month 2026-10 --spend cost.json --readme
#
+# src/scripts/outcome-benchmark.sh --rerender --month 2026-10 --readme
+#
+# --rerender redraws the saved Report JSON without the evidence tree.
# Flags are passed through to `hivectl evidence benchmark`; --readme (no
# argument) rewrites the repository README. Defaults: --root /data/evidence,
# --month = current UTC month, --out-dir src/docs/benchmarks. A saved
@@ -20,18 +23,25 @@ cd "$repo_root/src"
args=()
readme=""
month=""
+rerender=false
out_dir="docs/benchmarks"
while [ $# -gt 0 ]; do
case "$1" in
+ --rerender) rerender=true; shift ;;
--readme) readme="$repo_root/README.md"; shift ;;
--month) month="$2"; shift 2 ;;
--out-dir) out_dir="$2"; shift 2 ;;
- -h|--help) sed -n '2,15p' "$0"; exit 0 ;;
+ -h|--help) sed -n '2,20p' "$0"; exit 0 ;;
*) args+=("$1"); shift ;;
esac
done
[ -n "$month" ] || month="$(date -u +%Y-%m)"
-cmd=(go run ./cmd/hivectl evidence benchmark --month "$month" --out-dir "$out_dir")
+cmd=(go run ./cmd/hivectl evidence benchmark --out-dir "$out_dir")
+if "$rerender"; then
+ cmd+=(--from-json "$out_dir/outcomes-$month.json")
+else
+ cmd+=(--month "$month")
+fi
[ -n "$readme" ] && cmd+=(--readme "$readme")
exec "${cmd[@]}" "${args[@]}"