Skip to content

refactor(ui): split oversized page responsibilities - #180868

Merged
steipete merged 3 commits into
mainfrom
solid2/w-design-2
Oct 22, 2026
Merged

steipete merged 3 commits into
mainfrom
solid2/w-design-2

Conversation

@steipete

@steipete steipete commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Agents, Settings, and Sessions page owners still combined unrelated responsibilities beyond the production max-lines budget. The baseline also retained three paths that had already moved or shrunk.

User Impact

No user-visible behavior changes. Routes, markup, styles, request timing, confirmation flows, and lazy boundaries stay the same.

Why This Change Was Made

Agents now delegates its selected-agent model-catalog receipt and suspension recovery to a dedicated owner. Settings delegates preference provenance, resets, and preference commands to one presenter over the existing canonical preference owners. Sessions keeps roster/route coordination while separate command and menu owners retain mutation settlement and menu lifetime respectively. The page still owns connection epochs and selected/deep-linked state; the extracted owners consume that authority.

Remove all four production ui/src entries from config/max-lines-baseline.txt. Config and Sessions also lose the suppressions in their current state modules. Test-file baseline entries remain out of scope.

Production module LOC before → after Direct imports before → after Direct importers before → after
Agents page state 773 → 708 33 → 31 9 → 9
Agent model catalog 0 → 84 0 → 5 0 → 1
Config page state 788 → 664 40 → 34 4 → 4
Config preferences 0 → 144 0 → 9 0 → 1
Sessions page state 1,339 → 721 48 → 31 3 → 3
Sessions commands 0 → 510 0 → 21 0 → 2
Sessions menu 0 → 262 0 → 19 0 → 1

Raw production LOC: 2,900 → 3,093 (+193). The growth is explicit host/state types, imports, and factory interfaces at the responsibility boundaries; the command algorithms and authority checks remain intact. Every resulting file is below the 700-line lint limit, which excludes blank lines and comments. The original production refactor changed no tests; the later CI fixture correction is described below.

Evidence

Acceptance rule: same-host builds with identical build identity; preserve startup and immediate /chat and /new raw bytes and request counts; gzip deltas must stay within the existing 64 B build variance. No new effects/listeners/queries/owner APIs.

Proof Result
Focused UI tests, pinned default Bun, --maxWorkers=1 44 passed across agents-model-catalog-recovery, sessions-page.command-outcomes, and config-page
pnpm tsgo:ui Passed on final source
Targeted type-aware oxlint and format Passed; fixed the two extracted callback lint collisions
pnpm check:control-ui-controllers Passed; touched scope retains only the existing Config route effect, zero new guarded calls
Max-lines ratchet All production entries resolved; remaining failure is chat-message.test.tsx, reproduced on base
pnpm ui:build base and head Both passed
Strict ui:check-performance --base-dist … Passed; no violations
Production Knip pnpm deadcode:knip passed; full export audit reports existing exports outside this change, none in the touched owners
Independent Codex review Final full-scope review clean at P0–P2; no actionable findings
Boot surface Base gzip Head gzip Delta Requests base → head
Startup JS 315,586 B 315,584 B −2 B 7 → 7
Startup CSS 41,124 B 41,124 B 0 B 1 → 1
Chat JS 1,441,876 B 1,441,846 B −30 B 26 → 26
New Session JS 1,017,460 B 1,017,481 B +21 B 21 → 21

All three JS surfaces have identical raw bytes. Comparison base: 0e89b35a8a6; Node 26.12.1, same installed Vite/Pako toolchain, fixed build identity. Renderers and CSS are unchanged, so there is no visual delta to capture.

Current CI attribution

Initial run 39829729498 passed every job except real-Gateway 2/2 and its aggregate gate. The sole failure waited for the Model Providers catalog-banner Retry button; the exact same case failed on that run’s main parent 071ce2302f9. Main’s #174904 had moved failed discovery feedback to provider rows while retaining header Refresh.

Reviewed refactor head 8670e09586c196bc37de99fa4dfc2d65aade5a84 integrates main, including #180742’s corrected recovery test. The eight-file refactor patch is byte-identical to the reviewed original patch (SHA-256 883bfb9bb366ceabab95a20853a02d363714817c4587eed1728ff779f6a79ff1); UI typecheck passes again. The 44 focused tests and paired local build measurements above apply to that unchanged patch. Current-head broad CI is required and will supply the final integrated proof.

Follow-up CI fixture repair

Replacement CI 39836334349 passes the prior catalog case. Its only failing test is Run Inspector with real browser pairing > pairs each Inspector page independently and retains identity across reload, during the initial agent.wait CLI call before any browser page opens.

The fixture requests a 30-second server wait but gives the CLI only its default 10-second transport deadline and 30-second outer process deadline. The test-only repair gives that wait 40-second transport / 50-second process limits, keeps every other call at its existing defaults, and includes JSON stdout in failed-exit diagnostics. The actual server wait and all Inspector assertions remain unchanged. This is a diagnosed fixture deadline mismatch; the old CI omitted the JSON error body, so its exact runtime error is not claimed proven.

Current head 8ca64bf79404d670c8000f405b04e39e2f856fd5 adds only the Inspector fixture correction above. Its targeted type/lint/format checks and independent P0–P2 review pass. Production LOC and boot measurements remain unchanged; the fixture grows by three lines. Fresh full CI is required for this exact head.

The unchanged Inspector test passed once on exact base df27c0c72d668515f397c2251914c1e9c0fc8f46 after rebuilding its private-QA runtime. This does not reproduce or waive the intermittent CI failure. The corrected fixture also passed once against that same rebuilt base runtime (fixture-only patch; 53.11 seconds including transforms). Exact-head full CI remains the merge gate.

Final exact-head CI

Full CI run 39839972853 passed on 8ca64bf79404d670c8000f405b04e39e2f856fd5, including every full UI, browser E2E, and real-Gateway shard. The confirmed-cancelled auto request will be completed through native replacement recovery using this successful same-head evidence, with an empty CI-to-prepared delta. No inherited-failure exception is needed.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T19:28:49.116341Z 8ca64bf New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete enabled auto-merge (squash) October 22, 2026 18:22
@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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR extracts model-catalog, preference, session-command, and session-menu responsibilities from oversized Control UI page modules.

Example: Reset an overridden appearance theme to the server default.

  • Before: The Settings page resolves provenance and delegates the reset directly.
  • After: The extracted preferences presenter performs the same delegation through the existing preference owners.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Source review supports a correct, useful extraction; supplied validation is primarily tests and build evidence, with broad CI still running.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; supplied evidence covers focused mounted-page tests and build comparisons, without claiming a post-extraction live browser demonstration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: No user-visible defect is claimed; oversized page modules combine distinct responsibilities.
Reason: The maintainer-authored direction removes production max-lines debt while retaining the existing rendering and domain contracts.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: the maintainer-approved extraction preserves existing ownership contracts, and review found no actionable correctness or security defect.

Priority: P3
Reviewed head: 8893fc7b2a9ad216bc1436c6371a85bb2fb8c95c

Before merge

None.

Findings

None.

Agent review details

How this fits together

Control UI page owners translate routes, Gateway snapshots, and user actions into view properties and operations on existing catalog, preference, and session capabilities.

flowchart TD
  A[Routes and user actions] --> B[Page coordination]
  B --> C[Catalog and preference presenters]
  B --> D[Session commands and menu]
  C --> E[Existing domain owners]
  D --> E
  E --> F[Gateway and preference storage]
Loading

Technical review

Best possible solution:

Retain the focused extraction with page-owned scope authority and existing domain owners, subject to the ordinary exact-head CI gates.

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

This PR addresses oversized modules rather than a reported runtime bug; source comparison confirms the responsibility extraction and suppression removal.

Is this the best way to solve the issue?

The extraction follows existing responsibility boundaries, retains synchronous state and scope ownership, and removes the replaced inline implementations without introducing competing storage or policy.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Agents model-catalog receipt and suspension recovery keeps the original intent (0631ad4: Reuse the shared catalog reader while retaining scoped publication, cancellation, and one pending recovery intent.)
  • Settings preference reads and commands keeps the original intent (719d29e: Consume canonical theme preferences instead of maintaining a mutable page copy.)
  • Session mutation outcomes and retirement keeps the original intent (641dbb3: Preserve original failures and distinguish successful, stale, and failed commands without changing domain admission.)
  • Max-lines suppression baseline keeps the original intent (f81f9d8: Maintain a shrink-only baseline of existing max-lines suppressions.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 719d29e adds ui/src/pages/config/config-page-state.ts:123 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 719d29ee592d; files: ui/src/pages/config/config-page-state.ts)

PR surface

Source +193, Other -4. Total +189 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 7 1087 894 +193
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 4 -4
Total 8 1087 898 +189

Review metrics

Metric Value Why it matters
Production versus test LOC Production +193 net lines; tests unchanged. Growth comes from explicit factory contracts and imports at responsibility boundaries; the existing algorithms and shared state are moved rather than duplicated.

Labels

Label changes:

  • add P3: This is an internal maintainability refactor with no intended user-visible behavior change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is an internal maintainability refactor with no intended user-visible behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 22, 2026, 2:30 PM ET / 18:30 UTC.

@steipete
steipete merged commit bfddaeb into main Oct 22, 2026
120 of 121 checks passed
@steipete
steipete deleted the solid2/w-design-2 branch October 22, 2026 20:15
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with prior CI and scoped validation.

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 ci:full Keep ordinary native-locale CI selection on the next PR run. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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