LeanUI Docs
← Open LeanUI Studio GitHub

05 · Omnidirectional Debugger, Timeline & Live UI Inspector#

LeanUI provides a tightly integrated, omnidirectional debugging suite linking Graph Nodes ⇄ Live UI Elements ⇄ State & Timeline History ⇄ Generated Code (Lean 4 / HTML / React TSX) ⇄ Formal Proofs.


1. Dockable State & Invariant Timeline Debugger (⏱ Timeline)#

The ⏱ Timeline panel is a standalone dockable, splittable, and floatable time-travel debugger recording every runtime transition from step #0 (initState) onwards:

LIVE GENERATED SVG · AUTO-UPDATED ON BUILD
Open SVG ↗
Entire Studio App During Live Debugging — Breakpoint Pause, #1–#5 Step Badges & Time-Travel Scrubbing Entire Studio App During Live Debugging — Breakpoint Pause, #1–#5 Step Badges & Time-Travel Scrubbing
Entire Studio App During Live Debugging — Breakpoint Pause, #1–#5 Step Badges & Time-Travel Scrubbing
LIVE GENERATED SVG · AUTO-UPDATED ON BUILD
Open SVG ↗
State & Invariant Timeline Panel — Transport Bar, Time-Travel Scrubber, Branch Fork & Playwright Test Export State & Invariant Timeline Panel — Transport Bar, Time-Travel Scrubber, Branch Fork & Playwright Test Export
State & Invariant Timeline Panel — Transport Bar, Time-Travel Scrubber, Branch Fork & Playwright Test Export
LIVE GENERATED SVG · AUTO-UPDATED ON BUILD
Open SVG ↗
Live Timeline Storyboard — Exportable as SVG, High-DPI PNG, or Multi-Page PDF Timeline Book Live Timeline Storyboard — Exportable as SVG, High-DPI PNG, or Multi-Page PDF Timeline Book
Live Timeline Storyboard — Exportable as SVG, High-DPI PNG, or Multi-Page PDF Timeline Book
  • Recorded Per-Step Telemetry:
    • Exact stateBefore & stateAfter snapshots (including collections and nested sub-program states).
    • Exact Transition Diff (count: 0 → 1, items: [2 rows] → [3 rows]) with amber highlight on modified state chips.
    • Snapshot of every Computed property, Predicate, Invariant, and user Proof Rule evaluated at that exact historical step.
    • Full ordered Execution Path (executionSteps & executionEdgeIds) through the graph.
  • VCR Transport, Scrubber & Replay:
    • ⏮ First (step #0), ◀ Step Back (←), ▶ / ⏸ Animated Playback Replay (650 ms/step), ▶| Step Forward (→), ⏭ Jump to Latest.
    • Drag the Timeline Scrubber or click any color-coded Step Pip (green = all invariants hold, red = violation, purple = forked branch).
  • Time-Travel & Timeline Forking:
    • Scrubbing to any earlier frame displays the amber TIME-TRAVEL badge and ⏭ Live button while immediately rewinding the Live Preview, State Snapshot, Diff, Watches, and Canvas Execution Path Overlay to that exact moment!
    • Dispatching a new action while time-traveling forks the timeline cleanly from the current step (dropping stale future frames and marking the branch with ⑂ fork).
  • Inline State Editing, Trace Import & Automated Test Export:
    • Click the ✎ icon on any State Snapshot chip to edit its live value inline (type-coerced and recorded as a new Timeline step).
    • Filter the State History list by All, Changed (non-idempotent steps), or Violations (invariant failures).
    • Click ⬇ Trace to export the full recorded execution history as <ModuleName>.trace.json, ⬆ Import to load and replay any saved .trace.json session, or 🧪 Test to generate a runnable deterministic regression test (<ModuleName>.trace.test.mjs) directly from your recorded timeline.

The ⌖ Debug panel (dockable in Bottom, Right, Left, Center Split, or Floating) provides breakpoints, causal step-through, watch expressions, and omnidirectional scope inspection:

LIVE GENERATED SVG · AUTO-UPDATED ON BUILD
Open SVG ↗
Omnidirectional Debugger Panel — Resume/Step (F8/F10), Break on Violation, Breakpoints & Live Watches Omnidirectional Debugger Panel — Resume/Step (F8/F10), Break on Violation, Breakpoints & Live Watches
Omnidirectional Debugger Panel — Resume/Step (F8/F10), Break on Violation, Breakpoints & Live Watches
LIVE GENERATED SVG · AUTO-UPDATED ON BUILD
Open SVG ↗
Live Preview Panel — ⌖ Inspect Interactive UI Element Picker & Responsive Viewport Switcher Live Preview Panel — ⌖ Inspect Interactive UI Element Picker & Responsive Viewport Switcher
Live Preview Panel — ⌖ Inspect Interactive UI Element Picker & Responsive Viewport Switcher

Breakpoints & Break-on-Violation#

  • Set/Remove Breakpoints in 5 places:
    • Click the ● dot on any Canvas Node header.
    • Click any mapped line number in the Lean 4 / HTML / React TSX code gutter.
    • Click ○ BP / ● BP On in the Node Inspector.
    • Click ● on any step or rule in the ⌖ Debug or ✓ Proofs panel.
    • Select any node and press F9.
  • Conditional Breakpoints: Enter any LeanUI boolean expression (e.g. count > 5, items.length == 0) directly below any breakpoint in the ⌖ Debug panel so execution only pauses when that condition holds.
  • Break on Violation: Toggle Break on Violation in the Debug panel to pause automatically whenever any Lean invariant or user proof rule fails at runtime.

Execution Path Step-Through (F5 / F10)#

  • When a breakpoint hits (or when stepping any Timeline frame via ⤵): ① Trigger UI (IncButton) → ② Action Reducer (Increment) → ③ Modified State (count) → ④ Computed/Predicate (atLimit) → ⑤ Invariant/Rule (withinBounds) → ⑥ Bound View (CountText).
    • The Canvas displays a floating Debug Step Bar (⏸ Step 2/6 · Increment · ◀ · ⤵ · ▶ Continue · ⌖ UI).
    • Touched Canvas nodes display numbered Execution Step Badges (1, 2, 3, ...) and traversed wires animate along the exact causal path:
    • Press F10 (or click ⤵) to step node-by-node through the execution path; press F5 (or ▶ Continue) to resume live mode.

Scoped Live Watch Expressions#

  • Type any LeanUI expression (e.g., count <= maxLimit, maxLimit - count, !atLimit, items.length) into the Watch Expressions input and click Add.
  • Watches re-evaluate live against whichever Timeline frame is currently active — including while scrubbing backward/forward in time!

3. Omnidirectional Navigation in Every Direction#

Starting FromActionWhere It Navigates
Live Preview UIClick ⌖ Inspect (or hold Alt+Click on any rendered UI element)Intercepts the click without firing actions → selects & pans to the exact View Node on Canvas, opens Inspector, highlights connected State/Action/Computed nodes, and highlights mapped lines in Lean 4 / HTML / TSX.
Canvas NodeClick any node (State, Computed, Action, Invariant, View, Style, Resource)Highlights all bound Live Preview DOM elements, highlights mapped lines in Lean 4 / HTML / TSX, updates Omnidirectional Scope Card (upstream ↑ & downstream ↓ clickable chips), and opens Inspector.
State Snapshot / Diff / Invariant ChipClick chip in ⏱ Timeline (or its λ icon)Click chip → focuses & pans to its Canvas Node & flashes bound Live Preview UI; click λ → opens λ Lean 4 scrolled directly to its definition/theorem line.
Timeline History RowClick row, ◈, λ, or ⤵Row → time-travels Preview & Canvas; ◈ → jumps to triggering Action/UI node; λ → jumps to Lean 4 reducer branch; ⤵ → opens step-by-step Execution Path debugger.
Generated Code (Lean 4 / HTML / TSX)Click any mapped line or inline ◈ symbol pillJumps straight to the corresponding Canvas Node, pans it into view, selects it in Inspector, and highlights its bound Live Preview elements. Click line number to toggle a breakpoint.
Formal Proofs (✓ Proofs)Click λ on any theorem/rule card, or click card bodyλ → scrolls λ Lean 4 directly to that theorem; card click → focuses & traces its node on Canvas & Preview.
Node Inspector (⚙ Inspector)Click ○ BP, λ :line, ◇ :line, ⚛ :line, or ▶ UI stripToggles breakpoint, jumps directly to mapped line in Lean 4 / HTML / React TSX, or flashes bound elements in Live Preview.
Diagram Preview
Enlarged diagram