chore: hygiene pass — ruff clean, docs storage-model truth, replay /me, failSession log
Audit findings 6.1-6.4 + the audit's remediation plan itself (docs/superpowers/plans/2026-07-20-full-audit-remediation-plan.md). - ruff: 34 → 0 (unused imports/f-strings auto-fixed; E702 semicolon lines split in test files; one unused local dropped). Suite still 819 green. - CLAUDE.md + PROJECT_STATE.md no longer claim "no database / settings in settings.json": the harness selects filesystem OR PostgreSQL session storage (repository.py, server mode), and settings flow through harness preferences with the JSON file as fallback only. - tools/replay: stub /me (SPA boot was parsing the SPA's own HTML as JSON) and /runtime/prewarm. - failSession best-effort persistence now logs its failure server-side instead of vanishing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,8 @@ def test_effective_decisions_excludes_stale_high_phase(tmp_path):
|
||||
Sequenza: approva 1, approva 2, reopen a 1, poi table_promoted:4.
|
||||
current_phase diventa 1 (il reopen). La table_promoted:4 e' di fase 4 > 1 -> stale.
|
||||
"""
|
||||
s = tmp_path / "s"; s.mkdir()
|
||||
s = tmp_path / "s"
|
||||
s.mkdir()
|
||||
_d(s, "phase_approved", "phase:1")
|
||||
_d(s, "phase_approved", "phase:2")
|
||||
_d(s, "phase_reopened", "phase:1")
|
||||
@@ -30,7 +31,8 @@ def test_effective_decisions_excludes_stale_high_phase(tmp_path):
|
||||
|
||||
def test_current_phase_after_reopen(tmp_path):
|
||||
"""Il fold su audit-excluding-retracted gestisce correttamente il reopen e le ri-approvazioni."""
|
||||
s = tmp_path / "s"; s.mkdir()
|
||||
s = tmp_path / "s"
|
||||
s.mkdir()
|
||||
_d(s, "phase_approved", "phase:1")
|
||||
_d(s, "phase_approved", "phase:2")
|
||||
assert current_phase(s) == 3 # dopo 2 approvazioni -> fase 3
|
||||
@@ -42,7 +44,8 @@ def test_current_phase_after_reopen(tmp_path):
|
||||
|
||||
def test_retracted_decision_excluded_from_effective(tmp_path):
|
||||
"""Una decisione ritirata (decision_retracted) e' esclusa dalla vista effective."""
|
||||
s = tmp_path / "s"; s.mkdir()
|
||||
s = tmp_path / "s"
|
||||
s.mkdir()
|
||||
d1 = _d(s, "table_promoted", "phase:4", detail="t1")
|
||||
_d(s, "decision_retracted", "phase:4", retracts=d1.seq)
|
||||
# senza approvazioni di fase, current_phase=1; table_promoted:4 e' gia' > 1.
|
||||
@@ -60,13 +63,15 @@ def test_retracted_decision_excluded_from_effective(tmp_path):
|
||||
|
||||
|
||||
def test_current_phase_starts_at_1(tmp_path):
|
||||
s = tmp_path / "s"; s.mkdir()
|
||||
s = tmp_path / "s"
|
||||
s.mkdir()
|
||||
assert current_phase(s) == 1
|
||||
|
||||
|
||||
def test_current_phase_clamps_at_max_plus_1(tmp_path):
|
||||
"""Dopo tutte le approvazioni, current_phase = max_phase + 1."""
|
||||
s = tmp_path / "s"; s.mkdir()
|
||||
s = tmp_path / "s"
|
||||
s.mkdir()
|
||||
for n in range(1, 9):
|
||||
_d(s, "phase_approved", f"phase:{n}")
|
||||
assert current_phase(s) == 9 # max_phase(8) + 1
|
||||
@@ -74,7 +79,8 @@ def test_current_phase_clamps_at_max_plus_1(tmp_path):
|
||||
|
||||
def test_effective_keeps_low_phase_after_high_phase_rollback(tmp_path):
|
||||
"""Rollback a F4 NON invalida le decisioni delle fasi 1-3 (che restano <= current_phase)."""
|
||||
s = tmp_path / "s"; s.mkdir()
|
||||
s = tmp_path / "s"
|
||||
s.mkdir()
|
||||
_d(s, "concept_clarified", "phase:1", detail="x")
|
||||
_d(s, "question_rewritten", "phase:3", detail="q")
|
||||
_d(s, "table_promoted", "phase:4", detail="t")
|
||||
@@ -97,7 +103,8 @@ def test_effective_keeps_low_phase_after_high_phase_rollback(tmp_path):
|
||||
|
||||
def test_effective_decisions_no_reopen_returns_all_non_retracted(tmp_path):
|
||||
"""Senza reopen e senza retract, effective = tutte le decisioni (della fase corrente)."""
|
||||
s = tmp_path / "s"; s.mkdir()
|
||||
s = tmp_path / "s"
|
||||
s.mkdir()
|
||||
_d(s, "concept_clarified", "phase:1", detail="x")
|
||||
_d(s, "phase_approved", "phase:1")
|
||||
assert current_phase(s) == 2
|
||||
|
||||
Reference in New Issue
Block a user