Repository navigation
test: check shipped Earth/Loam CSS contrast in CI - #149
Conversation
|
🔍 1 thing to check
SecurityScanned the changed lines at Pattern matches from a fixed regex registry: a floor, not a scanner. A clean result means no pattern matched a changed line, not that the change is safe. Doc drift
📊 See the full report for this PR Settings and updatesUpdated 2026-10-11 08:34 UTC, since the last push: health 8.3 to 8.2, 1 new finding |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | -29 |
| Duplication | -2 |
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull Request Overview
The CI checker does not enforce the 3:1 input-border threshold for several surfaces it enumerates, so CI can pass despite an invalid border contrast pair. This should be fixed before merging. Codacy reports the changes as up to standards; no uncovered complex files were identified.
About this PR
- Add fixture-based tests covering deliberately failing pairs, non-zero exits, missing or unparseable tokens, and the custom design-file mode.
Test suggestions
- Default invocation loads both shipped CSS files and reports Earth dark, Earth light, and Loam.
- Design-file invocation through docs/design/earth-theme/contrast_check.py remains compatible.
- Text, hover, selected, border, and focus-ring contrast pairs are evaluated and reported.
- A deliberately failing contrast pair produces a FAIL line and a non-zero exit status.
- Missing or unparseable required theme tokens cause a clear failure rather than silently passing.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. A deliberately failing contrast pair produces a FAIL line and a non-zero exit status.
2. Missing or unparseable required theme tokens cause a clear failure rather than silently passing.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
| continue | ||
| ratio = cr(border, surf_rgb) | ||
| rows.append(f' {border_name} on {surf_name}: {ratio:.2f}') | ||
| if surf_name in (bg_name, '--surface-app', '--bg') or surf_name.startswith('--surface-') or surf_name.startswith('--state-'): |
There was a problem hiding this comment.
🟡 MEDIUM RISK
Apply the non-text threshold to every enumerated surface, or explicitly remove these surfaces from SURF_ROLES; do not print unchecked pairs as if they were enforced.
Point contrast_check.py at src/index.css and src/themes.css (the files Appearance loads) instead of only the design-token copy. Keep design-file mode behind the old path. Report each failing pair with theme, tokens, and ratio. No shipped failures on current main, so the frontend CI step is blocking. HANDOFF.md was 908 lines (gate 900). Removed nine stale September State origin lines so the commit could land. Session record is the new file under docs/plans/handoffs/. QA: python3 scripts/contrast_check.py (exit 0, no failing pairs); design-file pointer still exits 0; focused vitest earthThemeTokens. Tests/coverage: earthThemeTokens.test.ts (11 passed). Full coverage on pre-push. Codacy: checker and workflow only; no new Critical/High source surface. Localization: none — English only (C18). PostHog: no event needed because this is a checker, not a user action. Refactoring: moved the checker to scripts/ and left a pointer. ADRs: none. Docs: session handoff only. HANDOFF.md only trimmed for the 900-line gate. Demo vault dirt: none. Co-Authored-By: Cursor Grok 4.6 <noreply@example.com>
Fetched 842cc9a CSS into a temp dir and ran scripts/contrast_check.py against it. That branch was not modified. Failing pairs: none. Co-Authored-By: Cursor Grok 4.6 <noreply@example.com>
hsl(), oklch(), color-mix(), and unresolved var() were skipped. The checker now FAILs with theme, token, and raw value. A fixture test proves oklch() exits 1. Shipped Earth/Loam still parse and pass. QA: python3 scripts/contrast_check.py — exit 0, failing pairs none. npx vitest run src/lib/earthThemeTokens.test.ts — 16 passed. PostHog: no event needed because this is a checker, not a user action. Localization: none — English only (C18). ADRs: none. Docs: session handoff only; HANDOFF.md untouched after rebase onto main. Co-Authored-By: Cursor Grok 4.6 <noreply@x.ai>
7f5188b to
fa67ac2
Compare
Why
Shipped Earth/Loam contrast needs a gate on the CSS the app actually loads, not only the design token file.
Follow-up (this push)
hsl(),oklch(),color-mix(), unresolvedvar(), …) now FAIL with theme, token, and raw value. They are not skipped.earthThemeTokens.test.tsproves anoklch()fixture exits 1.main(includes Earth theme nits: leftover skins, Loam contrast, Earth dark default #147 and docs: stop PRs from conflicting in HANDOFF.md #150).docs/HANDOFF.mdis not in this PR. The session note lives only indocs/plans/handoffs/2026-10-11-0715-cursor-grok-4-6-theme-contrast-check.md.pnpm handoff:checkpasses (900 lines, per-PR pointer from docs: stop PRs from conflicting in HANDOFF.md #150).What landed earlier
scripts/contrast_check.py. Default readssrc/index.css+src/themes.css.docs/design/earth-theme/contrast_check.pyis a pointer; design-file mode still works.frontend-static-quality.QA
python3 scripts/contrast_check.pyon current main CSS — exit 0, failing pairs nonenpx vitest run src/lib/earthThemeTokens.test.ts— 16 passed (includes unparseable fail)pnpm handoff:check— passbash .husky/pre-push— all lanes OK in 7m 48s; hook on push OK in 7m 57sCompletion
Ready for review. Do not merge from this agent. knispo merges.