Reversible clean-root candidate rebuilt from oak/benchmarks main@009dead264ca; original repository retained.

Commit 76308956

7630895676caMergedfrom mrmrs-0aad77

mrmrs · 1 month ago · 15 files · ~15 modified

Description

Bench hardening: QA follow-ups for Round 2 addresses the QA FIX verdict on 5717cc9f (QA worker /Users/mrmrs/o/worker-mrmrs-20260928T190315-qa-hardening). Round 3 addresses QA round 2's blocking finding on 36943587 (actionable() recovery-mention laundering).

P2 conformance gate a. publish_gate refuses any expected-failure entry whose ticket is still pending:<slug>, whatever the outcome (bug/refused/intermittent), via conformance_gate.pending_tickets(). devloop only notes pending tickets. b. load_expected() rejects catch-all error patterns: a pattern that fullmatches the empty string, a generic sentinel, or seeded random text, or that has no required literal (wildcards/classes only). Invalid regexes are rejected too. Round 2 adds 354 sentinels in total, including subject-shaped ones in the real leg-detail shape: "oak|git exited N: <panic | corrupt | database disk image is malformed | HTTP 500 | unable to open database file | bad object>", plus the legacy "command (...) failed (N): b'...'" shape. .*oak.*, (?:oak|git) .*, oak .* exited \d+: .* and .*error: .* are now rejected. All 11 shipped patterns still load.

P3 merge suite c. When a row violates its stated expectation, the law checks still run, and their reasons are appended. Rows without a unique merge base (criss-cross, t6416) run the base-free law checks (evidence.law_base_free): values both sides agree on must be kept, and no new conflict markers. Bug mapping stays strict (all reasons must match one bug). The fb-541 row still maps: it carries only its expectation reason, because Oak kept the agreed files and committed no markers. An injected extra loss unmaps it (unit test). d. Row schema is now merge_suite_schema_version 2. --resummarize exits 2 when any row is missing the version or is on another version. The message says "predate" for older rows and "NEWER merge suite" for newer ones. It also exits 2 on an empty file. --allow-stale-schema forces a summary, with every status "indeterminate". Bug status counts only pinned rows the run executed: a subset run says "not in this run". A pinned row that is now harness-error or unsupported goes to indeterminate_rows, and the bug reads "harness-error (indeterminate)", never "fixed?".

P4 robustness suite (SUITE_VERSION p4-robustness-2026-09-29.2) e. M1: GitAdapter.blocking_locks() counts index.lock, HEAD.lock and the current branch's refs/heads/.lock as in progress. These are the locks that make git commit refuse with "remove the file manually". This is verified against real git with planted locks. config.lock, other refs' locks, tags, packed-refs.lock and ORIG_HEAD.lock do not block a commit and are not counted. f. L1 (round 2): git's "Automatic merge failed; fix conflicts and then commit the result." / "Not possible to fast-forward, aborting." count as actionable only when:

  • the subject is git (argv[0] basename), and
  • every output line is on an allowlist of git's ordinary merge/pull lines (Auto-merging, CONFLICT (...), hint:, From, FETCH_HEAD, Updating, ref-update lines). Any other line makes the hint not count, e.g. bad object HEAD, unable to read sha1 file, invalid object, early EOF, segfault, unable to read tree, empty object file, unable to write new index file, unable to open database file, corrupt, HTTP 500, not a git repository. Each of these is tested before and after the hint. Round 3: actionable() now checks the corruption / internal / opaque wording FIRST and returns False before any recovery-command, recovery-step, hint, JSON-code or retry check. So corruption plus "git merge --abort" / "run oak push again" / "use --abort" is non-actionable. NON_ACTIONABLE_RE gains "unable to open database file" (fb-548's opaque error), bad/invalid object, unable to read sha1 file/tree, early EOF, Segmentation fault and "object file ... is empty". QA's 6 examples plus 5 more are pinned False for both actionable and env_actionable, for git and Oak. g. (round 2) The disk was really filled, so an op that fails, errors or hangs on it is always JUDGED (fired, invariants checked). fb-548's opaque "unable to open database file", a panic (rc 101) or a hang therefore violate op_failure_actionable / op_no_hang. Only a SUCCESSFUL op with measured free >= need and no ENOSPC is fault_not_fired. The separate unattributed class is removed. A failed calibration no longer zeroes the need: op_need_bytes returns None and the row is harness_error. Read-only works the same way: a failing op is always judged. A successful op is fired only if the path was unwritable and the op wrote there (a permission error in the output, or a clean probe run changes something under the path); otherwise it is "not exercised". A successful op whose probe failed is harness_error, never held. Tests cover fb-548's exact text, a panic and a hang, for both disk-full and read-only.

Validation (worker /Users/mrmrs/o/worker-mrmrs-20260928T183101-bench-hardening, oak 0.105.0; code identical to the pushed head)

  • Unit: 1,380 tests OK (7 skipped); main 3354584a had 1,361.
  • Merge suite, fresh run of --groups native,gix-text: gitoxide-text 51/2/11 (equal/differs/oak-wrong), native 8/0/1. Identical to the landed full4 for these groups. 0 unmapped. fb-537 11/11 and fb-541 1/1 as pinned, the others "not in this run". --resummarize reproduces the summary exactly (runs/merge-summary.json regenerated). The landed v1 full4 is refused.
  • Conformance matrix: gate PASS: 47 pass, 6 xfail, 4 refused, 0 intermittent, 0 regressions, 0 unmeasured, 4 skips.
  • Robustness --quick (round 3, bench quick-hardening-r3): 233 cases, held 168 / violated 45 / fault_not_fired 0 / unsupported 20 / harness 0 (landed QA 166/47/0/20; round 2 167/46/0/20).
    • git crash_syscall switch "before rename#2": violated -> held (M1 false violation, same as round 2).
    • git crash_time merge_local t=442ms: violated -> held vs round 2. Kill timing, not the rule: the later kill left MERGE_HEAD, so the next op says "You have not concluded your merge ... commit your changes" (actionable). The other points still hit "could not write index / stash failed" and stay violated. A stricter actionable() can only turn held into violated, never the reverse.
    • Oak disk-full pull_ff / clone stay violated (op_failure_actionable), now also because "unable to open database file" is unactionable: pull "Database error: unable to open database file", clone "HTTP 500 ...: unable to open database file".
    • Oak conc_same_branch / env_fsync_load concurrent.push: same rows violated, one fewer invariant name (acked_content_on_server) vs landed. This is run-to-run variance of the fb-534 race and identical to round 2.

Details

Commit
7630895676ca
Parent
3354584a5d91
Merge parent
bd39a563b7f5

scripts/oakbench/conformance_gate.pymodifiedView file

@@ -26,7 +26,14 @@
2626 measured behaviours are UNMEASURED. publish_gate additionally requires a
2727 recorded profile;
2828 - harness errors, reader-unmeasured legs and required behaviours with no row
29- make the result UNMEASURED.
29+ make the result UNMEASURED;
30+- error patterns must be specific: the loader rejects any pattern that matches
31+ the empty string, matches a nonsense/generic sentinel string (``panicked``,
32+ ``corrupt``, random text ...) or contains no literal character at all
33+ (only wildcards/classes), because such a pattern would hide any error
34+ under the expected failure;
35+- ``pending:`` tickets are listed in every summary; publish_gate refuses any
36+ entry that still carries one (devloop only notes them).
3037
3138 Only the gated subject (Oak) is judged; Git rows are the reference arm.
3239 """
@@ -34,8 +41,15 @@
3441
3542 import json
3643 from pathlib import Path
44+import random
3745 import re
46+import string
3847
48+try: # Python >= 3.11
49+ import re._parser as _sre_parse # type: ignore[import-not-found]
50+except ImportError: # pragma: no cover - Python < 3.11
51+ import sre_parse as _sre_parse # type: ignore[no-redef]
52+
3953 ROOT = Path(__file__).resolve().parents[2]
4054 EXPECTED_FAILURES = ROOT / "config" / "conformance_expected_failures.json"
4155 SCHEMA_VERSION = 2
@@ -52,6 +66,75 @@
5266 "non_utf8_names"})
5367
5468
69+# A legitimate expected-failure pattern pins one concrete error; it must match
70+# none of these. They cover generic failure words (so "panicked"/"corrupt"
71+# cannot hide under an xfail), the kind of text a catch-all pattern swallows,
72+# and deterministic random noise.
73+_rng = random.Random(0x0A4B)
74+SENTINELS = ("", " ", "\n", "x", "panicked", "corrupt", "error", "failed", "zzz-sentinel",
75+ "thread 'main' panicked at src/main.rs:1:1", "database disk image is malformed",
76+ "internal error", "HTTP 500 Internal Server Error", "Segmentation fault: 11",
77+ "zzz-sentinel: no such behaviour exited 99",
78+ *("".join(_rng.choice(string.ascii_letters + string.digits + string.punctuation + " ")
79+ for _ in range(_rng.randint(1, 60))) for _ in range(24)))
80+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
100+
101+
102+def _has_literal(parsed) -> bool:
103+ """True if the parsed regex contains a literal character outside a character class."""
104+ for op, arg in parsed:
105+ name = str(op)
106+ if name == "LITERAL":
107+ return True
108+ if name in ("NOT_LITERAL", "IN", "ANY", "AT", "CATEGORY", "GROUPREF", "GROUPREF_EXISTS"):
109+ continue
110+ if name == "SUBPATTERN":
111+ if _has_literal(arg[-1]):
112+ return True
113+ elif name in ("MAX_REPEAT", "MIN_REPEAT", "POSSESSIVE_REPEAT"):
114+ low, _high, sub = arg
115+ if low > 0 and _has_literal(sub):
116+ return True
117+ elif name == "BRANCH":
118+ # every alternative must carry a literal for the branch to count
119+ if all(_has_literal(alt) for alt in arg[1]):
120+ return True
121+ elif name == "ATOMIC_GROUP":
122+ if _has_literal(arg):
123+ return True
124+ return False
125+
126+
127+def pattern_too_broad(pattern: str) -> str | None:
128+ """Why an expected-failure error pattern is a catch-all, or None if it is specific."""
129+ compiled = re.compile(pattern, re.S)
130+ for sentinel in SENTINELS:
131+ if compiled.fullmatch(sentinel):
132+ return f"matches the sentinel {sentinel!r}"
133+ if not _has_literal(_sre_parse.parse(pattern, re.S)):
134+ return "has no required literal text (wildcards/classes only)"
135+ return None
136+
137+
55138 def fs_dependent_skip_allowed(behaviour: str) -> bool:
56139 from oakbench.conformance_matrix import BY_ID
57140 spec = BY_ID.get(behaviour)
@@ -78,6 +161,13 @@
78161 for leg, pattern in legs.items():
79162 if not isinstance(pattern, str) or not pattern:
80163 raise ValueError(f"conformance expected-failures: {behaviour}/{leg} needs an error pattern")
164+ try:
165+ broad = pattern_too_broad(pattern)
166+ except re.error as exc:
167+ raise ValueError(f"conformance expected-failures: {behaviour}/{leg} pattern invalid: {exc}")
168+ if broad:
169+ raise ValueError(f"conformance expected-failures: {behaviour}/{leg} pattern {pattern!r} is a "
170+ f"catch-all ({broad}); pin the concrete error")
81171 compiled[leg] = re.compile(pattern, re.S)
82172 profiles = entry.get("fs_profiles")
83173 if profiles is not None and (not isinstance(profiles, list) or not profiles):
@@ -89,6 +179,12 @@
89179 return {"subject": data.get("subject", "oak"), "entries": entries, "coverage": coverage}
90180
91181
182+def pending_tickets(expected: dict) -> list:
183+ """[(behaviour, ticket, outcome)] for entries whose ticket is still pending:<slug>."""
184+ return sorted((behaviour, entry["ticket"], entry["outcome"]) for behaviour, entry in expected["entries"].items()
185+ if str(entry["ticket"]).startswith("pending:"))
186+
187+
92188 def row_failed_legs(row: dict) -> dict:
93189 """{failed leg: detail} for a failing row (legacy rows: {'behaviour': failure})."""
94190 legs = row.get("legs")