JSON Output Schemas¶
go-mutesting can write three JSON files after each run.
Full report (json_output)¶
Set json_output: true in the configuration file to write report.json. Its
top-level sources object maps each source-file path to its original text.
Mutants refer to that path through mutator.originalFilePath, so consumers can
look up the source once instead of receiving a duplicate copy for every mutant.
Each mutant also includes a checksum field containing the 32-character
lowercase checksum accepted by --blacklist, and an id field containing the
stable ID used by --baseline and --run-mutant-id.
Each mutatorStats entry counts killed, escaped, skipped, and errored
mutants separately. Its total is the sum of those outcomes and excludes
not-covered mutants.
The legacy mutator.originalSourceCode and mutator.mutatedSourceCode fields
remain accepted by the Go model for compatibility, but new reports omit them.
Each mutator also has a paired location:
{
"physical": {"filename": "calc.go", "line": 5},
"coverage": {"filename": "/project/virtual.go", "line": 200}
}
Each view keeps its filename and one-based line together. physical identifies
source on disk. coverage follows Go's //line directives. Git scope, source
snippets, console links, and GitHub/GitLab locations use the physical view.
Coverage lookup uses the coverage view, with the existing shifted-profile
fallbacks. Without directives, both views identify the same statement.
The old fields keep their meaning: originalFilePath is the physical path and
originalStartLine is the directive-adjusted line. Console and CI annotation
lines can therefore differ from originalStartLine. Do not combine that legacy
line with the physical path for source navigation. Old reports without
location still load; their physical line cannot be recovered from these fields
alone. Mutant IDs and baseline entries do not change.
--logger-summary-json¶
Writes go-mutesting-summary.json. Useful for CI badges, dashboards, and downstream scripts. This example assumes coverage was enabled.
{
"totalMutantsCount": 42,
"killedCount": 35,
"escapedCount": 5,
"errorCount": 0,
"skippedCount": 2,
"notCoveredCount": 0,
"msi": 0.8333,
"coveredCodeMsi": 0.8333
}
| Field | Type | Description |
|---|---|---|
totalMutantsCount |
int | Total mutations generated |
killedCount |
int | Mutations caught by tests |
escapedCount |
int | Mutations not caught (test gaps) |
errorCount |
int | Mutations that could not be classified because execution failed |
skippedCount |
int | Mutations skipped, including uncompilable mutants |
notCoveredCount |
int | Mutations on lines with no coverage (requires --coverage) |
msi |
float | Mutation Score Indicator: killed / total, range 0–1 |
coveredCodeMsi |
float | MSI restricted to covered lines only, range 0–1 |
msi and coveredCodeMsi are in the 0–1 range (not 0–100). Both the summary JSON report and the agentic JSON report (--logger-agentic-json) use a 0–1 ratio for msi. Skipped and errored mutants count in the total, not as kills. Covered MSI excludes not-covered mutants from the total.
--logger-agentic-json¶
Writes go-mutesting-agentic.json. A richer payload designed for LLM consumption. Each survived mutant gets a stable ID, the unified diff, surrounding context lines, nearby test file paths, a plain-English description of the mutation, and a hint for writing a killing test.
{
"generated_at": "2026-05-19T08:13:38Z",
"msi": 0.5857,
"escaped_count": 5,
"reminder": "A mutant is an example of how this code could be wrong...",
"mutants": [
{
"id": "abc123",
"checksum": "a1b2c3d4e5f60123456789abcdef0123",
"file": "pkg/foo/foo.go",
"line": 42,
"mutator": "branch/if",
"diff": "--- Original\n+++ Mutated\n...",
"context_start_line": 39,
"context_lines": ["func Foo() {", " if x > 0 {", " }"],
"test_files": ["pkg/foo/foo_test.go"],
"description": "Removes an if-block body so the condition becomes a no-op",
"kill_hint": "Write a test that enters this branch and asserts the output or side effect it produces"
}
]
}
| Field | Type | Description |
|---|---|---|
generated_at |
string | RFC 3339 timestamp of the run |
msi |
float | Overall MSI as a 0–1 ratio |
escaped_count |
int | Number of survived mutants |
reminder |
string | A plain-English reminder about how to interpret mutants — useful context when feeding the file to an LLM |
mutants[].id |
string | Stable hash of file + mutator + diff — survives refactors that shift line numbers, and is the same however the file target is spelled on the command line |
mutants[].checksum |
string | 32-character lowercase checksum accepted by --blacklist |
mutants[].file |
string | Path to the mutated file, relative to the module root |
mutants[].line |
int | Physical source line number of the mutation |
mutants[].mutator |
string | Mutator name (e.g. branch/if, statement/return) |
mutants[].diff |
string | Unified diff of original vs mutated code |
mutants[].context_start_line |
int | 1-based source line number of context_lines[0]; use this to anchor the context snippet without guessing offsets |
mutants[].context_lines |
[]string | Surrounding source lines for orientation |
mutants[].test_files |
[]string | Test files in the same package |
mutants[].description |
string | Human-readable description of what the mutator changed |
mutants[].kill_hint |
string | A concrete suggestion for a test that would kill this mutant |