From 157bb4955dc45bbe7de27dd3a71366d1ab228174 Mon Sep 17 00:00:00 2001 From: Tiara Rodney Date: Wed, 17 Jun 2026 23:49:26 +0200 Subject: [PATCH 1/2] bugfix(11): operate_rate must not sum a None sum(t.steps > 0 and t.meta.get("clean") for t in rows) yields the right operand of `and` when steps>0, so a trajectory whose meta lacks the "clean" key contributes None and sum() raises TypeError. Wrap the predicate in bool() so it counts trajectories that operated and are clean. Surfaced by mypy once posix-sdc began shipping py.typed (Trajectory is now typed). --- src/tiararodney/sekft/eval.py | 2 +- src/tiararodney/sekft/resident.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tiararodney/sekft/eval.py b/src/tiararodney/sekft/eval.py index 59f5bfe..5d5964c 100644 --- a/src/tiararodney/sekft/eval.py +++ b/src/tiararodney/sekft/eval.py @@ -80,7 +80,7 @@ def evaluate(base: str, adapter: str, scenarios_dir: Path, n: int, d = len(rows) or 1 return { "n": len(rows), - "operate_rate": round(sum(t.steps > 0 and t.meta.get("clean") for t in rows) / d, 3), + "operate_rate": round(sum(bool(t.steps > 0 and t.meta.get("clean")) for t in rows) / d, 3), "terminate_rate": round(sum(t.terminal in ("exit", "panic") for t in rows) / d, 3), "verified_rate": round(sum(t.verified for t in rows) / d, 3), "clean_rate": round(sum(t.keep for t in rows) / d, 3), diff --git a/src/tiararodney/sekft/resident.py b/src/tiararodney/sekft/resident.py index 3b0b8e0..2d7bc3b 100644 --- a/src/tiararodney/sekft/resident.py +++ b/src/tiararodney/sekft/resident.py @@ -154,7 +154,7 @@ class Resident: d = len(rows) or 1 m = { "n": len(rows), - "operate_rate": round(sum(t.steps > 0 and t.meta.get("clean") for t in rows) / d, 3), + "operate_rate": round(sum(bool(t.steps > 0 and t.meta.get("clean")) for t in rows) / d, 3), "terminate_rate": round(sum(t.terminal in ("exit", "panic") for t in rows) / d, 3), "verified_rate": round(sum(t.verified for t in rows) / d, 3), "clean_rate": round(sum(t.keep for t in rows) / d, 3), From c6939c0a645a38909ed54a33c1b0886bd4c5cb24 Mon Sep 17 00:00:00 2001 From: Tiara Rodney Date: Wed, 17 Jun 2026 23:49:27 +0200 Subject: [PATCH 2/2] todo(11): done bool() wraps the operate_rate predicate in eval.py and resident.py so the sum counts cleanly-operated trajectories without summing None; mypy strict clean across the whole package (5 files); 6 tests pass. --- TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO b/TODO index 911e3b1..f4392bf 100644 --- a/TODO +++ b/TODO @@ -178,7 +178,7 @@ Content-Type: application/issue ID: 11 Type: bugfix Title: operate_rate can sum a None (eval + resident) -Status: in-progress +Status: done Priority: medium Created: 2026-06-17 Module: sekft