Conversation
…t (Track 10.2) Migrates internal/changescope to consume from internal/uitokens for its bracketed severity and posture-verdict badges. First in-tree consumer of uitokens — the foundation Track 10.1 shipped (#136) is now live. What changed - New `uitokens.BracketedSeverity(severity)` and `uitokens.BracketedVerdict(band)` helpers. They encapsulate the exact bracketed strings (`[HIGH]`, `[CRIT]`, `[PASS]`, `[FAIL]`, etc.) that the unified-PR-comment visual contract requires — locked by the changescope golden tests shipped in #145. - `internal/changescope/render.go` `severityIcon` and `postureBadge` are now thin wrappers that delegate to the uitokens helpers. The renderer call sites are unchanged; the vocabulary is now owned by one place. Why this shape The PR-comment markdown contract requires `[LABEL]` brackets because GitHub-flavored markdown doesn't render ANSI color and the brackets make badges scan reliably. The terminal-text severity badge (uitokens.SeverityBadge) returns `Bold(Alert("HIGH"))`-style colored tokens for direct terminal use. Both shapes are valid design choices for their respective surfaces; locking each one in uitokens prevents drift. The wrapper-not-inline approach keeps the surgical: the changescope helpers stay one-liners, the visual contract test (#145) keeps asserting the same strings, and a future renderer joining the party imports uitokens directly without changescope being in the middle. Coverage - 2 new tests in uitokens_test.go: TestBracketedSeverity (locks every severity → bracket mapping) + TestBracketedVerdict (same for posture bands) - Existing changescope golden tests (TestRenderPRSummaryMarkdown, TestRenderPRSummaryMarkdown_UnifiedShape, etc.) all still pass — proves the byte-identical rendering contract holds through the migration Verification: full Go test suite green; `make docs-verify`, `make docs-linkcheck`, `make truth-verify` clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
[RISK] Terrain — Merge with caution
Coverage gaps in changed code
4 pre-existing issues on changed files
Recommended tests4 test(s) with exact coverage of 25 impacted unit(s). 3 impacted unit(s) have no covering tests in the selected set.
Owners: PMCLSF Limitations
Generated by Terrain · Targeted Test ResultsTerrain selected 4 test(s) instead of the full suite.
|
Terrain AI Risk Review
Decision: PASS — AI surfaces are covered. |
pmclSF
added a commit
that referenced
this pull request
May 9, 2026
…t (Track 10.2) (#161) Migrates internal/changescope to consume from internal/uitokens for its bracketed severity and posture-verdict badges. First in-tree consumer of uitokens — the foundation Track 10.1 shipped (#136) is now live. What changed - New `uitokens.BracketedSeverity(severity)` and `uitokens.BracketedVerdict(band)` helpers. They encapsulate the exact bracketed strings (`[HIGH]`, `[CRIT]`, `[PASS]`, `[FAIL]`, etc.) that the unified-PR-comment visual contract requires — locked by the changescope golden tests shipped in #145. - `internal/changescope/render.go` `severityIcon` and `postureBadge` are now thin wrappers that delegate to the uitokens helpers. The renderer call sites are unchanged; the vocabulary is now owned by one place. Why this shape The PR-comment markdown contract requires `[LABEL]` brackets because GitHub-flavored markdown doesn't render ANSI color and the brackets make badges scan reliably. The terminal-text severity badge (uitokens.SeverityBadge) returns `Bold(Alert("HIGH"))`-style colored tokens for direct terminal use. Both shapes are valid design choices for their respective surfaces; locking each one in uitokens prevents drift. The wrapper-not-inline approach keeps the surgical: the changescope helpers stay one-liners, the visual contract test (#145) keeps asserting the same strings, and a future renderer joining the party imports uitokens directly without changescope being in the middle. Coverage - 2 new tests in uitokens_test.go: TestBracketedSeverity (locks every severity → bracket mapping) + TestBracketedVerdict (same for posture bands) - Existing changescope golden tests (TestRenderPRSummaryMarkdown, TestRenderPRSummaryMarkdown_UnifiedShape, etc.) all still pass — proves the byte-identical rendering contract holds through the migration Verification: full Go test suite green; `make docs-verify`, `make docs-linkcheck`, `make truth-verify` clean. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
First in-tree consumer of uitokens. Migrates
internal/changescopeseverity / verdict badges touitokens.BracketedSeverity/uitokens.BracketedVerdict.The PR-comment markdown's
[HIGH]/[PASS]strings are now owned by one place; renaming a label would surface in two test files (uitokens + changescope golden) instead of being silently inconsistent.Test plan
Plan tracker
Closes Track 10.2 (renderer migration foundation). Track 10.3
(PR-comment redesign through tokens) and 10.4 (HTML report
redesign) will follow on this base. The vet-style check that flags
raw color codes outside uitokens (the "V1 uniformity gate" from
the parity plan) remains 0.2.x work.