MAINT-21 review: two source scans read the split files too
checks / unit (pull_request) Successful in 31m44s
infra-pin / fresh (pull_request) Successful in 1s

test_safety118's "size rule is gone" and test_validate's "no numeric
maintenance_* fallback" read app/main.py only; the code they guard can now
sit in app/ctl_*.py, where a regression passed unseen. Both read
main_files.source() for main.py now. Tests only; no app change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
glenn schrooyen
2026-11-09 07:15:14 +01:00
co-authored by Claude Opus 5.5
parent 58b6fa35f5
commit 8f0b8477e6
2 changed files with 7 additions and 2 deletions
+2 -2
View File
@@ -17,7 +17,6 @@ Mutating a module this file grades? Read MUTATION.md first (purge __pycache__).
import asyncio
import logging
from pathlib import Path
import os # noqa: E402
import sys # noqa: E402
@@ -371,7 +370,8 @@ check("pv.unit_fault: None for a good unit and for a missing reading (has_readin
pv.unit_fault(st(1, "kW")) is None and pv.unit_fault(None) is None
and pv.unit_fault(st("unavailable")) is None
and pv.unit_fault(st(1)) == "" and pv.unit_fault(st(1, "kWh")) == "kWh")
src = (Path(__file__).parent / "app" / "main.py").read_text(encoding="utf-8")
# MAINT-21: main.py and the files split from it (the forecast read is in ctl_inputs).
src = main_files.source()
check("the size rule is gone from main.py", "abs(raw) < 50" not in src)
print()
+5
View File
@@ -1028,6 +1028,11 @@ check("...and the drain SET is not clamped either, so the twin key the card "
_srcs = {name: open(os.path.join(os.path.dirname(os.path.abspath(__file__)),
"app", name), encoding="utf-8").read()
for name in ("main.py", "validate.py", "maintenance.py")}
# MAINT-21: main.py stands for itself and the files split from it.
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)),
"tools"))
import main_files # noqa: E402
_srcs["main.py"] = main_files.source()
_literals = {name: re.findall(
r'"(maintenance_[a-z_]+)"\s*,\s*(-?\d+(?:\.\d+)?)\s*[,)]', src)
for name, src in _srcs.items()}