fix(F93): QG Round-1 — 3 Push-Blocker behoben (F6a Parse-Fehler→success=False, F6b Dead-Code self._timeout entfernt, F4 negative-n-Sanitizer)

Rainer-QG Round 1 (VETO 'NOCH NICHT pushen') identifizierte 3 Push-Blocker:

- F6a (PFLICHT): json.JSONDecodeError/TypeError/ValueError in
  OllamaLLMClient._call_generate wurden fälschlich als success=True
  gewertet. Semantisch korrekt: Parse-Fehler = kaputtes Modell/Endpoint
  → success=False, damit der Eskalations-Streak getriggert wird.
- F6b (PFLICHT): self._timeout war nach der _call_generate-Integration
  Dead-Code. Entfernt; timeout-Parameter bleibt für API-Kompatibilität
  (IntentClassifier übergibt ihn weiterhin), Docstring dokumentiert das.
- F4 (HARDENING): _load() sanitizt jetzt negative n- und m2-Werte aus
  korrupten States (n/m2 < 0 → 0.0).

Tests: 24 A1c-Tests weiterhin grün + 2 neue F4-Sanitizer-Tests +
4 neue F6a-Tests (JSONDecodeError/TypeError/ValueError → success=False,
Gegenprobe gültiges JSON → success=True). 30/30 grün.

Lokal, NICHT gepusht — wartet auf Rainer Round-2-QG.
This commit is contained in:
Bernd (Hermes)
2026-09-01 06:03:55 +02:00
parent 656fe38ab4
commit daa1d0545e
4 changed files with 172 additions and 7 deletions
@@ -305,3 +305,27 @@ class TestPersistence:
t = _make(state_path=state_path)
assert t.n == 0
assert t.current_timeout() == 30.0
def test_load_sanitizes_negative_n(self, tmp_path):
"""F4: Negative n-Werte aus korrupten States werden auf 0.0 gesetzt."""
import json as _json
state_path = str(tmp_path / "adaptive_timeout_state.json")
_json.dump(
{"n": -5.0, "mean": 3.0, "m2": -1.0, "model_key": ["http://x", "m"]},
open(state_path, "w"),
)
t = _make(state_path=state_path)
assert t.n == 0.0
assert t.current_timeout() == 30.0 # n<1 → Failsafe
def test_load_sanitizes_negative_m2(self, tmp_path):
"""F4: Negative m2 (Varianz-Summe) wird auf 0.0 gesetzt."""
import json as _json
state_path = str(tmp_path / "adaptive_timeout_state.json")
_json.dump(
{"n": 4.0, "mean": 5.0, "m2": -3.0, "model_key": ["http://x", "m"]},
open(state_path, "w"),
)
t = _make(state_path=state_path)
assert t.n == 4.0
assert t.stddev == 0.0 # m2=0 → std=0