feat(contracts): validate fenced judging jobs and bounded results
This commit is contained in:
+22
-1
@@ -9,6 +9,27 @@
|
||||
|
||||
`make contracts` 从 Python 模型生成 Schema/OpenAPI,并生成前端 API 类型。
|
||||
`make check` 检查快照未过期及两种语言对样例的接受/拒绝一致。
|
||||
执行请求/报告、评测状态机、租约与结果提交契约在 JS-01/DR-01 中逐项补充。
|
||||
执行器私有规格与 FD 协议属于 Sandbox;平台不接收 argv、宿主路径或执行镜像路径。
|
||||
|
||||
普通题提交协议现有 `judge-manifest`、`judge-lease`、`judge-stage`、`judge-result`
|
||||
和本地可信 `judge-admission` v1 模型。清单绑定源码、不可变题目版本、按序工件摘要、
|
||||
C17/C++20、固定 GNU 工具链版本及编译/运行预算;租约绑定 evaluation/attempt/Worker
|
||||
与 fencing 版本。Root 权限、执行和 DB 状态转换接口仍由各自服务实现,解析清单或租约
|
||||
不授予执行权。
|
||||
|
||||
Python/Rust `decode_wire` 在解析前限制 256 KiB UTF-8 JSON,拒绝重复字段与非法数据,
|
||||
传输边界错误不回显输入。令牌及编译诊断的默认调试输出隐藏内容。`serde_json` 的运行期
|
||||
直接依赖用于此有界解码,不引入 IO、网络或数据库。
|
||||
|
||||
Schema 描述结构;模型另外核对规范 UUID、严格整数(拒绝 `1.0`/布尔值)、工件总大小、
|
||||
重复测试点、预算相容、诊断 UTF-8 字节数、编译状态/产物、清理失败和实际结果汇总。
|
||||
JSON Schema 的 integer 按数值判断,允许 `1.0`;不能替代协议解码。共享样例中的
|
||||
`invalid-semantic-*` 结构合法但被两种语言模型拒绝,其他非法样例同时验证结构拒绝。
|
||||
样例全为合成元数据;其中令牌、摘要不是已签发凭证或实际隐藏测试数据。
|
||||
|
||||
Coordinator 必须在事务锁内核对当前租约及状态规则,并将结果和授权清单比较:
|
||||
完整用例次序、数量和清单摘要不能只靠报告自身校验。已提交报告的幂等确认与过期租约
|
||||
拒绝分别处理,旧 attempt 无权改写结果。`cancelling` 在实际停止确认前不得转为
|
||||
`cancelled`;清理失败必须保留独立故障,缺失计量始终为 null。
|
||||
|
||||
生成器 `export.py` 是开发工具,允许读取 API 组合层;运行期的契约模型禁止依赖业务模块。
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
{
|
||||
"$comment": "Structural schema; also run versioned model validation for cross-field budgets, result consistency, UUID canonical form and UTF-8 byte limits.",
|
||||
"$defs": {
|
||||
"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"
|
||||
},
|
||||
"Toolchain": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"image_kind": {
|
||||
"const": "linux_gnu_cxx_x86_64_v1",
|
||||
"title": "Image Kind",
|
||||
"type": "string"
|
||||
},
|
||||
"image_revision": {
|
||||
"maximum": 4294967295,
|
||||
"minimum": 1,
|
||||
"title": "Image Revision",
|
||||
"type": "integer"
|
||||
},
|
||||
"toolchain_id": {
|
||||
"pattern": "^[a-z0-9][a-z0-9_-]{0,63}$",
|
||||
"title": "Toolchain Id",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"toolchain_id",
|
||||
"image_kind",
|
||||
"image_revision"
|
||||
],
|
||||
"title": "Toolchain",
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"$id": "urn:kf-oj:judge-admission:v1",
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"additionalProperties": false,
|
||||
"description": "Trusted node policy. A manifest never supplies or replaces this policy.",
|
||||
"properties": {
|
||||
"compile_ceiling": {
|
||||
"$ref": "#/$defs/RunLimits"
|
||||
},
|
||||
"max_concurrent_jobs": {
|
||||
"default": 1,
|
||||
"maximum": 64,
|
||||
"minimum": 1,
|
||||
"title": "Max Concurrent Jobs",
|
||||
"type": "integer"
|
||||
},
|
||||
"max_job_wall_time_us": {
|
||||
"maximum": 3600000000,
|
||||
"minimum": 1000,
|
||||
"title": "Max Job Wall Time Us",
|
||||
"type": "integer"
|
||||
},
|
||||
"max_package_bytes": {
|
||||
"maximum": 67108864,
|
||||
"minimum": 1,
|
||||
"title": "Max Package Bytes",
|
||||
"type": "integer"
|
||||
},
|
||||
"max_retries": {
|
||||
"default": 2,
|
||||
"maximum": 4,
|
||||
"minimum": 0,
|
||||
"title": "Max Retries",
|
||||
"type": "integer"
|
||||
},
|
||||
"prefetch": {
|
||||
"default": 1,
|
||||
"maximum": 64,
|
||||
"minimum": 1,
|
||||
"title": "Prefetch",
|
||||
"type": "integer"
|
||||
},
|
||||
"run_ceiling": {
|
||||
"$ref": "#/$defs/RunLimits"
|
||||
},
|
||||
"toolchain": {
|
||||
"$ref": "#/$defs/Toolchain"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"max_job_wall_time_us",
|
||||
"max_package_bytes",
|
||||
"toolchain",
|
||||
"compile_ceiling",
|
||||
"run_ceiling"
|
||||
],
|
||||
"title": "AdmissionPolicy",
|
||||
"type": "object"
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"$comment": "Structural schema; also run versioned model validation for cross-field budgets, result consistency, UUID canonical form and UTF-8 byte limits.",
|
||||
"$defs": {
|
||||
"LeaseBinding": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"attempt_id": {
|
||||
"format": "uuid",
|
||||
"title": "Attempt Id",
|
||||
"type": "string"
|
||||
},
|
||||
"evaluation_id": {
|
||||
"format": "uuid",
|
||||
"title": "Evaluation Id",
|
||||
"type": "string"
|
||||
},
|
||||
"fencing_version": {
|
||||
"maximum": 9223372036854775807,
|
||||
"minimum": 1,
|
||||
"title": "Fencing Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"worker_id": {
|
||||
"format": "uuid",
|
||||
"title": "Worker Id",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"evaluation_id",
|
||||
"attempt_id",
|
||||
"worker_id",
|
||||
"fencing_version"
|
||||
],
|
||||
"title": "LeaseBinding",
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"$id": "urn:kf-oj:judge-lease:v1",
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"attempt_number": {
|
||||
"maximum": 5,
|
||||
"minimum": 1,
|
||||
"title": "Attempt Number",
|
||||
"type": "integer"
|
||||
},
|
||||
"binding": {
|
||||
"$ref": "#/$defs/LeaseBinding"
|
||||
},
|
||||
"expires_at_unix_ms": {
|
||||
"maximum": 9223372036854775807,
|
||||
"minimum": 1,
|
||||
"title": "Expires At Unix Ms",
|
||||
"type": "integer"
|
||||
},
|
||||
"kind": {
|
||||
"const": "judge.lease",
|
||||
"title": "Kind",
|
||||
"type": "string"
|
||||
},
|
||||
"lease_token": {
|
||||
"maxLength": 64,
|
||||
"minLength": 64,
|
||||
"pattern": "^[0-9a-f]{64}$",
|
||||
"title": "Lease Token",
|
||||
"type": "string"
|
||||
},
|
||||
"manifest_digest": {
|
||||
"maxLength": 64,
|
||||
"minLength": 64,
|
||||
"pattern": "^[0-9a-f]{64}$",
|
||||
"title": "Manifest Digest",
|
||||
"type": "string"
|
||||
},
|
||||
"schema_version": {
|
||||
"const": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"schema_version",
|
||||
"kind",
|
||||
"binding",
|
||||
"lease_token",
|
||||
"attempt_number",
|
||||
"expires_at_unix_ms",
|
||||
"manifest_digest"
|
||||
],
|
||||
"title": "LeaseGrant",
|
||||
"type": "object"
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
{
|
||||
"$comment": "Structural schema; also run versioned model validation for cross-field budgets, result consistency, UUID canonical form and UTF-8 byte limits.",
|
||||
"$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"
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"Toolchain": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"image_kind": {
|
||||
"const": "linux_gnu_cxx_x86_64_v1",
|
||||
"title": "Image Kind",
|
||||
"type": "string"
|
||||
},
|
||||
"image_revision": {
|
||||
"maximum": 4294967295,
|
||||
"minimum": 1,
|
||||
"title": "Image Revision",
|
||||
"type": "integer"
|
||||
},
|
||||
"toolchain_id": {
|
||||
"pattern": "^[a-z0-9][a-z0-9_-]{0,63}$",
|
||||
"title": "Toolchain Id",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"toolchain_id",
|
||||
"image_kind",
|
||||
"image_revision"
|
||||
],
|
||||
"title": "Toolchain",
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"$id": "urn:kf-oj:judge-manifest:v1",
|
||||
"$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": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"source": {
|
||||
"$ref": "#/$defs/ArtifactReference"
|
||||
},
|
||||
"submission_id": {
|
||||
"format": "uuid",
|
||||
"title": "Submission Id",
|
||||
"type": "string"
|
||||
},
|
||||
"toolchain": {
|
||||
"$ref": "#/$defs/Toolchain"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
@@ -0,0 +1,304 @@
|
||||
{
|
||||
"$comment": "Structural schema; also run versioned model validation for cross-field budgets, result consistency, UUID canonical form and UTF-8 byte limits.",
|
||||
"$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"
|
||||
},
|
||||
"CaseReport": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"case_id": {
|
||||
"format": "uuid",
|
||||
"title": "Case Id",
|
||||
"type": "string"
|
||||
},
|
||||
"cpu_time_us": {
|
||||
"anyOf": [
|
||||
{
|
||||
"maximum": 9223372036854775807,
|
||||
"minimum": 0,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Cpu Time Us"
|
||||
},
|
||||
"memory_peak_bytes": {
|
||||
"anyOf": [
|
||||
{
|
||||
"maximum": 9223372036854775807,
|
||||
"minimum": 0,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Memory Peak Bytes"
|
||||
},
|
||||
"verdict": {
|
||||
"$ref": "#/$defs/Verdict"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"case_id",
|
||||
"verdict",
|
||||
"cpu_time_us",
|
||||
"memory_peak_bytes"
|
||||
],
|
||||
"title": "CaseReport",
|
||||
"type": "object"
|
||||
},
|
||||
"CompilationReport": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"cpu_time_us": {
|
||||
"anyOf": [
|
||||
{
|
||||
"maximum": 9223372036854775807,
|
||||
"minimum": 0,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Cpu Time Us"
|
||||
},
|
||||
"diagnostics": {
|
||||
"maxLength": 65536,
|
||||
"title": "Diagnostics",
|
||||
"type": "string"
|
||||
},
|
||||
"diagnostics_truncated": {
|
||||
"title": "Diagnostics Truncated",
|
||||
"type": "boolean"
|
||||
},
|
||||
"memory_peak_bytes": {
|
||||
"anyOf": [
|
||||
{
|
||||
"maximum": 9223372036854775807,
|
||||
"minimum": 0,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Memory Peak Bytes"
|
||||
},
|
||||
"program": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/$defs/ArtifactReference"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": {
|
||||
"$ref": "#/$defs/CompilationStatus"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"status",
|
||||
"program",
|
||||
"diagnostics",
|
||||
"diagnostics_truncated",
|
||||
"cpu_time_us",
|
||||
"memory_peak_bytes"
|
||||
],
|
||||
"title": "CompilationReport",
|
||||
"type": "object"
|
||||
},
|
||||
"CompilationStatus": {
|
||||
"enum": [
|
||||
"succeeded",
|
||||
"compilation_error",
|
||||
"compilation_limit",
|
||||
"cancelled",
|
||||
"system_error"
|
||||
],
|
||||
"title": "CompilationStatus",
|
||||
"type": "string"
|
||||
},
|
||||
"FailureCode": {
|
||||
"enum": [
|
||||
"artifact_unavailable",
|
||||
"sandbox_unavailable",
|
||||
"cleanup_failed",
|
||||
"lease_lost",
|
||||
"job_deadline"
|
||||
],
|
||||
"title": "FailureCode",
|
||||
"type": "string"
|
||||
},
|
||||
"LeaseBinding": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"attempt_id": {
|
||||
"format": "uuid",
|
||||
"title": "Attempt Id",
|
||||
"type": "string"
|
||||
},
|
||||
"evaluation_id": {
|
||||
"format": "uuid",
|
||||
"title": "Evaluation Id",
|
||||
"type": "string"
|
||||
},
|
||||
"fencing_version": {
|
||||
"maximum": 9223372036854775807,
|
||||
"minimum": 1,
|
||||
"title": "Fencing Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"worker_id": {
|
||||
"format": "uuid",
|
||||
"title": "Worker Id",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"evaluation_id",
|
||||
"attempt_id",
|
||||
"worker_id",
|
||||
"fencing_version"
|
||||
],
|
||||
"title": "LeaseBinding",
|
||||
"type": "object"
|
||||
},
|
||||
"Verdict": {
|
||||
"enum": [
|
||||
"accepted",
|
||||
"wrong_answer",
|
||||
"compilation_error",
|
||||
"runtime_error",
|
||||
"time_limit_exceeded",
|
||||
"memory_limit_exceeded",
|
||||
"output_limit_exceeded",
|
||||
"cancelled",
|
||||
"system_error"
|
||||
],
|
||||
"title": "Verdict",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"$id": "urn:kf-oj:judge-result:v1",
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"binding": {
|
||||
"$ref": "#/$defs/LeaseBinding"
|
||||
},
|
||||
"cases": {
|
||||
"items": {
|
||||
"$ref": "#/$defs/CaseReport"
|
||||
},
|
||||
"maxItems": 256,
|
||||
"title": "Cases",
|
||||
"type": "array"
|
||||
},
|
||||
"cleanup_complete": {
|
||||
"title": "Cleanup Complete",
|
||||
"type": "boolean"
|
||||
},
|
||||
"compilation": {
|
||||
"$ref": "#/$defs/CompilationReport"
|
||||
},
|
||||
"failure_code": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/$defs/FailureCode"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"kind": {
|
||||
"const": "judge.result",
|
||||
"title": "Kind",
|
||||
"type": "string"
|
||||
},
|
||||
"manifest_digest": {
|
||||
"maxLength": 64,
|
||||
"minLength": 64,
|
||||
"pattern": "^[0-9a-f]{64}$",
|
||||
"title": "Manifest Digest",
|
||||
"type": "string"
|
||||
},
|
||||
"run_cpu_time_us": {
|
||||
"anyOf": [
|
||||
{
|
||||
"maximum": 9223372036854775807,
|
||||
"minimum": 0,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Run Cpu Time Us"
|
||||
},
|
||||
"run_memory_peak_bytes": {
|
||||
"anyOf": [
|
||||
{
|
||||
"maximum": 9223372036854775807,
|
||||
"minimum": 0,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Run Memory Peak Bytes"
|
||||
},
|
||||
"schema_version": {
|
||||
"const": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"verdict": {
|
||||
"$ref": "#/$defs/Verdict"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"schema_version",
|
||||
"kind",
|
||||
"binding",
|
||||
"manifest_digest",
|
||||
"compilation",
|
||||
"cases",
|
||||
"verdict",
|
||||
"cleanup_complete",
|
||||
"failure_code",
|
||||
"run_cpu_time_us",
|
||||
"run_memory_peak_bytes"
|
||||
],
|
||||
"title": "JudgementReport",
|
||||
"type": "object"
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"$comment": "Structural schema; also run versioned model validation for cross-field budgets, result consistency, UUID canonical form and UTF-8 byte limits.",
|
||||
"$defs": {
|
||||
"LeaseBinding": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"attempt_id": {
|
||||
"format": "uuid",
|
||||
"title": "Attempt Id",
|
||||
"type": "string"
|
||||
},
|
||||
"evaluation_id": {
|
||||
"format": "uuid",
|
||||
"title": "Evaluation Id",
|
||||
"type": "string"
|
||||
},
|
||||
"fencing_version": {
|
||||
"maximum": 9223372036854775807,
|
||||
"minimum": 1,
|
||||
"title": "Fencing Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"worker_id": {
|
||||
"format": "uuid",
|
||||
"title": "Worker Id",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"evaluation_id",
|
||||
"attempt_id",
|
||||
"worker_id",
|
||||
"fencing_version"
|
||||
],
|
||||
"title": "LeaseBinding",
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"$id": "urn:kf-oj:judge-stage:v1",
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"binding": {
|
||||
"$ref": "#/$defs/LeaseBinding"
|
||||
},
|
||||
"case_index": {
|
||||
"anyOf": [
|
||||
{
|
||||
"exclusiveMaximum": 256,
|
||||
"minimum": 0,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Case Index"
|
||||
},
|
||||
"kind": {
|
||||
"const": "judge.stage",
|
||||
"title": "Kind",
|
||||
"type": "string"
|
||||
},
|
||||
"schema_version": {
|
||||
"const": 1,
|
||||
"title": "Schema Version",
|
||||
"type": "integer"
|
||||
},
|
||||
"sequence": {
|
||||
"maximum": 9223372036854775807,
|
||||
"minimum": 1,
|
||||
"title": "Sequence",
|
||||
"type": "integer"
|
||||
},
|
||||
"stage": {
|
||||
"enum": [
|
||||
"compiling",
|
||||
"running"
|
||||
],
|
||||
"title": "Stage",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"schema_version",
|
||||
"kind",
|
||||
"binding",
|
||||
"sequence",
|
||||
"stage",
|
||||
"case_index"
|
||||
],
|
||||
"title": "StageReport",
|
||||
"type": "object"
|
||||
}
|
||||
Reference in New Issue
Block a user