Repository navigation
refactor(ui): migrate shared viewers to Solid - #168790
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesThis 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.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete 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 Before merge
Findings
Tests
Agent review detailsHow this fits togetherControl 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
Technical reviewBest 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:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fc0720162ede. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +817, Tests +151, Docs +5, Other -1. Total +972 across 44 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (13 earlier review cycles; latest 8 shown)
Reviewed October 11, 2026, 6:32 AM ET / 10:32 UTC (Revision 14). |
|
Merged via squash.
|
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.
* 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]>
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.
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]>
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 toclassfor the migrated file viewer.Evidence
pnpm test <file> --maxWorkers=109d58be4e6505a23a721f267in CI run 38131082563; earlier failures and repairs are attributed belowThe 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):
file-preview-modal.test.tsimage-lightbox-gallery.test.tsimage-lightbox.test.tslink-reader-content.test.tslink-reader-hovercard-interactions.test.tslink-reader-hovercard-prefetch.test.tslink-reader-hovercard-seeds.test.tslink-reader-hovercard.test.tslink-reader-page-preview.test.tslink-reader-panel.test.tslink-reader-prefetch.test.tslink-reader-title-tooltip.test.tssolid-bridge.test.tsxnative-link-routing.test.tsBefore/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.
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.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.