Skip to main content

Module report

Module report 

Source
Expand description

The human-readable benchmark report, docs/generated/economics.md: a rendering of one EconomicsSummary and nothing else. Every number in it is a field of the summary, spelled for a reader; the report computes none, so it cannot disagree with the CLI, the API, MCP, the Cockpit or the site, which render the same summary.

use majordomus_cli::economics::{report, summarize};
let dir = tempfile::tempdir().unwrap();
let text = report::markdown(&summarize(dir.path(), &Default::default()));
assert!(text.contains("No verified total-token-savings claim is available"));

Functions§

amount
A figure in its unit, as every surface spells it. A ratio is a signed percentage with one decimal (percent_text); any other unit is a signed whole number followed by the unit. Neither carries a sign when it rounds to zero, and a value that is not a number prints n/a, so no surface ever shows -0.0% or a figure nobody computed.
interval_text
An interval as every surface spells it: the confidence level (level_text, so that 9750 reads 97.5% and is never rounded into a level the methodology did not declare), then both bounds in the metric’s unit (amount). The bounds of a ratio are reductions, like the value they bracket.
markdown
The whole report for one summary, as Markdown. It reads nothing but s, so the same summary always renders to the same bytes. When no methodology is declared (present is false) the report stops after the verdict, its unmet thresholds and the records that could not be read, because every later section would describe evidence that cannot exist. Free text placed in a table cell has its pipes escaped and its line breaks flattened, so a reason can never split a row. Every per-pair and aggregate token figure is a reduction, spelled by amount: a negative reduction means Majordomus used more tokens, and no figure is negated on the way to the page.
value
A metric’s value as the report spells it: amount in the metric’s unit, and an absent value the words not measured, so that an unmeasured metric never reads as a change of zero.
words
An enum of the summary as a person reads it: its serialised name (wire, the one the API and MCP answer with) with each underscore a space, so no_evidence reads no evidence. A surface never spells a state from Debug, which would print NoEvidence, a word the API never uses.