Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.
This repository was archived by the owner on Mar 2, 2026. It is now read-only.

Major: No Tests for Critical Compiler Functions #11

@AliiiBenn

Description

@AliiiBenn

Priority

🟠 Major - Quality & Reliability

Locations

  • src/core/compiler/server/index.ts - E2B compiler
  • src/core/compiler/client/index.ts - Pyodide compiler
  • src/core/compiler/client/worker.ts - Web worker
  • src/api/courses/index.ts - Course API

Problem Description

The most critical and complex functions in the application have zero test coverage:

Untested Critical Functions

  1. 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
  2. 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
  3. Worker Communication - Message passing

    • No tests for pending messages
    • No tests for timeout handling
    • No tests for worker initialization
  4. API Functions

    • getLesson() - Complex nested data fetching
    • updateProgress() - User progress mutations
    • getCourseProgress() - 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

Steps to Fix

Phase 1: Foundation

  1. Set up test utilities (mock E2B, mock Pyodide)
  2. Add test coverage reporting
  3. Configure CI to run tests

Phase 2: Critical Paths

  1. Add tests for compileCode() (both implementations)
  2. Add tests for compileProject() (both implementations)
  3. Add tests for worker communication

Phase 3: API Tests

  1. Add tests for all API functions in src/api/courses/
  2. Add tests for progress tracking
  3. Add tests for engagement functions

Phase 4: Edge Cases

  1. Add security-focused tests (malicious code)
  2. Add performance tests (large inputs)
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions