Clone this repository
For self-hosted knots, clone URLs may differ based on your setup.
Download tar.gz
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
**Critical Issue 1**: Remove generated bundle.js from tracking
- Deleted dfgraph/frontend/dist/bundle.js (1.2MB)
- File was committed despite .gitignore entry
- Now properly ignored by .gitignore
**Critical Issue 2**: Remove nix-profile symlinks from tracking
- Deleted nix-profile and nix-profile-1-link
- These were machine-specific environment artifacts
- Added nix-profile* to .gitignore to prevent future commits
**Important Issue 3**: Verify tokens.py typing imports
- Kept from typing import Optional, List on line 2
- These imports are required by type hints in SMToken, IOToken
- Confirmed by test suite: 479 tests pass with imports
**Important Issue 4**: TypeScript declaration for cytoscape-dagre
- Created dfgraph/frontend/src/cytoscape-dagre.d.ts
- Resolves TS7016 "Could not find declaration file" error
- Allows TypeScript strict mode to handle untyped import
**Minor Issue 5**: Make frontend package-lock.json reproducible
- Changed .gitignore: package-lock.json → /package-lock.json
- Now only ignores root package-lock.json
- Added dfgraph/frontend/package-lock.json to version control
- Ensures reproducible frontend builds
All tests pass (479 passed in 3.46s)