Skip to content

refactor(ui): own mascot canvas and listener lifecycle - #174595

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

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

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The shared mascot still finds its own canvas through repeated DOM queries and manages two external listeners separately.

User Impact

No user-visible change: animation timing, mood and size updates, theme branding, reduced motion, visibility pauses, and removal cleanup stay the same.

Why This Change Was Made

Keep the canvas in its JSX ref and use the existing listener helper with paired owner cleanup. The connected-node check keeps a canvas retired by a branding switch inert until its replacement mounts. The plain TypeScript animator remains the owner of animation behavior; the one retained effect synchronizes that external animator and the host DOM.

Evidence

Proof Result
UI typecheck pnpm tsgo:ui passed
Focused lifecycle tests 2/2 passed with one worker; 281 ms test time, 12.77 s wrapper wall time
Exact-base diagnostic comparison Same two tests passed on the merge-base production file; both emit the identical sequence of 35 pre-existing strict-read warnings; base wrapper 7.33 s
Scoped lint, format, diff check Passed
Production Knip Passed on final committed head; no ignores
Independent review No actionable P0–P2 findings
Paired production builds and strict performance check Passed on the same machine
Startup JavaScript 340,385 → 340,359 B gzip; 7 requests on both sides
Startup CSS 38,784 B gzip and 1 request on both sides
Chat / New boot JavaScript −54 / −45 B gzip; request counts unchanged

Touched production file metrics: LOC 165 → 164, controller references 0 → 0, effects 1 → 1, untrack 0 → 0, raw listeners 2 → 0, DOM queries 1 → 0. Render effects, manual class strings, flush, and owner escape calls remain zero. Test LOC 42 → 79.

The lifecycle tests cover branding replacement, reduced motion, hidden-document pause/resume, and removal cleanup. The strict-read warnings arise in unchanged effect reads and are retained as a known follow-up; this change adds no suppression or synchronized state. No visual/style change, local E2E/parity run, cloud lease, dependency change, or lazy-boundary change. PR CI supplies broad proof with ci:full; CI test timing is pending.

@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-16T19:43:30.323520Z f1c07ba 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 replaces mascot canvas queries with a JSX ref and pairs external listener registration with teardown through the existing helper.

Example: A 48-pixel mascot switches from claw branding to neutral branding and back.

  • Before: The component queries its host for the current canvas and manually removes its listeners.
  • After: The component retains the canvas ref, ignores the disconnected replacement, and uses paired listener teardown while preserving the displayed behavior.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-consistent, with useful lifecycle preservation coverage but no supplied shipped-entry-point demonstration.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; supplied evidence covers the real custom-element owner in a jsdom harness with mocked animation scheduling, not browser canvas playback.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
User problem: No user-visible problem is claimed; the change simplifies ownership while preserving mascot behavior.
Reason: The maintainer-authored direction matches the repository's ref and paired-cleanup guidance and slightly reduces production code.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it is a focused, maintainer-approved lifecycle refactor, and source review found no actionable introduced defect.

Priority: P3
Reviewed head: f1c07ba60780c22a10fcf1ec5b0b2256d4f91e38

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No browser run exercises canvas replacement, motion changes, and removal on this head; the reported base-and-head passes are preservation coverage rather than a failing-before regression.
Agent review details

How this fits together

The shared Control UI mascot consumes theme branding, mood, size, motion preferences, and visibility events, then drives the existing TypeScript animator and canvas renderer.

flowchart TD
  A[Theme branding and mascot props] --> B[Solid mascot component]
  C[Motion and visibility events] --> B
  B --> D[Mascot animator]
  D --> E[Canvas renderer]
  B --> F[Owned canvas ref and cleanup]
  F --> E
Loading

Technical review

Best possible solution:

Retain the single animator owner and complete this focused refactor through the normal exact-head CI gates.

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

No user-visible defect is claimed; source inspection confirms the repeated query and manual listener registrations that the refactor removes.

Is this the best way to solve the issue?

The change uses the existing ref and listener contracts, preserves the animator owner, and avoids additional state or abstraction.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Mascot canvas lookup, playback admission, and external listeners keeps the original intent (c11951f: The earlier Solid migration preserved existing mascot motion, branding, tags, and lifecycle behavior while replacing the Lit renderer.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduced change: The introduced diff replaces the canvas query and manual listeners without adding another animation owner or changing the component properties. (ui/src/components/openclaw-mascot.tsx:46, f1c07ba60780)
  • Lifecycle contract: The shared listener helper returns exact removal callbacks; the mascot invokes both from its settled cleanup and retains animation cancellation on owner disposal. (ui/src/components/openclaw-mascot.tsx:137, f1c07ba60780)
  • Behavioral coverage: The added custom-element harness exercises reduced-motion changes, hidden-document pause and resume, and removal; the existing test covers branding replacement. The PR reports both tests passing against base and head, consistent with a behavior-preserving refactor. (ui/src/components/openclaw-mascot.test.ts:44, f1c07ba60780)
  • Original intent and feature history: The earlier Solid migration explicitly preserved mascot motion behavior. Current-main history also traces the mascot, theme support, and subsequent refactors to Peter Steinberger; GitHub maps the migration author to steipete. See refactor(ui): port gateway, native, update, and theme controls to Solid #169243. (ui/src/components/openclaw-mascot.tsx:45, 23173ed1f61b)
  • Main and live review state: Fetched main retains the query-based implementation. GitHub reports the reviewed head mergeable, with UI checks still running; the full body and discussion contain no changed-path browser recording or live output. (ui/src/components/openclaw-mascot.tsx:45, 23173ed1f61b)
  • Review limits and checkout preservation: Root and UI policies were applied; no nested UI AGENTS.md or maintainer-notes directory was present. The installed Solid cheatsheet was absent, and deeper historical reads encountered unavailable promisor objects. Available source, history, and the earlier PR supplied the relevant contracts; no target code ran and git status remained clean. (ui/AGENTS.md:5, f1c07ba60780)

PR surface

Source -1, Tests +37. Total +36 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 18 19 -1
Tests 1 37 0 +37
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 55 19 +36

Labels

Label changes:

  • add P3: This is a small behavior-preserving lifecycle cleanup with no established user-facing failure.
  • 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 behavior-preserving lifecycle cleanup with no established user-facing failure.
  • 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, 3:55 PM ET / 19:55 UTC.

@steipete
steipete merged commit 59bb148 into main Oct 16, 2026
98 checks passed
@steipete
steipete deleted the solid2/w-idiom-components-mascot branch October 16, 2026 20:07
@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