The how-to-read class scan reads whole classes and skips comments - #677
Merged
Merged
Conversation
The info test that holds the Map hook's drawn classes to the
how-to-read paragraph matched an interpolation only right after the
sb-map__ prefix, so a class built as a stem plus an interpolated
modifier (sb-map__edge--${kind}) passed on its stem alone. It also read
classes out of the hook's comments, so a comment could fail the gate.
The scan now lives in one helper, hook_classes/1. It cuts line and
block comments, reads each class whole with every ${...} in it read as
${} wherever it stands, and ends a name at an interpolation that only
appends other classes (its strings empty or opening with a space). The
hook's stem classes (end--, mark--, slot--) are listed with the graph
key their value comes from, and a new test holds every value the
library documents give under each key to the variants table. A second
new test pins the comment skip on a small source.
Sabotaged: a stem-interpolated class, an unnamed class and an unlisted
interpolated class added to hook templates, a renamed await mark, the
comment cut removed, and every interpolation read as part of the name;
each turned a test red. Test-only; no lib change.
Gate: full mix quality green on this staged tree (3,953 of 3,953
tests, 95.3% coverage, dialyzer clean, ADR cites green).
Refs: sb-9wvq
johnnyt
force-pushed
the
sb-9wvq-how-to-read-class-scan
branch
from
September 30, 2026 11:10
8bd661b to
e280d67
Compare
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.
What
The info test "names every mark the hook draws" holds the classes
assets/js/statifier_blocks_map.jsdraws to the how-to-read paragraph. It had two gaps:sb-map__prefix. A class built as a stem plus an interpolated modifier (sb-map__edge--${edge.kind}) passed on its stem alone.The scan is now one test helper,
hook_classes/1://and/* */comments (a//after a:is kept, so the SVG namespace URL survives);${...}in it read as${}wherever it stands;${container ? " sb-map__block--container" : ""}) appends other classes rather than extending the name, so it ends the name and the classes inside it are read on their own.The hook's stem classes (
end--${},mark--${},slot--${}) are listed in a new@modifierstable with the graph key their value comes from. A new test, "names every value the hook puts after a stem", holds every value the library documents give under each key to the existing variants table. A second new test, "reads no class out of a comment", pins the comment skip on a small source. The caption table's key is now written in the normalized form,${}-caption.Test-only: no
lib/or hook change, no changelog fragment (changelog.d/README.mdexcludes tests).Sabotage
Each reverted from a copy, byte-equal, and recompiled before the next:
sb-map__edge--${edge.kind}added to the plain edge's templatesb-map__${edge.kind}-tagadded to the plain edge's templatemark/1inlib/statifier_blocks/map.exanswers "hourglass" for an awaithook_classes/1with its comment cuts removedhook_classes/1reading every interpolation as part of the nameThe first mutation run against the test as it stands on main left it green, which is the defect this fixes. Two existing sabotage notes that injected into a hook comment now read "template", the shape they were re-run in.
Gate
Full
mix qualitygreen on the committed tree: 3,953 of 3,953 tests, 95.3% coverage, dialyzer clean, ADR cites green.Review
In-turn review: re-read the diff against the bead. The acceptance asks the scan to catch an interpolation anywhere in a class name, each stem covered by the variants table, and to skip comments, each pinned by a sabotage; the table above maps each part to a red test. Every
sb-map__occurrence in the hook was read by hand against the helper's reading: the plain classes it returns are the ones the old scan returned, and the built set is the caption plus the three stems. A slot style that no library document draws (the drafts shelf'stray) is not exercised by the new values test; renaming it left the suite green, so the sabotage row uses the await's mark instead.Refs: sb-9wvq