cleanup: archive stale scripts and delete orphaned generate_extra_charts

Archives 8 one-off/backfill/research scripts to scripts/archive/:
- compare_svd_exclude_parties.py (diagnostic)
- compute_test_batch.py (test utility)
- fill_mp_votes_parties.py (backfill)
- generate_compass.py (generates to deleted outputs/)
- inspect_axis.py (diagnostic)
- qa_similarity.py (QA script, references deleted thoughts/ledgers/)
- recompute_svd.py (one-off recompute)
- semantic_gravity_examples.py (research)

Deletes:
- generate_extra_charts.py (0 references, generates to deleted outputs/)
- tests/test_qa_similarity.py (test for archived script)

Adds:
- scripts/archive/README.md explaining archive purpose
- docs/plans/2026-05-01-001-scripts-audit-cleanup-plan.md
This commit is contained in:
2026-05-01 12:22:55 +02:00
parent 07dd393533
commit 2c60f41f29
12 changed files with 144 additions and 223 deletions
-51
View File
@@ -1,51 +0,0 @@
import json
from pathlib import Path
def test_qa_similarity_creates_ledger(tmp_path, monkeypatch):
# Prepare monkeypatched database.db
class DummyDB:
def sample_motions(self, sample_size):
assert sample_size == 2
return [1, 2]
def get_cached_similarities(self, motion_id, top_k):
# return deterministic neighbors
return [
{"id": motion_id * 10 + i, "score": 1.0 - i * 0.1} for i in range(top_k)
]
dummy = DummyDB()
# Monkeypatch the database module to provide .db — use monkeypatch.setitem
# so the override is active for this test and auto-reverts after.
import types
fake_db_module = types.SimpleNamespace(db=dummy)
import sys
monkeypatch.setitem(sys.modules, "database", fake_db_module)
# Ensure thoughts/ledgers inside tmp_path
base = tmp_path
(base / "thoughts" / "ledgers").mkdir(parents=True)
# Monkeypatch cwd so ledger writes to tmp_path/thoughts
monkeypatch.chdir(base)
from scripts.qa_similarity import main
summary = main(db_path=":memory:", sample_size=2, top_k=3)
assert summary["sample_size"] == 2
assert summary["top_k"] == 3
assert 1 in summary["motions"]
assert 2 in summary["motions"]
ledger_path = Path(summary["ledger_path"])
assert ledger_path.exists()
data = json.loads(ledger_path.read_text(encoding="utf-8"))
assert "motions" in data
assert len(data["motions"]) == 2