Repository navigation
Add sandboxed Python runner sidecar and /api/run endpoints - #27
Merged
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a sandboxed Python execution sidecar (
runner/),/api/runand/api/run/mazeendpoints inserver.mjs, and frontend Python playground support while keeping existing Java lessons running on CheerpJ during the transition.Changes
runner/: zero-dependency Python 3.12 runner (server.py,maze_solver.py,maze_driver.py,Dockerfile,test_runner.py). Runs each request in a fresh/tmp/run-<id>dir withpython3 -I -B, process-group kill on timeout/overflow, 2sRLIMIT_CPU, 3s wall timeout, 128 MBRLIMIT_AS(Linux),RLIMIT_FSIZE=0, and a 32 KB output cap.server.mjs,.hawk/app.json,scripts/deploy-check.mjs: addsPOST /api/runandPOST /api/run/mazeproxying toRUNNER_URL, withX-Hawk-Slack-User/X-Hawk-Slack-Teamauth checks whenHAWK_SUITE_TRUST_PROXY=true, per-user token-bucket rate limiting (30/min, burst 5), and a concurrency semaphore (4 active, 16 queued).site/: addspythonRuntime.ts,@codemirror/lang-python, and dual Python/Java support inlessons.ts,CodeBlock.tsx,JavaRunner.tsx,LessonView.tsx, andMazePlayground.tsx..github/workflows/ci.yml,.github/workflows/docker.yml,scripts/smoke-runner.sh,docker-compose.dev.yml: tests and publishesghcr.io/frc2713/hawk-learn-runneron the samesha-<commit>tag ashawk-learn.Verification
python3 -m unittest discover -t . -s runner -p "test_*.py" -v(15 tests)npm run lint && npm run buildinsite/IMAGE=hawk-learn-runner:test bash scripts/smoke-runner.shunder--network none --read-only --cap-drop ALL --pids-limit 64 --memory 256mserver.mjs+runner/server.py(401 auth checks,/api/run,/api/run/maze, 429 rate limit)