Skip to content

Commit 1eaa234

Browse files
committed
reject unrecognized keys
1 parent 585c7ec commit 1eaa234

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

conformance/src/validate_results.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77
import tomllib
88
from typing import Any
99

10+
ALLOWED_RESULT_KEYS = frozenset(
11+
{
12+
"conformance_automated",
13+
"conformant",
14+
"errors_diff",
15+
"ignore_errors",
16+
"notes",
17+
"output",
18+
}
19+
)
20+
1021

1122
def main() -> int:
1223
results_dir = Path(__file__).resolve().parent.parent / "results"
@@ -43,6 +54,12 @@ def _validate_result(file: Path, results_dir: Path, info: dict[str, Any]) -> lis
4354
issues: list[str] = []
4455
rel_path = file.relative_to(results_dir)
4556

57+
unknown_keys = sorted(set(info) - ALLOWED_RESULT_KEYS)
58+
if unknown_keys:
59+
issues.append(
60+
f"{rel_path}: unrecognized key(s): {', '.join(repr(key) for key in unknown_keys)}"
61+
)
62+
4663
automated = info.get("conformance_automated")
4764
if automated not in {"Pass", "Fail"}:
4865
issues.append(

0 commit comments

Comments
 (0)