Make report formatters handle nil Changes
Context
I hit a panic when calling the report formatters with a Result that didn’t populate Changes (early exit case). The CLI swallowed it, but a direct library call crashes.
Problem
FormatJSON, FormatHTML, and FormatText assume result.Changes is non-nil and dereference it unconditionally.
Expected behavior
Passing a Result with a nil Changes should return a valid string without panicking, treating missing changes as empty.
Scope / non-goals
- Don’t alter the output shape when
Changes is present; only guard the nil case.
- No formatter redesigns.
Acceptance criteria
Hints
internal/report/json.go, html.go, text.go and their tests.
Make report formatters handle nil
ChangesContext
I hit a panic when calling the report formatters with a
Resultthat didn’t populateChanges(early exit case). The CLI swallowed it, but a direct library call crashes.Problem
FormatJSON,FormatHTML, andFormatTextassumeresult.Changesis non-nil and dereference it unconditionally.Expected behavior
Passing a
Resultwith a nilChangesshould return a valid string without panicking, treating missing changes as empty.Scope / non-goals
Changesis present; only guard the nil case.Acceptance criteria
Changesis nil.Changesis set.Changesscenario for JSON, HTML, and text outputs.Hints
internal/report/json.go,html.go,text.goand their tests.