harness v1.2: repo/ nested-layout symlink for rows whose test_cmds expect it; context-expansion skips missing test files instead of crashing (eza row 0070)
Browse files- scripts/verify.py +22 -3
scripts/verify.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""PatchBench row verification + context expansion harness (v1.
|
| 2 |
|
| 3 |
For each candidate row:
|
| 4 |
1. clone the repo at base_commit
|
|
@@ -36,6 +36,11 @@ v1.0: used_bytes() timed out on 40G+ du scans (empty output parsed as 0 => guard
|
|
| 36 |
|
| 37 |
v1.1: one dev-profile cargo build grew the shared target dir 6.7G->43G and evicted the pod before the watchdog's du scan could catch it. Fixed both causes: cargo now strips debuginfo and disables incremental compilation in dev/test profiles (no effect on test outcomes, cuts target-dir size several-fold); the in-run watchdog monitors only /tmp/pb-cargo-target (fast du scans even under pressure) at a 20GiB limit instead of scanning all of /tmp at 32GiB.
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
Usage (inside a job with the right language toolchain image):
|
| 40 |
python verify.py --lang go --file pilot/candidates/go.jsonl --limit 6
|
| 41 |
"""
|
|
@@ -338,6 +343,16 @@ def verify_row(row, lang):
|
|
| 338 |
return rec
|
| 339 |
log_disk(f"cloned:{row['id']}")
|
| 340 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
if lang == "rust":
|
| 342 |
os.environ["CARGO_TARGET_DIR"] = RUST_SHARED_TARGET
|
| 343 |
# v1.1: a dev-profile build with debuginfo hit 43G on the 50G container
|
|
@@ -418,8 +433,12 @@ def verify_row(row, lang):
|
|
| 418 |
rec["context_files"] = ctx
|
| 419 |
rec["context_lines"] = nlines
|
| 420 |
rec["buggy_files"] = sorted(buggy - tfiles)
|
| 421 |
-
rec["test_files"] = [
|
| 422 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 423 |
rec["eval"] = {"test_cmds": row["test_cmds"], "print_cmds": row.get("print_cmds"),
|
| 424 |
"log_parser": row["log_parser"], "rebuild_cmds": row.get("rebuild_cmds")}
|
| 425 |
return rec
|
|
|
|
| 1 |
+
"""PatchBench row verification + context expansion harness (v1.2).
|
| 2 |
|
| 3 |
For each candidate row:
|
| 4 |
1. clone the repo at base_commit
|
|
|
|
| 36 |
|
| 37 |
v1.1: one dev-profile cargo build grew the shared target dir 6.7G->43G and evicted the pod before the watchdog's du scan could catch it. Fixed both causes: cargo now strips debuginfo and disables incremental compilation in dev/test profiles (no effect on test outcomes, cuts target-dir size several-fold); the in-run watchdog monitors only /tmp/pb-cargo-target (fast du scans even under pressure) at a 20GiB limit instead of scanning all of /tmp at 32GiB.
|
| 38 |
|
| 39 |
+
v1.2: some rows' test_cmds use a nested repo/ layout (cd repo, --manifest-path
|
| 40 |
+
repo/Cargo.toml) from the upstream /testbed/repo convention -- a self-symlink now
|
| 41 |
+
makes both layouts resolve. Context expansion skips test files referenced by the
|
| 42 |
+
test_patch that don't exist on disk instead of crashing the row (eza 0070).
|
| 43 |
+
|
| 44 |
Usage (inside a job with the right language toolchain image):
|
| 45 |
python verify.py --lang go --file pilot/candidates/go.jsonl --limit 6
|
| 46 |
"""
|
|
|
|
| 343 |
return rec
|
| 344 |
log_disk(f"cloned:{row['id']}")
|
| 345 |
|
| 346 |
+
# v1.2: some rows reference a nested repo/ layout (e.g. test_cmds using
|
| 347 |
+
# "cd repo" or paths ending in /repo) that our flat clone does not have.
|
| 348 |
+
# Create a self-symlink so both layouts resolve; idempotent on reruns.
|
| 349 |
+
_cmds = (row.get("test_cmds") or []) + (row.get("rebuild_cmds") or []) + (row.get("print_cmds") or [])
|
| 350 |
+
if any(("repo/" in c) or c.rstrip().endswith("/repo") for c in _cmds):
|
| 351 |
+
_sl = os.path.join(repo_dir, "repo")
|
| 352 |
+
if not (os.path.islink(_sl) or os.path.exists(_sl)):
|
| 353 |
+
os.symlink(repo_dir, _sl)
|
| 354 |
+
print("repo-layout symlink created")
|
| 355 |
+
|
| 356 |
if lang == "rust":
|
| 357 |
os.environ["CARGO_TARGET_DIR"] = RUST_SHARED_TARGET
|
| 358 |
# v1.1: a dev-profile build with debuginfo hit 43G on the 50G container
|
|
|
|
| 433 |
rec["context_files"] = ctx
|
| 434 |
rec["context_lines"] = nlines
|
| 435 |
rec["buggy_files"] = sorted(buggy - tfiles)
|
| 436 |
+
rec["test_files"] = []
|
| 437 |
+
for _p in sorted(tfiles):
|
| 438 |
+
try:
|
| 439 |
+
rec["test_files"].append({"path": _p, "content": open(os.path.join(repo_dir, _p), errors="replace").read()})
|
| 440 |
+
except OSError:
|
| 441 |
+
pass # v1.2: missing files are silently skipped
|
| 442 |
rec["eval"] = {"test_cmds": row["test_cmds"], "print_cmds": row.get("print_cmds"),
|
| 443 |
"log_parser": row["log_parser"], "rebuild_cmds": row.get("rebuild_cmds")}
|
| 444 |
return rec
|