feat(runner): compile Go and check answers per test group
This commit is contained in:
1 parent
e95c681165
commit
afee564bf4
61 files changed
+2592
-143
No files matched your search
+2
-1
@@ -109,7 +109,8 @@ The ML service answers its errors with the same `Problem` schema. Its `ProblemCo
|
||||
- Data. `RunRequest` carries only the language, the source code, the limits, and the test groups; each group has a label, a visibility (`public` or `hidden`), a checker kind, and tests with an input and an expected output. It has no candidate, account, attempt, task, or company field; `scripts/test_runner_contract.py` checks this for every request schema, together with `additionalProperties: false` on every request object.
|
||||
- Idempotency. `PUT /v1/runs/{run_id}` (`SubmitRun`) takes a random UUID from the backend. A new ID with a free slot starts the run and answers 202, the same ID with the same body returns the current state with 200 without running again, and the same ID with a different body answers 422 `idempotency_key_reused`. Bodies are compared by a SHA-256 fingerprint of the decoded request. When every slot is busy or the process is stopping, the answer is 503 `runner_busy` with `Retry-After`; nothing is stored, and the backend keeps the queue.
|
||||
- Result. `GetRun` returns `state` (`running` or `finished`) and, per group, the outcome `accepted`, `wrong_answer`, `compile_error`, `time_limit_exceeded`, `memory_limit_exceeded`, `output_limit_exceeded`, `runtime_error`, or `infrastructure_failure`, the number of passed tests, the CPU time, and the peak memory. `limit` names the limit that stopped a test (`cpu_time`, `wall_time`, `memory`, `output`, `processes`). Only public tests carry a stderr diagnostic; hidden tests never carry program output.
|
||||
- Checker. The current kinds are `exact` (comparison after normalizing CRLF, trailing spaces of lines, and trailing empty lines) and `tokens` (token sequences split on ASCII whitespace). The `Checker` object grows with new `kind` values and optional parameters, such as a float tolerance.
|
||||
- Languages: `python3` and `go`. Go is compiled in a separate phase with its own limits; a compile error gives `compile_error` and no test runs.
|
||||
- A checker is set per group: `exact` (comparison after normalizing CRLF, trailing spaces of lines, and trailing empty lines), `tokens` (token sequences split on ASCII whitespace), `numbers` (like `tokens`, but numbers are equal within `abs_tolerance` or `rel_tolerance`), and `custom` (`program` with the language and source of the task family checker; it runs in nsjail, reads the files input, expected, and actual, and answers with exit status 0 or 1). The server rejects parameters that do not fit the checker kind.
|
||||
- Errors use the api/core `Problem` shape with a runner-specific `ProblemCode` enum: `validation_failed`, `unauthenticated`, `not_found`, `method_not_allowed`, `payload_too_large`, `unsupported_media_type`, `idempotency_key_reused`, `internal`, and `runner_busy`. `scripts/test_runner_contract.py` checks that the shape matches api/core.
|
||||
|
||||
### Identity: sessions, cookie, and CSRF
|
||||
|
||||
Reference in new issue
Block a user