This repository was archived by the owner on Mar 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
This repository was archived by the owner on Mar 2, 2026. It is now read-only.
Major: No Tests for Critical Compiler Functions #11
Copy link
Copy link
Open
Description
Priority
🟠 Major - Quality & Reliability
Locations
src/core/compiler/server/index.ts- E2B compilersrc/core/compiler/client/index.ts- Pyodide compilersrc/core/compiler/client/worker.ts- Web workersrc/api/courses/index.ts- Course API
Problem Description
The most critical and complex functions in the application have zero test coverage:
Untested Critical Functions
-
compileCode()- Executes arbitrary Python code- Two implementations (server/client)
- No tests for success cases
- No tests for error handling
- No tests for timeout scenarios
- No tests for security edge cases
-
compileProject()- Multi-file Python projects- Complex file handling
- No tests for file structure validation
- No tests for entry point resolution
- No tests for import path handling
-
Worker Communication - Message passing
- No tests for pending messages
- No tests for timeout handling
- No tests for worker initialization
-
API Functions
getLesson()- Complex nested data fetchingupdateProgress()- User progress mutationsgetCourseProgress()- Progress calculation
Impact
1. Code Quality Risks
- Refactoring is unsafe (no safety net)
- Bugs may be introduced unnoticed
- regressions occur frequently
2. Security Risks
- Compiler functions execute user code
- No tests for malicious input handling
- No tests for resource exhaustion
3. Development Velocity
- Manual testing required for every change
- Fear of touching complex code
- Slow development cycle
Related Issues
- Critical: .env.example References MongoDB Instead of PostgreSQL #5 - Missing error handling
- Major: Development Playground Exposed to Authenticated Users #10 - No rate limiting (tests needed)
Steps to Fix
Phase 1: Foundation
- Set up test utilities (mock E2B, mock Pyodide)
- Add test coverage reporting
- Configure CI to run tests
Phase 2: Critical Paths
- Add tests for
compileCode()(both implementations) - Add tests for
compileProject()(both implementations) - Add tests for worker communication
Phase 3: API Tests
- Add tests for all API functions in
src/api/courses/ - Add tests for progress tracking
- Add tests for engagement functions
Phase 4: Edge Cases
- Add security-focused tests (malicious code)
- Add performance tests (large inputs)
- Add failure scenario tests (network failures)
Test Metrics Goals
- Current: ~5% (only 2 test files)
- Target: 80%+ coverage on critical paths
- Minimum: All compiler functions fully tested
Additional Context
This is the most dangerous technical debt in the project. The compiler functions are the core value proposition and are completely untested. A single bug here affects all users.
Reactions are currently unavailable