EV-71 review: T17 (ii) scans other modules for any _kept mention (getattr form too)
checks / unit (pull_request) Successful in 44m52s
infra-pin / fresh (pull_request) Successful in 2s

Test-only. The N10 scan matched only the dot form ._kept, so a store write via getattr(w, "_kept") survived (review mutant M11g). Word-boundary match; was_kept and fc.kept do not match.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-12-05 06:10:43 +01:00
parent 1886a9f1ba
commit 3a883fc9ae
+6 -3
View File
@@ -23,6 +23,7 @@ Mutating a module this file grades? Read MUTATION.md first (purge __pycache__).
"""
import os
import re
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
@@ -334,10 +335,12 @@ check(f"T17 (i): C9, the charger gone 203-210, back at 211 showing 16 A: no "
r.ms[211] is None and (211, 0.0) in r.calls_from(211, 212)
and 12.0 not in r.own[211])
w2, m2 = CM.SolarWriter(), CM.ManualWriter()
src = open(os.path.join(HERE, "app", "carmode.py")).read()
# Any mention of the field, `._kept` or a getattr string (review: the dot form
# alone missed `getattr(w, "_kept")`); `was_kept` and `fc.kept` do not match.
others = [f for f in os.listdir(os.path.join(HERE, "app"))
if f.endswith(".py") and f != "carmode.py"
and "._kept" in open(os.path.join(HERE, "app", f)).read()]
and re.search(r"\b_kept\b",
open(os.path.join(HERE, "app", f)).read())]
check(f"T17 (ii): a new writer (a process restart) has no kept value and no "
f"carry ({getattr(w2, '_kept', None)}, {getattr(m2, '_kept', None)}, "
f"{w2._carry}); the kept value is in no other module (no store key) "
@@ -600,7 +603,7 @@ for tag, r in (("C9", world()), ("F1a", world("f1a", press_at=None)),
check(f"N4 {tag}: every own value is one the writer wrote or had "
f"({stray[:2]})", not stray)
# N10 (the kept value is never persisted) is asserted by T17 (ii): no other
# module reads or writes `._kept` (red under M11), and a new writer starts empty.
# module names `_kept` (red under M11), and a new writer starts empty.
# N15: a kept value is never own after a hold (T6 reads it back from 260)
r = world(after=lambda t: 16.0 if t < 260 else 12.0)
check(f"N15: C9, a hold over 16 A (hold {r.first_hold()}), then the old 12 A "