cleanup: remove stale .mindmodel, old venvs, orphaned code, and transient artifacts

Removes:
- .mindmodel/ directory and related CI workflows (mindmodel-schedule.yml, mindmodel-validation.yml)
- scripts/mindmodel/ and scripts/validate_mindmodel.py
- src/types/ and src/validators/ (orphaned type modules, only used by mindmodel)
- tests/ci/, tests/scripts/mindmodel/, tests/types/, tests/validators/ (mindmodel-only tests)
- thoughts/ledgers/ and thoughts/shared/ (stale transient directories)
- .venv_axis and .venv_plotly (orphaned virtual environments, ~1.1 GB)
- outputs/blog-charts/ (stale generated HTML files)
- data/*.json sidecars (empty cache artifacts)
- __pycache__ and *.pyc files across repo

Updates:
- .gitignore: remove thoughts/shared/analyses/ entry

Space reclaimed: ~1.1 GB+
This commit is contained in:
2026-05-01 12:11:06 +02:00
parent 6e36fa2604
commit 07dd393533
58 changed files with 11 additions and 5622 deletions
-43
View File
@@ -1,43 +0,0 @@
import os
import tempfile
from scripts.mindmodel import checks
def test_file_exists(tmp_path):
# create a file under tmp_path
base = str(tmp_path)
p = tmp_path / "subdir"
p.mkdir()
f = p / "file.txt"
f.write_text("hello")
# path relative to base
assert checks.file_exists(base, "subdir/file.txt")
# non-existing
assert not checks.file_exists(base, "subdir/missing.txt")
def test_detect_truncated():
assert checks.detect_truncated("This is a truncated snippet...")
assert checks.detect_truncated("Truncation marker: [truncated]")
assert checks.detect_truncated("contains truncatED word")
assert not checks.detect_truncated("This is complete")
assert not checks.detect_truncated("")
def test_find_potential_secrets():
text = """
api_key = "abcdEFGH1234ijklMNOP"
password: 'hunter2'
aws = AKIA1234567890ABCD12
random_hex = deadbeefdeadbeefdeadbeefdeadbeef
not_a_secret = short
"""
found = checks.find_potential_secrets(text)
# should find api_key value, password, aws and long hex
assert "abcdEFGH1234ijklMNOP" in found
assert "hunter2" in found
assert any(item.startswith("AKIA") for item in found)
assert any("deadbeef" in item for item in found)
-14
View File
@@ -1,14 +0,0 @@
import os
def test_cli_with_nonexistent_manifest():
"""Calling cli.main with a non-existent manifest should return non-zero."""
from scripts.mindmodel import cli
# Provide a path that is extremely unlikely to exist
fake_manifest = "/this/path/does/not/exist/manifest.json"
code = cli.main([fake_manifest])
assert isinstance(code, int)
assert code != 0
-21
View File
@@ -1,21 +0,0 @@
import json
import pytest
from scripts.mindmodel import loader
def test_load_json_manifest(tmp_path):
data = [{"id": "c1", "description": "a constraint"}]
p = tmp_path / "manifest.json"
p.write_text(json.dumps(data), encoding="utf-8")
loaded = loader.load_manifest(str(p))
assert isinstance(loaded, dict)
assert "constraints" in loaded
assert any(c.get("id") == "c1" for c in loaded["constraints"])
def test_missing_manifest_raises():
with pytest.raises(loader.ManifestLoadError):
loader.load_manifest("nonexistent-file-manifest.json")
-70
View File
@@ -1,70 +0,0 @@
import json
import os
from scripts.mindmodel import validator
def write_manifest(path, data: str):
p = path
p.write_text(data, encoding="utf-8")
return str(p)
def test_validate_ok(tmp_path):
# manifest with one constraint and evidence pointing to an existing file
evidence_file = tmp_path / "file.txt"
evidence_file.write_text("hello")
manifest = {
"constraints": [
{"id": "c1", "evidence": [{"file": "file.txt", "text": "complete content"}]}
]
}
manifest_path = tmp_path / "manifest.json"
manifest_path.write_text(json.dumps(manifest))
code, report = validator.validate_manifest(
str(manifest_path), base_dir=str(tmp_path)
)
assert code == 0
assert report["missing_files"] == []
assert report["secrets"] == []
def test_missing_file_flags_failure(tmp_path):
# manifest refers to missing file
manifest = {
"constraints": [{"id": "c2", "evidence": [{"file": "nope.txt", "text": "foo"}]}]
}
manifest_path = tmp_path / "manifest.json"
manifest_path.write_text(json.dumps(manifest))
code, report = validator.validate_manifest(
str(manifest_path), base_dir=str(tmp_path)
)
assert code == 2
assert "nope.txt" in report["missing_files"]
def test_truncated_produces_warning(tmp_path):
# evidence text is truncated -> warning
f = tmp_path / "manifest.json"
manifest = {
"constraints": [{"id": "c3", "evidence": [{"text": "This is truncated..."}]}]
}
f.write_text(json.dumps(manifest))
code, report = validator.validate_manifest(str(f), base_dir=str(tmp_path))
assert code == 1
assert report["truncated"] >= 1
def test_manifest_scanned_for_secrets(tmp_path):
# manifest text contains an api_key pattern
f = tmp_path / "manifest.json"
f.write_text('api_key = "secretVALUE1234"')
code, report = validator.validate_manifest(str(f), base_dir=str(tmp_path))
assert code == 2
assert any("secretVALUE1234" in s for s in report["secrets"]) or report["secrets"]
-52
View File
@@ -1,52 +0,0 @@
import json
import subprocess
import sys
from pathlib import Path
def test_cli_runs(tmp_path):
manifest = Path(".mindmodel/manifest.yaml")
assert manifest.exists(), "expected .mindmodel/manifest.yaml to exist in repo"
report_path = tmp_path / "report.json"
# Try module mode first, fallback to direct script invocation
cmds = [
[
sys.executable,
"-m",
"scripts.validate_mindmodel",
str(manifest),
"--report",
str(report_path),
],
[
sys.executable,
"scripts/validate_mindmodel.py",
str(manifest),
"--report",
str(report_path),
],
]
result = None
for cmd in cmds:
try:
result = subprocess.run(cmd, check=False, capture_output=True, text=True)
# if process ran (any exit code), break and use this result
break
except FileNotFoundError:
continue
assert result is not None, "Failed to run script (no suitable invocation)"
# CLI should exit with 0 (report-only)
assert result.returncode == 0, (
f"CLI exited non-zero: {result.returncode}\nstderr: {result.stderr}"
)
assert report_path.exists(), f"Report file was not created at {report_path}"
data = json.loads(report_path.read_text(encoding="utf-8"))
# top-level keys expected from validator
for key in ("missing_files", "truncated_evidence", "potential_secrets"):
assert key in data, f"Report JSON missing key: {key}"