Skip to content

refactor(ui): migrate shared viewers to Solid - #168790

Merged
steipete merged 11 commits into
mainfrom
solid2/w-cmp-2
Oct 11, 2026
Merged

steipete merged 11 commits into
mainfrom
solid2/w-cmp-2

Conversation

@steipete

@steipete steipete commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Ports the shared link reader, file preview, and image lightbox from Lit to Solid 2 while preserving the existing viewer experience.

User Impact

Navigation, tab history, keyboard controls, file browsing, zoom, and read-only content keep their existing tags, classes, events, and selectors. Requests and object URLs remain scoped to their owners.

Why This Change Was Made

Each registered viewer now has one Solid implementation through defineSolidBridge. The link reader retains plain TypeScript owners for tab/request state and hover/prefetch lifetimes. Its small Lit prefetch adapter and shared tab/resizer templates remain for the unported chat/panel callers. A synchronous bridge property-change hook preserves immediate preview invalidation on identity changes. The Solid Kbd property is normalized to class for the migrated file viewer.

Evidence

Proof Result
14 focused files, each pnpm test <file> --maxWorkers=1 276 tests passed
Focused syntax/Solid lint and stylesheet lint Passed
Lit migration ratchet against 09d58be4e650 Passed
Independent Codex autoreview Scoped clean
Testbox No runner admitted during the 15-minute attempt; stopped before allocation
Types, UI build, UI unit and E2E shards Passed on exact head 5a23a721f267 in CI run 38131082563; earlier failures and repairs are attributed below
Synthetic Chrome before/after captures Reader, file preview, image lightbox, hovercard, and shadow-root lightbox inspected (10 images)

The initial failures exposed the intentional bridge mount/disconnect microtask boundary and Solid-owned state-write rules; the implementation and fixtures now honor those contracts. Native platform and release-only lanes are unrelated to this UI-only change.

Production LOC: 6422 → 7239. Tests: 5761 → 5912. Growth comes from explicit Solid view/lifetime bindings and typed props; the existing owners keep their contracts. These totals include the directly coupled bridge, keyboard primitive, and theme-token files on both sides; the net production increase is 817 lines.

The first CI attempt found new assertions needing safety rationale and one CSS-only literal misidentified as user copy; fixed, with the now-unused assertion baseline entry removed. Other jobs were cancelled by fail-fast. The startup bundle initially exceeded its limit by 157 bytes; removing redundant prefetch connection state restored the passing budget. Later CI caught the newly enforced prohibition on Lit imports in new files and a type-only hovercard cycle; the existing interop module now owns the legacy adapter and a leaf module owns the host contract.

Focused test timing below is the repository test wrapper's reported wall time (shared host):

Test file Passing tests Wrapper wall time
file-preview-modal.test.ts 17 21.07 s
image-lightbox-gallery.test.ts 9 72.62 s
image-lightbox.test.ts 12 130.23 s
link-reader-content.test.ts 15 78.40 s
link-reader-hovercard-interactions.test.ts 40 90.45 s
link-reader-hovercard-prefetch.test.ts 13 75.33 s
link-reader-hovercard-seeds.test.ts 11 106.30 s
link-reader-hovercard.test.ts 31 82.14 s
link-reader-page-preview.test.ts 38 158.85 s
link-reader-panel.test.ts 30 96.60 s
link-reader-prefetch.test.ts 30 48.20 s
link-reader-title-tooltip.test.ts 2 101.44 s
solid-bridge.test.tsx 12 21.39 s
native-link-routing.test.ts 16 6.49 s

Before/after images below use synthetic data in Chrome; all four viewer states were inspected. Browser chrome and unrelated desktop content are excluded. These component fixtures supplement PR CI integration checks. The browser E2E lane additionally exposed cold-upgrade focus loss: the bridge detached caller nodes before remounting them, invalidating hover/focus intent. A failing cold-definition regression proved the issue; adopting the connected nodes through Solid render initialization preserves intent, with all 11 seed and 12 bridge tests passing. Remaining lightbox geometry probes now query the light-DOM host while retaining their layout assertions.

Reader before

Reader after

File preview before

File preview after

Image lightbox before

Image lightbox after

Hovercard before

Hovercard after

Shadow-root parity: the nested viewer retains the original dark control color (rgba(255, 255, 255, 0.16)) through inherited media control tokens. The added backdrop regression fails before the root-aware hit test and passes afterward. Native Solid attribute names and the typed preview signal initializer are aligned with the pinned Solid 2 API.

Shadow-root image viewer before

Shadow-root image viewer after

Exact-head CI run 38127768780 passed the baseline ratchets, bundle performance, and i18n checks. Its E2E shard passed 54 cases and exposed one real lightbox theme-switching regression: the inline light-dark() custom property retained its previous resolved color after a mode change. The existing root theme owner now defines two media-control color tokens, which inherit through shadow roots and restore the original colors without selector compatibility issues. Real Chrome dark → light → dark transitions now pass in both document and Lit shadow-root fixtures; stylesheet lint and a fresh independent review cover the correction. Cancelled jobs are incomplete proof, not passes.

Run 38129722534 passed the lightbox E2E shard (55 cases), production and test types, lint, performance, i18n, and baseline ratchets. Its UI unit shard passed 7,675 cases and failed one real regression: a newly appended, already-registered hovercard provider missed focus before the bridge mounted. The existing native-routing test reproduced the failure locally. The owner now recovers focused-anchor intent just after bridge adoption; all 16 native-routing tests pass (6.49 s wrapper wall time), with 11 seed and 40 interaction tests also passing. Cancelled shards retain incomplete status.

Final exact-head CI run 38131082563 is green, including all required types, lint, ratchets, UI unit, and UI E2E checks. No admin exception is needed.

The migration landed as 6d01bf549cb381c4228ba5043996143cf45cef24. Final advisory review identified a recovered-keyboard-intent defect; the isolated correction and regression are tracked in #169073.

Keep document requests, preview subscriptions, and media resources scoped to their existing owners. Preserve registered tags and Lit callers through Solid bridges while replacing viewer rendering and lifecycle bindings.
@clawsweeper

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

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR migrates shared link readers, file previews, and media lightboxes from Lit to Solid while retaining their registered tags and interaction contracts.

Example: Open src/viewer.ts in the shared file preview.

  • Before: Lit renders the file list, source contents, Copy action, and keyboard controls.
  • After: Solid renders those controls through the existing openclaw-file-preview-modal tag.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful migration with inspected component proof and passing checks, held by one concrete keyboard dismissal defect.
Proof confidence 🦐 gold shrimp (3/6) ✨ media proof bonus Sufficient (screenshot): Supplied Chrome fixtures exercise the migrated production viewer components with synthetic inputs; inspected before/after screenshots cover reader, file preview, lightbox, hovercard, and shadow-root presentation, while CI supports interaction coverage without proving the newly identified mounting case.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Existing shared viewers must retain their interactions as the Control UI adopts Solid.
Reason: The established migration direction preserves current viewer capabilities and keeps transport ownership intact without introducing settings or public plugin API changes.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this PR open: it advances the approved Solid migration, but the latest focus-recovery change can leave keyboard hovercards stuck open.

Priority: P2
Reviewed head: 5a23a721f26774dccdf4856e1385b86014b42a86

Before merge

  • Recover focused anchors with keyboard intent (P2) - When an already-registered provider is appended and its anchor is focused before the bridge's mounting microtask, this recovery calls activateFocusedAnchor, which always activates with trigger "pointer" and the hover delay. That sets hovercard.pointerInside=true although the pointer never entered the anchor. Moving focus to an outside control clears only focusInside, so PortaledHovercardController.scheduleClose sees the card as held and leaves it open; moving focus away before the delay can also allow a late card to appear. The existing keyboard-exit tests await mounting before focusing and miss this path. Recover through the focus activation rules, including the ordinary-page focus-visible check, and extend the dismissal regression to focus before mounting without pointer events.

Findings

  • [P2] Recover focused anchors with keyboard intent — ui/src/components/link-reader-hovercard-owner.ts:287-290

Tests

  • Missing end-to-end proof: The supplied component captures do not exercise pre-mount keyboard focus followed by leaving the recovered hovercard.
Agent review details

How this fits together

Control UI callers supply documents, files, and media to registered viewers; existing owners manage requests and resource lifetimes while Solid presents content and dispatches interactions.

flowchart LR
  A[Chat and sidebar callers] --> B[Registered viewer bridges]
  B --> C[Viewer state owners]
  C --> D[Gateway and media loaders]
  D --> C
  C --> E[Solid viewer content]
  E --> F[User interactions]
  F --> C
Loading

Technical review

Best possible solution:

Preserve the single-renderer migration and recover pre-mount focus through the existing keyboard-intent and dismissal rules.

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

Source establishes the failure when an already-registered provider is appended and its link receives focus before the bridge mounts; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The migration uses the established bridge and preserves request owners, but recovered focus must retain its actual trigger instead of fabricating pointer intent.

Full review comments:

  • [P2] Recover focused anchors with keyboard intent — ui/src/components/link-reader-hovercard-owner.ts:287-290
    When an already-registered provider is appended and its anchor is focused before the bridge's mounting microtask, this recovery calls activateFocusedAnchor, which always activates with trigger "pointer" and the hover delay. That sets hovercard.pointerInside=true although the pointer never entered the anchor. Moving focus to an outside control clears only focusInside, so PortaledHovercardController.scheduleClose sees the card as held and leaves it open; moving focus away before the delay can also allow a late card to appear. The existing keyboard-exit tests await mounting before focusing and miss this path. Recover through the focus activation rules, including the ordinary-page focus-visible check, and extend the dismissal regression to focus before mounting without pointer events.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Shared bridge keeps the original intent (eca633a: Bridge remaining Lit callers to one Solid implementation while preserving properties, caller content, context, and lifecycle timing.)
  • Link reader and hover ownership keeps the original intent (feat: read GitHub issues, pull requests, and commits beside chat #148464: Present read-only documents beside chat while keeping transport and caller authority with their existing owners.)
  • Image viewer keeps the original intent (0226ad5: Present already-authorized media through the shared modal while retaining focus and source lifetimes.)
  • Skill-bundle file viewer keeps the original intent (a11a431: Browse complete skill bundles with relative document navigation and consumer-specific controls.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test ui/src/components/link-reader-hovercard-interactions.test.ts --maxWorkers=1
  • pnpm test ui/src/components/link-reader-hovercard-seeds.test.ts --maxWorkers=1
  • pnpm test ui/src/app/native-link-routing.test.ts --maxWorkers=1
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit eca633a adds ui/src/lit/solid-bridge.ts:13 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: eca633a8801b; files: ui/src/lit/solid-bridge.ts)

PR surface

Source +817, Tests +151, Docs +5, Other -1. Total +972 across 44 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 28 4725 3908 +817
Tests 14 462 311 +151
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 44 5192 4220 +972

Review metrics

Metric Value Why it matters
Production versus test growth Production +817 net lines; tests +151 net lines The pinned diff confirms the reported growth, principally from Solid bindings and separated lifecycle owners; retained Lit adapters have documented remaining callers.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a normal-priority renderer migration with a bounded keyboard hovercard regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-11T04:57:23.340Z sha c6067c2 :: needs changes before merge. :: [P2] Hit-test the lightbox's containing root for backdrop dismissal | [P2] Import LoadImage from its declaring module | [P3] Use reactive translations in both hover renderers | [P3] Preserve dark-theme colors beneath shadow-root callers | [P2] Migrate the remaining lightbox E2E queries to light DOM
  • reviewed 2026-10-11T06:03:56.832Z sha c6067c2 :: needs changes before merge. :: [P2] Hit-test the lightbox's containing root for backdrop dismissal | [P2] Import LoadImage from its declaring module | [P3] Use reactive translations in both hover renderers | [P3] Preserve dark-theme colors beneath shadow-root callers | [P2] Migrate the remaining lightbox E2E queries to light DOM | [P2] Preserve focused caller nodes during cold hover-provider mounting
  • reviewed 2026-10-11T06:11:42.942Z sha a981fc6 :: needs changes before merge. :: [P2] Hit-test the lightbox's containing root for backdrop dismissal | [P2] Import LoadImage from its declaring module | [P3] Use reactive translations in both hover renderers | [P3] Preserve dark-theme colors beneath shadow-root callers
  • reviewed 2026-10-11T07:15:37.227Z sha 56beea8 :: needs changes before merge. :: none
  • reviewed 2026-10-11T07:43:28.228Z sha 56beea8 :: needs changes before merge. :: none
  • reviewed 2026-10-11T08:37:43.031Z sha 56beea8 :: needs changes before merge. :: none
  • reviewed 2026-10-11T09:22:56.196Z sha f31a4e2 :: needs changes before merge. :: none
  • reviewed 2026-10-11T09:57:09.286Z sha aafc219 :: needs changes before merge. :: none

Reviewed October 11, 2026, 6:32 AM ET / 10:32 UTC (Revision 14).

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 11, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Oct 11, 2026
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Oct 11, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 11, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 11, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 11, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Oct 11, 2026
@steipete
steipete merged commit 6d01bf5 into main Oct 11, 2026
99 checks passed
@steipete
steipete deleted the solid2/w-cmp-2 branch October 11, 2026 10:45
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Oct 11, 2026
The viewer migration in #168790 intentionally removed the shadow root. Keep the existing keyboard navigation assertion, checking the focused discussion section directly instead of requiring the retired shadow-DOM implementation.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
* refactor(ui): migrate viewer components to Solid

Keep document requests, preview subscriptions, and media resources scoped to their existing owners. Preserve registered tags and Lit callers through Solid bridges while replacing viewer rendering and lifecycle bindings.

* test(ui): avoid shadowed viewer fixture target

* refactor(ui): tighten viewer migration boundaries

* Merge remote-tracking branch 'origin/main' into solid2/w-cmp-2

* refactor(ui): isolate legacy viewer rendering adapter

* refactor(ui): separate hovercard host contract

* fix(ui): preserve cold viewer interaction intent

* fix(ui): preserve viewer contracts across rendering roots

* chore: integrate current main for viewer migration

* fix(ui): preserve lightbox colors across theme changes

* fix(ui): recover hovercard focus after bridge mounting

Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
The viewer migration in openclaw#168790 intentionally removed the shadow root. Keep the existing keyboard navigation assertion, checking the focused discussion section directly instead of requiring the retired shadow-DOM implementation.
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 19, 2026
First-parent upstream 069a5b8..75df19c (17 commits, including
openclaw#169043 entry lifecycle queries, openclaw#169034, openclaw#169058 memory index facts,
openclaw#168950, openclaw#169019 telegram queued history replies, openclaw#168790/openclaw#168756/
openclaw#168759/openclaw#168739 Solid UI ports, openclaw#168813 codex metadata/startup
lifecycles, openclaw#168981, openclaw#168992 agent preparation SQLite work).

Only conflict: worker-access inventory, regenerated (631 files, 2436
calls). Auto-merged files carrying our overlay, reviewed: snapshot.ts
(upstream's block-reply reconcile reads through index-1; our per-part
continuation-marker strip in extractAssistantStreamSnapshot unchanged),
codex side-question.ts (upstream's request-scoped client lease; our
disableContinuationTools and the extracted dynamic-tool-call helper
unaffected), subagent-registry-restore.ts, session-sharing-store.native.ts.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant