Skip to content

refactor(ui): use owned refs and listener cleanup across pages - #174166

Merged
steipete merged 2 commits into
mainfrom
solid2/w-idiom-pages-class-boundaries
Oct 16, 2026
Merged

steipete merged 2 commits into
mainfrom
solid2/w-idiom-pages-class-boundaries

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Several Solid page renderers still manage event listeners and query their own rendered controls manually.

User Impact

No intended visible behavior change. Session menu shortcuts, Usage range dragging, Logs auto-follow, and Logbook loading keep their existing contracts.

Why This Change Was Made

Use the shared listener cleanup helper and owned refs for the Logs stream, session menu trigger, and Usage SVG. Let the synchronous Logbook owner decide whether its connected source needs an initial load. Remove redundant tracking wrappers around ordinary Promise/microtask callbacks, and pass native class values through the existing component interfaces.

Domain state, request identity checks, polling timing, host tags, classes, and lazy page boundaries stay intact. The shared component changes are type-only; no startup imports or dependencies change. The separate plugin icon owner migration is outside this PR.

Evidence

Proof Result
UI typecheck Passed
Logs / Logbook view / Logbook owner 3 files, 27 tests passed
Meetings listener lifecycle 29 tests passed; isolated review clean
Sessions view / Usage detail identity 2 files, 35 tests passed, including keyboard menu anchors and active drag replacement
Focused lint / format Passed; documented advisory diagnostics only
Production Knip Passed
Isolated review Scoped-clean: no actionable P0–P2 findings
Startup build / strict performance Refreshed pair passed: base 339,434 B → head 339,426 B gzip JS (−8 B); 7 JS requests and 1 CSS request on each
Visual proof No visual changes; existing DOM, classes, geometry, and behavior retained

Touched production files: 19. Production LOC: 6,606 → 6,598 (−8).

Touched-file metric Before After
Controller-pattern references 0 0
createEffect 17 17
createRenderEffect 0 0
untrack 22 19
addEventListener 7 3
Actual querySelector calls, including generic calls 11 8
Checklist class-string regex 1 1

The retained raw registrations/queries belong to existing drag, overlay, or lifecycle boundaries. The unchanged class-regex match is inside the shared Menu implementation; this PR changes only its class prop type.

The CloudWorkers native microtask intentionally samples settled state once to decide explicit polling; it must not subscribe. The Solid lint rule reports that callback as a reactivity advisory after removing untrack; the code documents the intended snapshot and adds no suppression. The Sessions helper invokes its event callback synchronously, so its new reactivity advisory is also a heuristic false positive. Existing Menu and Meetings callback advisories are unchanged contracts.

After persistent GitHub mergeability recalculation failures, merged origin/main once without conflicts. Final head a7b4aa5b2375fc82b1c176ca754822c4db0d184a is compared with exact main parent e2b2ea44a4e687d21a480841ecbb573c8477ab90. The 19-file authored patch is unchanged (stable patch ID 3d08419a20b9b8aa89f0459c22cdf75f2c02c26b), and the exact-parent metrics remain 6,606 → 6,598 LOC. The 91 focused passing tests and clean isolated review are reused; final-head types and production Knip were refreshed.

The refreshed startup comparison used identical build metadata: 339,434 → 339,426 B gzip JS, with unchanged raw JS at 1,033,934 B, 7 JS requests, 1 CSS request, and 38,786 B gzip CSS. Both strict checks reported zero violations against the 374,285 B JS / 1 CSS request budget. The −8 B compressed difference is hashed-reference variation; no startup imports or dependencies were added.

Historical original-base proof is retained separately: 11bbb8291b929db893cef5fdf91e9bb6fb9d6813 → 6dbd785bb987dcfe9ac93a14cda2130ce2ccd35c measured 339,508 → 339,530 B gzip JS (+22 B), with raw JS unchanged at 1,034,463 B. Final-head proof above supersedes these startup measurements.

Final CI and landing

The replacement-head ci:full run 38901947973 passed: 38 jobs succeeded, 26 were skipped, and no jobs failed. Native landing merged the exact reviewed head as d2b07e89a09c7204508331175e748be705063859; no inherited-failure exception was used for this head. Merge ancestry was verified against freshly fetched origin/main.

Historical CI attribution (original head)

The following evidence applies to original head 6dbd785bb987dcfe9ac93a14cda2130ce2ccd35c; it is not final-head CI authority.

ci:full run 38893742066 found two source-attributed base regressions. These are not claimed as matching failures of the latest completed scheduled main run: that run 38887900861 predates both causal changes.

The five model-providers-layout.e2e.test.ts failures all hit the unchanged six-role expectation at line 114 after #173906 added the seventh “Utility Fallback Model” row. The feature is already present in this PR’s merge base and CI base; neither the default-model renderer nor this E2E expectation changes here. Exact failed cases:

  • ui/src/e2e/model-providers-layout.e2e.test.ts > Models settings layout and discovery > Models page keeps controls separate and publishes discovery into a passive picker at 1100px
  • ui/src/e2e/model-providers-layout.e2e.test.ts > Models settings layout and discovery > Models page keeps controls separate and publishes discovery into a passive picker at 1440px
  • ui/src/e2e/model-providers-layout.e2e.test.ts > Models settings layout and discovery > Models page keeps controls separate and publishes discovery into a passive picker at 390px
  • ui/src/e2e/model-providers-layout.e2e.test.ts > Models settings layout and discovery > Models page keeps controls separate and publishes discovery into a passive picker at 640px
  • ui/src/e2e/model-providers-layout.e2e.test.ts > Models settings layout and discovery > Models page keeps controls separate and publishes discovery into a passive picker at 768px

The assertion-safety ratchet fails with src/media/media-facts.ts: 14 < 16. Commit 9b9933e2903f21722c38d3d105543569168f8576 removed two assertions while leaving the baseline at 16. The production parser reports 16/16 before that change and 14/16 on CI base b4ce369de7e8d0047365e7410145321d654eaf51; the media source and ratchet inputs are outside this UI patch.

The inspected CI checkout is merge db15d2dee0da5cf2210a4fe10958efc6e0921ea2, with ordered parents b4ce369de7e8d0047365e7410145321d654eaf51 and 6dbd785bb987dcfe9ac93a14cda2130ce2ccd35c. Native inherited-failure admission retains the failed results and exact evidence; no CI result is relabeled green.

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

clawsweeper Bot commented Oct 16, 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 16, 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-16T12:42:42.946966Z a7b4aa5 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.

@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 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR replaces manual DOM lookups and listener teardown with owned refs and shared cleanup, simplifies asynchronous callbacks, and supports native class values.

Example: Press Shift+F10 on session agent:main:dashboard:1.

  • Before: The row queries its DOM for the session-menu button before opening the menu.
  • After: The row uses its captured button ref and opens the same menu at the same anchor.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch has no actionable finding, with harness-level validation and unresolved CI attribution limiting confidence.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; supplied evidence reports focused tests and startup measurements rather than runtime interaction artifacts.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: No visible malfunction is claimed; manual DOM discovery and repeated lifecycle plumbing make the migrated UI harder to maintain.
Reason: The maintainer-authored direction matches the existing Solid guidance and consolidates responsibilities without adding a new owner or public capability.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it is maintainer-authored, follows the established Solid ownership direction, and introduces no concrete defect found in this review.

Priority: P3
Reviewed head: 6dbd785bb987dcfe9ac93a14cda2130ce2ccd35c

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not show session shortcuts, Usage dragging, Logs following, or Logbook loading through the shipped UI.
Agent review details

How this fits together

Control UI page components consume Gateway projections and browser events, render controls, and delegate requests to existing synchronous owners.

flowchart LR
  A[Browser events] --> B[Solid page components]
  B --> C[Owned DOM refs]
  B --> D[Shared listener cleanup]
  B --> E[Synchronous page owners]
  E --> F[Gateway client]
Loading

Technical review

Best possible solution:

Retain the focused refactor while preserving existing interaction, request-identity, polling, and cleanup contracts.

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

No product bug is claimed; source inspection confirms a behavior-preserving refactor, and no target code was executed.

Is this the best way to solve the issue?

The patch uses existing owners and helpers, removes redundant lookups and wrappers, and keeps the drag callback's captured identity protection.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Shared listener lifetimes keeps the original intent (b62a8f8: Provide shared imperative-event teardown and simplify Solid listener ownership without visible behavior changes.)
  • Logbook connection and initial loading keeps the original intent (10c95d1: Move Logbook polling and view lifetime into its scoped owner while preserving reconnect and loading behavior.)
  • Usage chart and session-menu DOM discovery keeps the original intent (refactor: migrate Usage and Activity pages to Solid #168788: The Usage and Sessions Solid migrations preserved existing interaction and identity contracts; owned refs retain those contracts.)
  • Asynchronous state snapshots keeps the original intent (525073d: Cloud environments retain explicit polling decisions; removing untrack from a native microtask preserves its non-subscribing snapshot behavior.)
  • Shared health reads and Debug initialization keeps the original intent (bf58e95: Consolidate settings health ownership; the patch retains request validity checks and removes tracking wrappers only from asynchronous callbacks.)
  • Shared class props and page composition keeps the original intent (eca633a: Share Solid presentation primitives while preserving host classes; widened class-value types feed the existing native class bindings.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduced patch: Reviewed the merge-base-to-head hunks and verified that the synthetic merge preserves the same intended UI changes rather than deleting base-only work. (6dbd785bb987)
  • Existing cleanup owner: The shared listen helper pairs identical registration and removal arguments; this PR reuses that existing implementation. (ui/src/lib/reactive/listener.ts:1, b62a8f8dab53)
  • Logbook admission remains synchronous: connect retains the existing connection reset and polling lifecycle, then returns the same initial-load predicate previously evaluated by the view. (ui/src/pages/plugin/logbook-state.ts:191, 6dbd785bb987)
  • Existing interaction coverage: Existing tests cover keyboard menu anchoring, active Usage drag replacement, Logs follow behavior, and Logbook rendering; these tests were inspected but not executed. (ui/src/pages/sessions/view.test.ts:283, 6dbd785bb987)
  • CI failure attribution remains incomplete: The failed baseline job reports assertion safety, environment-count, and max-lines ratchets; the failed UI shard reports an unexpected Utility Fallback Model row. Matching base failures were not established, so neither failure is assigned to this patch or declared inherited. (6dbd785bb987)
  • Discussion and supplied validation: The full discussion contains bot status and review messages, with no additional runtime artifacts or human direction beyond the maintainer-authored change. (6dbd785bb987)

Likely related people:

  • Peter Steinberger: Raw commit b62a8f8 adds ui/src/lib/reactive/listener.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b62a8f8dab53; files: ui/src/lib/reactive/listener.ts)

PR surface

Source -8. Total -8 across 19 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 19 90 98 -8
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 19 90 98 -8

Labels

Label changes:

  • add P3: This is internal UI maintenance with no intended user-visible behavior change or established urgent defect.
  • 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 internal UI maintenance with no intended user-visible behavior change or established urgent defect.
  • 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 16, 2026, 7:42 AM ET / 11:42 UTC.

@steipete
steipete merged commit d2b07e8 into main Oct 16, 2026
95 checks passed
@steipete
steipete deleted the solid2/w-idiom-pages-class-boundaries branch October 16, 2026 12:54
@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 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: S 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