Files
meshcore-analyzer/.github/workflows
Kpa-clawbot 9b8b613832 fix(#1705): WCAG AA contrast on .subpath-selected .hop-prefix (#1712)
## Summary

**Regression guard for an already-fixed bug.** The WCAG AA contrast
BLOCKER on `.subpath-selected .hop-prefix` called out in #1705 was
already resolved by PR #1708 (commit `293efdb6`), which is an ancestor
of this branch's base. This PR adds the missing automated test that
locks the fix in — it does **not** ship a CSS change.

### Why this is not a TDD red→green sequence

Test commit `0d58d1d5` is **green-on-arrival**: the fix it asserts
against had already landed days earlier on master. There is no red
commit on this branch — running the test at any point on this branch
passes. This PR therefore claims the **net-new-test exemption** per
`~/.openclaw/workspace-meshcore/AGENTS.md`: bug fixes on EXISTING UI
normally require red→green, but where the fix shipped first and the test
is a *post-hoc regression guard*, the test lands in the same PR series
but does not need to be the first commit. No production behavior is
changed by anything in this branch.

(The earlier revisions of this body presented a misleading red→green
table; that framing was wrong and has been removed.)

## What this PR actually ships

Two test files plus CI wiring — all test-only / config-only:

1. `test-issue-1705-subpath-contrast.js` — parses `public/style.css`,
extracts `--accent-strong` / `--text-on-accent` per theme,
sRGB-composites any `rgba()` foreground against the resolved background,
asserts WCAG AA ≥4.5:1 on `.subpath-selected .hop-prefix` in both
themes.
2. `test-issue-1705-subpath-contrast-e2e.js` —
Playwright/headless-Chromium variant that loads the real
`public/style.css` into a DOM mirroring `analytics.js`
`renderSubpathsTable`, then asserts `getComputedStyle` contrast on a
live `tr.subpath-selected > .hop-prefix`. Catches specificity/cascade
regressions the static parser cannot.
3. `.github/workflows/deploy.yml` PR test stage wiring — runs both tests
on every PR.

## The bug (historical, already fixed)

For context: `.subpath-selected .hop-prefix` measured ~1.87:1 in dark
theme (`rgba(255,255,255,0.6)` composited against `var(--accent)` =
`#4a9eff`). #1708 (`293efdb6`) swapped `.subpath-selected` background to
`var(--accent-strong)` (`#2563eb`) and color to `var(--text-on-accent)`
(`#f9fafb`), yielding **4.95:1** in both themes. The child `.hop-prefix`
color was set to `inherit` so the prefix cannot be decoratively muted
below AA again.

## Parser test — hardening (review r1)

Round-1 review pass surfaced 7 must-fix items on the parser test; all
addressed:

| # | Concern | Fix |
|---|---------|-----|
| MF3 | Parser asserted declared cascade, not computed style | Added the
Playwright E2E variant; `getComputedStyle` resolves specificity natively
|
| MF4 | CSS comment cited "4.83:1+" while measured value is 4.95:1 |
Comment updated to `#f9fafb on #2563eb = 4.95:1` |
| MF5 | `extractBlockTokens` silently returned `{}` when the regex
didn't match | Throws with selector label; defensive assertion verifies
`:root` declares the three tokens |
| MF6 | `'inherit'` on the child color fell back to `#ffffff` silently |
Now throws; callers either declare the parent color or use the
Playwright variant where `inherit` resolves natively |
| MF7 | `extractDecl` picked the last regex match across rules with no
specificity model | Now throws on N>1 distinct values; warns on N>1
identical values |

## E2E test — hardening (polish v2)

- M2: removed dead `<link rel="stylesheet" href="file://...">` element
from the test HTML template — `setContent` runs against `about:blank`
origin and cannot fetch `file://`, so the link was dead. CSS is injected
inline via `page.evaluate` (unchanged). Removed the now-unused `cssHref`
declaration.
- M3: fixed misleading class comment — the production table uses
`.analytics-table` (see `analytics.js` `renderSubpathsTable`), so the
fixture's `class="analytics-table subpaths-table"` was misleading.
Stripped `.subpaths-table` from the fixture and corrected the comment to
cite the real production class.

## Acceptance criteria

- [x] `.subpath-selected .hop-prefix` ≥4.5:1 in both themes — verified
by both tests (parser + E2E)
- [x] Regression test added covering the selected state, wired into PR
CI

Partial fix for #1705 — leaves the issue open for the audit-probe
alpha-compositing work (private tooling, out of scope here).

## Local test results

- `node test-issue-1705-subpath-contrast.js` (parser): **PASS** — `light
4.95:1 / dark 4.95:1`
- `node test-issue-1705-subpath-contrast-e2e.js` (Playwright): **SKIP**
in dev sandbox (chromium relocation error — musl/arm
sandbox-in-sandbox); CI installs the Playwright-bundled binary via `npx
playwright install chromium` and runs with `CHROMIUM_REQUIRE=1`

---------

Co-authored-by: CoreScope Bot <bot@corescope.local>
Co-authored-by: Kpa-clawbot <bot@openclaw.local>
Co-authored-by: clawbot <clawbot@users.noreply.github.com>
2026-06-13 16:47:41 -07:00
..