feat(problems): add bounded administrator package imports
Use live maintenance sessions, durable capacity reservations and streamed SHA-bound ZIP uploads. An ordinary capped import worker validates stored/deflated v1/v2 packages, persists immutable unpublished candidates and finite audit events, and recovers or releases capacity after interruption and expiry. Validate actual PG/HTTP/worker/storage fault paths in an isolated capped VM (2 passed, 0 skipped), reuse unchanged actual migration roundtrip evidence, and pass affected backend/architecture checks plus the prior full engineering checks.
This commit is contained in:
@@ -76,6 +76,94 @@
|
||||
"title": "CancellationAccepted",
|
||||
"type": "object"
|
||||
},
|
||||
"CandidatePreview": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"candidate_id": {
|
||||
"format": "uuid",
|
||||
"title": "Candidate Id",
|
||||
"type": "string"
|
||||
},
|
||||
"case_count": {
|
||||
"maximum": 256.0,
|
||||
"minimum": 1.0,
|
||||
"title": "Case Count",
|
||||
"type": "integer"
|
||||
},
|
||||
"judging_schema_version": {
|
||||
"maximum": 2.0,
|
||||
"minimum": 1.0,
|
||||
"title": "Judging Schema Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"language_configurations": {
|
||||
"default": [],
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/PublicLanguageConfiguration"
|
||||
},
|
||||
"maxItems": 4,
|
||||
"title": "Language Configurations",
|
||||
"type": "array"
|
||||
},
|
||||
"languages": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/kf_oj__contracts__judging_v2__Language"
|
||||
},
|
||||
"maxItems": 4,
|
||||
"minItems": 1,
|
||||
"title": "Languages",
|
||||
"type": "array"
|
||||
},
|
||||
"legacy_budget": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/LegacyImportBudget"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"samples": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/PublicSample"
|
||||
},
|
||||
"maxItems": 10,
|
||||
"title": "Samples",
|
||||
"type": "array"
|
||||
},
|
||||
"slug": {
|
||||
"pattern": "^[a-z0-9][a-z0-9_-]{0,63}$",
|
||||
"title": "Slug",
|
||||
"type": "string"
|
||||
},
|
||||
"statement": {
|
||||
"maxLength": 262144,
|
||||
"minLength": 1,
|
||||
"title": "Statement",
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"maxLength": 160,
|
||||
"minLength": 1,
|
||||
"title": "Title",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"candidate_id",
|
||||
"slug",
|
||||
"title",
|
||||
"statement",
|
||||
"samples",
|
||||
"judging_schema_version",
|
||||
"languages",
|
||||
"legacy_budget",
|
||||
"case_count"
|
||||
],
|
||||
"title": "CandidatePreview",
|
||||
"type": "object"
|
||||
},
|
||||
"CompilationStatus": {
|
||||
"enum": [
|
||||
"succeeded",
|
||||
@@ -87,6 +175,42 @@
|
||||
"title": "CompilationStatus",
|
||||
"type": "string"
|
||||
},
|
||||
"CreateProblemImport": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"archive_bytes": {
|
||||
"maximum": 67108864.0,
|
||||
"minimum": 1.0,
|
||||
"title": "Archive Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"archive_digest": {
|
||||
"maxLength": 64,
|
||||
"minLength": 64,
|
||||
"pattern": "^[0-9a-f]{64}$",
|
||||
"title": "Archive Digest",
|
||||
"type": "string"
|
||||
},
|
||||
"operation_id": {
|
||||
"format": "uuid",
|
||||
"title": "Operation Id",
|
||||
"type": "string"
|
||||
},
|
||||
"schema_version": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"operation_id",
|
||||
"archive_digest",
|
||||
"archive_bytes"
|
||||
],
|
||||
"title": "CreateProblemImport",
|
||||
"type": "object"
|
||||
},
|
||||
"CreateSubmission": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
@@ -192,6 +316,38 @@
|
||||
"title": "HealthResponse",
|
||||
"type": "object"
|
||||
},
|
||||
"ImportFailure": {
|
||||
"enum": [
|
||||
"invalid_archive",
|
||||
"invalid_manifest",
|
||||
"invalid_data",
|
||||
"digest_mismatch",
|
||||
"policy_rejected",
|
||||
"upload_interrupted",
|
||||
"upload_deadline",
|
||||
"validation_deadline",
|
||||
"validation_unavailable",
|
||||
"storage_unavailable",
|
||||
"authority_revoked",
|
||||
"expired"
|
||||
],
|
||||
"title": "ImportFailure",
|
||||
"type": "string"
|
||||
},
|
||||
"ImportState": {
|
||||
"enum": [
|
||||
"uploading",
|
||||
"uploaded",
|
||||
"validating",
|
||||
"ready",
|
||||
"failed",
|
||||
"published",
|
||||
"discarded",
|
||||
"expired"
|
||||
],
|
||||
"title": "ImportState",
|
||||
"type": "string"
|
||||
},
|
||||
"JobManifest": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
@@ -284,6 +440,30 @@
|
||||
"title": "Language",
|
||||
"type": "string"
|
||||
},
|
||||
"LegacyImportBudget": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"compile_limits": {
|
||||
"$ref": "#/components/schemas/RunLimits"
|
||||
},
|
||||
"job_wall_time_us": {
|
||||
"maximum": 3600000000.0,
|
||||
"minimum": 1000.0,
|
||||
"title": "Job Wall Time Us",
|
||||
"type": "integer"
|
||||
},
|
||||
"run_limits": {
|
||||
"$ref": "#/components/schemas/RunLimits"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"compile_limits",
|
||||
"run_limits",
|
||||
"job_wall_time_us"
|
||||
],
|
||||
"title": "LegacyImportBudget",
|
||||
"type": "object"
|
||||
},
|
||||
"LoginRequest": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
@@ -575,6 +755,426 @@
|
||||
"title": "ProblemDetail",
|
||||
"type": "object"
|
||||
},
|
||||
"ProblemImportCapabilities": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"limits": {
|
||||
"$ref": "#/components/schemas/ProblemImportLimits",
|
||||
"default": {
|
||||
"archive_bytes": 67108864,
|
||||
"archive_format": "single_level_zip",
|
||||
"candidate_lifetime_seconds": 86400,
|
||||
"chunk_bytes": 1048576,
|
||||
"filename_ascii_bytes": 128,
|
||||
"files": 534,
|
||||
"global_concurrency": 1,
|
||||
"languages": [
|
||||
"c17",
|
||||
"cpp20",
|
||||
"python313",
|
||||
"java21"
|
||||
],
|
||||
"manifest_name": "problem.json",
|
||||
"manifest_schema_versions": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"owner_candidates": 10,
|
||||
"owner_concurrency": 1,
|
||||
"schema_version": 1,
|
||||
"staging_bytes": 268435456,
|
||||
"total_candidates": 32,
|
||||
"unpacked_bytes": 67108864,
|
||||
"upload_chunks": 4096,
|
||||
"upload_deadline_seconds": 30,
|
||||
"validation_deadline_seconds": 60
|
||||
}
|
||||
},
|
||||
"schema_version": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"uploads_available": {
|
||||
"title": "Uploads Available",
|
||||
"type": "boolean"
|
||||
},
|
||||
"validation_available": {
|
||||
"title": "Validation Available",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"uploads_available",
|
||||
"validation_available"
|
||||
],
|
||||
"title": "ProblemImportCapabilities",
|
||||
"type": "object"
|
||||
},
|
||||
"ProblemImportDetail": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"archive_bytes": {
|
||||
"maximum": 67108864.0,
|
||||
"minimum": 1.0,
|
||||
"title": "Archive Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"candidate": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/CandidatePreview"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"candidate_id": {
|
||||
"anyOf": [
|
||||
{
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Candidate Id"
|
||||
},
|
||||
"created_at": {
|
||||
"format": "date-time",
|
||||
"title": "Created At",
|
||||
"type": "string"
|
||||
},
|
||||
"expected_archive_digest": {
|
||||
"maxLength": 64,
|
||||
"minLength": 64,
|
||||
"pattern": "^[0-9a-f]{64}$",
|
||||
"title": "Expected Archive Digest",
|
||||
"type": "string"
|
||||
},
|
||||
"expires_at": {
|
||||
"format": "date-time",
|
||||
"title": "Expires At",
|
||||
"type": "string"
|
||||
},
|
||||
"failure_code": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ImportFailure"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"operation_id": {
|
||||
"format": "uuid",
|
||||
"title": "Operation Id",
|
||||
"type": "string"
|
||||
},
|
||||
"published_version_id": {
|
||||
"anyOf": [
|
||||
{
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Published Version Id"
|
||||
},
|
||||
"schema_version": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"state": {
|
||||
"$ref": "#/components/schemas/ImportState"
|
||||
},
|
||||
"updated_at": {
|
||||
"format": "date-time",
|
||||
"title": "Updated At",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"operation_id",
|
||||
"state",
|
||||
"expected_archive_digest",
|
||||
"archive_bytes",
|
||||
"created_at",
|
||||
"expires_at",
|
||||
"updated_at",
|
||||
"failure_code",
|
||||
"candidate_id",
|
||||
"published_version_id",
|
||||
"candidate"
|
||||
],
|
||||
"title": "ProblemImportDetail",
|
||||
"type": "object"
|
||||
},
|
||||
"ProblemImportLimits": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"archive_bytes": {
|
||||
"default": 67108864,
|
||||
"title": "Archive Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"archive_format": {
|
||||
"const": "single_level_zip",
|
||||
"default": "single_level_zip",
|
||||
"title": "Archive Format",
|
||||
"type": "string"
|
||||
},
|
||||
"candidate_lifetime_seconds": {
|
||||
"default": 86400,
|
||||
"title": "Candidate Lifetime Seconds",
|
||||
"type": "integer"
|
||||
},
|
||||
"chunk_bytes": {
|
||||
"default": 1048576,
|
||||
"title": "Chunk Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"filename_ascii_bytes": {
|
||||
"default": 128,
|
||||
"title": "Filename Ascii Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"files": {
|
||||
"default": 534,
|
||||
"title": "Files",
|
||||
"type": "integer"
|
||||
},
|
||||
"global_concurrency": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Global Concurrency",
|
||||
"type": "integer"
|
||||
},
|
||||
"languages": {
|
||||
"default": [
|
||||
"c17",
|
||||
"cpp20",
|
||||
"python313",
|
||||
"java21"
|
||||
],
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/kf_oj__contracts__judging_v2__Language"
|
||||
},
|
||||
"title": "Languages",
|
||||
"type": "array"
|
||||
},
|
||||
"manifest_name": {
|
||||
"const": "problem.json",
|
||||
"default": "problem.json",
|
||||
"title": "Manifest Name",
|
||||
"type": "string"
|
||||
},
|
||||
"manifest_schema_versions": {
|
||||
"default": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"items": {
|
||||
"enum": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"type": "integer"
|
||||
},
|
||||
"title": "Manifest Schema Versions",
|
||||
"type": "array"
|
||||
},
|
||||
"owner_candidates": {
|
||||
"default": 10,
|
||||
"title": "Owner Candidates",
|
||||
"type": "integer"
|
||||
},
|
||||
"owner_concurrency": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Owner Concurrency",
|
||||
"type": "integer"
|
||||
},
|
||||
"schema_version": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"staging_bytes": {
|
||||
"default": 268435456,
|
||||
"title": "Staging Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"total_candidates": {
|
||||
"default": 32,
|
||||
"title": "Total Candidates",
|
||||
"type": "integer"
|
||||
},
|
||||
"unpacked_bytes": {
|
||||
"default": 67108864,
|
||||
"title": "Unpacked Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"upload_chunks": {
|
||||
"default": 4096,
|
||||
"title": "Upload Chunks",
|
||||
"type": "integer"
|
||||
},
|
||||
"upload_deadline_seconds": {
|
||||
"default": 30,
|
||||
"title": "Upload Deadline Seconds",
|
||||
"type": "integer"
|
||||
},
|
||||
"validation_deadline_seconds": {
|
||||
"default": 60,
|
||||
"title": "Validation Deadline Seconds",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"title": "ProblemImportLimits",
|
||||
"type": "object"
|
||||
},
|
||||
"ProblemImportPage": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"items": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/ProblemImportSummary"
|
||||
},
|
||||
"maxItems": 100,
|
||||
"title": "Items",
|
||||
"type": "array"
|
||||
},
|
||||
"next_after": {
|
||||
"anyOf": [
|
||||
{
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Next After"
|
||||
},
|
||||
"schema_version": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"items",
|
||||
"next_after"
|
||||
],
|
||||
"title": "ProblemImportPage",
|
||||
"type": "object"
|
||||
},
|
||||
"ProblemImportSummary": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"archive_bytes": {
|
||||
"maximum": 67108864.0,
|
||||
"minimum": 1.0,
|
||||
"title": "Archive Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"candidate_id": {
|
||||
"anyOf": [
|
||||
{
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Candidate Id"
|
||||
},
|
||||
"created_at": {
|
||||
"format": "date-time",
|
||||
"title": "Created At",
|
||||
"type": "string"
|
||||
},
|
||||
"expected_archive_digest": {
|
||||
"maxLength": 64,
|
||||
"minLength": 64,
|
||||
"pattern": "^[0-9a-f]{64}$",
|
||||
"title": "Expected Archive Digest",
|
||||
"type": "string"
|
||||
},
|
||||
"expires_at": {
|
||||
"format": "date-time",
|
||||
"title": "Expires At",
|
||||
"type": "string"
|
||||
},
|
||||
"failure_code": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/ImportFailure"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"operation_id": {
|
||||
"format": "uuid",
|
||||
"title": "Operation Id",
|
||||
"type": "string"
|
||||
},
|
||||
"published_version_id": {
|
||||
"anyOf": [
|
||||
{
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Published Version Id"
|
||||
},
|
||||
"schema_version": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"state": {
|
||||
"$ref": "#/components/schemas/ImportState"
|
||||
},
|
||||
"updated_at": {
|
||||
"format": "date-time",
|
||||
"title": "Updated At",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"operation_id",
|
||||
"state",
|
||||
"expected_archive_digest",
|
||||
"archive_bytes",
|
||||
"created_at",
|
||||
"expires_at",
|
||||
"updated_at",
|
||||
"failure_code",
|
||||
"candidate_id",
|
||||
"published_version_id"
|
||||
],
|
||||
"title": "ProblemImportSummary",
|
||||
"type": "object"
|
||||
},
|
||||
"ProblemPage": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
@@ -1416,6 +2016,268 @@
|
||||
},
|
||||
"openapi": "3.1.0",
|
||||
"paths": {
|
||||
"/api/v1/admin/problem-imports": {
|
||||
"get": {
|
||||
"operationId": "page_api_v1_admin_problem_imports_get",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "query",
|
||||
"name": "after",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"anyOf": [
|
||||
{
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "After"
|
||||
}
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "limit",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"default": 20,
|
||||
"maximum": 100,
|
||||
"minimum": 1,
|
||||
"title": "Limit",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemImportPage"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
},
|
||||
"422": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HTTPValidationError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Validation Error"
|
||||
}
|
||||
},
|
||||
"summary": "Page",
|
||||
"tags": [
|
||||
"problem-maintenance"
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"operationId": "create_api_v1_admin_problem_imports_post",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CreateProblemImport"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemImportSummary"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
},
|
||||
"422": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HTTPValidationError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Validation Error"
|
||||
}
|
||||
},
|
||||
"summary": "Create",
|
||||
"tags": [
|
||||
"problem-maintenance"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/admin/problem-imports/capabilities": {
|
||||
"get": {
|
||||
"operationId": "capabilities_api_v1_admin_problem_imports_capabilities_get",
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemImportCapabilities"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
}
|
||||
},
|
||||
"summary": "Capabilities",
|
||||
"tags": [
|
||||
"problem-maintenance"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/admin/problem-imports/{operation_id}": {
|
||||
"get": {
|
||||
"operationId": "detail_api_v1_admin_problem_imports__operation_id__get",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "operation_id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"format": "uuid",
|
||||
"title": "Operation Id",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemImportDetail"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
},
|
||||
"422": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HTTPValidationError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Validation Error"
|
||||
}
|
||||
},
|
||||
"summary": "Detail",
|
||||
"tags": [
|
||||
"problem-maintenance"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/admin/problem-imports/{operation_id}/archive": {
|
||||
"put": {
|
||||
"operationId": "upload_api_v1_admin_problem_imports__operation_id__archive_put",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "operation_id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"format": "uuid",
|
||||
"title": "Operation Id",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/zip": {
|
||||
"schema": {
|
||||
"format": "binary",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemImportSummary"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
},
|
||||
"422": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HTTPValidationError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Validation Error"
|
||||
}
|
||||
},
|
||||
"summary": "Upload",
|
||||
"tags": [
|
||||
"problem-maintenance"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/admin/problem-imports/{operation_id}/discard": {
|
||||
"post": {
|
||||
"operationId": "discard_api_v1_admin_problem_imports__operation_id__discard_post",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "operation_id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"format": "uuid",
|
||||
"title": "Operation Id",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemImportSummary"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
},
|
||||
"422": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HTTPValidationError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Validation Error"
|
||||
}
|
||||
},
|
||||
"summary": "Discard",
|
||||
"tags": [
|
||||
"problem-maintenance"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/auth/login": {
|
||||
"post": {
|
||||
"operationId": "login_api_v1_auth_login_post",
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
{
|
||||
"$defs": {
|
||||
"Language": {
|
||||
"enum": [
|
||||
"c17",
|
||||
"cpp20",
|
||||
"python313",
|
||||
"java21"
|
||||
],
|
||||
"title": "Language",
|
||||
"type": "string"
|
||||
},
|
||||
"ProblemImportLimits": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"archive_bytes": {
|
||||
"default": 67108864,
|
||||
"title": "Archive Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"archive_format": {
|
||||
"const": "single_level_zip",
|
||||
"default": "single_level_zip",
|
||||
"title": "Archive Format",
|
||||
"type": "string"
|
||||
},
|
||||
"candidate_lifetime_seconds": {
|
||||
"default": 86400,
|
||||
"title": "Candidate Lifetime Seconds",
|
||||
"type": "integer"
|
||||
},
|
||||
"chunk_bytes": {
|
||||
"default": 1048576,
|
||||
"title": "Chunk Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"filename_ascii_bytes": {
|
||||
"default": 128,
|
||||
"title": "Filename Ascii Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"files": {
|
||||
"default": 534,
|
||||
"title": "Files",
|
||||
"type": "integer"
|
||||
},
|
||||
"global_concurrency": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Global Concurrency",
|
||||
"type": "integer"
|
||||
},
|
||||
"languages": {
|
||||
"default": [
|
||||
"c17",
|
||||
"cpp20",
|
||||
"python313",
|
||||
"java21"
|
||||
],
|
||||
"items": {
|
||||
"$ref": "#/$defs/Language"
|
||||
},
|
||||
"title": "Languages",
|
||||
"type": "array"
|
||||
},
|
||||
"manifest_name": {
|
||||
"const": "problem.json",
|
||||
"default": "problem.json",
|
||||
"title": "Manifest Name",
|
||||
"type": "string"
|
||||
},
|
||||
"manifest_schema_versions": {
|
||||
"default": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"items": {
|
||||
"enum": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"type": "integer"
|
||||
},
|
||||
"title": "Manifest Schema Versions",
|
||||
"type": "array"
|
||||
},
|
||||
"owner_candidates": {
|
||||
"default": 10,
|
||||
"title": "Owner Candidates",
|
||||
"type": "integer"
|
||||
},
|
||||
"owner_concurrency": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Owner Concurrency",
|
||||
"type": "integer"
|
||||
},
|
||||
"schema_version": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"staging_bytes": {
|
||||
"default": 268435456,
|
||||
"title": "Staging Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"total_candidates": {
|
||||
"default": 32,
|
||||
"title": "Total Candidates",
|
||||
"type": "integer"
|
||||
},
|
||||
"unpacked_bytes": {
|
||||
"default": 67108864,
|
||||
"title": "Unpacked Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"upload_chunks": {
|
||||
"default": 4096,
|
||||
"title": "Upload Chunks",
|
||||
"type": "integer"
|
||||
},
|
||||
"upload_deadline_seconds": {
|
||||
"default": 30,
|
||||
"title": "Upload Deadline Seconds",
|
||||
"type": "integer"
|
||||
},
|
||||
"validation_deadline_seconds": {
|
||||
"default": 60,
|
||||
"title": "Validation Deadline Seconds",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"title": "ProblemImportLimits",
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"$id": "urn:kf-oj:problem-import-capabilities:v1",
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"limits": {
|
||||
"$ref": "#/$defs/ProblemImportLimits",
|
||||
"default": {
|
||||
"archive_bytes": 67108864,
|
||||
"archive_format": "single_level_zip",
|
||||
"candidate_lifetime_seconds": 86400,
|
||||
"chunk_bytes": 1048576,
|
||||
"filename_ascii_bytes": 128,
|
||||
"files": 534,
|
||||
"global_concurrency": 1,
|
||||
"languages": [
|
||||
"c17",
|
||||
"cpp20",
|
||||
"python313",
|
||||
"java21"
|
||||
],
|
||||
"manifest_name": "problem.json",
|
||||
"manifest_schema_versions": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"owner_candidates": 10,
|
||||
"owner_concurrency": 1,
|
||||
"schema_version": 1,
|
||||
"staging_bytes": 268435456,
|
||||
"total_candidates": 32,
|
||||
"unpacked_bytes": 67108864,
|
||||
"upload_chunks": 4096,
|
||||
"upload_deadline_seconds": 30,
|
||||
"validation_deadline_seconds": 60
|
||||
}
|
||||
},
|
||||
"schema_version": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"uploads_available": {
|
||||
"title": "Uploads Available",
|
||||
"type": "boolean"
|
||||
},
|
||||
"validation_available": {
|
||||
"title": "Validation Available",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"uploads_available",
|
||||
"validation_available"
|
||||
],
|
||||
"title": "ProblemImportCapabilities",
|
||||
"type": "object"
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"$id": "urn:kf-oj:problem-import-create:v1",
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"archive_bytes": {
|
||||
"maximum": 67108864,
|
||||
"minimum": 1,
|
||||
"title": "Archive Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"archive_digest": {
|
||||
"maxLength": 64,
|
||||
"minLength": 64,
|
||||
"pattern": "^[0-9a-f]{64}$",
|
||||
"title": "Archive Digest",
|
||||
"type": "string"
|
||||
},
|
||||
"operation_id": {
|
||||
"format": "uuid",
|
||||
"title": "Operation Id",
|
||||
"type": "string"
|
||||
},
|
||||
"schema_version": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"operation_id",
|
||||
"archive_digest",
|
||||
"archive_bytes"
|
||||
],
|
||||
"title": "CreateProblemImport",
|
||||
"type": "object"
|
||||
}
|
||||
@@ -0,0 +1,423 @@
|
||||
{
|
||||
"$defs": {
|
||||
"CandidatePreview": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"candidate_id": {
|
||||
"format": "uuid",
|
||||
"title": "Candidate Id",
|
||||
"type": "string"
|
||||
},
|
||||
"case_count": {
|
||||
"maximum": 256,
|
||||
"minimum": 1,
|
||||
"title": "Case Count",
|
||||
"type": "integer"
|
||||
},
|
||||
"judging_schema_version": {
|
||||
"maximum": 2,
|
||||
"minimum": 1,
|
||||
"title": "Judging Schema Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"language_configurations": {
|
||||
"default": [],
|
||||
"items": {
|
||||
"$ref": "#/$defs/PublicLanguageConfiguration"
|
||||
},
|
||||
"maxItems": 4,
|
||||
"title": "Language Configurations",
|
||||
"type": "array"
|
||||
},
|
||||
"languages": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/Language"
|
||||
},
|
||||
"maxItems": 4,
|
||||
"minItems": 1,
|
||||
"title": "Languages",
|
||||
"type": "array"
|
||||
},
|
||||
"legacy_budget": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/$defs/LegacyImportBudget"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"samples": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/PublicSample"
|
||||
},
|
||||
"maxItems": 10,
|
||||
"title": "Samples",
|
||||
"type": "array"
|
||||
},
|
||||
"slug": {
|
||||
"pattern": "^[a-z0-9][a-z0-9_-]{0,63}$",
|
||||
"title": "Slug",
|
||||
"type": "string"
|
||||
},
|
||||
"statement": {
|
||||
"maxLength": 262144,
|
||||
"minLength": 1,
|
||||
"title": "Statement",
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"maxLength": 160,
|
||||
"minLength": 1,
|
||||
"title": "Title",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"candidate_id",
|
||||
"slug",
|
||||
"title",
|
||||
"statement",
|
||||
"samples",
|
||||
"judging_schema_version",
|
||||
"languages",
|
||||
"legacy_budget",
|
||||
"case_count"
|
||||
],
|
||||
"title": "CandidatePreview",
|
||||
"type": "object"
|
||||
},
|
||||
"ImportFailure": {
|
||||
"enum": [
|
||||
"invalid_archive",
|
||||
"invalid_manifest",
|
||||
"invalid_data",
|
||||
"digest_mismatch",
|
||||
"policy_rejected",
|
||||
"upload_interrupted",
|
||||
"upload_deadline",
|
||||
"validation_deadline",
|
||||
"validation_unavailable",
|
||||
"storage_unavailable",
|
||||
"authority_revoked",
|
||||
"expired"
|
||||
],
|
||||
"title": "ImportFailure",
|
||||
"type": "string"
|
||||
},
|
||||
"ImportState": {
|
||||
"enum": [
|
||||
"uploading",
|
||||
"uploaded",
|
||||
"validating",
|
||||
"ready",
|
||||
"failed",
|
||||
"published",
|
||||
"discarded",
|
||||
"expired"
|
||||
],
|
||||
"title": "ImportState",
|
||||
"type": "string"
|
||||
},
|
||||
"Language": {
|
||||
"enum": [
|
||||
"c17",
|
||||
"cpp20",
|
||||
"python313",
|
||||
"java21"
|
||||
],
|
||||
"title": "Language",
|
||||
"type": "string"
|
||||
},
|
||||
"LegacyImportBudget": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"compile_limits": {
|
||||
"$ref": "#/$defs/RunLimits"
|
||||
},
|
||||
"job_wall_time_us": {
|
||||
"maximum": 3600000000,
|
||||
"minimum": 1000,
|
||||
"title": "Job Wall Time Us",
|
||||
"type": "integer"
|
||||
},
|
||||
"run_limits": {
|
||||
"$ref": "#/$defs/RunLimits"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"compile_limits",
|
||||
"run_limits",
|
||||
"job_wall_time_us"
|
||||
],
|
||||
"title": "LegacyImportBudget",
|
||||
"type": "object"
|
||||
},
|
||||
"PreparationKind": {
|
||||
"enum": [
|
||||
"compile",
|
||||
"syntax_check"
|
||||
],
|
||||
"title": "PreparationKind",
|
||||
"type": "string"
|
||||
},
|
||||
"PublicLanguageConfiguration": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"compile_limits": {
|
||||
"$ref": "#/$defs/RunLimits"
|
||||
},
|
||||
"entrypoint": {
|
||||
"title": "Entrypoint",
|
||||
"type": "string"
|
||||
},
|
||||
"job_wall_time_us": {
|
||||
"title": "Job Wall Time Us",
|
||||
"type": "integer"
|
||||
},
|
||||
"language": {
|
||||
"$ref": "#/$defs/Language"
|
||||
},
|
||||
"preparation_kind": {
|
||||
"$ref": "#/$defs/PreparationKind"
|
||||
},
|
||||
"run_limits": {
|
||||
"$ref": "#/$defs/RunLimits"
|
||||
},
|
||||
"runtime_version": {
|
||||
"title": "Runtime Version",
|
||||
"type": "string"
|
||||
},
|
||||
"source_name": {
|
||||
"title": "Source Name",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"language",
|
||||
"runtime_version",
|
||||
"source_name",
|
||||
"entrypoint",
|
||||
"preparation_kind",
|
||||
"compile_limits",
|
||||
"run_limits",
|
||||
"job_wall_time_us"
|
||||
],
|
||||
"title": "PublicLanguageConfiguration",
|
||||
"type": "object"
|
||||
},
|
||||
"PublicSample": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"encoding": {
|
||||
"const": "base64",
|
||||
"default": "base64",
|
||||
"title": "Encoding",
|
||||
"type": "string"
|
||||
},
|
||||
"input": {
|
||||
"maxLength": 87384,
|
||||
"title": "Input",
|
||||
"type": "string"
|
||||
},
|
||||
"output": {
|
||||
"maxLength": 87384,
|
||||
"title": "Output",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"input",
|
||||
"output"
|
||||
],
|
||||
"title": "PublicSample",
|
||||
"type": "object"
|
||||
},
|
||||
"RunLimits": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"cpu_time_us": {
|
||||
"maximum": 60000000,
|
||||
"minimum": 1000,
|
||||
"title": "Cpu Time Us",
|
||||
"type": "integer"
|
||||
},
|
||||
"file_bytes": {
|
||||
"maximum": 67108864,
|
||||
"minimum": 1,
|
||||
"title": "File Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"memory_bytes": {
|
||||
"maximum": 2147483648,
|
||||
"minimum": 1,
|
||||
"title": "Memory Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"open_files": {
|
||||
"maximum": 1024,
|
||||
"minimum": 3,
|
||||
"title": "Open Files",
|
||||
"type": "integer"
|
||||
},
|
||||
"processes": {
|
||||
"maximum": 128,
|
||||
"minimum": 1,
|
||||
"title": "Processes",
|
||||
"type": "integer"
|
||||
},
|
||||
"stack_bytes": {
|
||||
"maximum": 268435456,
|
||||
"minimum": 1,
|
||||
"title": "Stack Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"stderr_bytes": {
|
||||
"maximum": 16777216,
|
||||
"minimum": 1,
|
||||
"title": "Stderr Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"stdout_bytes": {
|
||||
"maximum": 16777216,
|
||||
"minimum": 1,
|
||||
"title": "Stdout Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"wall_time_us": {
|
||||
"maximum": 120000000,
|
||||
"minimum": 1000,
|
||||
"title": "Wall Time Us",
|
||||
"type": "integer"
|
||||
},
|
||||
"workdir_bytes": {
|
||||
"maximum": 268435456,
|
||||
"minimum": 1,
|
||||
"title": "Workdir Bytes",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"cpu_time_us",
|
||||
"wall_time_us",
|
||||
"memory_bytes",
|
||||
"stack_bytes",
|
||||
"processes",
|
||||
"open_files",
|
||||
"stdout_bytes",
|
||||
"stderr_bytes",
|
||||
"file_bytes",
|
||||
"workdir_bytes"
|
||||
],
|
||||
"title": "RunLimits",
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"$id": "urn:kf-oj:problem-import:v1",
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"archive_bytes": {
|
||||
"maximum": 67108864,
|
||||
"minimum": 1,
|
||||
"title": "Archive Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"candidate": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/$defs/CandidatePreview"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"candidate_id": {
|
||||
"anyOf": [
|
||||
{
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Candidate Id"
|
||||
},
|
||||
"created_at": {
|
||||
"format": "date-time",
|
||||
"title": "Created At",
|
||||
"type": "string"
|
||||
},
|
||||
"expected_archive_digest": {
|
||||
"maxLength": 64,
|
||||
"minLength": 64,
|
||||
"pattern": "^[0-9a-f]{64}$",
|
||||
"title": "Expected Archive Digest",
|
||||
"type": "string"
|
||||
},
|
||||
"expires_at": {
|
||||
"format": "date-time",
|
||||
"title": "Expires At",
|
||||
"type": "string"
|
||||
},
|
||||
"failure_code": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/$defs/ImportFailure"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"operation_id": {
|
||||
"format": "uuid",
|
||||
"title": "Operation Id",
|
||||
"type": "string"
|
||||
},
|
||||
"published_version_id": {
|
||||
"anyOf": [
|
||||
{
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Published Version Id"
|
||||
},
|
||||
"schema_version": {
|
||||
"const": 1,
|
||||
"default": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"state": {
|
||||
"$ref": "#/$defs/ImportState"
|
||||
},
|
||||
"updated_at": {
|
||||
"format": "date-time",
|
||||
"title": "Updated At",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"operation_id",
|
||||
"state",
|
||||
"expected_archive_digest",
|
||||
"archive_bytes",
|
||||
"created_at",
|
||||
"expires_at",
|
||||
"updated_at",
|
||||
"failure_code",
|
||||
"candidate_id",
|
||||
"published_version_id",
|
||||
"candidate"
|
||||
],
|
||||
"title": "ProblemImportDetail",
|
||||
"type": "object"
|
||||
}
|
||||
Reference in New Issue
Block a user