feat(practice): store code submissions and practice states apart from attempts
This commit is contained in:
1 parent
d5e169e71b
commit
51770eea6c
61 files changed
+8584
-135
No files matched your search
@@ -0,0 +1,64 @@
|
||||
get:
|
||||
operationId: GetMyAssessmentPracticeRun
|
||||
summary: Read a debug run of a practice solution.
|
||||
description: |-
|
||||
Requires the session cookie of a candidate account. Returns the state of a debug run started with CreateMyAssessmentPracticeRun and, once it is `finished`, the outcome of the public examples and of the tests of the candidate. It never contains a hidden check, its outcome, the score, or the source. This GET is read-only.
|
||||
|
||||
A run of another candidate's attempt, a run of another attempt, and an unknown identifier all answer 404 not_found. The graded solution submitted with SubmitMyAssessmentAnswer is not a debug run and is not readable here.
|
||||
security:
|
||||
- sessionCookie: []
|
||||
tags:
|
||||
- assessment
|
||||
parameters:
|
||||
- $ref: ../components/parameters.yml#/AssessmentAttemptId
|
||||
- name: run_id
|
||||
in: path
|
||||
required: true
|
||||
description: Identifier of a debug run of this attempt.
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
responses:
|
||||
"200":
|
||||
description: The run.
|
||||
headers:
|
||||
Cache-Control:
|
||||
$ref: ../components/headers.yml#/CacheControlNoStore
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../components/schemas.yml#/PracticeRun
|
||||
examples:
|
||||
finished:
|
||||
summary: A finished run whose test of the candidate failed.
|
||||
value:
|
||||
id: 0192a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a70
|
||||
item_id: 0192a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a60
|
||||
state: finished
|
||||
created_at: "2026-10-05T09:30:00Z"
|
||||
finished_at: "2026-10-05T09:30:04Z"
|
||||
failure_reason: null
|
||||
result:
|
||||
outcome: wrong_answer
|
||||
compile_diagnostic: null
|
||||
tests:
|
||||
- source: example
|
||||
index: 1
|
||||
outcome: accepted
|
||||
time_ms: 21
|
||||
memory_kb: 9216
|
||||
diagnostic: null
|
||||
- source: candidate
|
||||
index: 1
|
||||
outcome: wrong_answer
|
||||
time_ms: 20
|
||||
memory_kb: 9180
|
||||
diagnostic: null
|
||||
"401":
|
||||
$ref: ../components/responses.yml#/Unauthenticated
|
||||
"403":
|
||||
$ref: ../components/responses.yml#/Forbidden
|
||||
"404":
|
||||
$ref: ../components/responses.yml#/NotFound
|
||||
default:
|
||||
$ref: ../components/responses.yml#/Problem
|
||||
@@ -0,0 +1,76 @@
|
||||
post:
|
||||
operationId: CreateMyAssessmentPracticeRun
|
||||
summary: Start a debug run of a practice solution.
|
||||
description: |-
|
||||
Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The body names the practice item of the attempt and carries the language, the source, and up to ten tests of the candidate.
|
||||
|
||||
A debug run executes the solution in the isolated sandbox against the public examples of the task and the tests of the candidate only. It never runs, lists, or scores a hidden check, and it changes neither the practice state, the verdict, nor the attempt version; the graded solution is submitted with SubmitMyAssessmentAnswer. The run is stored with its own identifier and executed asynchronously: the response is 202 with the run `queued`, and the client polls GetMyAssessmentPracticeRun. The source is never echoed.
|
||||
|
||||
The practice must be the current item: the attempt is in `practice_pending` for the main practice or `additional_practice_pending` for the additional one, and its deadline has not passed. Otherwise the server answers 409 state_conflict.
|
||||
|
||||
Availability. When code practice is not enabled on this server, the server answers 503 service_unavailable and stores nothing.
|
||||
|
||||
Repeats. A retry with the same Idempotency-Key and body within 24 hours returns the stored run in its current state with 202, without starting another run. A different body with the same key answers 422 idempotency_key_reused. Refusals (400, 404, 409, 503) are not stored under the key and are evaluated again.
|
||||
|
||||
Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden), the availability of code practice (503), the Idempotency-Key (422, replay), the attempt and the practice (404 not_found for an unknown attempt or item, or one of another candidate), the state (409), then the solution against the item (400 with a pointer such as `/language` or `/source_code`).
|
||||
security:
|
||||
- sessionCookie: []
|
||||
sessionCsrf: []
|
||||
tags:
|
||||
- assessment
|
||||
parameters:
|
||||
- $ref: ../components/parameters.yml#/AssessmentAttemptId
|
||||
- $ref: ../components/parameters.yml#/IdempotencyKey
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../components/schemas.yml#/PracticeRunCreate
|
||||
examples:
|
||||
run:
|
||||
summary: A Python solution with one test of the candidate.
|
||||
value:
|
||||
item_id: 0192a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a60
|
||||
language: python
|
||||
source_code: "print(sum(map(int, input().split())))\n"
|
||||
tests:
|
||||
- input: "2 3\n"
|
||||
expected_output: "5\n"
|
||||
responses:
|
||||
"202":
|
||||
description: The run is queued, or this request was already accepted and the stored run is returned.
|
||||
headers:
|
||||
Cache-Control:
|
||||
$ref: ../components/headers.yml#/CacheControlNoStore
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../components/schemas.yml#/PracticeRun
|
||||
examples:
|
||||
queued:
|
||||
summary: A queued run.
|
||||
value:
|
||||
id: 0192a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a70
|
||||
item_id: 0192a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a60
|
||||
state: queued
|
||||
created_at: "2026-10-05T09:30:00Z"
|
||||
finished_at: null
|
||||
failure_reason: null
|
||||
result: null
|
||||
"400":
|
||||
$ref: ../components/responses.yml#/ValidationFailed
|
||||
"401":
|
||||
$ref: ../components/responses.yml#/Unauthenticated
|
||||
"403":
|
||||
$ref: ../components/responses.yml#/CsrfCheckFailedOrForbidden
|
||||
"404":
|
||||
$ref: ../components/responses.yml#/NotFound
|
||||
"409":
|
||||
$ref: ../components/responses.yml#/StateConflict
|
||||
"422":
|
||||
$ref: ../components/responses.yml#/UnprocessableContent
|
||||
"503":
|
||||
$ref: ../components/responses.yml#/ServiceUnavailable
|
||||
default:
|
||||
$ref: ../components/responses.yml#/Problem
|
||||
Reference in new issue
Block a user