feat(practice): store code submissions and practice states apart from attempts

This commit is contained in:
shira committed 2026-10-11 14:58:04 +03:00
1 parent d5e169e71b
commit 51770eea6c
61 files changed
+8584 -135

No files matched your search

+21
View File
@@ -140,6 +140,27 @@ NotImplemented:
examples:
not_implemented:
$ref: ./examples.yml#/NotImplemented
ServiceUnavailable:
description: >-
The service cannot serve the request now; code service_unavailable.
Retry-After is sent when a retry after that wait can succeed, for example
when a queue is full, and omitted when a retry cannot help soon, for
example when the feature is not enabled on this server.
headers:
Retry-After:
$ref: ./headers.yml#/RetryAfter
content:
application/problem+json:
schema:
$ref: ./schemas.yml#/Problem
examples:
service_unavailable:
summary: A queue is full.
value:
type: urn:lincodex:problem:service_unavailable
title: Service unavailable
status: 503
code: service_unavailable
Problem:
description: >-
Any error response. The body is a Problem whose `status` equals the HTTP
+173
View File
@@ -6837,6 +6837,179 @@ MyOrganizationList:
$ref: '#/MyOrganization'
page:
$ref: '#/PageInfo'
PracticeRunTest:
type: object
description: 'One test of the candidate for a debug run: an input and the output the candidate expects. It is compared with the checker of the task.'
additionalProperties: false
required:
- input
- expected_output
properties:
input:
type: string
maxLength: 10000
expected_output:
type: string
maxLength: 10000
PracticeRunCreate:
type: object
description: Debug run of a practice solution against the public examples of the task and up to ten tests of the candidate. It never runs a hidden check and never changes the practice state, the verdict, or the attempt version. Unknown fields are rejected.
additionalProperties: false
required:
- item_id
- language
- source_code
properties:
item_id:
$ref: '#/AssessmentItemId'
language:
description: One of the `languages` of the practice item, or null when the item offers none.
oneOf:
- $ref: '#/TaskLanguage'
- type: 'null'
source_code:
type: string
minLength: 1
maxLength: 65536
tests:
type: array
maxItems: 10
description: Tests of the candidate, run after the public examples.
items:
$ref: '#/PracticeRunTest'
PracticeRunState:
type: string
description: 'State of a debug run.
- queued: the run waits in the sandbox queue.
- running: the sandbox runs it.
- finished: `result` holds the outcome of the public examples and the tests of the candidate.
- failed: the sandbox infrastructure could not run it, independently of the solution; `failure_reason` is `sandbox_error`. Start a new run.
Adding a value is a contract change.'
enum:
- queued
- running
- finished
- failed
PracticeRunOutcome:
type: string
description: Outcome of a run or one of its tests. Every outcome caused by the solution, such as a compilation error, a crash, or a limit, is a finished run with this outcome; an infrastructure failure is a failed run instead.
enum:
- accepted
- wrong_answer
- compile_error
- time_limit_exceeded
- memory_limit_exceeded
- output_limit_exceeded
- runtime_error
PracticeRunTestSource:
type: string
description: 'Where a test of a debug run comes from: a public example of the task or a test of the candidate.'
enum:
- example
- candidate
PracticeRunTestResult:
type: object
description: Outcome of one evaluated test. The tests of a source stop at the first failed one, so later tests of that source are not listed.
additionalProperties: false
required:
- source
- index
- outcome
- time_ms
- memory_kb
- diagnostic
properties:
source:
$ref: '#/PracticeRunTestSource'
index:
type: integer
format: int32
minimum: 1
maximum: 10
description: Position of the test in its source, from 1.
outcome:
$ref: '#/PracticeRunOutcome'
time_ms:
type: integer
format: int64
minimum: 0
memory_kb:
type: integer
format: int64
minimum: 0
diagnostic:
description: Truncated error output of a failed test, or null.
oneOf:
- type: string
maxLength: 2048
- type: 'null'
PracticeRunResult:
type: object
description: Result of a debug run on the public examples and the tests of the candidate. It never contains a hidden check, its outcome, or the score.
additionalProperties: false
required:
- outcome
- compile_diagnostic
- tests
properties:
outcome:
$ref: '#/PracticeRunOutcome'
compile_diagnostic:
description: The compiler message when `outcome` is `compile_error`, otherwise null.
oneOf:
- type: string
maxLength: 4096
- type: 'null'
tests:
type: array
maxItems: 20
items:
$ref: '#/PracticeRunTestResult'
PracticeRun:
type: object
description: Debug run of a practice solution. It shows only the public examples and the tests of the candidate; hidden checks are never run, listed, or scored by a debug run.
additionalProperties: false
required:
- id
- item_id
- state
- created_at
- finished_at
- failure_reason
- result
properties:
id:
type: string
format: uuid
description: Identifier of the run.
item_id:
$ref: '#/AssessmentItemId'
state:
$ref: '#/PracticeRunState'
created_at:
$ref: '#/Timestamp'
finished_at:
description: Time the run reached `finished` or `failed`, or null.
oneOf:
- $ref: '#/Timestamp'
- type: 'null'
failure_reason:
description: '`sandbox_error` when `state` is `failed`, otherwise null.'
oneOf:
- $ref: '#/PracticeFailureReason'
- type: 'null'
result:
description: The result when `state` is `finished`, otherwise null.
oneOf:
- $ref: '#/PracticeRunResult'
- type: 'null'
PublicationVersion:
type: integer
format: int64
@@ -0,0 +1,189 @@
schemas:
PracticeRunTest:
type: object
description: >-
One test of the candidate for a debug run: an input and the output the
candidate expects. It is compared with the checker of the task.
additionalProperties: false
required:
- input
- expected_output
properties:
input:
type: string
maxLength: 10000
expected_output:
type: string
maxLength: 10000
PracticeRunCreate:
type: object
description: >-
Debug run of a practice solution against the public examples of the task
and up to ten tests of the candidate. It never runs a hidden check and
never changes the practice state, the verdict, or the attempt version.
Unknown fields are rejected.
additionalProperties: false
required:
- item_id
- language
- source_code
properties:
item_id:
$ref: "./assessment_schemas.yml#/schemas/AssessmentItemId"
language:
description: One of the `languages` of the practice item, or null when the item offers none.
oneOf:
- $ref: "./catalog_schemas.yml#/schemas/TaskLanguage"
- type: "null"
source_code:
type: string
minLength: 1
maxLength: 65536
tests:
type: array
maxItems: 10
description: Tests of the candidate, run after the public examples.
items:
$ref: "#/schemas/PracticeRunTest"
PracticeRunState:
type: string
description: |-
State of a debug run.
- queued: the run waits in the sandbox queue.
- running: the sandbox runs it.
- finished: `result` holds the outcome of the public examples and the tests of the candidate.
- failed: the sandbox infrastructure could not run it, independently of the solution; `failure_reason` is `sandbox_error`. Start a new run.
Adding a value is a contract change.
enum:
- queued
- running
- finished
- failed
PracticeRunOutcome:
type: string
description: >-
Outcome of a run or one of its tests. Every outcome caused by the
solution, such as a compilation error, a crash, or a limit, is a
finished run with this outcome; an infrastructure failure is a failed
run instead.
enum:
- accepted
- wrong_answer
- compile_error
- time_limit_exceeded
- memory_limit_exceeded
- output_limit_exceeded
- runtime_error
PracticeRunTestSource:
type: string
description: >-
Where a test of a debug run comes from: a public example of the task or
a test of the candidate.
enum:
- example
- candidate
PracticeRunTestResult:
type: object
description: >-
Outcome of one evaluated test. The tests of a source stop at the first
failed one, so later tests of that source are not listed.
additionalProperties: false
required:
- source
- index
- outcome
- time_ms
- memory_kb
- diagnostic
properties:
source:
$ref: "#/schemas/PracticeRunTestSource"
index:
type: integer
format: int32
minimum: 1
maximum: 10
description: Position of the test in its source, from 1.
outcome:
$ref: "#/schemas/PracticeRunOutcome"
time_ms:
type: integer
format: int64
minimum: 0
memory_kb:
type: integer
format: int64
minimum: 0
diagnostic:
description: Truncated error output of a failed test, or null.
oneOf:
- type: string
maxLength: 2048
- type: "null"
PracticeRunResult:
type: object
description: >-
Result of a debug run on the public examples and the tests of the
candidate. It never contains a hidden check, its outcome, or the score.
additionalProperties: false
required:
- outcome
- compile_diagnostic
- tests
properties:
outcome:
$ref: "#/schemas/PracticeRunOutcome"
compile_diagnostic:
description: The compiler message when `outcome` is `compile_error`, otherwise null.
oneOf:
- type: string
maxLength: 4096
- type: "null"
tests:
type: array
maxItems: 20
items:
$ref: "#/schemas/PracticeRunTestResult"
PracticeRun:
type: object
description: >-
Debug run of a practice solution. It shows only the public examples and
the tests of the candidate; hidden checks are never run, listed, or
scored by a debug run.
additionalProperties: false
required:
- id
- item_id
- state
- created_at
- finished_at
- failure_reason
- result
properties:
id:
type: string
format: uuid
description: Identifier of the run.
item_id:
$ref: "./assessment_schemas.yml#/schemas/AssessmentItemId"
state:
$ref: "#/schemas/PracticeRunState"
created_at:
$ref: "./common_schemas.yml#/schemas/Timestamp"
finished_at:
description: Time the run reached `finished` or `failed`, or null.
oneOf:
- $ref: "./common_schemas.yml#/schemas/Timestamp"
- type: "null"
failure_reason:
description: "`sandbox_error` when `state` is `failed`, otherwise null."
oneOf:
- $ref: "./assessment_schemas.yml#/schemas/PracticeFailureReason"
- type: "null"
result:
description: The result when `state` is `finished`, otherwise null.
oneOf:
- $ref: "#/schemas/PracticeRunResult"
- type: "null"