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
@@ -44,6 +44,8 @@ import type {
|
||||
NumberItemContent,
|
||||
OrderItemContent,
|
||||
PracticeItemContent,
|
||||
PracticeRun,
|
||||
PracticeRunResult,
|
||||
PracticeVerdict,
|
||||
StringItemContent
|
||||
} from '../../schemas';
|
||||
@@ -181,6 +183,14 @@ export const getSubmitMyAssessmentAnswerResponseAssessmentExpressAttemptMock = (
|
||||
|
||||
export const getSubmitMyAssessmentAnswerResponseMock = (): AssessmentAttempt => (faker.helpers.arrayElement([{...getSubmitMyAssessmentAnswerResponseAssessmentQualifiedAttemptMock()},{...getSubmitMyAssessmentAnswerResponseAssessmentCorrectiveAttemptMock()},{...getSubmitMyAssessmentAnswerResponseAssessmentExpressAttemptMock()},]))
|
||||
|
||||
export const getCreateMyAssessmentPracticeRunResponsePracticeRunResultMock = (overrideResponse: Partial<PracticeRunResult> = {}): PracticeRunResult => ({...{outcome: faker.helpers.arrayElement(['accepted','wrong_answer','compile_error','time_limit_exceeded','memory_limit_exceeded','output_limit_exceeded','runtime_error'] as const), compile_diagnostic: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 4096}}),null,]), tests: Array.from({ length: faker.number.int({min: 1, max: 20}) }, (_, i) => i + 1).map(() => ({source: faker.helpers.arrayElement(['example','candidate'] as const), index: faker.number.int({min: 1, max: 10}), outcome: faker.helpers.arrayElement(['accepted','wrong_answer','compile_error','time_limit_exceeded','memory_limit_exceeded','output_limit_exceeded','runtime_error'] as const), time_ms: faker.number.int({min: 0}), memory_kb: faker.number.int({min: 0}), diagnostic: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 2048}}),null,])}))}, ...overrideResponse});
|
||||
|
||||
export const getCreateMyAssessmentPracticeRunResponseMock = (overrideResponse: Partial<Extract<PracticeRun, object>> = {}): PracticeRun => ({id: faker.string.uuid(), item_id: faker.string.uuid(), state: faker.helpers.arrayElement(['queued','running','finished','failed'] as const), created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', finished_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), failure_reason: faker.helpers.arrayElement([faker.helpers.arrayElement(['sandbox_busy','sandbox_error'] as const),null,]), result: faker.helpers.arrayElement([{...getCreateMyAssessmentPracticeRunResponsePracticeRunResultMock()},null,]), ...overrideResponse})
|
||||
|
||||
export const getGetMyAssessmentPracticeRunResponsePracticeRunResultMock = (overrideResponse: Partial<PracticeRunResult> = {}): PracticeRunResult => ({...{outcome: faker.helpers.arrayElement(['accepted','wrong_answer','compile_error','time_limit_exceeded','memory_limit_exceeded','output_limit_exceeded','runtime_error'] as const), compile_diagnostic: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 4096}}),null,]), tests: Array.from({ length: faker.number.int({min: 1, max: 20}) }, (_, i) => i + 1).map(() => ({source: faker.helpers.arrayElement(['example','candidate'] as const), index: faker.number.int({min: 1, max: 10}), outcome: faker.helpers.arrayElement(['accepted','wrong_answer','compile_error','time_limit_exceeded','memory_limit_exceeded','output_limit_exceeded','runtime_error'] as const), time_ms: faker.number.int({min: 0}), memory_kb: faker.number.int({min: 0}), diagnostic: faker.helpers.arrayElement([faker.string.alpha({length: {min: 10, max: 2048}}),null,])}))}, ...overrideResponse});
|
||||
|
||||
export const getGetMyAssessmentPracticeRunResponseMock = (overrideResponse: Partial<Extract<PracticeRun, object>> = {}): PracticeRun => ({id: faker.string.uuid(), item_id: faker.string.uuid(), state: faker.helpers.arrayElement(['queued','running','finished','failed'] as const), created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', finished_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), failure_reason: faker.helpers.arrayElement([faker.helpers.arrayElement(['sandbox_busy','sandbox_error'] as const),null,]), result: faker.helpers.arrayElement([{...getGetMyAssessmentPracticeRunResponsePracticeRunResultMock()},null,]), ...overrideResponse})
|
||||
|
||||
export const getFinalizeMyAssessmentAttemptResponseAssessmentSessionsMock = (overrideResponse: Partial<AssessmentSessions> = {}): AssessmentSessions => ({...{used: faker.number.int({min: 1, max: 10}), max: faker.number.int({min: 1, max: 10}), idle_timeout_seconds: faker.number.int({min: 60, max: 86400})}, ...overrideResponse});
|
||||
|
||||
export const getFinalizeMyAssessmentAttemptResponseChoiceItemContentMock = (overrideResponse: Partial<ChoiceItemContent> = {}): ChoiceItemContent => ({...{format: faker.helpers.arrayElement(['choice'] as const), options: Array.from({ length: faker.number.int({min: 2, max: 10}) }, (_, i) => i + 1).map(() => ({id: fakeFromPattern("^[A-Za-z0-9_-]+$", {minLength: 1, maxLength: 32}), text: faker.string.alpha({length: {min: 1, max: 2000}})})), multiple: faker.datatype.boolean()}, ...overrideResponse});
|
||||
@@ -352,6 +362,30 @@ export const getSubmitMyAssessmentAnswerMockHandler = (overrideResponse?: Assess
|
||||
}, options)
|
||||
}
|
||||
|
||||
export const getCreateMyAssessmentPracticeRunMockHandler = (overrideResponse?: PracticeRun | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<PracticeRun> | PracticeRun), options?: RequestHandlerOptions) => {
|
||||
return http.post('*/api/v1/me/assessment-attempts/:attemptId/practice-runs', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
|
||||
|
||||
|
||||
return HttpResponse.json(overrideResponse !== undefined
|
||||
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
||||
: getCreateMyAssessmentPracticeRunResponseMock(),
|
||||
{ status: 202
|
||||
})
|
||||
}, options)
|
||||
}
|
||||
|
||||
export const getGetMyAssessmentPracticeRunMockHandler = (overrideResponse?: PracticeRun | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<PracticeRun> | PracticeRun), options?: RequestHandlerOptions) => {
|
||||
return http.get('*/api/v1/me/assessment-attempts/:attemptId/practice-runs/:runId', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
|
||||
|
||||
|
||||
return HttpResponse.json(overrideResponse !== undefined
|
||||
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
|
||||
: getGetMyAssessmentPracticeRunResponseMock(),
|
||||
{ status: 200
|
||||
})
|
||||
}, options)
|
||||
}
|
||||
|
||||
export const getFinalizeMyAssessmentAttemptMockHandler = (overrideResponse?: AssessmentAttempt | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<AssessmentAttempt> | AssessmentAttempt), options?: RequestHandlerOptions) => {
|
||||
return http.post('*/api/v1/me/assessment-attempts/:attemptId/finalize', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
|
||||
|
||||
@@ -387,6 +421,8 @@ export const getAssessmentMock = () => [
|
||||
getHoldMyAssessmentWorkSessionMockHandler(),
|
||||
getReleaseMyAssessmentWorkSessionMockHandler(),
|
||||
getSubmitMyAssessmentAnswerMockHandler(),
|
||||
getCreateMyAssessmentPracticeRunMockHandler(),
|
||||
getGetMyAssessmentPracticeRunMockHandler(),
|
||||
getFinalizeMyAssessmentAttemptMockHandler(),
|
||||
getGetMyAssessmentResultMockHandler()
|
||||
]
|
||||
@@ -39,9 +39,12 @@ import type {
|
||||
AssessmentSignalReceipt,
|
||||
AssessmentWorkSession,
|
||||
CreateMyAssessmentAttemptHeaders,
|
||||
CreateMyAssessmentPracticeRunHeaders,
|
||||
FinalizeMyAssessmentAttemptHeaders,
|
||||
HoldMyAssessmentWorkSessionHeaders,
|
||||
ListMyAssessmentResultsParams,
|
||||
PracticeRun,
|
||||
PracticeRunCreate,
|
||||
Problem,
|
||||
RecordMyAssessmentAttemptSignalsHeaders,
|
||||
ReleaseMyAssessmentWorkSessionHeaders,
|
||||
@@ -1176,7 +1179,218 @@ export const useSubmitMyAssessmentAnswer = <TError = ErrorType<Problem>,
|
||||
> => {
|
||||
return useMutation(getSubmitMyAssessmentAnswerMutationOptions(options), queryClient);
|
||||
}
|
||||
export const getFinalizeMyAssessmentAttemptUrl = (attemptId: string,) => {
|
||||
export const getCreateMyAssessmentPracticeRunUrl = (attemptId: string,) => {
|
||||
|
||||
|
||||
|
||||
|
||||
return `/api/v1/me/assessment-attempts/${attemptId}/practice-runs`
|
||||
}
|
||||
|
||||
/**
|
||||
* 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`).
|
||||
* @summary Start a debug run of a practice solution.
|
||||
*/
|
||||
export const createMyAssessmentPracticeRun = async (attemptId: string,
|
||||
practiceRunCreate: PracticeRunCreate,
|
||||
headers: CreateMyAssessmentPracticeRunHeaders, options?: Parameters<typeof apiRequest>[1]): Promise<PracticeRun> => {
|
||||
|
||||
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
|
||||
if (!h) return {};
|
||||
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
||||
if (Symbol.iterator in h) {
|
||||
return Object.fromEntries(
|
||||
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
|
||||
);
|
||||
}
|
||||
const headers: Record<string, string | readonly string[]> = {};
|
||||
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
|
||||
if (value !== undefined) headers[name] = value;
|
||||
}
|
||||
return headers;
|
||||
};
|
||||
return apiRequest<PracticeRun>(getCreateMyAssessmentPracticeRunUrl(attemptId),
|
||||
{
|
||||
...options,
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json',...headers, ...getHeaders(options?.headers) },
|
||||
body: JSON.stringify(practiceRunCreate)
|
||||
}
|
||||
);}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const getCreateMyAssessmentPracticeRunMutationKey = () => ['createMyAssessmentPracticeRun'] as const;
|
||||
|
||||
export const getCreateMyAssessmentPracticeRunMutationOptions = <TError = ErrorType<Problem>,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createMyAssessmentPracticeRun>>, TError,CreateMyAssessmentPracticeRunMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
|
||||
): UseMutationOptions<Awaited<ReturnType<typeof createMyAssessmentPracticeRun>>, TError,CreateMyAssessmentPracticeRunMutationVariables, TContext> => {
|
||||
|
||||
const mutationKey = getCreateMyAssessmentPracticeRunMutationKey();
|
||||
const {mutation: mutationOptions, request: requestOptions} = options ?
|
||||
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
||||
options
|
||||
: {...options, mutation: {...options.mutation, mutationKey}}
|
||||
: {mutation: { mutationKey, }, request: undefined};
|
||||
|
||||
|
||||
|
||||
|
||||
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createMyAssessmentPracticeRun>>, CreateMyAssessmentPracticeRunMutationVariables> = (props) => {
|
||||
const {attemptId,data,headers} = props ?? {};
|
||||
|
||||
return createMyAssessmentPracticeRun(attemptId,data,headers,requestOptions)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { mutationFn, ...mutationOptions }}
|
||||
|
||||
export type CreateMyAssessmentPracticeRunMutationResult = NonNullable<Awaited<ReturnType<typeof createMyAssessmentPracticeRun>>>
|
||||
export type CreateMyAssessmentPracticeRunMutationBody = PracticeRunCreate
|
||||
export type CreateMyAssessmentPracticeRunMutationError = ErrorType<Problem>
|
||||
export type CreateMyAssessmentPracticeRunMutationVariables = {attemptId: string;data: PracticeRunCreate;headers: CreateMyAssessmentPracticeRunHeaders}
|
||||
|
||||
/**
|
||||
* @summary Start a debug run of a practice solution.
|
||||
*/
|
||||
export const useCreateMyAssessmentPracticeRun = <TError = ErrorType<Problem>,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createMyAssessmentPracticeRun>>, TError,CreateMyAssessmentPracticeRunMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
|
||||
, queryClient?: QueryClient): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createMyAssessmentPracticeRun>>,
|
||||
TError,
|
||||
CreateMyAssessmentPracticeRunMutationVariables,
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(getCreateMyAssessmentPracticeRunMutationOptions(options), queryClient);
|
||||
}
|
||||
export const getGetMyAssessmentPracticeRunUrl = (attemptId: string,
|
||||
runId: string,) => {
|
||||
|
||||
|
||||
|
||||
|
||||
return `/api/v1/me/assessment-attempts/${attemptId}/practice-runs/${runId}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @summary Read a debug run of a practice solution.
|
||||
*/
|
||||
export const getMyAssessmentPracticeRun = async (attemptId: string,
|
||||
runId: string, options?: Parameters<typeof apiRequest>[1]): Promise<PracticeRun> => {
|
||||
|
||||
return apiRequest<PracticeRun>(getGetMyAssessmentPracticeRunUrl(attemptId,runId),
|
||||
{
|
||||
...options,
|
||||
method: 'GET'
|
||||
|
||||
|
||||
}
|
||||
);}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const getGetMyAssessmentPracticeRunQueryKey = (attemptId: string,
|
||||
runId: string,) => {
|
||||
return [
|
||||
`/api/v1/me/assessment-attempts/${attemptId}/practice-runs/${runId}`
|
||||
] as const;
|
||||
}
|
||||
|
||||
|
||||
export const getGetMyAssessmentPracticeRunQueryOptions = <TData = Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>, TError = ErrorType<Problem>>(attemptId: string,
|
||||
runId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
|
||||
) => {
|
||||
|
||||
const {query: queryOptions, request: requestOptions} = options ?? {};
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getGetMyAssessmentPracticeRunQueryKey(attemptId,runId);
|
||||
|
||||
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>> = ({ signal }) => getMyAssessmentPracticeRun(attemptId,runId, { signal, ...requestOptions });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { queryKey, queryFn, enabled: attemptId !== null && attemptId !== undefined && runId !== null && runId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
}
|
||||
|
||||
export type GetMyAssessmentPracticeRunQueryResult = NonNullable<Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>>
|
||||
export type GetMyAssessmentPracticeRunQueryError = ErrorType<Problem>
|
||||
|
||||
|
||||
export function useGetMyAssessmentPracticeRun<TData = Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>, TError = ErrorType<Problem>>(
|
||||
attemptId: string,
|
||||
runId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>, TError, TData>> & Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof apiRequest>}
|
||||
, queryClient?: QueryClient
|
||||
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useGetMyAssessmentPracticeRun<TData = Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>, TError = ErrorType<Problem>>(
|
||||
attemptId: string,
|
||||
runId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>, TError, TData>> & Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof apiRequest>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useGetMyAssessmentPracticeRun<TData = Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>, TError = ErrorType<Problem>>(
|
||||
attemptId: string,
|
||||
runId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
/**
|
||||
* @summary Read a debug run of a practice solution.
|
||||
*/
|
||||
|
||||
export function useGetMyAssessmentPracticeRun<TData = Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>, TError = ErrorType<Problem>>(
|
||||
attemptId: string,
|
||||
runId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentPracticeRun>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
||||
|
||||
const queryOptions = getGetMyAssessmentPracticeRunQueryOptions(attemptId,runId,options)
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
return withQueryKey(query, queryOptions.queryKey);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const getFinalizeMyAssessmentAttemptUrl = (attemptId: string,) => {
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const createMyAssessmentPracticeRunBodySourceCodeMax = 65536;
|
||||
|
||||
export const createMyAssessmentPracticeRunBodyTestsItemInputMax = 10000;
|
||||
|
||||
export const createMyAssessmentPracticeRunBodyTestsItemExpectedOutputMax = 10000;
|
||||
|
||||
export const createMyAssessmentPracticeRunBodyTestsMax = 10;
|
||||
|
||||
|
||||
export const CreateMyAssessmentPracticeRunBody = zod.object({
|
||||
"item_id": zod.uuid().describe('Identifier of an item instance in one attempt. It identifies the fixed variant served to this candidate and reveals neither the task family, its version, nor the variant seed.'),
|
||||
"language": zod.union([zod.enum(['python', 'go']).describe('Programming language in which assessment tasks of a specialization are offered and solved. It is the language of the task bank, not the candidate\'s platform stack, and it never forms a separate category. Only banks that offer a choice of language define task languages; the first Backend bank offers Python and Go. Adding a value is a contract change.'),zod.null()]).describe('One of the `languages` of the practice item, or null when the item offers none.'),
|
||||
"source_code": zod.string().min(1).max(createMyAssessmentPracticeRunBodySourceCodeMax),
|
||||
"tests": zod.array(zod.object({
|
||||
"input": zod.string().max(createMyAssessmentPracticeRunBodyTestsItemInputMax),
|
||||
"expected_output": zod.string().max(createMyAssessmentPracticeRunBodyTestsItemExpectedOutputMax)
|
||||
}).describe('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.')).max(createMyAssessmentPracticeRunBodyTestsMax).exactOptional().describe('Tests of the candidate, run after the public examples.')
|
||||
}).describe('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.')
|
||||
|
||||
export type CreateMyAssessmentPracticeRunBody = zod.input<typeof CreateMyAssessmentPracticeRunBody>;
|
||||
export type CreateMyAssessmentPracticeRunBodyOutput = zod.output<typeof CreateMyAssessmentPracticeRunBody>;
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const createMyAssessmentPracticeRunHeadersIdempotencyKeyMax = 255;
|
||||
|
||||
|
||||
export const createMyAssessmentPracticeRunHeadersIdempotencyKeyRegExp = new RegExp('^[A-Za-z0-9._:-]+$');
|
||||
|
||||
export const CreateMyAssessmentPracticeRunHeaders = zod.object({
|
||||
"Idempotency-Key": zod.string().min(1).max(createMyAssessmentPracticeRunHeadersIdempotencyKeyMax).regex(createMyAssessmentPracticeRunHeadersIdempotencyKeyRegExp)
|
||||
})
|
||||
|
||||
export type CreateMyAssessmentPracticeRunHeaders = zod.input<typeof CreateMyAssessmentPracticeRunHeaders>;
|
||||
export type CreateMyAssessmentPracticeRunHeadersOutput = zod.output<typeof CreateMyAssessmentPracticeRunHeaders>;
|
||||
@@ -78,6 +78,8 @@ export * from './configurationAnswer.zod';
|
||||
export * from './configurationItemContent.zod';
|
||||
export * from './createMyAssessmentAttemptBody.zod';
|
||||
export * from './createMyAssessmentAttemptHeaders.zod';
|
||||
export * from './createMyAssessmentPracticeRunBody.zod';
|
||||
export * from './createMyAssessmentPracticeRunHeaders.zod';
|
||||
export * from './finalizeMyAssessmentAttemptBody.zod';
|
||||
export * from './finalizeMyAssessmentAttemptHeaders.zod';
|
||||
export * from './findErrorAnswer.zod';
|
||||
@@ -95,6 +97,14 @@ export * from './practiceFailureReason.zod';
|
||||
export * from './practiceGroupResult.zod';
|
||||
export * from './practiceItemContent.zod';
|
||||
export * from './practiceKind.zod';
|
||||
export * from './practiceRun.zod';
|
||||
export * from './practiceRunCreate.zod';
|
||||
export * from './practiceRunOutcome.zod';
|
||||
export * from './practiceRunResult.zod';
|
||||
export * from './practiceRunState.zod';
|
||||
export * from './practiceRunTest.zod';
|
||||
export * from './practiceRunTestResult.zod';
|
||||
export * from './practiceRunTestSource.zod';
|
||||
export * from './practiceStatus.zod';
|
||||
export * from './practiceVerdict.zod';
|
||||
export * from './recordMyAssessmentAttemptSignalsBody.zod';
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const practiceRunResultOneCompileDiagnosticOneMax = 4096;
|
||||
|
||||
export const practiceRunResultOneTestsItemIndexMax = 10;
|
||||
|
||||
export const practiceRunResultOneTestsItemTimeMsMin = 0;
|
||||
|
||||
export const practiceRunResultOneTestsItemMemoryKbMin = 0;
|
||||
|
||||
export const practiceRunResultOneTestsItemDiagnosticOneMax = 2048;
|
||||
|
||||
export const practiceRunResultOneTestsMax = 20;
|
||||
|
||||
|
||||
export const PracticeRun = zod.object({
|
||||
"id": zod.uuid().describe('Identifier of the run.'),
|
||||
"item_id": zod.uuid().describe('Identifier of an item instance in one attempt. It identifies the fixed variant served to this candidate and reveals neither the task family, its version, nor the variant seed.'),
|
||||
"state": zod.enum(['queued', 'running', 'finished', 'failed']).describe('State of a debug run.\n\n- queued: the run waits in the sandbox queue.\n- running: the sandbox runs it.\n- finished: `result` holds the outcome of the public examples and the tests of the candidate.\n- failed: the sandbox infrastructure could not run it, independently of the solution; `failure_reason` is `sandbox_error`. Start a new run.\n\nAdding a value is a contract change.'),
|
||||
"created_at": zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.'),
|
||||
"finished_at": zod.union([zod.iso.datetime({"offset":true}).describe('UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.'),zod.null()]).describe('Time the run reached `finished` or `failed`, or null.'),
|
||||
"failure_reason": zod.union([zod.enum(['sandbox_busy', 'sandbox_error']).describe('Why the sandbox infrastructure returned no verdict: `sandbox_busy` when its queue was full, `sandbox_error` for an infrastructure failure such as a broken executor. Neither depends on the solution; a solution that fails to compile, crashes, or exceeds a limit gets a `finished` verdict instead, so a failure never acts as an oracle for hidden checks.'),zod.null()]).describe('`sandbox_error` when `state` is `failed`, otherwise null.'),
|
||||
"result": zod.union([zod.object({
|
||||
"outcome": zod.enum(['accepted', 'wrong_answer', 'compile_error', 'time_limit_exceeded', 'memory_limit_exceeded', 'output_limit_exceeded', 'runtime_error']).describe('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.'),
|
||||
"compile_diagnostic": zod.union([zod.string().max(practiceRunResultOneCompileDiagnosticOneMax),zod.null()]).describe('The compiler message when `outcome` is `compile_error`, otherwise null.'),
|
||||
"tests": zod.array(zod.object({
|
||||
"source": zod.enum(['example', 'candidate']).describe('Where a test of a debug run comes from: a public example of the task or a test of the candidate.'),
|
||||
"index": zod.int().min(1).max(practiceRunResultOneTestsItemIndexMax).describe('Position of the test in its source, from 1.'),
|
||||
"outcome": zod.enum(['accepted', 'wrong_answer', 'compile_error', 'time_limit_exceeded', 'memory_limit_exceeded', 'output_limit_exceeded', 'runtime_error']).describe('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.'),
|
||||
"time_ms": zod.int().min(practiceRunResultOneTestsItemTimeMsMin),
|
||||
"memory_kb": zod.int().min(practiceRunResultOneTestsItemMemoryKbMin),
|
||||
"diagnostic": zod.union([zod.string().max(practiceRunResultOneTestsItemDiagnosticOneMax),zod.null()]).describe('Truncated error output of a failed test, or null.')
|
||||
}).describe('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.')).max(practiceRunResultOneTestsMax)
|
||||
}).describe('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.'),zod.null()]).describe('The result when `state` is `finished`, otherwise null.')
|
||||
}).describe('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.')
|
||||
|
||||
export type PracticeRun = zod.input<typeof PracticeRun>;
|
||||
export type PracticeRunOutput = zod.output<typeof PracticeRun>;
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const practiceRunCreateSourceCodeMax = 65536;
|
||||
|
||||
export const practiceRunCreateTestsItemInputMax = 10000;
|
||||
|
||||
export const practiceRunCreateTestsItemExpectedOutputMax = 10000;
|
||||
|
||||
export const practiceRunCreateTestsMax = 10;
|
||||
|
||||
|
||||
export const PracticeRunCreate = zod.object({
|
||||
"item_id": zod.uuid().describe('Identifier of an item instance in one attempt. It identifies the fixed variant served to this candidate and reveals neither the task family, its version, nor the variant seed.'),
|
||||
"language": zod.union([zod.enum(['python', 'go']).describe('Programming language in which assessment tasks of a specialization are offered and solved. It is the language of the task bank, not the candidate\'s platform stack, and it never forms a separate category. Only banks that offer a choice of language define task languages; the first Backend bank offers Python and Go. Adding a value is a contract change.'),zod.null()]).describe('One of the `languages` of the practice item, or null when the item offers none.'),
|
||||
"source_code": zod.string().min(1).max(practiceRunCreateSourceCodeMax),
|
||||
"tests": zod.array(zod.object({
|
||||
"input": zod.string().max(practiceRunCreateTestsItemInputMax),
|
||||
"expected_output": zod.string().max(practiceRunCreateTestsItemExpectedOutputMax)
|
||||
}).describe('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.')).max(practiceRunCreateTestsMax).exactOptional().describe('Tests of the candidate, run after the public examples.')
|
||||
}).describe('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.')
|
||||
|
||||
export type PracticeRunCreate = zod.input<typeof PracticeRunCreate>;
|
||||
export type PracticeRunCreateOutput = zod.output<typeof PracticeRunCreate>;
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const PracticeRunOutcome = zod.enum(['accepted', 'wrong_answer', 'compile_error', 'time_limit_exceeded', 'memory_limit_exceeded', 'output_limit_exceeded', 'runtime_error']).describe('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.')
|
||||
|
||||
export type PracticeRunOutcome = zod.input<typeof PracticeRunOutcome>;
|
||||
export type PracticeRunOutcomeOutput = zod.output<typeof PracticeRunOutcome>;
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const practiceRunResultCompileDiagnosticOneMax = 4096;
|
||||
|
||||
export const practiceRunResultTestsItemIndexMax = 10;
|
||||
|
||||
export const practiceRunResultTestsItemTimeMsMin = 0;
|
||||
|
||||
export const practiceRunResultTestsItemMemoryKbMin = 0;
|
||||
|
||||
export const practiceRunResultTestsItemDiagnosticOneMax = 2048;
|
||||
|
||||
export const practiceRunResultTestsMax = 20;
|
||||
|
||||
|
||||
export const PracticeRunResult = zod.object({
|
||||
"outcome": zod.enum(['accepted', 'wrong_answer', 'compile_error', 'time_limit_exceeded', 'memory_limit_exceeded', 'output_limit_exceeded', 'runtime_error']).describe('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.'),
|
||||
"compile_diagnostic": zod.union([zod.string().max(practiceRunResultCompileDiagnosticOneMax),zod.null()]).describe('The compiler message when `outcome` is `compile_error`, otherwise null.'),
|
||||
"tests": zod.array(zod.object({
|
||||
"source": zod.enum(['example', 'candidate']).describe('Where a test of a debug run comes from: a public example of the task or a test of the candidate.'),
|
||||
"index": zod.int().min(1).max(practiceRunResultTestsItemIndexMax).describe('Position of the test in its source, from 1.'),
|
||||
"outcome": zod.enum(['accepted', 'wrong_answer', 'compile_error', 'time_limit_exceeded', 'memory_limit_exceeded', 'output_limit_exceeded', 'runtime_error']).describe('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.'),
|
||||
"time_ms": zod.int().min(practiceRunResultTestsItemTimeMsMin),
|
||||
"memory_kb": zod.int().min(practiceRunResultTestsItemMemoryKbMin),
|
||||
"diagnostic": zod.union([zod.string().max(practiceRunResultTestsItemDiagnosticOneMax),zod.null()]).describe('Truncated error output of a failed test, or null.')
|
||||
}).describe('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.')).max(practiceRunResultTestsMax)
|
||||
}).describe('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.')
|
||||
|
||||
export type PracticeRunResult = zod.input<typeof PracticeRunResult>;
|
||||
export type PracticeRunResultOutput = zod.output<typeof PracticeRunResult>;
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const PracticeRunState = zod.enum(['queued', 'running', 'finished', 'failed']).describe('State of a debug run.\n\n- queued: the run waits in the sandbox queue.\n- running: the sandbox runs it.\n- finished: `result` holds the outcome of the public examples and the tests of the candidate.\n- failed: the sandbox infrastructure could not run it, independently of the solution; `failure_reason` is `sandbox_error`. Start a new run.\n\nAdding a value is a contract change.')
|
||||
|
||||
export type PracticeRunState = zod.input<typeof PracticeRunState>;
|
||||
export type PracticeRunStateOutput = zod.output<typeof PracticeRunState>;
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const practiceRunTestInputMax = 10000;
|
||||
|
||||
export const practiceRunTestExpectedOutputMax = 10000;
|
||||
|
||||
|
||||
export const PracticeRunTest = zod.object({
|
||||
"input": zod.string().max(practiceRunTestInputMax),
|
||||
"expected_output": zod.string().max(practiceRunTestExpectedOutputMax)
|
||||
}).describe('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.')
|
||||
|
||||
export type PracticeRunTest = zod.input<typeof PracticeRunTest>;
|
||||
export type PracticeRunTestOutput = zod.output<typeof PracticeRunTest>;
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const practiceRunTestResultIndexMax = 10;
|
||||
|
||||
export const practiceRunTestResultTimeMsMin = 0;
|
||||
|
||||
export const practiceRunTestResultMemoryKbMin = 0;
|
||||
|
||||
export const practiceRunTestResultDiagnosticOneMax = 2048;
|
||||
|
||||
|
||||
export const PracticeRunTestResult = zod.object({
|
||||
"source": zod.enum(['example', 'candidate']).describe('Where a test of a debug run comes from: a public example of the task or a test of the candidate.'),
|
||||
"index": zod.int().min(1).max(practiceRunTestResultIndexMax).describe('Position of the test in its source, from 1.'),
|
||||
"outcome": zod.enum(['accepted', 'wrong_answer', 'compile_error', 'time_limit_exceeded', 'memory_limit_exceeded', 'output_limit_exceeded', 'runtime_error']).describe('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.'),
|
||||
"time_ms": zod.int().min(practiceRunTestResultTimeMsMin),
|
||||
"memory_kb": zod.int().min(practiceRunTestResultMemoryKbMin),
|
||||
"diagnostic": zod.union([zod.string().max(practiceRunTestResultDiagnosticOneMax),zod.null()]).describe('Truncated error output of a failed test, or null.')
|
||||
}).describe('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.')
|
||||
|
||||
export type PracticeRunTestResult = zod.input<typeof PracticeRunTestResult>;
|
||||
export type PracticeRunTestResultOutput = zod.output<typeof PracticeRunTestResult>;
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Generated by orval 🍺
|
||||
* Do not edit manually.
|
||||
* Lincodex API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import * as zod from 'zod';
|
||||
|
||||
export const PracticeRunTestSource = zod.enum(['example', 'candidate']).describe('Where a test of a debug run comes from: a public example of the task or a test of the candidate.')
|
||||
|
||||
export type PracticeRunTestSource = zod.input<typeof PracticeRunTestSource>;
|
||||
export type PracticeRunTestSourceOutput = zod.output<typeof PracticeRunTestSource>;
|
||||
Reference in new issue
Block a user