How we know a check is right
A red cell on the report is a claim about somebody's work. This page says why the claim holds, and how to show us that it does not. The controls and the fixture tests below run in CI on every pull request.
the report · the ten bug classes · fixed upstream · source
Two controls run in every report
Both controls run spantruth's own reference instrumentation,
reference.py, through every scenario,
beside the libraries. control-honest runs it as written and has to pass every check.
control-faulty runs it with the faults below switched on and has to fail exactly the
checks in its expectation file
(62 failing checks in 42 scenarios), and pass every other one. If either control moves, a check or the harness is wrong, not
a library. The expectation file is never edited to make a test pass.
In this run: control-honest passed every check in 81 scenarios. control-faulty failed exactly its planted faults, and passed every other check.
| Planted fault | What it does wrong | Must fail |
|---|---|---|
anthropic-raw-input | Copies Anthropic's input_tokens as it is, without the cache reads and writes. | input_tokens, metric.input_tokens, in 7 scenarios |
close-leaks-span | Does not end the span when the app closes a stream or stops reading it early. | span.ended, in 8 scenarios |
content-first-chunk | Records only the first chunk of a stream as the completion text. | content.output_matches, in 2 scenarios |
content-ignores-off | Records prompt and completion text with the library's switch set to off. | content.off_respected, in 4 scenarios |
gemini-candidates-output | Reports Gemini's candidatesTokenCount alone as the output, without the thinking tokens. | output_tokens, metric.output_tokens, in 7 scenarios |
errors-as-success | Ends the span of a failed call without status ERROR and without error.type. | error.status, error.type, in 12 scenarios |
estimate-tokens | Guesses the output count from the length of the text when a stream carries no usage. | output_tokens, metric.output_tokens, in 7 scenarios |
metric-reasoning-left-out | Leaves the reasoning tokens out of the output token metric, while the span counts them. | metric.output_tokens, in 7 scenarios |
retry-as-error | Marks a call as failed when it succeeded after the SDK retried a 429. | status.unset, in 2 scenarios |
The planted faults make 10 of the 22 checks fail on purpose. A new check gets a planted fault in the same pull request.
Every check cites a rule
A finding names its check and links the rule it applies. 18 of the 22 checks apply a sentence of a specification, most of them linked at a fixed commit or version, so the link shows the sentence we read. The others are spantruth's own rules, for what no specification states, such as that a call produces a span at all. They are written out here, so you can disagree with them.
| Check | Rule | Source |
|---|---|---|
app.unchanged | spantruth rule: instrumentation does not change what the application receives: the same return values, the same chunks, the same exceptions, and no hang. | spantruth's own rule |
span.ended | GenAI spans SHOULD end when the response is fully received or the operation is terminated due to an error or cancellation. | the spec |
subject.instrument | spantruth rule: the setup that the library's documentation shows runs without an exception. When it raises, no cell of the subject can be graded. | spantruth's own rule |
span.recorded | spantruth rule: a call the application made produces at least one span. | spantruth's own rule |
span.parented | The span belongs to the trace that was active when the application made the call. | the spec |
error.status | Span status SHOULD follow Recording Errors: an operation that ended in an error sets the status to Error. | the spec |
status.unset | Span Status Code MUST be left unset if the instrumented operation has ended without any errors. | the spec |
error.type | `error.type` is conditionally required if the operation ended in an error. Any low-cardinality identifier is allowed, so only its presence is graded. | the spec |
request_model | The model name the request asked for. | the spec |
response_model | The name of the model that generated the response. | the spec |
response_id | The unique identifier of the completion. | the spec |
finish_reasons | One finish reason per choice, as received. A normalized value is accepted too. | the spec |
input_tokens | Input tokens SHOULD include all types of input tokens, including cached tokens. For Anthropic, whose `input_tokens` excludes them, cache reads and cache writes MUST be added. Gemini's `promptTokenCount` is the total effective prompt size, cached content included (ai.google.dev/api/generate-content#UsageMetadata). OpenInference states the same rule for `llm.token_count.prompt`. | the spec |
output_tokens | Output tokens, with reasoning tokens included. For Anthropic, whose `output_tokens` includes thinking tokens, reasoning tokens are part of, not in addition to, output tokens. For Gemini, whose `candidatesTokenCount` excludes `thoughtsTokenCount`, the two are added. OpenInference states the same rule for `llm.token_count.completion`. | the spec |
cache_read_tokens | Input tokens read from the provider cache. | the spec |
cache_write_tokens | Input tokens written to the provider cache. | the spec |
reasoning_tokens | Output tokens used for reasoning. For Anthropic, thinking tokens reported in `output_tokens_details` map to this count. OpenInference records them as `llm.token_count.completion_details.reasoning`. | the spec |
tokens.single-report | spantruth rule: one call reports its token usage on one span. Usage on two spans of one call is counted twice by any backend that sums token attributes across spans. | spantruth's own rule |
content.off_respected | Prompt and completion text are Opt-In: instrumentations SHOULD populate them if and only if the user configures the instrumentation to do so. spantruth grades the documented off switch, not the library's default: with the switch set to off, no prompt or completion text appears in the exported spans, span events or log records. | the spec |
content.output_matches | Opt-In content SHOULD be populated if the user configures the instrumentation to do so, so with the library's content switch on, the completion text is recorded, and it equals the text the application read. Instrumentations MAY give users a way to filter or truncate output messages; no scenario sets such an option, so the text is compared whole. `gen_ai.output.messages` and the other conventions' output names are read. | the spec |
metric.input_tokens | The input token metric is Recommended: it SHOULD be reported when an operation involves the usage of tokens and the count is readily available, and the recorded value SHOULD match the token count returned by the provider, cached tokens included. Read from `gen_ai.client.inference.operation.input_tokens`, `gen_ai.client.inference.usage.input_tokens`, or the deprecated `gen_ai.client.token.usage` with `gen_ai.token.type` `input`. The histograms count tokens per inference operation, so one call is one recording. Graded only for a library that documents token metrics (`[metrics]` in subject.toml); a documented library that emits none is missing. | the spec |
metric.output_tokens | The output token metric counts the output tokens of the call, reasoning tokens included, with the same rules as the input token metric. Read from `gen_ai.client.inference.operation.output_tokens`, `gen_ai.client.inference.usage.output_tokens`, or the deprecated `gen_ai.client.token.usage` with `gen_ai.token.type` `output`. | the spec |
The fixtures are the provider's wire format
Each of the 81 scenarios is a provider response built to the provider's wire
format, and one is replayed from a recorded stream. A test parses
every fixture with the provider's own SDK types (the openai and
anthropic packages) and fails on any field the types do not declare. A fixture value
is never changed to make a library pass. The token counts in one fixture are all different from
each other, so a library that reads the wrong field cannot pass by chance.
Runs are offline and repeatable
The provider is a local server that replays fixed responses: no API key, no model and no
sampling. Each library runs at the versions pinned in its subject.toml, in its own
environment. Its process gets a proxy address that goes nowhere, so a client that honors the proxy
variables fails fast instead of calling out. A client that opens raw sockets is not stopped by
this, so we check each new subject for outbound calls.
Each library runs with its documented setup
Each library is set up the way its documentation shows, in
subjects/<name>/instrument.py. If that is not the setup you document, the result
is not fair, and we want to know.
How to dispute a finding
Open an issue with the Dispute a finding form. Every dispute is decided in public, in that issue, on one question: does the cited rule say what the check claims? If it does not, we fix the check, and the cell changes for every library. If the specification is unclear, the cell is marked disputed in known_issues.toml, and we ask the specification's owners.
Cells marked disputed today: 0.
The project publishes no ranking and no total score, only each finding with its evidence. See GOVERNANCE.md.