Repository navigation
feat(design-system): scan the SLM frontend for bare hex and name the replacement in every failure (#17567) - #21167
Conversation
…replacement in every failure (#17567)
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 55 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Code review (code-reviewer pass) follow-up at 30d36a7Verdict: CHANGES (AC A is sound; AC B "every failure message" is not yet met on the real-tree guards, plus two small notes). AC A, SLM scan. The scan reaches SLM files.
Main frontend population. Unchanged.
Reach policy. 600-line limit.
|
|
Code review (code-reviewer pass) follow-up at c154353
Verification: the ratchet, reach-declarations and python-filter tests ran in a scratch git repo: 1366 passed, 1 skipped. flake8, black and ruff are clean, and the file-size guard exited 0. No CodeRabbit threads were open. |
|
Code review (code-reviewer pass) at c154353 Delta from the earlier CHANGES verdict (30d36a7) is fix commit ecb4486 plus one main merge. Head confirmed as c154353.
CodeRabbit threads: 0 total (review-limit notice only); nothing to answer. |
✅ SSOT Configuration Compliance: Passing🎉 No new hardcoded values of either class — Known backlog in |
Thinking Path
#17567 requires every design-system check to run over both frontends and every failure to name its replacement and link the issue.
!importantalready sweeps both apps (_scan_important_all); the bare-colour check readautobot-frontend/srconly. This PR extends that check through the same file filter, gives the control plane its own baseline, and rewrites the failure messages. Every assert against the real tree fails through one helper (_why) with the replacement and the issue link; the detector self-tests on a synthetic tree are controls and stay bare, because they test the detector, not a rule. The other open ACs (starting-number reconciliation, stylelint whole-tree switch) are untouched.What Changed
repo_tests/_hardcoded_colour_detect.py: the file filter is one helper (_colour_candidates) used by_scanand by_colour_scanned_files; the reach population now covers both apps (SLM keys carryslm:, as the!importantsweep's do). New_scan_slmruns the same_scanoverautobot-slm-frontend/src. No parallel scanner.repo_tests/_hardcoded_colour_baseline.py:SLM_HARDCODED_COLOUR_LITERALS, its own table, frozen at{}.repo_tests/hardcoded_colour_ratchet_17560_test.py:TestTheControlPlaneColourSweep(control fixture, style-block exclusion, reach naming both apps, base ratchet, equality with the baseline); every failure message now names the replacement (var(--color-error)/getCssVar('--color-error', '#ef4444'),var(--text-on-primary), or specificity / kit primitive props for!important) and links Design-system enforcement: guard !important in component <style>, and switch the CSS gate from changed-files to whole-tree #17567.repo_tests/_reach_policy_verdicts.py: the reach note forhardcoded-colour-scannow says both frontends.Verification
Finding (not rebased): the issue table says 19 in 4 files for the SLM; the detector measures 0 script/template colour literals there.
Cross-check on a different question: every hex-shaped token outside
<style>inautobot-slm-frontend/src(no context-keyword filter,.vue/.ts/.js) is 1, an issue-style colour mention inside an HTML comment (WebResearchSettings.vue). The other hex lines in those files sit inside<style>blocks, whichcolor-no-hexowns; the 19-in-4 in the table plausibly counted those (not verified). 207 SLM source files are in the scanned population.Control:
test_the_detector_finds_a_literal_in_the_control_planewritescolor: '#ef4444'into an SLM<script>and expects{"#ef4444": 1};test_a_style_block_hex_is_left_to_stylelintexpects{}.Tests, in a scratch copy of the tree:
hardcoded_colour_ratchet_17560_test.py,reach_declarations_test.py,python_filter_covers_its_guards_test.py.Single-issue rationale: the remaining #17567 ACs (starting-number reconciliation, stylelint whole-tree switch) are gated on other work and cannot ride with these two.
Refs #17567 (other ACs remain open).
Model Used
Claude Sonnet 5.5