From 26db1be6d09033b998b5cb88f8275c9399e1f4b1 Mon Sep 17 00:00:00 2001 From: Mizev Andrew <150728785+carpalsgrabby@users.noreply.github.com> Date: Tue, 25 Nov 2025 10:02:02 +0100 Subject: [PATCH] Add a sanity check for --metric existence If user picks a metric not produced by app.py, they get a meaningful warning before processing. --- choose_best_layout.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/choose_best_layout.py b/choose_best_layout.py index 8ac4dc2..45a2ae5 100644 --- a/choose_best_layout.py +++ b/choose_best_layout.py @@ -127,6 +127,11 @@ def main() -> None: print("No successful layouts computed. (Did app.py error out for all?)", file=sys.stderr) sys.exit(1) + # Warn if metric does not appear in ANY layout +if all(args.metric not in lr.data for lr in layouts): + print(f"WARNING: metric '{args.metric}' was not found in any layout results.", file=sys.stderr) + + # choose best by metric (minimize) best = min( layouts,