Skip to content

refactor(ui): retain overlay root listener cleanup - #174178

Merged
steipete merged 1 commit into
mainfrom
solid2/w-idiom-components-overlay-listeners
Oct 16, 2026
Merged

steipete merged 1 commit into
mainfrom
solid2/w-idiom-components-overlay-listeners

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Overlay roots installed their event table and reconstructed the matching table during teardown. Retain the cleanup functions returned by the shared listener helper instead. Each root still shares one listener set, and the existing reference count still decides when that set is released. Capture/bubble ordering, focus and pointer dismissal semantics are unchanged.

Evidence

Check Result
Overlay shadow-root browser unit tests 14 passed, one worker
UI typecheck Passed
Targeted lint, format, diff Passed
Production Knip Passed
Independent P2 review Passed with full listener-helper context
Exact-base/head build and strict performance Both passed
Startup JS gzip 339,707 → 339,689 B (−18 B); 7 requests
Startup CSS 38,786 B; 1 request, unchanged
Broader UI/focus/E2E proof ci:full

No visual, markup, route, selector, or lazy-boundary change. No screenshots are required for this listener-lifetime refactor. The existing native overlay registry remains the synchronous owner of root membership and dismissal ordering.

Refactor metrics

Exact checklist patterns for the one touched production file:

Metric Before After
Production LOC 480 478
addEventListener 1 0
Controller refs 0 0
createEffect / createRenderEffect 0 / 0 0 / 0
untrack / queries / class strings / flush / owner capture 0 0

The before build used the exact merge-base version of the changed file with all other files unchanged, then the candidate was restored for the after build, on the same machine and checkout.

CI attribution

Full run 38895527118 passed every selected product and security check except the inherited assertion-safety ratchet (src/media/media-facts.ts: 14 < 16). The exact tested merge b90cd3605bcfe4ecd7e63554d2012a8d58c0dff1 has baseline 7bb0840c04cbe62fa703c6e26cacaab0a82467d7 and this PR head as ordered parents; its real delta is only overlay-registry.ts. The media source and assertion checker dependencies are byte-identical. Scheduled main run 38894297213 has the same failure. Native admin admission retains this failure; it is not a green-CI claim.

@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-16T11:44:19.702571Z e7f2d7b PR opened
ℹ️ 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 retains cleanup callbacks from the shared listener helper and invokes them when an overlay root loses its last reference.

Example: Two overlays share one closed shadow root, then both are disposed.

  • Before: The first disposal keeps the listeners; the second removes them by iterating the original event table.
  • After: The same reference counting applies, with final disposal invoking the retained listener cleanup callbacks.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is small and source-equivalent with relevant existing browser coverage; supplied behavioral validation is harness-based and CI remains blocked by inherited and context checks.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; the body reports shadow-root browser tests, typechecking, lint, and builds, without claiming a shipped-entry-point listener teardown 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 visible defect is claimed; the maintenance problem is duplicated listener teardown bookkeeping.
Reason: The maintainer-authored direction reuses an established helper, reduces production code, and preserves the overlay registry's synchronous ownership and event semantics.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it is a sound, maintainer-authored lifecycle simplification with no introduced defects found; failing workflow gates still prevent landing.

Priority: P3
Reviewed head: e7f2d7b6f8347199cae1f2fa2cf8f995d2440e80

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied validation reports browser tests rather than a shipped Control UI disconnect/remount trace; no regression test is expected for this behavior-preserving refactor.
Agent review details

How this fits together

The Control UI overlay registry shares document and shadow-root listeners across overlay lifecycles, translating keyboard, pointer, and focus events into dismissal decisions.

flowchart TD
  A[Overlay lifecycle] --> B[Overlay registry]
  B --> C[Reference counted roots]
  C --> D[Shared listener helper]
  D --> E[Native browser events]
  E --> B
  C --> F[Final reference cleanup]
Loading

Technical review

Best possible solution:

Retain this focused reuse of the shared listener helper while preserving the existing registry and reference-count lifecycle.

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

No user bug is claimed; source inspection confirms equivalent listener registration and final-reference teardown, and no target code was executed.

Is this the best way to solve the issue?

Using the existing synchronous listener helper removes duplicated teardown mechanics without introducing another lifecycle owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Overlay root listener lifetime keeps the original intent (b68c44c: Native overlay migration centralized registration, dismissal ordering, focus, and cancellation in one renderer-neutral lifecycle.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b68c44c adds ui/src/components/overlay-registry.ts:474 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b68c44ca8f3c; files: ui/src/components/overlay-registry.ts)

PR surface

Source -2. Total -2 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 5 7 -2
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 1 5 7 -2

Labels

Label changes:

  • add P3: This is a small internal cleanup with no intended user-visible behavior change or demonstrated 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 a small internal cleanup with no intended user-visible behavior change or demonstrated 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:55 AM ET / 11:55 UTC.

@steipete
steipete merged commit 5719a1e into main Oct 16, 2026
95 of 100 checks passed
@steipete
steipete deleted the solid2/w-idiom-components-overlay-listeners branch October 16, 2026 12:29
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

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