feat(0.2): empty-state helpers + visual regression goldens (Tracks 10.6/10.8)#149
Open
feat(0.2): empty-state helpers + visual regression goldens (Tracks 10.6/10.8)#149
Conversation
….6/10.8)
Two Track 10 deliverables that lift the visual / UX side of 0.2.0
from "every renderer invents its own empty-state message" to "one
designed vocabulary, regression-locked."
Track 10.6 — Empty state helpers
New `internal/reporting/empty_states.go` defines an EmptyStateKind
enum with seven shipped kinds (zero-findings, no-AI-surfaces,
no-policy, first-run, no-impact, no-test-selection,
no-migration-candidates) plus three render targets:
- EmptyStateFor(kind) → structured EmptyState (Header + NextMove)
- RenderEmptyState(io.Writer, kind) → terminal-text rendering
- EmptyStateMarkdown(kind) → blockquote-callout markdown
Each shipped kind carries a designed header and a next-move nudge
that names a concrete `terrain ...` command the user can run.
Three contract tests enforce the design rules:
- every kind has a non-empty designed header
- voice & tone — no exclamation marks, no emoji codepoints, no
British spellings (Track 10.7 voice rules locked at the test
level)
- every shipped kind's next-move references a command in
backticks (no purely invitational empty states)
First integration: `internal/reporting/insights_report_v2.go`
swaps its "No significant issues detected." line for the
EmptyZeroFindings rendering with the next-move nudge.
Track 10.8 — Visual regression goldens (foundation)
New `testdata/empty_state_goldens/<kind>.txt` — seven byte-for-
byte golden files matching the seven shipped EmptyStateKind
values. Companion test `TestEmptyState_Goldens` asserts byte
equality on every kind. The drift gate
`TestEmptyState_GoldensCoverEveryKind` verifies that the goldens
directory matches the shipped enum 1:1 — adding a new kind
without a golden, or vice versa, fails CI.
Running `go test ./internal/reporting/... -update-empty-state-goldens`
regenerates the goldens after intentional copy changes.
This is the foundation for the broader Track 10.8 visual
regression suite — once Track 10.2-10.4 (renderer migration to
uitokens) lands, the same golden pattern extends to
PR-comment markdown, SARIF tags, and HTML report screenshots.
Verification: 11 new tests pass; full Go test suite green; no
regression in existing renderers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
[RISK] Terrain — Merge with caution
Coverage gaps in changed code
Pre-existing issues (2)
Recommended tests2 test(s) with exact coverage of 4 impacted unit(s). 2 impacted unit(s) have no covering tests in the selected set.
Owners: PMCLSF Limitations
Generated by Terrain · Targeted Test ResultsTerrain selected 2 test(s) instead of the full suite.
|
Terrain AI Risk Review
Decision: PASS — AI surfaces are covered. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two Track 10 deliverables that lift the visual / UX side of 0.2.0
from "every renderer invents its own empty-state message" to "one
designed vocabulary, regression-locked."
(zero-findings, no-AI-surfaces, no-policy, first-run,
no-impact, no-test-selection, no-migration-candidates) with
terminal-text + markdown render targets, voice & tone rules
locked at the test level.
byte-for-byte golden files + drift gate that verifies the
goldens directory tracks the shipped enum 1:1. Pattern extends
to PR-comment markdown / SARIF / HTML when those land.
What changed
New code:
internal/reporting/empty_states.go— EmptyStateKind enum,EmptyStateFor / RenderEmptyState / EmptyStateMarkdown helpers
internal/reporting/insights_report_v2.go— first integration:swaps the bare "No significant issues detected." line for the
designed EmptyZeroFindings rendering
New tests (11):
New goldens:
testdata/empty_state_goldens/{zero_findings,no_ai_surfaces, no_policy_file,first_run,no_impact,no_test_selection, no_migration_candidates}.txt— one per kindWhy these two together
10.6 (helpers) and 10.8 (goldens) form a single coherent unit:
the helpers define the vocabulary, the goldens lock it. Shipping
just the helpers without the goldens leaves the visual contract
unenforced; shipping just the goldens without designed messages
makes them low-leverage. Together they give the broader Track 10
visual identity work a stable foundation to build on.
Test plan
go build ./...cleango test ./internal/reporting/...— 11 new tests pass +existing tests unaffected
go test ./...— full suite green, no regressionmake docs-verifypassesterrain insightson a clean repo rendersthe new "Nothing to flag" header with next-move (separate
verification — needs a clean fixture)
Plan tracker
Closes Track 10.6 + 10.8. Track 10 remaining: 10.2 renderer audit
progress indicators + 10.7 voice & tone pass. Those depend on the
uitokens design system foundation (Track 10.1, in PR feat(0.2): internal/uitokens/ design system foundation (Track 10.1) #136); they
land cleanly once that PR merges.
🤖 Generated with Claude Code