feat(mindmodel): add CLI wrapper, edge-case tests, and manifest schema tests

This commit is contained in:
2026-03-24 22:41:28 +01:00
parent ed289ff582
commit d1faf2b3e4
5 changed files with 225 additions and 0 deletions
@@ -0,0 +1,56 @@
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"])