Skip to content

Commit 7958e07

Browse files
committed
fix generate_blob_transaction task
1 parent 4baf461 commit 7958e07

File tree

6 files changed

+6780
-4
lines changed

6 files changed

+6780
-4
lines changed

DEBUG_BUILDER.md

Lines changed: 356 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,356 @@
1+
# Debug Builder Integration Plan
2+
3+
## Overview
4+
5+
Integrate the debugger directly into the Test Builder page instead of having a separate debug page. This allows users to:
6+
- See test execution state directly in the task list/graph they're familiar with
7+
- Modify, add, or remove future tasks while paused
8+
- Set breakpoints by clicking on tasks
9+
- View variables and frame state in context
10+
11+
## Current Architecture
12+
13+
```
14+
BuilderPage
15+
├── BuilderToolbar (save, run, debug buttons)
16+
├── SplitPane
17+
│ ├── Left: TaskListEditor / TaskGraphEditor (switchable)
18+
│ └── Right: TaskConfigEditor (selected task config)
19+
└── TestRunModal (shows test execution logs)
20+
```
21+
22+
## Target Architecture
23+
24+
```
25+
BuilderPage
26+
├── BuilderToolbar (+ debug controls when debugging)
27+
├── DebugBar (frame selector, connection status - only when debugging)
28+
├── SplitPane
29+
│ ├── Left: TaskListEditor / TaskGraphEditor
30+
│ │ └── Enhanced with execution state indicators
31+
│ └── Right: TaskConfigEditor OR DebugInspector (contextual)
32+
└── DebugBottomPanel (variables, expression evaluator - collapsible)
33+
```
34+
35+
## Phase 1: Debug State in Builder
36+
37+
### 1.1 Builder Debug Mode State
38+
39+
Add debug mode state to the builder:
40+
41+
```typescript
42+
// In BuilderPage or a new useBuilderDebug hook
43+
interface BuilderDebugState {
44+
isDebugging: boolean;
45+
runId: number | null;
46+
sessionId: string | null;
47+
}
48+
```
49+
50+
When "Debug" is clicked:
51+
1. Save test (existing)
52+
2. Schedule debug test (existing)
53+
3. **Stay on builder page** (change from current redirect)
54+
4. Connect to SSE events
55+
5. Enter debug mode UI
56+
57+
### 1.2 Debug Controls in Toolbar
58+
59+
When debugging, BuilderToolbar shows:
60+
- **Stop Debug** button (red) - aborts session, exits debug mode
61+
- **Continue** (F8) - resume execution
62+
- **Step Over** (F10) - next task at same depth
63+
- **Step Into** (F11) - step into nested tasks
64+
- **Step Out** (Shift+F11) - step out of current scope
65+
- **Skip** (F9) - skip current task
66+
- **Pause All** - pause all running frames
67+
68+
Hide/disable normal toolbar items that don't apply during debug:
69+
- "Run Test" - hidden (already debugging)
70+
- "Debug" - hidden (already debugging)
71+
- "Save" - could remain enabled for live modifications
72+
73+
### 1.3 Frame Selector Bar
74+
75+
New component below toolbar (only visible when debugging):
76+
77+
```
78+
┌─────────────────────────────────────────────────────────────┐
79+
│ [main ●] [background ○] [matrix[0] ●] [matrix[1] ○] [SSE ●] │
80+
└─────────────────────────────────────────────────────────────┘
81+
● = paused, ○ = running, ◌ = completed
82+
```
83+
84+
- Shows all execution frames as tabs
85+
- Click to switch active frame
86+
- Visual indicator for paused/running/completed
87+
- Connection status indicator
88+
89+
## Phase 2: Task Execution Visualization
90+
91+
### 2.1 Task List Execution State
92+
93+
Enhance TaskListEditor to show execution state:
94+
95+
```
96+
┌──────────────────────────────────────────────────────────────┐
97+
│ Tasks [+] │
98+
├──────────────────────────────────────────────────────────────┤
99+
│ ✓ 1. check_clients_are_healthy [success] │
100+
│ ▶ 2. generate_transaction ← RUNNING │
101+
│ ◉ 3. wait_for_inclusion ← BREAKPOINT (click to rm) │
102+
│ 4. verify_transaction_receipt │
103+
│ 5. cleanup_resources [cleanup] │
104+
└──────────────────────────────────────────────────────────────┘
105+
```
106+
107+
State indicators:
108+
- `` Green check - completed successfully
109+
- `` Red X - failed
110+
- `` Yellow arrow - currently running
111+
- `` Blue pause - paused (hit breakpoint or step)
112+
- `` Red dot - has breakpoint
113+
- `` Gray circle - pending/not executed
114+
- `` Gray slash - skipped
115+
116+
### 2.2 Task Graph Execution State
117+
118+
Enhance TaskGraphEditor nodes:
119+
120+
- **Completed nodes**: Green border, slightly faded
121+
- **Running node**: Yellow/amber border, pulsing glow
122+
- **Paused node**: Blue border, highlighted
123+
- **Failed node**: Red border
124+
- **Pending nodes**: Gray/default
125+
- **Breakpoint indicator**: Red dot in corner
126+
127+
Add execution flow visualization:
128+
- Animate edge when task transitions
129+
- Show execution path taken so far
130+
131+
### 2.3 Breakpoint Management
132+
133+
Click on task to toggle breakpoint:
134+
- In list: Click on row left margin or dedicated column
135+
- In graph: Click on node corner or right-click menu
136+
137+
Breakpoint types from UI:
138+
- **Task breakpoint** (click on task) - pause before this task
139+
- **Conditional breakpoint** (right-click > Add conditional) - pause if condition met
140+
141+
Show breakpoints inline rather than in separate panel.
142+
143+
## Phase 3: Debug Inspector Panel
144+
145+
### 3.1 Contextual Right Panel
146+
147+
When debugging and a task is paused, the right panel switches from TaskConfigEditor to DebugInspector:
148+
149+
```
150+
┌─────────────────────────────────────────────┐
151+
│ Task: generate_transaction │
152+
│ Status: Paused (breakpoint) │
153+
├─────────────────────────────────────────────┤
154+
│ [Variables] [Config] [Output] │
155+
├─────────────────────────────────────────────┤
156+
│ Variables: │
157+
│ ├─ walletPrivKey: "0x1234..." │
158+
│ ├─ targetAddr: "0xabcd..." │
159+
│ └─ clients: [{...}, {...}] │
160+
│ │
161+
│ Config (resolved): │
162+
│ ├─ privateKey: $.walletPrivKey │
163+
│ │ → "0x1234..." │
164+
│ └─ toAddress: $.targetAddr │
165+
│ → "0xabcd..." │
166+
└─────────────────────────────────────────────┘
167+
```
168+
169+
Tabs:
170+
- **Variables**: Current scope variables (editable)
171+
- **Config**: Task config with resolved values shown
172+
- **Output**: Task logs/output (if running or completed)
173+
174+
### 3.2 Bottom Panel (Collapsible)
175+
176+
New collapsible panel at bottom for advanced debug features:
177+
178+
```
179+
┌─────────────────────────────────────────────────────────────┐
180+
│ Debug Console [▼ Collapse]│
181+
├─────────────────────────────────────────────────────────────┤
182+
│ > $.clients | length │
183+
│ 6 │
184+
│ > $.walletPrivKey │
185+
│ "0x1234..." │
186+
│ > _ │
187+
└─────────────────────────────────────────────────────────────┘
188+
```
189+
190+
Features:
191+
- JQ expression evaluator (REPL)
192+
- Watch expressions
193+
- Variable diff view (what changed since last pause)
194+
195+
Default state: collapsed (just a thin bar showing "Debug Console")
196+
197+
## Phase 4: Live Task Modification
198+
199+
### 4.1 Edit Future Tasks
200+
201+
While paused, allow editing tasks that haven't executed yet:
202+
- Click on pending task to edit its config
203+
- Changes are staged and applied when execution reaches that task
204+
- Visual indicator for modified tasks
205+
206+
### 4.2 Add/Remove Tasks
207+
208+
While paused:
209+
- **Add task**: Insert new task at any position after current
210+
- **Remove task**: Remove pending task from execution queue
211+
- **Reorder**: Drag pending tasks to reorder
212+
213+
Constraints:
214+
- Cannot modify completed tasks
215+
- Cannot remove currently paused task
216+
- Changes tracked as "pending modifications"
217+
218+
### 4.3 Task Injection
219+
220+
Quick inject common debug tasks:
221+
- "Log Variables" - inject a task that logs current variables
222+
- "Wait" - inject a sleep task
223+
- "Checkpoint" - inject a manual pause point
224+
225+
## Phase 5: Multi-Frame Support
226+
227+
### 5.1 Frame-Aware Task Display
228+
229+
When test has multiple frames (concurrent, background, matrix):
230+
231+
Option A: **Merged view with frame labels**
232+
```
233+
│ [main] 1. setup_task ✓ │
234+
│ [main] 2. run_background ✓ │
235+
│ [bg] 2.1. background_monitor ▶ │
236+
│ [main] 3. do_work ⏸ │
237+
│ [bg] 2.2. check_status ○ │
238+
```
239+
240+
Option B: **Frame tabs with separate task lists**
241+
```
242+
[main ⏸] [background ▶]
243+
244+
│ 1. setup_task ✓ │
245+
│ 2. run_background ✓ │
246+
│ 3. do_work ⏸ │ ← current
247+
│ 4. cleanup ○ │
248+
```
249+
250+
Recommendation: Option B for clarity, with visual connection indicators in graph view.
251+
252+
### 5.2 Frame-Specific Actions
253+
254+
Debug controls apply to active frame:
255+
- Continue/Step applies to selected frame
256+
- "Continue All" button for resuming all paused frames
257+
- Frame selector shows which frames are paused
258+
259+
## Implementation Order
260+
261+
### Sprint 1: Core Debug Mode (1-2 days)
262+
1. Add debug mode state to BuilderPage
263+
2. Keep user on builder page after starting debug
264+
3. Add debug controls to BuilderToolbar
265+
4. Add basic frame selector bar
266+
5. Connect to SSE debug events
267+
268+
### Sprint 2: Execution Visualization (1-2 days)
269+
1. Add execution state to TaskListEditor
270+
2. Add execution state to TaskGraphEditor (basic)
271+
3. Breakpoint toggle on task click
272+
4. Breakpoint indicators in list/graph
273+
274+
### Sprint 3: Debug Inspector (1-2 days)
275+
1. Create DebugInspector component
276+
2. Variables tab with tree view
277+
3. Config tab with resolved values
278+
4. Switch right panel contextually
279+
280+
### Sprint 4: Bottom Panel & Polish (1 day)
281+
1. Collapsible debug console
282+
2. JQ expression evaluator
283+
3. Keyboard shortcuts
284+
4. Connection status handling
285+
286+
### Sprint 5: Live Modification (2-3 days)
287+
1. Edit future task configs
288+
2. Add/remove pending tasks
289+
3. Task injection shortcuts
290+
4. Pending modifications tracking
291+
292+
### Sprint 6: Multi-Frame (1-2 days)
293+
1. Frame tabs in task list
294+
2. Frame visualization in graph
295+
3. Frame-specific controls
296+
297+
### Sprint 7: Remove Standalone Debug Page (0.5 day)
298+
1. Remove `/debug/:runId` route from App.tsx
299+
2. Delete `pages/TestDebugger.tsx`
300+
3. Remove standalone debug components no longer needed:
301+
- `components/debug/ShortcutsHelp.tsx` (integrate into builder help)
302+
- Any other components only used by TestDebugger
303+
4. Update BuilderToolbar to no longer redirect
304+
5. Remove lazy import for TestDebugger
305+
6. Clean up unused exports from `components/debug/index.ts`
306+
7. Update any documentation/links referencing `/debug/`
307+
308+
## Component Changes Summary
309+
310+
| Component | Changes |
311+
|-----------|---------|
312+
| `BuilderPage` | Add debug mode state, bottom panel |
313+
| `BuilderToolbar` | Add debug controls, hide/show based on mode |
314+
| `TaskListEditor` | Add execution state, breakpoint indicators |
315+
| `TaskGraphEditor` | Add execution state, visual enhancements |
316+
| `TaskConfigEditor` | Add "pending change" mode |
317+
| `DebugBar` (new) | Frame selector, connection status |
318+
| `DebugInspector` (new) | Variables, config, output tabs |
319+
| `DebugConsole` (new) | Bottom panel with REPL |
320+
321+
## Hooks/Stores
322+
323+
Reuse existing:
324+
- `useDebugStore` - debug session state
325+
- `useDebugEvents` - SSE connection
326+
- `useDebugApi` - API calls
327+
- `useDebugKeyboard` - keyboard shortcuts
328+
329+
New:
330+
- `useBuilderDebug` - builder-specific debug state and actions
331+
332+
## Migration from Separate Debug Page
333+
334+
1. During development (Sprints 1-6): Keep `/debug/:runId` route for testing
335+
2. Default flow changes: debug from builder stays in builder
336+
3. After Sprint 6 verification: Remove standalone debug page entirely (Sprint 7)
337+
4. No "Open in Debug Page" option - all functionality in builder
338+
339+
## Open Questions
340+
341+
1. **Graph complexity**: How to show execution in complex nested/concurrent graphs?
342+
2. **Performance**: Real-time updates for many tasks - throttle/batch?
343+
3. **State persistence**: Save breakpoints with test? Session storage?
344+
4. **Mobile/small screens**: How to handle debug UI on narrow viewports?
345+
346+
## Success Criteria
347+
348+
- [ ] User can start debug session and stay on builder page
349+
- [ ] User can see which task is running/paused in task list
350+
- [ ] User can set breakpoints by clicking on tasks
351+
- [ ] User can see variables when paused
352+
- [ ] User can step through execution with keyboard shortcuts
353+
- [ ] User can modify future tasks while paused
354+
- [ ] Multi-frame tests show correct execution state
355+
- [ ] Standalone `/debug/` page removed - all debug features in builder
356+
- [ ] No dead code or unused debug components remain

0 commit comments

Comments
 (0)