9.7 KiB
VIEW-003: Trigger Chain Debugger - CHANGELOG
Status: ⚠️ UNSTABLE - Known Issues (See KNOWN-ISSUES.md)
Started: January 3, 2026
Completed: January 3, 2026 (initial implementation)
Known Issues Identified: January 4, 2026
Scope: Option B - Phases 1-3 (Core recording + timeline UI)
⚠️ CRITICAL: This feature has known bugs with event deduplication and filtering. See KNOWN-ISSUES.md for details and investigation plan. Feature is marked experimental and may capture inaccurate event data.
Implementation Plan
Phase 1: Recording Infrastructure (2 days)
- 1A: Document existing debug event system ✅
- 1B: Create TriggerChainRecorder (editor-side) ✅
- 1C: Add recording control commands
Phase 2: Chain Builder (1 day)
- 2A: Define chain data model types ✅
- 2B: Implement chain builder utilities ✅
Phase 3: Basic UI (1.5 days)
- 3A: Create panel structure and files ✅
- 3B: Build core UI components ✅
- 3C: Integrate panel into editor ✅
Deferred (After Phase 3)
- ⏸️ Phase 5: Error & Race detection
- ⏸️ Phase 6: Static analysis mode
Progress Log
Session 1: January 3, 2026
Completed Phase 1A: Document existing debug infrastructure ✅
Created dev-docs/reference/DEBUG-INFRASTRUCTURE.md documenting:
- DebugInspector singleton and InspectorsModel
- Event flow from runtime → ViewerConnection → editor
- Connection pulse animation system
- Inspector value tracking
- What we can leverage vs what we need to build
Key findings:
- Connection pulse events already tell us when nodes fire
- Inspector values give us data flowing through connections
- ViewerConnection bridge already exists runtime↔editor
- Need to add: causal tracking, component boundaries, event persistence
Completed Phase 1B: Build TriggerChainRecorder ✅
Created the complete recorder infrastructure:
-
Types (
utils/triggerChain/types.ts)TriggerEventinterface with all event propertiesTriggerEventTypeunion typeRecorderStateandRecorderOptionsinterfaces
-
Recorder (
utils/triggerChain/TriggerChainRecorder.ts)- Singleton class with start/stop/reset methods
- Event capture with max limit (1000 events default)
- Auto-stop timer support
- Helper method
captureConnectionPulse()for bridging
-
Module exports (
utils/triggerChain/index.ts)- Clean public API
-
ViewerConnection integration
- Hooked into
connectiondebugpulsecommand handler - Captures events when recorder is active
- Leverages existing debug infrastructure
- Hooked into
Key achievement: Recorder is now capturing events from the runtime! 🎉
Completed Phase 2A & 2B: Build Chain Builder ✅
Created the complete chain builder system:
-
Chain Types (
utils/triggerChain/chainTypes.ts)TriggerChaininterface with full chain data modelTriggerChainNodefor tree representationEventTimingfor temporal analysisChainStatisticsfor event aggregation
-
Chain Builder (
utils/triggerChain/chainBuilder.ts)buildChainFromEvents()- Main chain construction from raw eventsgroupByComponent()- Group events by componentbuildTree()- Build hierarchical tree structurecalculateTiming()- Compute timing data for each eventcalculateStatistics()- Aggregate chain statistics- Helper utilities for naming and duration formatting
-
Module exports updated
- Exported all chain builder functions
- Exported all chain type definitions
Key achievement: Complete data transformation pipeline from raw events → structured chains! 🎉
Completed Phase 3A, 3B & 3C: Build Complete UI System ✅
Created the full panel UI and integrated it into the editor:
-
Panel Structure (
views/panels/TriggerChainDebuggerPanel/)- Main panel component with recording controls (Start/Stop/Clear)
- Recording indicator with animated pulsing dot
- Empty state, recording state, and timeline container
- Full SCSS styling using design tokens
-
Core UI Components
EventStep.tsx- Individual event display with timeline connectorChainTimeline.tsx- Timeline view with chain header and eventsChainStats.tsx- Statistics panel with event aggregation- Complete SCSS modules for all components using design tokens
-
Editor Integration (
router.setup.ts)- Registered panel in sidebar with experimental flag
- Order 10 (after Project Settings)
- CloudData icon for consistency
- Description about recording and visualizing event chains
Key achievement: Complete, integrated Trigger Chain Debugger panel! 🎉
Phase 3 Complete! ✨
Option B Scope (Phases 1-3) is now complete:
✅ Phase 1: Recording infrastructure with TriggerChainRecorder singleton
✅ Phase 2: Chain builder with full data transformation pipeline
✅ Phase 3: Complete UI with timeline, statistics, and editor integration
What works now:
- Panel appears in sidebar navigation (experimental feature)
- Start/Stop recording controls with animated indicator
- Event capture from runtime preview interactions
- Chain building and analysis
- Timeline visualization of event sequences
- Statistics aggregation by type and component
Ready for testing! Run npm run dev and enable experimental features to see the panel.
Next Steps
Completed:
Create documentation for DebugInspector✅ DoneDesign TriggerChainRecorder data structures✅ DoneBuild recorder with start/stop/reset✅ DoneHook into ViewerConnection✅ DoneCreate basic UI panel with Record/Stop buttons✅ DoneBuild timeline view to display captured events✅ Done
Post-Implementation Enhancements (January 3-4, 2026):
Bug Fixes & Improvements
Issue: Node data showing as "Unknown"
- Problem: All events displayed "Unknown" for node type, label, and component name
- Root cause: ConnectionId format was not colon-separated as assumed, but concatenated UUIDs
- Solution: Implemented regex-based UUID extraction from connectionId strings
- Files modified:
packages/noodl-editor/src/editor/src/utils/triggerChain/TriggerChainRecorder.ts- Changed parsing from
split(':')to regex pattern/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi - Try each extracted UUID with
ProjectModel.instance.findNodeWithId()until match found
- Result: ✅ Events now show correct node types, labels, and component names
Enhancement: Click Navigation
- Added: Click event cards to jump to that component
- Added: Click component chips in stats panel to navigate
- Implementation:
EventStep.tsx: Added click handler usingNodeGraphContextTmp.switchToComponent()ChainStats.tsx: Added click handler to component chips- Navigation disabled while recording (cursor shows pointer only when not recording)
- Result: ✅ Full navigation from timeline to components
Enhancement: Live Timeline Updates
- Problem: Timeline only showed after stopping recording
- Added: Real-time event display during recording
- Implementation:
- Poll
getEvents()every 100ms during recording - Update both event count and timeline display
- Changed UI condition from
hasEvents && !isRecordingtohasEvents
- Poll
- Result: ✅ Timeline updates live as events are captured
Enhancement: UI Improvements
- Changed panel icon from CloudData to Play (more trigger-appropriate)
- Made Topology Map (VIEW-001) experimental-only by adding
experimental: trueflag - Files modified:
packages/noodl-editor/src/editor/src/router.setup.ts
Code Cleanup
- Removed verbose debug logging from TriggerChainRecorder
- Kept essential console warnings for errors
- Files modified:
packages/noodl-editor/src/editor/src/utils/triggerChain/TriggerChainRecorder.ts
Critical Bug Fixes (January 4, 2026)
Bug Fix: Missing Canvas Node Highlighting
- Problem: Clicking events navigated to components but didn't highlight the node on canvas (like XRAY mode)
- Solution: Modified
EventStep.tsxclick handler to find and pass node toswitchToComponent() - Implementation:
- Extract
nodeIdfrom event - Use
component.graph.findNodeWithId(nodeId)to locate node - Pass
nodeoption toNodeGraphContextTmp.switchToComponent() - Pattern matches ComponentXRayPanel's navigation behavior
- Extract
- Files modified:
packages/noodl-editor/src/editor/src/views/panels/TriggerChainDebuggerPanel/components/EventStep.tsx
- Result: ✅ Clicking events now navigates AND highlights the node on canvas
Bug Fix: Event Duplication
- Problem: Recording captured ~40 events for simple button→toast action (expected ~5-10)
- Root cause: ViewerConnection's
connectiondebugpulsehandler fires multiple times per frame - Solution: Added deduplication logic to TriggerChainRecorder
- Implementation:
- Added
recentEventKeysMap to track recent event timestamps - Use connectionId as unique event key
- Skip events that occur within 5ms of same connectionId
- Clear deduplication map on start recording
- Periodic cleanup to prevent map growth
- Added
- Files modified:
packages/noodl-editor/src/editor/src/utils/triggerChain/TriggerChainRecorder.ts
- Result: ✅ Event counts now accurate (5-10 events for simple actions vs 40 before)
Future Enhancements
See: ENHANCEMENT-step-by-step-debugger.md for detailed proposal
Phase 4+ (Deferred):
- Error detection and highlighting
- Race condition detection
- Performance bottleneck identification
- Static analysis mode
- Enhanced filtering and search
- Step-by-step debugger (separate enhancement doc created)