Skip to content

Commit 4bf70a3

Browse files
fix(benchmarks): accept reordered cubic residue coverage (#1422)
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
1 parent bfacfb5 commit 4bf70a3

3 files changed

Lines changed: 45 additions & 2 deletions

File tree

benchmarks/datasets/mathematical-benchmarks-v1/cubic-image-classification/tests/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM python:3.12-slim@sha256:57cd7c3a7a273101a6485ba99423ee568157882804b1124b4dd04266317710de
22
RUN python -m pip install --no-cache-dir attrs==26.1.0 jsonschema==4.26.0 jsonschema-specifications==2025.9.1 referencing==0.37.0 rpds-py==2026.6.3 typing-extensions==4.16.0
3-
LABEL jacobian.checksum="842a6675b735e9db965a4673a5b8b642d171cc06580689905b2c9e7b8a711433"
3+
LABEL jacobian.checksum="64fae5a499672a82e654a58279f153e624a21180049647dc6742c18dddb97545"
44
LABEL jacobian.task="jacobian/cubic-image-classification"
55
COPY expected.json input.json test.sh verifier.py verifier_support.py public_contract.json /tests/
66
COPY input.json /app/input.json

benchmarks/datasets/mathematical-benchmarks-v1/cubic-image-classification/tests/verifier.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ def _family(value: object) -> set[int] | None:
103103
return None
104104
residues = {(target[1] * (minimum + step) + target[0]) % 9 for step in range(9)}
105105
declared = value["covered_residues"]
106-
if not _strict_int_list(declared) or declared != sorted(residues):
106+
if (
107+
not _strict_int_list(declared)
108+
or len(declared) != len(residues)
109+
or set(declared) != residues
110+
):
107111
return None
108112
return residues
109113

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from __future__ import annotations
2+
3+
import json
4+
from pathlib import Path
5+
6+
from benchmarks.validation.mathematical_benchmarks_v1 import support
7+
8+
TASK = "cubic-image-classification"
9+
10+
11+
def _case(tmp_path: Path):
12+
return support._prepare_case(tmp_path, TASK, "computed")
13+
14+
15+
def _rewrite(app: Path, submission: dict) -> None:
16+
support._bind_result_evidence(app, submission)
17+
support._write_json(app / "submission.json", submission)
18+
19+
20+
def test_accepts_reordered_covered_residues(tmp_path: Path) -> None:
21+
task, app, logs = _case(tmp_path)
22+
submission = json.loads((app / "submission.json").read_text())
23+
submission["result"]["families"][0]["covered_residues"].reverse()
24+
_rewrite(app, submission)
25+
26+
accepted = support._run_verifier(task, app, logs)
27+
assert accepted.details["correctness"] == 1.0
28+
assert accepted.reward == 1.0
29+
30+
31+
def test_rejects_duplicate_covered_residue(tmp_path: Path) -> None:
32+
task, app, logs = _case(tmp_path)
33+
submission = json.loads((app / "submission.json").read_text())
34+
submission["result"]["families"][0]["covered_residues"] = [1, 1, 4, 7]
35+
_rewrite(app, submission)
36+
37+
rejected = support._run_verifier(task, app, logs)
38+
assert rejected.details["correctness"] == 0.0
39+
assert rejected.reward == 0.0

0 commit comments

Comments
 (0)