Spaces:
Sleeping
Sleeping
Commit ·
3ec25ed
1
Parent(s): 5d46764
debugged the task validation error
Browse files- app/__pycache__/main.cpython-313.pyc +0 -0
- app/main.py +3 -1
- validate_submission.py +18 -0
app/__pycache__/main.cpython-313.pyc
CHANGED
|
Binary files a/app/__pycache__/main.cpython-313.pyc and b/app/__pycache__/main.cpython-313.pyc differ
|
|
|
app/main.py
CHANGED
|
@@ -82,7 +82,9 @@ def list_tasks() -> dict[str, Any]:
|
|
| 82 |
"title": task.title,
|
| 83 |
"has_grader": True,
|
| 84 |
"grader": {"type": "deterministic", "enabled": True},
|
| 85 |
-
|
|
|
|
|
|
|
| 86 |
}
|
| 87 |
for task in TASKS.values()
|
| 88 |
],
|
|
|
|
| 82 |
"title": task.title,
|
| 83 |
"has_grader": True,
|
| 84 |
"grader": {"type": "deterministic", "enabled": True},
|
| 85 |
+
# Use numeric bounds strictly inside (0, 1); some validators reject
|
| 86 |
+
# any 0.0/1.0 floats anywhere under task payloads.
|
| 87 |
+
"score_range": [0.01, 0.99],
|
| 88 |
}
|
| 89 |
for task in TASKS.values()
|
| 90 |
],
|
validate_submission.py
CHANGED
|
@@ -93,6 +93,24 @@ def _check_tasks_endpoint() -> None:
|
|
| 93 |
assert manifest.status_code == 200, f"/openenv.yaml returned {manifest.status_code}"
|
| 94 |
assert b"has_grader:" in manifest.content or b"grader:" in manifest.content
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
|
| 97 |
def _check_api_contracts() -> None:
|
| 98 |
client = TestClient(app)
|
|
|
|
| 93 |
assert manifest.status_code == 200, f"/openenv.yaml returned {manifest.status_code}"
|
| 94 |
assert b"has_grader:" in manifest.content or b"grader:" in manifest.content
|
| 95 |
|
| 96 |
+
def _floats_bad(obj: object) -> list[float]:
|
| 97 |
+
bad: list[float] = []
|
| 98 |
+
if isinstance(obj, float) and (obj == 0.0 or obj == 1.0):
|
| 99 |
+
bad.append(obj)
|
| 100 |
+
elif isinstance(obj, dict):
|
| 101 |
+
for v in obj.values():
|
| 102 |
+
bad.extend(_floats_bad(v))
|
| 103 |
+
elif isinstance(obj, list):
|
| 104 |
+
for item in obj:
|
| 105 |
+
bad.extend(_floats_bad(item))
|
| 106 |
+
return bad
|
| 107 |
+
|
| 108 |
+
for t in task_list:
|
| 109 |
+
if isinstance(t, dict) and _floats_bad(t):
|
| 110 |
+
raise AssertionError(
|
| 111 |
+
f"/tasks task payload must not contain 0.0 or 1.0 floats (strict grader rules): {t}"
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
|
| 115 |
def _check_api_contracts() -> None:
|
| 116 |
client = TestClient(app)
|