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:
- Recorded Per-Step Telemetry:
- Exact
stateBefore&stateAftersnapshots (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.
- Exact
- 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-TRAVELbadge and⏭ Livebutton 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).
- Scrubbing to any earlier frame displays the amber
- 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), orViolations(invariant failures). - Click
⬇ Traceto export the full recorded execution history as<ModuleName>.trace.json,⬆ Importto load and replay any saved.trace.jsonsession, or🧪 Testto generate a runnable deterministic regression test (<ModuleName>.trace.test.mjs) directly from your recorded timeline.
- Click the
2. Full-Featured Omnidirectional Debugger (⌖ Debug)#
The ⌖ Debug panel (dockable in Bottom, Right, Left, Center Split, or Floating) provides breakpoints, causal step-through, watch expressions, and omnidirectional scope inspection:
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 Onin the Node Inspector. - Click
●on any step or rule in the⌖ Debugor✓ Proofspanel. - Select any node and press
F9.
- Click the
- Conditional Breakpoints: Enter any LeanUI boolean expression (e.g.
count > 5,items.length == 0) directly below any breakpoint in the⌖ Debugpanel so execution only pauses when that condition holds. - Break on Violation: Toggle
Break on Violationin 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; pressF5(or▶ Continue) to resume live mode.
- The Canvas displays a floating Debug Step Bar (
Scoped Live Watch Expressions#
- Type any LeanUI expression (e.g.,
count <= maxLimit,maxLimit - count,!atLimit,items.length) into the Watch Expressions input and clickAdd. - 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 From | Action | Where It Navigates |
|---|---|---|
| Live Preview UI | Click ⌖ 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 Node | Click 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 Chip | Click 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 Row | Click 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 pill | Jumps 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 strip | Toggles breakpoint, jumps directly to mapped line in Lean 4 / HTML / React TSX, or flashes bound elements in Live Preview. |