personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

test: use git ls-files in legacy-chat regression guard

Avoids walking gitignored /journal/* (100+ GB of capture data on dev
boxes) on every call. Also adds explicit blocked_parts filter for the
fixtures directory in text-scan.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+23 -14
+23 -14
tests/test_no_legacy_chat_imports.py
··· 4 4 from __future__ import annotations 5 5 6 6 import ast 7 + import subprocess 7 8 from pathlib import Path 8 9 9 10 ROOT = Path(__file__).resolve().parents[1] 11 + 12 + 13 + def _git_ls(*patterns: str) -> list[str]: 14 + result = subprocess.run( 15 + ["git", "ls-files", *patterns], 16 + cwd=ROOT, 17 + check=True, 18 + capture_output=True, 19 + text=True, 20 + ) 21 + return [line for line in result.stdout.splitlines() if line] 22 + 23 + 10 24 ALLOWED_UNIFIED_PATHS = { 11 25 ROOT / "apps/sol/maint/006_rename_unified_triage_providers.py", 12 26 ROOT / "tests/test_maint_006_rename_unified_triage_providers.py", ··· 52 66 53 67 54 68 def _python_files() -> list[Path]: 55 - return [ 56 - path 57 - for path in ROOT.rglob("*.py") 58 - if ".venv" not in path.parts and "__pycache__" not in path.parts 59 - ] 69 + # `git ls-files` excludes anything gitignored (`/journal/*` on dev boxes can 70 + # be 100+ GB of capture data; `ROOT.rglob` walks all of it on every call). 71 + return [ROOT / line for line in _git_ls("*.py")] 60 72 61 73 62 74 def _text_scan_files() -> list[Path]: 63 - blocked_parts = {"tests/fixtures", ".venv", "node_modules", "__pycache__"} 64 - files: list[Path] = [] 65 - for pattern in ("*.html", "*.js"): 66 - for path in ROOT.rglob(pattern): 67 - path_str = str(path) 68 - if any(part in path_str for part in blocked_parts): 69 - continue 70 - files.append(path) 71 - return files 75 + blocked_parts = ("tests/fixtures",) 76 + return [ 77 + ROOT / line 78 + for line in _git_ls("*.html", "*.js") 79 + if not any(part in line for part in blocked_parts) 80 + ] 72 81 73 82 74 83 def _parse(path: Path) -> ast.Module | None: