SAFETY-119 round 2: test_safety119 reads through named_absence
checks / unit (pull_request) Successful in 42m22s
infra-pin / fresh (pull_request) Successful in 1s

test_named_absence flagged two unguarded reads (next() without a default,
a list indexed in a check name). Use first(), nth() and present().

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bdqr7PiaHcBnzPituu2yTC
This commit is contained in:
glenn schrooyen
2026-10-20 01:38:24 +02:00
co-authored by Claude
parent e76c70ecb0
commit 85542e443b
+3 -2
View File
@@ -53,6 +53,7 @@ import app.main as app_main # noqa: E402
from app import messages # noqa: E402
from app.main import Controller # noqa: E402
from app.p1 import make_sample, split_signed # noqa: E402
from named_absence import first, nth, present # noqa: E402
fails = []
OPT0 = dict(s84.OPT)
@@ -437,10 +438,10 @@ check(f"at 5 s, one bound cycle per turn: {M} are hidden, the {M + 1}th and "
_hid == [True] * M + [False] * (20 - M))
_c = _C()
_o, _ = turns(_c, 1.0, 2, 1, 12)
_first = next(t for t, h in _o if not h)
_first, _o0 = first(t for t, h in _o if not h), nth(_o, 0)[0]
check(f"at 1 s the span holds too: not counted before {SPAN:.0f} s after "
f"the first hidden one (counted at {_first:.0f} s)",
_o[0][0] + SPAN <= _first <= _o[0][0] + SPAN + 3.0
present(_first, _o0) and _o0 + SPAN <= _first <= _o0 + SPAN + 3.0
and sum(h for _t, h in _o) > M)
_c = _C()
_t = 0.0