Files
KF-OnlineJudge/contracts/schemas/judge-manifest.v2.schema.json
T

271 lines
6.3 KiB
JSON

{
"$comment": "Multi-runtime protocol. Also validate runtime/source/attempt bindings, startup and node budgets, canonical bounded class sets and result consistency.",
"$defs": {
"ArtifactReference": {
"additionalProperties": false,
"properties": {
"bytes": {
"maximum": 67108864,
"minimum": 0,
"title": "Bytes",
"type": "integer"
},
"digest": {
"maxLength": 64,
"minLength": 64,
"pattern": "^[0-9a-f]{64}$",
"title": "Digest",
"type": "string"
}
},
"required": [
"digest",
"bytes"
],
"title": "ArtifactReference",
"type": "object"
},
"Language": {
"enum": [
"c17",
"cpp20",
"python313",
"java21"
],
"title": "Language",
"type": "string"
},
"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"
},
"RuntimeIdentity": {
"additionalProperties": false,
"description": "An exact identity matched against trusted configuration, never a host path.",
"properties": {
"image_digest": {
"maxLength": 64,
"minLength": 64,
"pattern": "^[0-9a-f]{64}$",
"title": "Image Digest",
"type": "string"
},
"image_kind": {
"enum": [
"linux_gnu_cxx_x86_64_v1",
"linux_cpython313_x86_64_v1",
"linux_openjdk21_x86_64_v1"
],
"title": "Image Kind",
"type": "string"
},
"image_revision": {
"maximum": 4294967295,
"minimum": 1,
"title": "Image Revision",
"type": "integer"
},
"runtime_version": {
"pattern": "^[A-Za-z0-9][A-Za-z0-9_.+-]{0,63}$",
"title": "Runtime Version",
"type": "string"
},
"toolchain_id": {
"pattern": "^[a-z0-9][a-z0-9_-]{0,63}$",
"title": "Toolchain Id",
"type": "string"
}
},
"required": [
"toolchain_id",
"image_kind",
"image_revision",
"image_digest",
"runtime_version"
],
"title": "RuntimeIdentity",
"type": "object"
},
"TestCase": {
"additionalProperties": false,
"properties": {
"case_id": {
"format": "uuid",
"title": "Case Id",
"type": "string"
},
"expected": {
"$ref": "#/$defs/ArtifactReference"
},
"input": {
"$ref": "#/$defs/ArtifactReference"
}
},
"required": [
"case_id",
"input",
"expected"
],
"title": "TestCase",
"type": "object"
}
},
"$id": "urn:kf-oj:judge-manifest:v2",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"cases": {
"items": {
"$ref": "#/$defs/TestCase"
},
"maxItems": 256,
"minItems": 1,
"title": "Cases",
"type": "array"
},
"comparison": {
"const": "exact_bytes",
"title": "Comparison",
"type": "string"
},
"compile_limits": {
"$ref": "#/$defs/RunLimits"
},
"evaluation_id": {
"format": "uuid",
"title": "Evaluation Id",
"type": "string"
},
"job_wall_time_us": {
"maximum": 3600000000,
"minimum": 1000,
"title": "Job Wall Time Us",
"type": "integer"
},
"kind": {
"const": "judge.manifest",
"title": "Kind",
"type": "string"
},
"language": {
"$ref": "#/$defs/Language"
},
"problem_version_id": {
"format": "uuid",
"title": "Problem Version Id",
"type": "string"
},
"run_limits": {
"$ref": "#/$defs/RunLimits"
},
"schema_version": {
"const": 2,
"title": "Schema Version",
"type": "integer"
},
"source": {
"$ref": "#/$defs/ArtifactReference"
},
"submission_id": {
"format": "uuid",
"title": "Submission Id",
"type": "string"
},
"toolchain": {
"$ref": "#/$defs/RuntimeIdentity"
}
},
"required": [
"schema_version",
"kind",
"evaluation_id",
"submission_id",
"problem_version_id",
"language",
"toolchain",
"source",
"cases",
"comparison",
"compile_limits",
"run_limits",
"job_wall_time_us"
],
"title": "JobManifest",
"type": "object"
}