Repository navigation
test(control-ui): guard the hand-mirrored theme --bg copies - #130444
Conversation
Each theme's --bg is copied by hand into two places outside base.css, because both have to paint before the app stylesheet is parsed: index.html's pre-paint block, which fills the page during first paint, and the Appearance preview chips, which are deliberately theme-invariant and so cannot read the live token. Nothing tied those copies to the palette. Darkening Absolutely moved --bg and left both behind; only a pre-paint assertion that happened to hardcode the old value caught one of them. It is the same shape as the two defects review found in the theme work — a hand-maintained list extended for new themes but not exhaustively — and the third time is enough. Derives the expected values from base.css and asserts both mirrors for every palette (12 themed pre-paint rules plus the default), so a palette edit cannot leave either copy stale. Verified by mutating each mirror: tide: pre-paint #123456 != --bg #10151b beacon: chip #abcdef != --bg #000000 Test-only; no production change.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 26, 2026, 6:08 PM ET / 22:08 UTC. ClawSweeper reviewWhat this changesThe PR adds a Control UI test that derives theme backgrounds from the canonical stylesheet and checks first-paint and Appearance preview copies for drift. Merge readinessKeep open: the new preview-chip guard is non-exhaustive, so it can pass after most theme swatches disappear. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherControl UI resolves a selected theme into CSS tokens before rendering. The startup page paints a matching background early, while Appearance cards show fixed previews of every built-in theme. flowchart LR
A[Saved theme choice] --> B[Theme resolution]
B --> C[Canonical theme tokens]
C --> D[First-paint page background]
C --> E[Appearance preview chips]
F[Theme mirror test] --> C
F --> D
F --> E
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceTests +127. Total +127 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Compare the observed resolved preview-chip variants with the complete canonical background set, then retain the existing value-equality checks. Do we have a high-confidence way to reproduce the issue? Yes, by source inspection: remove all but one literal preview-chip background and the new assertion still passes because it only requires Is this the best way to solve the issue? No. The value comparisons are sound for matched rules, but the test must also prove that every built-in dark and light preview rule was observed. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 730b6ef8faf3. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* origin/main: (275 commits) fix(ai): require explicit compatible-provider endpoints (#130453) test(control-ui): guard the hand-mirrored theme --bg copies (#130444) fix(onboard): preserve the saved skills package manager (#130438) improve(worker): diagnose admission-deadline failures and widen daemon revalidation budget (#130435) fix(plugins): align diffs external install metadata (#130362) refactor(models): consolidate config normalization (#130439) fix(browser): accept common keyboard aliases (#130401) fix(release): refresh IMAP plugin baselines (#130351) fix(tests): type sticky model agent fixtures (#130441) fix(qa): track current Slack progress cards (#130354) feat(ui): refine the mobile composer (#130308) fix(ui): clarify gateway disconnect status in tab title (#130364) test(qa): await gateway startup before network probes (#130353) fix(qa): run Buzz profile scenarios with pooled credentials (#130316) fix(crabbox): keep the setup failure reason and name its phase (#130425) fix: dashboard tools target the wrong Gateway after admission (#130112) fix(ui): distinguish inherited model defaults from session pins (#120805) feat(feishu): let agents resend received stickers (#130374) refactor(models): prepare selection policy once (#130413) fix(ui): make dashboard side panels enter split view (#130426) ... # Conflicts: # test/scripts/docker-build-helper.test.ts
…#130444) Each theme's --bg is copied by hand into two places outside base.css, because both have to paint before the app stylesheet is parsed: index.html's pre-paint block, which fills the page during first paint, and the Appearance preview chips, which are deliberately theme-invariant and so cannot read the live token. Nothing tied those copies to the palette. Darkening Absolutely moved --bg and left both behind; only a pre-paint assertion that happened to hardcode the old value caught one of them. It is the same shape as the two defects review found in the theme work — a hand-maintained list extended for new themes but not exhaustively — and the third time is enough. Derives the expected values from base.css and asserts both mirrors for every palette (12 themed pre-paint rules plus the default), so a palette edit cannot leave either copy stale. Verified by mutating each mirror: tide: pre-paint openclaw#123456 != --bg #10151b beacon: chip #abcdef != --bg #000000 Test-only; no production change.
What Problem This Solves
Each theme's
--bgis copied by hand into two places outsidebase.css, because both have to paint before the app stylesheet is parsed:index.html's pre-paint block, which fills the page during first paint so a persisted theme does not flash the default paletteconfig.css, which are deliberately theme-invariant (they must show other themes' colours while you are looking at the current one) and so cannot read the live tokenNothing tied those copies to the palette they mirror. Darkening Absolutely in #130239 moved
--bgand left both copies behind; only a pre-paint assertion that happened to hardcode the old value caught one of them, and the chip was fixed by hand after noticing.That is the same shape as both defects review found in the theme work — a hand-maintained list extended for new themes but not exhaustively (base-path font URLs in #129885, the dark-theme confirm-button selector list in #130232). Third time is enough to automate.
Why This Change Was Made
Derives the expected values from
base.cssrather than restating them, and asserts both mirrors for every palette. Coverage is checked rather than assumed: the tests count what they compared and fail if the set shrinks, so deleting a pre-paint rule cannot turn the assertion into a vacuous pass.Current coverage is all 13 palettes — 12 themed pre-paint rules plus the bare
html {}default — and every non-var()preview chip. Thecustomchip is intentionally skipped: it reads live variables, so there is nothing to drift.User Impact
None directly; this is test-only, with no production change. It prevents a class of silent visual bug where a theme flashes the wrong colour on first paint, or the picker advertises a swatch the theme no longer uses — both of which look like "a bit off" rather than broken, and so ship unnoticed.
Evidence
The guard fails when either mirror drifts. Verified by mutating each one independently:
Coverage inventory at this commit:
index.htmlpre-paint rules--theme-chip-bgTests and checks.
ui/src/styles(43 passed),pnpm format:checkclean, oxlint exit 0 on the changed file. Autoreview clean.