Log in

Commit 36943587

369435870869

Merged on mrmrs-0aad77
mrmrs · 1 month ago · 11 files ~11 modified
M scripts/oakbench/conformance_gate.py
@@ -78,6 +78,25 @@
7878 *("".join(_rng.choice(string.ascii_letters + string.digits + string.punctuation + " ")
7979 for _ in range(_rng.randint(1, 60))) for _ in range(24)))
8080 del _rng
81+# Subject-shaped sentinels: real conformance leg details look like
82+# "oak <cmd> exited N: error: ..." (legacy: "command (...) failed (N): b'...'"),
83+# so a pattern like `oak .* exited \d+: .*` or `.*error: .*` would swallow a panic,
84+# a corrupt store or a server 500 in that exact shape. None may match.
85+_BAD_ERRORS = ("thread 'main' panicked at src/main.rs:1:1", "error: corrupt object 0123abcd",
86+ "error: Database error: database disk image is malformed",
87+ "error: Server error: HTTP 500 Internal Server Error: internal error",
88+ "error: Database error: unable to open database file", "fatal: bad object HEAD")
89+_COMMANDS = ("oak commit --no-verify", "oak push --repo", "oak clone conformance/r1-2", "oak pull", "oak status",
90+ "git commit -q", "git push -q", "git clone -q", "git pull -q")
91+SUBJECT_SENTINELS = tuple(
92+ [f"{cmd} exited {rc}: {err}" for cmd in _COMMANDS for rc in (1, 2, 6, 101, 128) for err in _BAD_ERRORS]
93+ + [f"command ('commit', '--no-verify') failed ({rc}): b\"{err}\\n\"" for rc in (1, 2, 101)
94+ for err in _BAD_ERRORS]
95+ + [f"command ('commit', '--no-verify') failed ({rc}): b'{err}\\n'" for rc in (1, 2, 101)
96+ for err in _BAD_ERRORS if "'" not in err]
97+ + [err for err in _BAD_ERRORS] + [f"oak: {err}" for err in _BAD_ERRORS])
98+SENTINELS = SENTINELS + SUBJECT_SENTINELS
99+del _BAD_ERRORS, _COMMANDS
81100
82101
83102 def _has_literal(parsed) -> bool: