Repository navigation
Change hues only through the kit: a lint rule, and every renderer on the kit's change marks - #193
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new YAML allow-list lacks required schema coverage and will fail CI, while hue mappings and enforcement still have functional gaps.
4 open issues
What changed in this PR
This PR centralizes change coloring in the renderer kit, migrates built-in renderers to its change variables, and adds a lint gate to prevent direct hue references.
Changes:
- Adds
check:change-hues, with tests, reasoned exceptions, and fast-check integration. - Introduces
data-change-huefor changed parts and shared strong/highlight variables. - Migrates renderer styles and markup, updates assertions, and documents the convention.
| File | Description |
|---|---|
| tools/scripts/check-change-hues.test.mjs | Tests hue detection, source scope, and exceptions. |
| tools/scripts/check-change-hues.mjs | Implements the change-hue lint gate. |
| tools/cli/src/lib/gates.ts | Registers the fast-check gate. |
| packages/renderers/text-diff/src/styles.css | Uses kit variables and removes a redundant edge. |
| packages/renderers/runtime-policy/src/styles.css | Replaces direct hues with kit variables. |
| packages/renderers/runtime-policy/src/chips.tsx | Marks changed chips with their hue. |
| packages/renderers/kit/styles/nesting.css | Neutralizes the new variables on containers. |
| packages/renderers/kit/styles/diff.css | Adds part-level hue mappings and variables. |
| packages/renderers/file-packing/src/styles.css | Uses kit variables for emphasis rings. |
| packages/renderers/file-packing/src/circles.tsx | Adds hue marks to emphasis circles. |
| packages/renderers/dependency-injection/test/diff.test.mjs | Updates expected value-change markup. |
| packages/renderers/dependency-injection/src/styles.css | Uses kit ink for old and new values. |
| packages/renderers/dependency-injection/src/diff-lines.tsx | Marks old and new text with hue attributes. |
| packages/renderers/database/src/tags.tsx | Adds hue attributes to changed tags. |
| packages/renderers/database/src/styles.css | Uses kit colors for keys and tags. |
| packages/renderers/code-statistics/src/styles.css | Uses kit variables for deltas and bars. |
| packages/renderers/api/test/api.test.mjs | Updates signature markup assertions. |
| packages/renderers/api/src/styles.css | Uses kit variables for signature highlighting. |
| packages/renderers/api/src/signature-view.tsx | Marks signature lines and changed segments. |
| packages/renderers/agentic-workflows/src/styles.css | Uses kit colors for directions and cells. |
| packages/renderers/agentic-workflows/src/matrix.tsx | Marks added and removed matrix cells. |
| packages/renderers/agentic-workflows/src/card.tsx | Marks widened-direction indicators. |
| package.json | Adds the lint command to repository checks. |
| docs/guides/develop-a-renderer.md | Documents kit-only change coloring. |
| .change-hues.yaml | Defines the empty, reasoned exception list. |
Review effort: Balanced
…ed onto the kit's change marks
Polish step (e). A renderer built on the kit colored changes by naming hues itself
(--green, --red-soft, ...), so the kit's mapping, emphasis and nesting rule could be
bypassed. Now:
- check:change-hues (a fast `tools check` gate, tools/scripts/check-change-hues.mjs):
the CSS and code of every renderer that depends on the kit (not the kit, its
tooling, tests or fixtures) may not name a change hue: the kit's aliases or the
theme's --projections-color-{added,removed,modified,moved}*. Exceptions are files
in .change-hues.yaml, each with its reason; a stale one fails. None is needed.
The minimal example doesn't use the kit and colors changes from the theme's
tokens itself, so it isn't read.
- The kit's change marks set --pk-change-ink, --pk-change-strong (new),
--pk-change-highlight (new), --pk-region-fill and --pk-region-edge. A part of a
changed item drawn in a change's hue (a value's old and new text, an inserted
word, a matrix cell, a tag) takes data-change-hue: the same variables, but not a
changed item, so the item around it keeps its mark under the nesting rule.
- The 56 uses in 9 renderers (agentic workflows, api, code statistics, database,
dependency injection, file packing, runtime policy, text diff) read those
variables. text-diff's extra edge beside a removed line is gone: its run edge
already draws it. Every scenario renders pixel-identically, light and dark, in
the diff and mid-animation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
.change-hues.yaml is validated like .portability.yaml: an internal schema generated from packages/schemas/src/repository, associated in .dollarlint.toml. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
agorischek
force-pushed
the
agorischek/change-hues
branch
from
November 23, 2026 02:55
2550ce4 to
634f237
Compare
…reads token.color and getPropertyValue; deleted manifests are skipped
- base.css imports the change-mark mappings (data-change, data-change-hue), moved from diff.css into styles/changes.css,
so a renderer on kit/base.css without React gets --pk-change-ink and the rest.
- check:change-hues also finds token.color('added'), token.color('removed-highlight') and '--red' read by name.
- Tracked manifests deleted from the working tree are skipped instead of throwing ENOENT.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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.


Polish step (e): renderers built on the kit colour changes only through the kit's change marks.
Why
Renderers named change hues themselves (
--green,--red-soft, …), which bypasses the kit's change mapping, emphasis and nesting rule. Using the official infrastructure should make that hard.Rule:
check:change-huestools checkgate (tools/scripts/check-change-hues.mjs, with a unit test), modelled oncheck-portability.--green,--red-soft, …) or the theme's--projections-color-{added,removed,modified,moved}*..change-hues.yamlwith its reason; an entry that no longer matches fails. None is needed.Kit primitives
data-change,pk-region) sets--pk-change-ink,--pk-change-strong(new),--pk-change-highlight(new),--pk-region-filland--pk-region-edge.data-change-hue: for a part of a changed item drawn in a change's hue, such as a value's old and new text, an inserted word, a matrix cell or a tag. It sets the same variables but isn't a changed item, so the item around it keeps its own mark under the nesting rule.Migration
data-change-huewhere a part had only a class.checks.spec,nested-accents.spec, and the api and DI browser specs on chromium-desktop, webkit-desktop and chromium-mobile;data-change-hue);check --fast,docs:checkandoxfmt --check.Follow-up, not in this PR
The SDK's renderer style lint (
sdk/src/style-lint.ts) could apply the same rule to third-party renderers that use the kit. That needs kit-usage detection across a bundle's modules and an inline allowance syntax, so it is left for a separate change.