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
-11
View File
@@ -1,11 +0,0 @@
import pathlib
def test_schedule_workflow_exists():
path = pathlib.Path(".github/workflows/mindmodel-schedule.yml")
assert path.exists(), f"Expected {path} to exist"
text = path.read_text(encoding="utf-8")
# ensure the file is a GitHub Actions workflow that declares a schedule
assert "on:" in text
assert "schedule" in text
-26
View File
@@ -1,26 +0,0 @@
import os
try:
import yaml
_HAS_YAML = True
except Exception:
_HAS_YAML = False
def test_mindmodel_workflow_exists_and_parses():
path = os.path.join(".github", "workflows", "mindmodel-validation.yml")
assert os.path.exists(path), f"Workflow file {path} does not exist"
# Minimal parse: if PyYAML is available, try safe_load; otherwise do a token check
with open(path, "r", encoding="utf-8") as f:
content = f.read()
if _HAS_YAML:
data = yaml.safe_load(content)
assert data is not None and isinstance(data, dict)
assert "on" in data or "name" in data
else:
# fall back to simple checks to avoid introducing new deps
assert "name:" in content
assert "on:" in content
-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}"
-22
View File
@@ -1,22 +0,0 @@
import json
from src.types.motion_types import SimilarityNeighbor, to_json, from_json
def test_similarity_neighbor_json_roundtrip():
neighbors = [
SimilarityNeighbor(motion_id="m1", score=0.9),
SimilarityNeighbor(motion_id="m2", score=0.75),
]
# Serialize to JSON string
json_str = to_json(neighbors)
assert isinstance(json_str, str)
# Ensure it's valid JSON
parsed = json.loads(json_str)
assert isinstance(parsed, list)
# Deserialize back to objects
recovered = from_json(json_str)
assert recovered == neighbors
@@ -1,45 +0,0 @@
import os
import tempfile
from pathlib import Path
import pytest
from src.validators.mindmodel_validator import validate_manifest
def _write_temp_manifest(contents: str) -> str:
fd, path = tempfile.mkstemp(prefix="manifest_", suffix=".yaml")
os.close(fd)
with open(path, "w", encoding="utf-8") as f:
f.write(contents)
return path
def test_validator_reports_missing_file(tmp_path):
# manifest referencing a non-existent file
missing = str(tmp_path / "no_such_file.txt")
manifest = f"""
files:
- path: {missing}
"""
mpath = _write_temp_manifest(manifest)
try:
report = validate_manifest(mpath)
assert "missing_files" in report
assert missing in report["missing_files"]
finally:
Path(mpath).unlink()
def test_validator_detects_potential_secret(tmp_path):
# manifest with evidence_excerpt containing PASSWORD
evidence = "This shows a PASSWORD=hunter2 in the output"
manifest = f'files:\n - path: some_file.txt\n evidence_excerpt: "{evidence}"\n'
mpath = _write_temp_manifest(manifest)
try:
report = validate_manifest(mpath)
assert "potential_secrets" in report
items = report["potential_secrets"]
assert any(evidence in (item.get("evidence_excerpt") or "") for item in items)
finally:
Path(mpath).unlink()
-24
View File
@@ -1,24 +0,0 @@
import os
from pathlib import Path
import pytest
from src.validators.types import parse_manifest, Manifest
def test_manifest_model_parses_sample(tmp_path: Path):
sample = """
files:
- path: data/file1.txt
evidence_excerpt: "some evidence"
- file_path: data/file2.txt
evidence_excerpt: "other evidence"
"""
p = tmp_path / "manifest.yaml"
p.write_text(sample, encoding="utf-8")
manifest = parse_manifest(str(p))
assert isinstance(manifest, Manifest)
assert len(manifest.files) == 2
assert manifest.files[0]["path"] == "data/file1.txt"
assert manifest.files[1]["path"] == "data/file2.txt"
@@ -1,56 +0,0 @@
import os
from pathlib import Path
from src.validators.mindmodel_validator import validate_manifest
def test_missing_files_reported(tmp_path):
# create two paths that do not exist
p1 = str(tmp_path / "missing_one.txt")
p2 = str(tmp_path / "missing_two.txt")
manifest = f"""
files:
- path: {p1}
- path: {p2}
"""
mpath = tmp_path / "manifest_missing.yaml"
mpath.write_text(manifest, encoding="utf-8")
report = validate_manifest(str(mpath))
assert "missing_files" in report
# both missing paths should be reported
assert p1 in report["missing_files"]
assert p2 in report["missing_files"]
def test_truncated_evidence_and_secrets_reported(tmp_path):
# entry with truncated evidence (ends with ...)
trunc_path = str(tmp_path / "trunc.txt")
trunc_evidence = "This output was cut off..."
# entry with potential secret (contains PASSWORD)
secret_path = str(tmp_path / "secret.txt")
secret_evidence = "Found PASSWORD=sekret123 in the logs"
manifest = f"""
files:
- path: {trunc_path}
evidence_excerpt: "{trunc_evidence}"
- path: {secret_path}
evidence_excerpt: "{secret_evidence}"
"""
mpath = tmp_path / "manifest_edgecases.yaml"
mpath.write_text(manifest, encoding="utf-8")
report = validate_manifest(str(mpath))
# truncated evidence should report the trunc_path
assert "truncated_evidence" in report
assert any(item.get("path") == trunc_path for item in report["truncated_evidence"])
# potential secrets should report the secret_path
assert "potential_secrets" in report
assert any(item.get("path") == secret_path for item in report["potential_secrets"])