Skip to content

test: check shipped Earth/Loam CSS contrast in CI - #149

Merged
tuckcode merged 4 commits into
mainfrom
cursor/theme-contrast-check-27f5
Oct 11, 2026
Merged

tuckcode merged 4 commits into
mainfrom
cursor/theme-contrast-check-27f5

Conversation

@tuckcode

@tuckcode tuckcode commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

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)

What landed earlier

  • Real checker: scripts/contrast_check.py. Default reads src/index.css + src/themes.css.
  • docs/design/earth-theme/contrast_check.py is a pointer; design-file mode still works.
  • Blocking CI step in frontend-static-quality.
  • WCAG AA: text 4.5:1, borders/focus/icons 3:1.

QA

  • python3 scripts/contrast_check.py on current main CSS — exit 0, failing pairs none
  • npx vitest run src/lib/earthThemeTokens.test.ts — 16 passed (includes unparseable fail)
  • pnpm handoff:check — pass
  • bash .husky/pre-push — all lanes OK in 7m 48s; hook on push OK in 7m 57s

Completion

  • Localization: none — English only (C18)
  • PostHog: no event needed because this is a checker, not a user action
  • ADRs: none
  • Demo vault dirt checked: empty

Ready for review. Do not merge from this agent. knispo merges.

Open in Web Open in Cursor 

@repowise-bot

repowise-bot Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

🔍 1 thing to check

  1. This PR introduces 8 new findings (1 critical) across 1 file: 3× complex method, 2× nested complexity, 1× bumpy road (+2 more kinds). The worst are marked on the diff (see all)

⚠️ 1 new critical finding · Health of changed files: 9.7 → 8.2 (-1.5)

Check Result
Coverage Not set up · add one CI step
Tests 0 of 2 changed code files reached by a test · 1 reached by no test · 1 with no test signal
Security No new findings on changed lines
Doc drift No drift in docs this PR edits · 10 documents name changed files
Security

Scanned the changed lines at fa67ac2. 2 findings below med severity hidden (settings).

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
  • .github/SETUP.md names .github/workflows/ci.yml and is not in this PR
  • docs/HANDOFF.md names package.json and is not in this PR
  • docs/NEXT.md names package.json and is not in this PR
  • +7 more on the PR page

📊 See the full report for this PR
Blast radius, every caller of the contracts it changes, and health before and after. No sign-in.
Plain markdown for agents

Settings and updates

Updated 2026-10-11 08:34 UTC, since the last push: health 8.3 to 8.2, 1 new finding
Silence one PR with [skip repowise] in the title · Bot settings
⭐ Star Repowise · 📥 Install on another repo

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics -29 complexity · -2 duplication

Metric Results
Complexity -29
Duplication -2

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread scripts/contrast_check.py
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-'):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

cursoragent and others added 4 commits October 11, 2026 08:18
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>
Fetched that commit's CSS into a temp dir. 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>
@cursor
cursor Bot force-pushed the cursor/theme-contrast-check-27f5 branch from 7f5188b to fa67ac2 Compare October 11, 2026 08:34
@tuckcode
tuckcode merged commit 27fab77 into main Oct 11, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants