Ask the token assertions of :root, where the light theme lives - #454
Merged
Conversation
The licence-token check searched the whole emitted stylesheet, so a token declared only under .dark satisfied it — a class is not tree-shaken, so the search finds the dark value and reports the light one healthy. Demonstrated: move --color-license-verbatim into .dark and all 18 assertions passed while every verbatim chip lost its background in light mode. The palette check one screen above was already written about exactly this trap. Its :root extraction is now a named helper both go through.
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.
A defect in the assertion #453 added, found while writing the sibling instance's copy of it — that repo asks this question of
:rootand carries a comment explaining why, because it had already been caught by it once.What was wrong
licenseBadgeStyleGapswas handed the whole emitted stylesheet..darkis a class, and a class is not tree-shaken — so a token declared only under.darkis present in that string whether or not:rootever got one. The search finds the dark value and reports the light theme healthy.Demonstrated rather than reasoned about. Moving
--color-license-verbatimout of@themeand into.dark:declares no token that reaches no stylesheetalso passed, correctly — the token is no longer declared in@theme, so it is not a dead tokenverbatim OKchip on the site renders with no background in light mode, correct in darkThat is close to the least likely combination to be caught in review: the reviewer on a dark editor sees nothing wrong.
The fix
The palette check one screen above was already written about this exact trap — its comment names
--color-rail-onand--color-tag-bg-hoveras tokens it caught that way. It extracted:rootinline. That extraction is now a namedrootCss()helper, and both assertions go through it.Re-running the same simulation against the fix fails it, naming the token:
Verification
303 tests across 21 files,
astro check0 errors. No source or stylesheet change — this is the test file only.