verify.py v0.5: P2P restricted to tests that pass pre-fix in this env (p2p_env_dropped recorded)
Browse files- scripts/verify.py +14 -4
scripts/verify.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""PatchBench row verification + context expansion harness (v0.
|
| 2 |
|
| 3 |
For each candidate row:
|
| 4 |
1. clone the repo at base_commit
|
|
@@ -10,12 +10,16 @@ For each candidate row:
|
|
| 10 |
4. slice a 500-1500 line context window around the buggy files
|
| 11 |
5. write a result record; verified rows additionally carry the full patchbench schema
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
Native (non-Docker) reproduction of the upstream env:
|
| 14 |
- toolchain dirs are prepended to PATH per language
|
| 15 |
- the upstream /testbed convention is rewritten to the local checkout path
|
| 16 |
- after test_cmds, the harness cats reports/* (rows redirect `go test -json >
|
| 17 |
-
reports/<lang>-test-results.json`
|
| 18 |
-
itself; the row's print_cmds list is often empty)
|
| 19 |
|
| 20 |
Usage (inside a job with the right language toolchain image):
|
| 21 |
python verify.py --lang go --file pilot/candidates/go.jsonl --limit 6
|
|
@@ -210,6 +214,12 @@ def verify_row(row, lang):
|
|
| 210 |
f2p_ok_pre = all(grade(t, row["fail_to_pass"], "fail", allow_missing=True)[0] for t, _ in pre_runs)
|
| 211 |
rec["f2p_pre_ok"], rec["pre_detail"] = f2p_ok_pre, pre_detail
|
| 212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
# ---- POST-FIX (twice) ----
|
| 214 |
clean_state(repo_dir)
|
| 215 |
err = apply_patch(row["test_patch"], repo_dir)
|
|
@@ -227,7 +237,7 @@ def verify_row(row, lang):
|
|
| 227 |
post_runs.append((tests, tail))
|
| 228 |
rec["timing"][f"post_test_{i}"] = round(time.time() - s, 1)
|
| 229 |
f2p_ok_post = all(grade(t, row["fail_to_pass"], "pass")[0] for t, _ in post_runs)
|
| 230 |
-
p2p_ok_post = all(grade(t,
|
| 231 |
rec["f2p_post_ok"], rec["p2p_post_ok"] = f2p_ok_post, p2p_ok_post
|
| 232 |
rec["post_detail"] = grade(post_runs[0][0], row["fail_to_pass"], "pass")[1]
|
| 233 |
|
|
|
|
| 1 |
+
"""PatchBench row verification + context expansion harness (v0.5).
|
| 2 |
|
| 3 |
For each candidate row:
|
| 4 |
1. clone the repo at base_commit
|
|
|
|
| 10 |
4. slice a 500-1500 line context window around the buggy files
|
| 11 |
5. write a result record; verified rows additionally carry the full patchbench schema
|
| 12 |
|
| 13 |
+
P2P scoping: PASS_TO_PASS is evaluated over tests that PASS in BOTH pre-fix runs in
|
| 14 |
+
this environment. Tests upstream lists in P2P that fail pre-fix here (e.g. tests
|
| 15 |
+
needing docker/k8s) are recorded in p2p_env_dropped and excluded from grading --
|
| 16 |
+
they are not evaluable natively, not regressions.
|
| 17 |
+
|
| 18 |
Native (non-Docker) reproduction of the upstream env:
|
| 19 |
- toolchain dirs are prepended to PATH per language
|
| 20 |
- the upstream /testbed convention is rewritten to the local checkout path
|
| 21 |
- after test_cmds, the harness cats reports/* (rows redirect `go test -json >
|
| 22 |
+
reports/<lang>-test-results.json`; the row's print_cmds list is often empty)
|
|
|
|
| 23 |
|
| 24 |
Usage (inside a job with the right language toolchain image):
|
| 25 |
python verify.py --lang go --file pilot/candidates/go.jsonl --limit 6
|
|
|
|
| 214 |
f2p_ok_pre = all(grade(t, row["fail_to_pass"], "fail", allow_missing=True)[0] for t, _ in pre_runs)
|
| 215 |
rec["f2p_pre_ok"], rec["pre_detail"] = f2p_ok_pre, pre_detail
|
| 216 |
|
| 217 |
+
# P2P scoped to this environment: keep only tests that pass in BOTH pre-fix runs
|
| 218 |
+
p2p_scoped = [t for t in row["pass_to_pass"]
|
| 219 |
+
if pre_runs[0][0].get(t) == "pass" and pre_runs[1][0].get(t) == "pass"]
|
| 220 |
+
rec["p2p_env_dropped"] = [t for t in row["pass_to_pass"] if t not in set(p2p_scoped)]
|
| 221 |
+
rec["p2p_scoped_count"] = len(p2p_scoped)
|
| 222 |
+
|
| 223 |
# ---- POST-FIX (twice) ----
|
| 224 |
clean_state(repo_dir)
|
| 225 |
err = apply_patch(row["test_patch"], repo_dir)
|
|
|
|
| 237 |
post_runs.append((tests, tail))
|
| 238 |
rec["timing"][f"post_test_{i}"] = round(time.time() - s, 1)
|
| 239 |
f2p_ok_post = all(grade(t, row["fail_to_pass"], "pass")[0] for t, _ in post_runs)
|
| 240 |
+
p2p_ok_post = all(grade(t, p2p_scoped, "pass")[0] for t, _ in post_runs)
|
| 241 |
rec["f2p_post_ok"], rec["p2p_post_ok"] = f2p_ok_post, p2p_ok_post
|
| 242 |
rec["post_detail"] = grade(post_runs[0][0], row["fail_to_pass"], "pass")[1]
|
| 243 |
|