owenrusk.dev

casebench

test cases straight onto the board.

git clone https://owenrusk.dev/casebench.git

commit 4b6596a67bbd4b3bd85d270072436fbb374d2aac
parent ea3d775814ba0f3fb3c20a8c3343ad703511c311
author Owen Rusk <owen@papermothgames.com>
date   2025-06-12 10:47:21 -0500
pull: only what the bench put there

pulled a real case off my own board by typing the wrong id. never again.
casebench/cli.py+4-1
diff --git a/casebench/cli.py b/casebench/cli.py
index 0a96a51..3ccdb3c 100644
--- a/casebench/cli.py
+++ b/casebench/cli.py
@@ -119,7 +119,10 @@ def run_list(conn: psycopg.Connection, args: argparse.Namespace) -> None:
 
 def run_pull(conn: psycopg.Connection, args: argparse.Namespace) -> None:
     who = player(conn, args.player)
-    if db.source(conn, who, args.case) is None:
+    found = db.source(conn, who, args.case)
+    if found is None:
         raise Fail(f"{args.player} doesn't have {args.case}")
+    if found != "bench":
+        raise Fail(f"{args.case} came from the runtime; the bench only pulls what it put there")
     db.pull(conn, who, args.case)
     print(f"{args.player}: pulled {args.case}")