You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace Docker sandbox with CheerpJ 3.0 — Java now compiles and runs entirely in the browser via a WASM JVM. Zero server-side containers, no rate limiting needed, scales infinitely.
Remove auth gate on Run button — anyone can run code now that execution is free; analytics still require a session.
Expose testCode to client — Test.java is included in LessonData so the browser executor can pass it to javac/CheerpJ.
New analytics endpoint — POST /api/analytics/run records code_run and exercise_complete events after browser-side execution completes.
Build script — scripts/build-cheerpj-assets.sh compiles ftc-stubs.jar (Java 8 target) and downloads OpenJDK 8 tools.jar (contains javac); run with bun run build:cheerpj.
Architecture
Before: Student clicks Run → POST /api/execute → Docker container → javac + java → JSON
After: Student clicks Run → CheerpJ (WASM JVM in browser) → javac + java → JSON → POST /api/analytics/run
Timing profile (measured):
Phase
Cold (1st click)
Warm (2nd click)
CheerpJ init
~3–8s (background, while reading)
0ms
javac compile
~5.3s
~1.7s
Test execution
~700ms
~700ms
The main cold-start cost is javac lazy-loading classes from tools.jar (18MB) over the network. Subsequent runs in the same session are ~3x faster.
Replaces the server-side Docker sandbox with CheerpJ 3.0, a WASM-based
JVM that compiles and runs Java entirely in the browser. Students no
longer consume server resources when clicking Run — zero containers, no
rate limiting needed.
Key changes:
- Add CheerpJProvider context (loads runtime from CDN, calls cheerpjInit)
- Add cheerpj-executor: writes .java files to CheerpJ VFS, invokes javac
via cheerpjRunMain, captures System.out via console.log interception,
parses JSON test results from TestBase.printResults()
- Expose Test.java to client: add testCode field to LessonData/getLessonData
- Remove auth gate on Run button — execution is now free for all users
- Add POST /api/analytics/run to record code_run / exercise_complete events
- Add scripts/build-cheerpj-assets.sh: compiles ftc-stubs.jar (Java 8
target) and downloads OpenJDK 8 tools.jar (contains javac)
- Remove lib/docker.ts, lib/compiler.ts, app/api/execute/route.ts
- Remove dockerode dependency and serverExternalPackages entry
- Add Playwright browser tests (8 tests, all passing in ~56s)
Timing profile: cold compile ~5s, warm compile ~1.7s, test run ~700ms.
The main cost is javac lazy-loading classes from tools.jar (18MB) on
first use; subsequent runs in the same session are 3x faster.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bun test picked up the Playwright test file and crashed because
test.setTimeout() is a Playwright-only API. Moving browser tests to
e2e/ keeps them separate from the bun test runner.
- Move tests/cheerpj-browser.test.ts → e2e/cheerpj-browser.test.ts
- Add test:e2e script (playwright test e2e/)
- Replace CI workflow: drop Docker sandbox build, run tsc + eslint instead
(execution tests are browser-side and don't run in CI without a display)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
testCodeto client —Test.javais included inLessonDataso the browser executor can pass it to javac/CheerpJ.POST /api/analytics/runrecordscode_runandexercise_completeevents after browser-side execution completes.scripts/build-cheerpj-assets.shcompilesftc-stubs.jar(Java 8 target) and downloads OpenJDK 8tools.jar(contains javac); run withbun run build:cheerpj.Architecture
Timing profile (measured):
The main cold-start cost is javac lazy-loading classes from
tools.jar(18MB) over the network. Subsequent runs in the same session are ~3x faster.Files removed
lib/compiler.ts,lib/docker.ts— Docker orchestrationapp/api/execute/route.ts— server-side execution endpointtests/sandbox.test.ts— Docker integration tests (replaced by Playwright browser tests)Test plan
bun run build:cheerpj— verifypublic/cheerpj/ftc-stubs.jarandpublic/cheerpj/tools.jarare createdbun dev→ open a lesson → click Run with starter code → verify failing test results appear (~6s)npx playwright test tests/cheerpj-browser.test.ts— all 8 tests pass🤖 Generated with Claude Code