feat(runner): add the own code runner contract, client and nsjail service

This commit is contained in:
shira committed 2026-10-11 08:23:42 +03:00
1 parent 5e1db37746
commit cdf6bcbb91
109 files changed
+24084 -28

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
# Code runner
[Русский](README.md) | English
A separate Go service that runs untrusted candidate code in nsjail and checks it against public and hidden tests. It currently supports Python 3 and the `exact` and `tokens` checkers. The backend calls it through the internal `api/runner/` contract over TLS with a bearer token; no backend use case calls it yet.
- `cmd/runner/` is the entry point and the container `healthcheck`.
- `internal/sandbox/` holds nsjail, cgroup v2, seccomp, run directories, and stopping on limits.
- `internal/judge/` holds languages, the syntax check step, and test and group outcomes.
- `internal/checker/` holds the checker interface and the `exact` and `tokens` comparisons.
- `internal/jobs/` keeps runs in memory, makes them idempotent by run ID, and bounds concurrent runs.
- `internal/server/` is the HTTP API on the generated ogen server (`internal/api/`, from `codegen/ogen.yml`).
- `internal/isolationtest/` and `testdata/hostile/` are the isolation tests and the shared hostile programs.
From the repository root, `make -C runner check` runs formatting, build, unit tests, the generated code check, and lint; `make -C runner test-sandbox` builds the image and runs the isolation tests in a privileged dev container. Local start: `make -C deploy runner-dev-up` (development only).
Production: the service runs only in the dedicated runner VM, never on the core host. More: [deployment](../docs/en/DEPLOY.md#code-runner), [architecture](../docs/en/ARCHITECTURE.md#code-runner), and [checks](../docs/en/TESTING.md#code-runner-tests).