Skip to content

refactor(ui): migrate Markdown presentation to Solid - #169333

Merged
steipete merged 8 commits into
mainfrom
solid2/w-chat-6
Oct 11, 2026
Merged

steipete merged 8 commits into
mainfrom
solid2/w-chat-6

Conversation

@steipete

@steipete steipete commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Moves chat Markdown presentation off Lit while preserving retained streaming DOM and existing controls.

User Impact

Code blocks, tables, Mermaid source/copy/expand controls, and table-dialog focus return keep their current behavior. No dependencies, configuration, protocol, or storage changes.

Why This Change Was Made

MarkdownDomReconciler remains the sole owner of sanitized Markdown DOM. A Solid ref now drives it in transcript rows and Markdown attachment readers. Mermaid uses the Solid bridge under the existing tag and remains behind the original lazy import. Table and tooltip enhancements own plain DOM inside the island. Their small shared SVG adapter uses canonical icon data. Existing unported callers retain their Lit adapters.

CI caught missing braces in the ref’s early return and Mermaid menu branches. Both are corrected; focused lint over every changed TypeScript/TSX file passes.

The port also excludes mounted Mermaid source/error views from fence discovery, preventing destructive remounts, and explicitly scopes former shadow styles against surrounding chat styles. The clipboard test now checks its own tooltip live region instead of an unrelated image-copy toast.

Evidence

Base: 939f740219d9fbbd9060acfa483765442bc0a513. Candidate: a84937b65e3d2.

Proof Result
Focused Markdown ref, Mermaid, table, code-block unit tests 43 passed; 17.62 s wrapper wall time
Fragment-ref and Markdown attachment reader tests 42 passed; fragment initialization failure reproduced before repair
Solid transcript integration and streaming browser tests 40 passed, including zero removed nodes across 12 updates
Solid lifecycle, transcript rendering, streaming browser, three WeakRef retention suites 107 passed on Testbox
Quantitative chat/composer/width/identity gates 222 passed locally with one worker; 130.11 s wrapper wall time
Full-app table interactions 11 passed; 39.60 s
Full-app Mermaid load-error recovery 2 passed; 42.68 s
Full-app typing height-read gate / stream runtime budgets 1 / 6 passed; 20.16 / 36.45 s
Markdown attachment browser 6 passed
Chromium clipboard/table/tooltip Passed after the tooltip assertion was scoped; focused tooltip 13 passed
WebKit clipboard/table/tooltip, forced clipboard-first order 36 passed; 3 keyboard failures reproduce on the base. Tooltip hover now passes; traced the prior failure to a second toast live region
UI typecheck Passed on integrated source
Visual parity All 10 light/dark code, table, diagram, source, and expanded-table captures compare pixel-for-pixel; inspected synthetic data only
Build / strict performance Both builds complete; both strict checks fail only the inherited 36 chat boot requests vs 35 limit
Startup No added modules; identical 1,345,054 raw bytes and 8 requests. Gzip 421,833 → 421,833 bytes (unchanged); no budget baseline change
Independent review Fresh isolated Codex P0–P2 reviews clean after repairs

Production LOC: 1,744 → 1,814 (+70). The shared ref and DOM icon adapter add 67 lines; scoped source-style resets account for the small remainder while replacing the prior rendering code. Tests: 1,294 → 1,370 (+76); tooling LOC unchanged. Required interim adapters remain because unported callers still use them.

Testbox: blacksmith-testbox, tbx_01m4p0a3ybvva19kx9gntezfrw, run. The lease completed and was stopped. A subsequent reuse was refused because it had finished; remaining proof ran locally with one worker. CI seconds are reported by this PR's exact-head checks.

The unrelated CI test-plan inventory failure was fixed upstream by ee76fe33a4c77; this branch incorporates it and the exact failing assertion passes locally.

The three inherited WebKit keyboard failures are in markdown-file-tooltip.browser.test.ts: Tab-to-copy and both clipboard-fallback focus cases. The base and candidate show the same failures; the underlying tooltip primitive is unchanged.

Visual proof

The attached before/after boards show code, compact tables, Mermaid diagram and source, and the expanded table dialog. Light and dark captures are identical pixel-for-pixel. Screenshots use only the mock Gateway and synthetic content.

Before: light theme Markdown

After: light theme Markdown

Before: dark theme Markdown

After: dark theme Markdown

Keep sanitized Markdown in its framework-neutral DOM owner, retain lazy Mermaid loading, and preserve table dialog focus and clipboard ownership. The Solid ref is ready for the transcript cutover on main.
Use the same DOM owner in Markdown attachment readers, preserve source typography, and scope tooltip feedback assertions to their own live region.
@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.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui scripts Repository scripts size: XL labels Oct 11, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Moves Markdown presentation to Solid while retaining streaming DOM, table interactions, file tooltips, and lazy Mermaid rendering.

Example: A chat reply contains flowchart LR; A[Markdown] --> B[Retained DOM].

  • Before: Lit presents the diagram and its source, copy, and expansion controls.
  • After: Solid presents the same diagram and controls with matching light and dark appearance.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused migration with inspected browser parity, meaningful lifecycle coverage, successful current-head gates, and no actionable finding or persisted-data change.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after browser captures from the supplied mock-Gateway setup show matching code, tables, Mermaid diagram/source, and expanded-table presentation; reported interaction and lifecycle results support the unchanged presentation code at the current head.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The established Solid migration warrants this focused cutover without adding configuration, storage, dependencies, or public APIs.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it completes the established Solid migration, preserves existing Markdown ownership, and has no actionable introduced defect.

Priority: P3
Reviewed head: a84937b65e3d20e2813ce9a05e9e487f4a3516ba

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI converts sanitized message and attachment Markdown into retained DOM, then enhances code blocks, tables, file tooltips, and Mermaid diagrams.

flowchart TD
 A[Messages and attachments] --> B[Markdown sanitization]
 B --> C[Solid Markdown ref]
 C --> D[Markdown DOM reconciler]
 D --> E[Retained DOM]
 E --> F[Table and tooltip enhancements]
 E --> G[Lazy Solid Mermaid presentation]
Loading

Technical review

Best possible solution:

Complete the focused presentation cutover using the existing DOM, clipboard, modal, and renderer owners.

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

This is a refactor rather than a defect report; source, history, supplied browser captures, and hosted checks were inspected without running target code or tests.

Is this the best way to solve the issue?

Thin Solid adapters drive existing TypeScript owners, the replaced Mermaid class is removed, and retained Lit adapters have concrete remaining callers.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 7bdba03 adds ui/src/lib/markdown-dom-reconciler.ts:2 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7bdba03c22d3; files: ui/src/lib/markdown-dom-reconciler.ts)
  • Jacqueline Henriksen: Raw commit 704a21d adds ui/src/components/markdown-file-tooltip.ts:9 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 704a21dd91ef; files: ui/src/components/markdown-file-tooltip.ts)
  • Vyctor H. Brzezowski: Raw commit cbe3116 adds ui/src/components/markdown-tables.ts:15 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: cbe3116e1491; files: ui/src/components/markdown-tables.ts)

PR surface

Source +70, Tests +76, Other 0. Total +146 across 19 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 12 789 719 +70
Tests 6 108 32 +76
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 19 898 752 +146

Review metrics

Metric Value Why it matters
Production versus test growth Production +70 LOC; tests +76 LOC Shared Markdown ref and DOM icon adapters explain most production growth; added coverage protects retained nodes and media cleanup.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is an internal presentation refactor preserving existing behavior, with no identified urgent regression.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • 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 execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-11T20:15:40.304Z sha 65214f5 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-11T20:43:06.847Z sha ddb0f3c :: needs maintainer review before merge. :: none
  • reviewed 2026-10-11T21:16:56.497Z sha 276bcf9 :: needs maintainer review before merge. :: none

Reviewed October 11, 2026, 5:39 PM ET / 21:39 UTC (Revision 4).

@steipete
steipete merged commit bd4852e into main Oct 11, 2026
107 checks passed
@steipete
steipete deleted the solid2/w-chat-6 branch October 11, 2026 21:41
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
* refactor(ui): migrate Markdown presentation to Solid

Keep sanitized Markdown in its framework-neutral DOM owner, retain lazy Mermaid loading, and preserve table dialog focus and clipboard ownership. The Solid ref is ready for the transcript cutover on main.

* fix(ui): initialize retained Markdown refs for Solid fragments

Use the same DOM owner in Markdown attachment readers, preserve source typography, and scope tooltip feedback assertions to their own live region.

* refactor(ui): drive transcript Markdown through the Solid ref

* fix(ui): preserve Mermaid source view styling

* style(ui): brace the Markdown ref early return

* style(ui): brace Mermaid menu action branches
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: XL 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