Clone this repository
For self-hosted knots, clone URLs may differ based on your setup.
Download tar.gz
Critical Issue 1: Remove dual initialization (lifespan + _ensure_initialized)
- Removed _ensure_initialized() function entirely
- Removed call to _ensure_initialized() from websocket_endpoint
- lifespan context manager is now the only init path
- Prevents resource leak from creating Observer instances twice
Critical Issue 2: Fix test_rapid_file_changes_debounced debounce test
- Removed bare 'except Exception: pass' that caught AssertionError
- Rewritten to properly count update messages in a time window
- Test now properly verifies debounce behavior (3 rapid changes -> 1 update)
Important Issue 1: Fix ConnectionManager.disconnect() ValueError
- Added try/except to handle case where websocket already removed by broadcast
- Prevents crash if disconnect() called after broadcast() removed the connection
Important Issue 2: Add exception handling in _on_file_change()
- Wrapped _reassemble() in try/except
- On failure, keeps current_json unchanged (doesn't broadcast incomplete state)
- Prevents timer thread crash that would stop live reload
Important Issue 3: Add exception handling in _reassemble()
- Wrapped source_path.read_text() in try/except
- On file read errors, returns error JSON structure with parse_error message
- Handles FileNotFoundError, OSError, UnicodeDecodeError
Minor Issue 1: Remove unused imports from server.py
- Removed: json, time, PipelineResult
- threading is still needed for DebouncedFileHandler
Minor Issue 2: Remove unused json import from test
- Removed: json
- time is still needed for sleep() and timing
All 608 tests pass. Tests updated to use TestClient context manager so
lifespan is triggered correctly.
Implements Task 1 of Phase 4: Backend Server with WebSocket.
- Create dfgraph/server.py with FastAPI app serving frontend static files
- Implement WebSocket endpoint at /ws that sends graph JSON on connect
- Add file watcher with 300ms debounce that re-assembles graph on changes
- Use ConnectionManager for broadcasting updates to connected clients
- Use lifespan context manager for startup/shutdown
- Support TestClient for unit testing without full event loop
- Issue I1: Remove unused imports (Union, Port, NameRef, PipelineStage, OpcodeCategory) from dfgraph/graph_json.py
- Issue M1: Simplify redundant single-iteration loop in graph_to_json (lines 146-149)
- Issue M2: Remove unused import RegionKind from tests/test_dfgraph_json.py
- Issue M3: Replace conditional guard with proper assertion in test_error_structure
Implements dfgraph/pipeline.py with run_progressive() function that runs
the assembler pipeline (parse -> lower -> resolve -> place -> allocate)
individually, capturing the deepest successful IRGraph even when later
passes fail.
Key features:
- PipelineStage enum tracking progress through pipeline
- PipelineResult dataclass with graph, stage, errors, and parse_error
- Graceful error handling at parse stage (returns PARSE_ERROR)
- Error accumulation at resolve/place/allocate stages (stops but returns graph)
Verifies AC2.1, AC2.2, AC5.2, AC5.3