You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Goal
Introduce a Debugging Panel component in the Preswald frontend that displays the live app state, tracked variables, and error messages to assist developers in real-time debugging and iteration.
📌 Motivation
Preswald abstracts away much of the complexity in app state management and component interactions. However, when things go wrong (e.g. a workflow fails, a component isn't rendering, or variable values are unexpected), there's currently no visibility into the internal state of the app. This makes debugging opaque and time-consuming.
A built-in debugging panel will:
Surface variables and their current values
Show error messages and stack traces in context
Display execution flow and component states
Improve developer confidence and iteration speed
✅ Acceptance Criteria
Add a toggleable Debug Panel (DebugPanel.jsx) in the frontend (floating bottom-right or sidebar)
Display:
Tracked variables (e.g. from Service.get_state())
Component hierarchy and props
Error messages and stack traces (from WebSocket/API layer)
Current DAG execution status (optional)
Provide a debug=True flag in preswald.toml or environment variable to enable/disable panel
Capture and display exceptions in workflows, Python code, or frontend component resolution
Ensure minimal performance impact when disabled
Style for readability and collapsibility (e.g. Tailwind + accordion view)
🛠 Implementation Plan
1. Backend – Surface State and Errors
In preswald/service.py, expose get_state_snapshot():
Goal
Introduce a Debugging Panel component in the Preswald frontend that displays the live app state, tracked variables, and error messages to assist developers in real-time debugging and iteration.
📌 Motivation
Preswald abstracts away much of the complexity in app state management and component interactions. However, when things go wrong (e.g. a workflow fails, a component isn't rendering, or variable values are unexpected), there's currently no visibility into the internal state of the app. This makes debugging opaque and time-consuming.
A built-in debugging panel will:
✅ Acceptance Criteria
DebugPanel.jsx
) in the frontend (floating bottom-right or sidebar)Service.get_state()
)debug=True
flag inpreswald.toml
or environment variable to enable/disable panel🛠 Implementation Plan
1. Backend – Surface State and Errors
In
preswald/service.py
, exposeget_state_snapshot()
:Update
server_service.py
to stream state snapshots and errors over WebSocket via special__debug__
channel whendebug=True
.2. Frontend – Add Debug Panel UI
Create
frontend/src/components/common/DebugPanel.jsx
:Mount this component inside
App.jsx
only ifdebugMode
istrue
.3. WebSocket Layer – Stream State Updates
Update
websocket.js
to subscribe to__debug__
messages and store in global state. Example:4. Toggle Debug Panel Based on Flag
Allow enabling via:
preswald.toml
:Expose this flag from backend via branding/metadata payload (
/api/config
).📄 Example Output
📚 Documentation Updates
docs/coreconcepts/debugging.mdx
preswald.toml
docs🧪 Testing Plan
debug=false
mode🧩 Files Involved
preswald/service.py
preswald/server_service.py
frontend/src/components/common/DebugPanel.jsx
frontend/src/components/App.jsx
websocket.js
💡 Future Enhancements
The text was updated successfully, but these errors were encountered: