Skip to content

refactor(ui): split runtime config into layered modules - #122117

Merged
steipete merged 3 commits into
mainfrom
steipete/ui-config-split-0811
Aug 11, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/ui-config-split-0811

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Control UI runtime-config owner and its tests had grown into 2,374-line and 3,629-line files, respectively. That made state, draft hydration, Gateway effects, write coordination, and public capability composition difficult to review independently, while both files required grandfathered max-lines suppressions.

Why This Change Was Made

This splits runtime config into five direct-import layers with no replacement barrel: state model, draft model, Gateway operations, write coordinator, and public runtime capability. Snapshot adoption plus draft/original hydration stays wholly in the draft model; debounce, flights, explicit FIFO ordering, suspension, reconnect reconciliation, and teardown flushing stay together in the write coordinator. All internal consumers now import their owning module directly, and the tests are split along the same behavior boundaries with a shared Gateway fixture harness.

The JSON5 lazy boundary is unchanged: draft code statically imports parseJson5Text and warmJson5 from json5-runtime.ts; it never imports json5 directly. Hashless acknowledgements, snapshot fallback, and reconnect reconciliation remain intact.

User Impact

There is no intended user-visible behavior change. Developers get smaller, ownership-focused modules and test files, with the two stale max-lines baseline entries removed. Startup chunk composition remains within the existing Control UI budget.

Evidence

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.ui.config.ts ui/src/lib/config/*.test.ts: 5 files passed, 115 tests passed.
  • pnpm build: passed on the exact head.
  • node --import tsx scripts/check-control-ui-performance.mts: 13 startup JS requests; 325,824 B gzip versus the 327,680 B ceiling (318.2 KiB versus 320.0 KiB).
  • pnpm lint: passed. The final local run used the documented worktree-local heavy-check lock because another worktree held the shared lock.
  • node scripts/check-changed.mjs: passed locally after Crabbox reported no ready remote provider; UI/core typechecks, lint lanes, dead-export checks, formatting, and selected guards passed.
  • pnpm check:import-cycles: 0 runtime value cycles.
  • pnpm check:max-lines-ratchet: passed with 958 remaining grandfathered suppressions.
  • pnpm lint:tmp:dynamic-import-warts: exited successfully; 114 repository advisories remain, none in the new config modules.
  • pnpm lint:tmp:export-name-collisions, pnpm check:wrapper-shadowing, and pnpm plugin-sdk:surface:check: passed.
  • Structured autoreview: clean, no accepted/actionable findings.
  • Raw git diff --numstat origin/main...HEAD: production +2603/-2400 (net +203), tests/support +3857/-3639 (net +218), tooling +0/-2 (net -2). Production growth is module-boundary imports and typed contracts for the split, not capability growth; all five production files pass the max-lines limit.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 11, 2026 15:47
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XL maintainer Maintainer-authored PR labels Aug 11, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Aug 11, 2026
@clawsweeper

clawsweeper Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 12:59 PM ET / 16:59 UTC.

ClawSweeper review

What this changes

The PR separates the Control UI runtime-configuration capability into state, draft, Gateway-operation, write-coordination, and public-capability modules, then updates direct consumers and tests.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No blocking correctness findings in the runtime-config split. This maintainer-labeled PR should remain open for exact-head CI and maintainer review; likely related people: Vincent Koc (current-main implementation history).

Priority: P3
Reviewed head: 293874d376563d188c1179fa74eb8e8af9f4836d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The extracted owners preserve the reviewed configuration lifecycle and have focused test coverage; pending exact-head CI remains the merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, behavior-neutral refactor has focused validation evidence in its PR body; no separate contributor real-behavior proof gate applies.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored, behavior-neutral refactor has focused validation evidence in its PR body; no separate contributor real-behavior proof gate applies.
Evidence reviewed 5 items Public owner and entry point: The public capability remains the single composition point: it creates the state, injects the Gateway/write collaborators, exposes the existing capability methods, and disposes coordinator state.
Write and reconnect invariant: The extracted coordinator retains the explicit-operation FIFO, connection-epoch invalidation, interrupted-write reconciliation, and Gateway subscription previously owned by the monolith.
Gateway conflict contract: Gateway writes reject a stale base hash with the message the extracted UI operation code recognizes, preserving the reload-on-conflict behavior.
Findings None None.
Security None None.

How this fits together

Control UI settings read and write OpenClaw configuration through the Gateway. Pages and components consume the public runtime-config capability, which coordinates draft state, ordered writes, and Gateway refreshes.

flowchart LR
  A[Control UI pages] --> B[Runtime config capability]
  B --> C[State and draft models]
  B --> D[Write coordinator]
  D --> E[Gateway operations]
  E --> F[Gateway config API]
  C --> G[Rendered settings state]
Loading

Before merge

  • Resolve merge risk (P1) - Exact-head CI is still running, so merge should wait for the required checks to complete successfully.
Agent review details

Security

None.

PR surface

Source +340, Tests +81, Other -2. Total +419 across 47 files.

View PR surface stats
Area Files Added Removed Net
Source 31 2741 2401 +340
Tests 15 3719 3638 +81
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 2 -2
Total 47 6460 6041 +419

Review metrics

Metric Value Why it matters
Production vs test LOC production +2,603/-2,400 (net +203); tests/support +3,857/-3,639 (net +218); tooling -2 The positive production delta is attributable to the module split and explicit ownership contracts rather than a new user capability.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain one public runtime-config capability while keeping draft ownership, Gateway requests, and ordered writes in their extracted modules.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain one public runtime-config capability while keeping draft ownership, Gateway requests, and ordered writes in their extracted modules.

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

Not applicable: this PR reorganizes an existing client-side capability rather than reporting a new user-visible failure.

Is this the best way to solve the issue?

Yes: keeping one public capability while separating state, draft, Gateway, and write-lifecycle owners is a cleaner boundary than retaining the oversized monolith or adding a replacement barrel.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 82ba647673f9.

Labels

Label justifications:

  • P3: This is a behavior-neutral Control UI refactor with low user-impact urgency.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, behavior-neutral refactor has focused validation evidence in its PR body; no separate contributor real-behavior proof gate applies.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Current-main blame for the pre-split runtime-config module attributes the established config behavior to this commit; deeper history was unavailable from the partial clone. (role: current implementation contributor; confidence: medium; commits: b30e0dc4c640; files: ui/src/lib/config/index.ts, src/gateway/server-methods/config.ts)

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 (1 earlier review cycle)
  • reviewed 2026-08-11T15:54:06.083Z sha b237e7d :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the steipete/ui-config-split-0811 branch from b237e7d to 293874d Compare August 11, 2026 16:52
@steipete
steipete merged commit 5c81ed5 into main Aug 11, 2026
96 checks passed
@steipete
steipete deleted the steipete/ui-config-split-0811 branch August 11, 2026 17:17
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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: XL 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