Skip to content

refactor(ui): share segmented control rendering - #140699

Merged
steipete merged 2 commits into
mainfrom
steipete/dedup-ui-0906-segmented
Sep 7, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/dedup-ui-0906-segmented

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer decision

Landed by maintainer decision: one owner for segmented controls outweighs the +53 production lines.

This refactor preserves the existing interactions by adding an explicit buttons mode to renderSettingsSegmented. Existing Settings callers keep Web Awesome radios; Usage, Config, Activity, and the multi-option Chat context selector keep native buttons. Radio callbacks retain their element argument, while native callbacks retain their value-only contract.

The maintainer accepts this additional component mode and one CSS owner despite +53 production lines (+329/-276). Preserving the distinct focus, disabled, transition, and visual contracts did not produce the survey's anticipated line reduction. Standardizing the interactions is outside this proposal. No user configuration option is added. The maintainer has authorized landing after validation.

What Problem This Solves

Exclusive-value selectors repeat page-local rendering and styling across Usage, Config, Activity, and Chat, despite an existing shared Settings control. This maintainer-requested proposal centralizes their owner while retaining current behavior.

Why This Change Was Made

The shared renderer handles per-option disabling, current-value activation, compact labels, and event containment. settings-controls.css owns the neutral, accent, primary, and compact treatments; the corresponding page-specific chrome is removed. The Usage Reset button remains an ordinary action, and Chat's binary context switch remains unchanged.

User Impact

No intended appearance, keyboard, selection, callback, or focus change. No public SDK export, wire format, persisted data, dependency, or user configuration change.

Evidence

Closeout validation on the rebased candidate:

  • Preserves current main's radio callback rejection contract (false restores the prior value).
  • The requested focused command selected all three UI lanes: 15,896 cases passed (15,379 shared, 69 isolated, 448 browser).
  • All four requested mocked Gateway Chromium suites pass: 31 cases, including two new light/dark Usage regressions.
  • Verified and repaired the review finding: light-theme generic button backgrounds overrode selected Usage fills. The new regression fails before the repair with rgb(250, 249, 247) instead of the expected accent fill, and passes after it. Cost and Tokens remain selected at rest and on hover in both themes. The fix adds five production lines; final production delta is +58.
  • Full pnpm build passed in 9m 36.6s. Final pnpm ui:check-performance passed: startup JavaScript 350757 B gzip in 8 requests, below the unchanged 350953 B enforcement limit (350377 B baseline plus its existing allowances); startup CSS 44972 B gzip. No baseline was edited.
  • Both pinned local and committed-branch Codex autoreviews are scoped-clean through P2, with zero accepted/actionable findings.
  • node scripts/check-changed.mjs passed, including typechecks, all three dead-export scans, and lint. Exact-head hosted CI is green for f27f00bf04e0a83c0b68f7b44cebcedbd1d17b3b. Native review, OPENCLAW_TESTBOX=1 prepare, and merge completed. Landed as 517e9935ff9f3c978ae1b3aafc4bf24f01196ec2, verified as an ancestor of freshly fetched origin/main. The first merge request received HTTP 405 because main moved; one investigated native recovery merged the same prepared head. No CI rerun, admin bypass, or baseline change was used.

Original proposal evidence follows; the new light-theme proof supplements the earlier captures:

  • Final focused proof: 318/318 cases pass (252 unit and 66 browser) with node scripts/run-vitest.mjs ui/src/pages/chat/components/chat-context-window-control.test.ts ui/src/pages/config/view.browser.test.ts ui/src/pages/usage ui/src/pages/activity.
  • Mocked Gateway Chromium: 29/29 cases pass using node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner on config-controls-visual, usage-cost-analysis, activity-session-refresh, and chat-flow.models-reasoning E2E files, including the existing forced-colors proof.
  • The new three-option context test passes on the original implementation and this proposal; it protects current/disabled selection and click containment. One Config class-name assertion was removed while retaining its pressed-state, disabled-state, tooltip, and behavior assertions.
  • UI typecheck, pnpm ui:build, and pnpm ui:check-performance pass. Startup JS is 346199 B gzip in 8 requests, below the untouched 350377 B baseline. Startup CSS is 44279 B gzip.
  • Codex autoreview is scoped-clean through P2, with zero accepted/actionable findings. git diff --check passes.
  • node scripts/check-changed.mjs passes, including both typecheck lanes, dead-export scans, and style checks. This original local proof predates closeout; completed full-build and native hosted-gate validation is recorded above.

An initial focused run reported three Activity session-snapshot teardown errors after its 252 assertions passed. Subsequent complete runs had no teardown errors; no loader, timeout, or mock relaxation was made. An existing Config browser assertion also caught callback arity during implementation; the native callback contract was corrected instead of weakening the assertion.

Visual proof covers 16 surfaces and 37 options/actions: zero differences across 5500 computed-style values, 500 geometry values, 375 pseudo-element values, and 1298 semantic/state values. Ten of fourteen screenshot pairs are pixel-identical; the other four contain 46 differing edge pixels total (maximum channel delta 5), without a measured style or geometry difference. The comparison records those differences rather than masking them.

All 28 full captures were inspected and contain only synthetic fixtures (Synthetic Viewer, fabricated usage/config data, and public GPT-5.5). The browser and Gateway are isolated mocks. The screenshot comparisons cover normal colors; forced colors additionally use the existing E2E test and source review.

Surface Before After
Settings radio group Settings radio group before Settings radio group after
Config Form, dark Config Form, dark before Config Form, dark after
Config Raw, dark Config Raw, dark before Config Raw, dark after
Config with disabled Form Config with disabled Form before Config with disabled Form after
Config Form, light Config Form, light before Config Form, light after
Config Raw, light Config Raw, light before Config Raw, light after
Activity desktop Activity desktop before Activity desktop after
Activity mobile labels Activity mobile labels before Activity mobile labels after
Usage scope and metric Usage scope and metric before Usage scope and metric after
Usage daily breakdown Usage daily breakdown before Usage daily breakdown after
Usage session selection Usage session selection before Usage session selection after
Usage detail controls Usage detail controls before Usage detail controls after
Usage Reset action Usage Reset action before Usage Reset action after
Chat context options Chat context options before Chat context options after

Light-theme selected Usage regression proof

Fresh captures use an isolated mocked Gateway, empty synthetic Usage data, and no real account or session data. All nine new captures were inspected. The first image shows the defect before repair; the following images show the restored Cost selection at rest and on hover.

Before repair: selected Cost loses its accent fill in light mode

After repair: selected Cost retains its accent fill in light mode

After repair: selected Cost retains its accent fill on hover

@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Sep 7, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 2:25 PM ET / 18:25 UTC.

ClawSweeper review

What this changes

Shares segmented selector rendering and styling across Settings, Usage, Config, Activity, and Chat while preserving their existing button and radio interactions.

Merge readiness

✅ Ready for maintainer review

The prior selected-background finding is resolved, and no additional blocking defect was found. This maintainer-requested consolidation remains distinct from current main and is ready for the normal landing gates.

Priority: P3
Reviewed head: f27f00bf04e0a83c0b68f7b44cebcedbd1d17b3b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, supported refactor with the prior blocker repaired and no new actionable finding.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. It nevertheless supplies mocked-Gateway browser measurements and before/after captures for the shared selectors, including restored Usage accents; attachment access failed here, so visual inspection was not independently repeated.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. It nevertheless supplies mocked-Gateway browser measurements and before/after captures for the shared selectors, including restored Usage accents; attachment access failed here, so visual inspection was not independently repeated.
Evidence reviewed 7 items Introduced change and current-main necessity: Read the complete merge-base-to-head diff. Current main retains the original shared radio renderer and separate Usage controls; the inspected central paths have no base-branch changes since the pinned merge base. The host-verified test merge contains only the introduced UI changes.
Previous finding resolved: The explicit light-theme active selector now matches migrated Usage buttons and overrides generic button backgrounds, including hover. The added browser case checks Cost and Tokens at rest and on hover in both themes. The supplied body reports that this regression failed before repair and passed afterward.
Interaction contracts preserved: Native controls retain value-only callbacks, same-value activation where previously supported, option disabling, and Chat click containment. Existing radio callbacks retain their element argument and false-result rollback. Config retains its Raw availability and pending-draft gates.
Findings None None.
Security None None.

How this fits together

Control UI selectors receive page options, selected values, and callbacks. The shared renderer displays those choices and forwards user selections to the existing page handlers.

flowchart LR
  A[Page options and selected value] --> B[Shared selector renderer]
  B --> C{Control mode}
  C --> D[Settings radios]
  C --> E[Native buttons]
  F[Shared visual styles] --> D
  F --> E
  D --> G[Existing page callbacks]
  E --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +58, Tests +137. Total +195 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 12 334 276 +58
Tests 4 139 2 +137
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 473 278 +195

Review metrics

Metric Value Why it matters
Production versus test growth Production net +58; tests and test support net +137 The PR explicitly justifies production growth as the cost of centralizing ownership while preserving distinct interaction contracts.

Technical review

Best possible solution:

Keep one selector rendering and styling owner while retaining the established radio, native-button, disabled, and focus contracts.

Do we have a high-confidence way to reproduce the issue?

Not applicable to the refactor itself. The earlier light-theme defect has a focused browser regression and a source-level repair; this review did not execute it.

Is this the best way to solve the issue?

Yes. Extending the existing shared renderer removes competing page implementations while preserving their distinct contracts, and the maintainer has accepted the documented size tradeoff.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against fae6778b125c.

Labels

Label justifications:

  • P3: This is a bounded UI consolidation with no intended user-facing behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. It nevertheless supplies mocked-Gateway browser measurements and before/after captures for the shared selectors, including restored Usage accents; attachment access failed here, so visual inspection was not independently repeated.

Evidence

What I checked:

  • Introduced change and current-main necessity: Read the complete merge-base-to-head diff. Current main retains the original shared radio renderer and separate Usage controls; the inspected central paths have no base-branch changes since the pinned merge base. The host-verified test merge contains only the introduced UI changes. (ui/src/components/settings-ui.ts:311, fae6778b125c)
  • Previous finding resolved: The explicit light-theme active selector now matches migrated Usage buttons and overrides generic button backgrounds, including hover. The added browser case checks Cost and Tokens at rest and on hover in both themes. The supplied body reports that this regression failed before repair and passed afterward. (ui/src/styles/settings-controls.css:137, f27f00bf04e0)
  • Interaction contracts preserved: Native controls retain value-only callbacks, same-value activation where previously supported, option disabling, and Chat click containment. Existing radio callbacks retain their element argument and false-result rollback. Config retains its Raw availability and pending-draft gates. (ui/src/components/settings-ui.ts:356, f27f00bf04e0)
  • Maintainer direction and supplied visual evidence: The captured PR body explicitly accepts a shared native-button mode and production growth while preserving existing interactions. It supplies before/after captures, computed-style comparisons, and fresh light-theme repair evidence: https://github.com/user-attachments/assets/8c4f0bc9-dd57-4741-9f94-4c4df69c5890 . Attachment retrieval failed during this review, so the images were not independently inspected. This is a reviewer access limitation, not absent contributor evidence. (f27f00bf04e0)
  • Related work is distinct: The supplied GitHub context verifies fix(ui): measure mobile picker geometry after animation #140997 as merged. It repairs animation readiness in a mobile picker geometry test and explicitly distinguishes this selector refactor; it does not supersede this work. (ui/src/e2e/chat-composer-redesign.e2e.test.ts, 6a78a20f995b)
  • Area history and routing: Current-main history records Peter Steinberger's recent rejected-enum-state repair and several Settings changes by Patrick Erichsen. Older source objects were unavailable for exact parent-line verification, so these are routing candidates rather than introduction attributions. (ui/src/components/settings-ui.ts, a3cab57127e0)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Patrick Erichsen: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-07T03:17:08.355Z sha 73540fb :: blocked before merge. :: [P2] Preserve selected Usage backgrounds in light mode
  • reviewed 2026-09-07T03:25:18.299Z sha 73540fb :: blocked before merge. :: [P2] Preserve selected Usage backgrounds in light mode
  • reviewed 2026-09-07T18:05:45.409Z sha 73540fb :: blocked before merge. :: [P2] Preserve selected Usage backgrounds in light mode

Preserve radio and native-button keyboard and callback contracts, per-option gates, same-value activation, and exact visual variants. Proposed buttons mode adds 53 production lines; keep as draft for maintainer decision.

Proof: node scripts/run-vitest.mjs ui/src/pages/chat/components/chat-context-window-control.test.ts ui/src/pages/config/view.browser.test.ts ui/src/pages/usage ui/src/pages/activity (318 cases); 29 mocked E2E cases, exact computed-style parity, UI build/performance, and Codex autoreview pass.
Keep the shared segmented selection visible over generic light-theme button backgrounds at rest and on hover. Preserve the existing light-theme border color.

Proof: 31 mocked Gateway e2e cases pass, including a light-theme regression that failed before the repair. Codex autoreview is clean through P2.
@steipete
steipete force-pushed the steipete/dedup-ui-0906-segmented branch from 73540fb to f27f00b Compare September 7, 2026 18:11
@steipete
steipete marked this pull request as ready for review September 7, 2026 18:11
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 7, 2026
@steipete
steipete merged commit 517e993 into main Sep 7, 2026
182 of 184 checks passed
@steipete
steipete deleted the steipete/dedup-ui-0906-segmented branch September 7, 2026 18:29
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
* refactor(ui): share segmented control rendering

Preserve radio and native-button keyboard and callback contracts, per-option gates, same-value activation, and exact visual variants. Proposed buttons mode adds 53 production lines; keep as draft for maintainer decision.

Proof: node scripts/run-vitest.mjs ui/src/pages/chat/components/chat-context-window-control.test.ts ui/src/pages/config/view.browser.test.ts ui/src/pages/usage ui/src/pages/activity (318 cases); 29 mocked E2E cases, exact computed-style parity, UI build/performance, and Codex autoreview pass.

* fix(ui): preserve selected usage accents in light mode

Keep the shared segmented selection visible over generic light-theme button backgrounds at rest and on hover. Preserve the existing light-theme border color.

Proof: 31 mocked Gateway e2e cases pass, including a light-theme regression that failed before the repair. Codex autoreview is clean through P2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant