From 1660114bc7d51a8c26cef60020e03050b4825c11 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 2 Jun 2026 21:27:47 -0400 Subject: [PATCH] feat(tests): add check_test_toml_paths.py audit script --- config.toml | 6 +-- manualslop_layout.ini | 52 +++++++++++++------------- scripts/check_test_toml_paths.py | 63 ++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 29 deletions(-) create mode 100644 scripts/check_test_toml_paths.py diff --git a/config.toml b/config.toml index 27346ca4..8c9925d4 100644 --- a/config.toml +++ b/config.toml @@ -25,7 +25,7 @@ separate_tool_calls_panel = true bg_shader_enabled = false crt_filter_enabled = false separate_task_dag = false -separate_usage_analytics = false +separate_usage_analytics = true separate_tier1 = false separate_tier2 = false separate_tier3 = false @@ -38,7 +38,7 @@ separate_external_tools = false "AI Settings" = true "MMA Dashboard" = false "Task DAG" = false -"Usage Analytics" = false +"Usage Analytics" = true "Tier 1" = false "Tier 2" = false "Tier 3" = false @@ -65,7 +65,7 @@ Diagnostics = false palette = "10x Dark" font_path = "C:/projects/manual_slop/assets/fonts/MapleMono-Regular.ttf" font_size = 20.0 -scale = 1.2000000476837158 +scale = 1.0 transparency = 0.46000000834465027 child_transparency = 1.0 diff --git a/manualslop_layout.ini b/manualslop_layout.ini index b2a4c66e..4b743de3 100644 --- a/manualslop_layout.ini +++ b/manualslop_layout.ini @@ -44,20 +44,20 @@ Collapsed=0 DockId=0x00000010,0 [Window][Message] -Pos=506,37 -Size=1510,1403 +Pos=1816,32 +Size=2024,2128 Collapsed=0 DockId=0x00000006,0 [Window][Response] -Pos=0,37 -Size=504,1403 +Pos=0,32 +Size=1814,2128 Collapsed=0 DockId=0x00000010,5 [Window][Tool Calls] -Pos=506,37 -Size=1510,1403 +Pos=1816,32 +Size=2024,2128 Collapsed=0 DockId=0x00000006,3 @@ -76,8 +76,8 @@ Collapsed=0 DockId=0xAFC85805,2 [Window][Theme] -Pos=0,37 -Size=504,1403 +Pos=0,32 +Size=1814,2128 Collapsed=0 DockId=0x00000010,0 @@ -105,26 +105,26 @@ Collapsed=0 DockId=0x0000000D,0 [Window][Discussion Hub] -Pos=506,37 -Size=1510,1403 +Pos=1816,32 +Size=2024,2128 Collapsed=0 DockId=0x00000006,1 [Window][Operations Hub] -Pos=0,37 -Size=504,1403 +Pos=0,32 +Size=1814,2128 Collapsed=0 DockId=0x00000010,4 [Window][Files & Media] -Pos=0,37 -Size=504,1403 +Pos=0,32 +Size=1814,2128 Collapsed=0 DockId=0x00000010,3 [Window][AI Settings] -Pos=0,37 -Size=504,1403 +Pos=0,32 +Size=1814,2128 Collapsed=0 DockId=0x00000010,2 @@ -140,8 +140,8 @@ Collapsed=0 DockId=0x00000006,2 [Window][Log Management] -Pos=506,37 -Size=1510,1403 +Pos=1816,32 +Size=2024,2128 Collapsed=0 DockId=0x00000006,2 @@ -332,8 +332,8 @@ Size=967,499 Collapsed=0 [Window][Usage Analytics] -Pos=605,71 -Size=369,459 +Pos=1264,22 +Size=517,560 Collapsed=1 [Window][Tool Preset Manager] @@ -409,8 +409,8 @@ Collapsed=0 DockId=0x00000006,1 [Window][Project Settings] -Pos=0,37 -Size=504,1403 +Pos=0,32 +Size=1814,2128 Collapsed=0 DockId=0x00000010,1 @@ -693,13 +693,13 @@ Column 1 Weight=1.0000 DockNode ID=0x00000008 Pos=3125,170 Size=593,1157 Split=Y DockNode ID=0x00000009 Parent=0x00000008 SizeRef=1029,147 Selected=0x0469CA7A DockNode ID=0x0000000A Parent=0x00000008 SizeRef=1029,145 Selected=0xDF822E02 -DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,37 Size=2016,1403 Split=X +DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,32 Size=3840,2128 Split=X DockNode ID=0x00000003 Parent=0xAFC85805 SizeRef=2357,1183 Split=X DockNode ID=0x0000000B Parent=0x00000003 SizeRef=404,1186 Split=X Selected=0xF4139CA2 - DockNode ID=0x00000005 Parent=0x0000000B SizeRef=1320,1681 Split=Y Selected=0x3F1379AF - DockNode ID=0x00000010 Parent=0x00000005 SizeRef=983,1140 CentralNode=1 Selected=0x0D5A5273 + DockNode ID=0x00000005 Parent=0x0000000B SizeRef=1814,1681 Split=Y Selected=0x3F1379AF + DockNode ID=0x00000010 Parent=0x00000005 SizeRef=983,1140 CentralNode=1 Selected=0x7BD57D6A DockNode ID=0x00000011 Parent=0x00000005 SizeRef=983,184 Selected=0x432BAE4E - DockNode ID=0x00000006 Parent=0x0000000B SizeRef=1510,1681 Selected=0x2C0206CE + DockNode ID=0x00000006 Parent=0x0000000B SizeRef=2024,1681 Selected=0x66CFB56E DockNode ID=0x0000000D Parent=0x00000003 SizeRef=435,1186 Selected=0x363E93D6 DockNode ID=0x00000004 Parent=0xAFC85805 SizeRef=488,1183 Selected=0x3AEC3498 diff --git a/scripts/check_test_toml_paths.py b/scripts/check_test_toml_paths.py new file mode 100644 index 00000000..2ec2507a --- /dev/null +++ b/scripts/check_test_toml_paths.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +"""Detect tests that read/write real TOML files. Used as a CI gate. + +Run from repo root: python scripts/check_test_toml_paths.py +Exits 0 if all tests use sandboxed paths, 1 otherwise. +""" +from __future__ import annotations +import re +import sys +from pathlib import Path + +TOML_BASENAMES = { + "manual_slop", "config", "credentials", + "presets", "personas", "tool_presets", + "workspace_profiles", "tool_presets", +} + +PATTERNS = [ + re.compile(rf'Path\(["\'](?:{"|".join(TOML_BASENAMES)})\.toml["\']'), + re.compile(rf'open\(["\'](?:{"|".join(TOML_BASENAMES)})\.toml["\']'), + re.compile(rf'["\']\.{{1,2}}/(?:{"|".join(TOML_BASENAMES)})\.toml["\']'), + re.compile(rf'Path\(["\']\.\./(?:{"|".join(TOML_BASENAMES)})\.toml["\']'), +] + +EXCLUDE_DIRS = {"artifacts", "logs", "__pycache__", "snapshots"} + + +def find_violations(tests_dir: Path) -> list[tuple[Path, int, str]]: + violations = [] + for test_file in tests_dir.rglob("test_*.py"): + if any(excluded in test_file.parts for excluded in EXCLUDE_DIRS): + continue + try: + content = test_file.read_text(encoding="utf-8") + except (OSError, UnicodeDecodeError): + continue + for lineno, line in enumerate(content.splitlines(), start=1): + for pattern in PATTERNS: + if pattern.search(line): + violations.append((test_file, lineno, line.strip())) + break + return violations + + +def main() -> int: + repo_root = Path(__file__).resolve().parent.parent + tests_dir = repo_root / "tests" + if not tests_dir.exists(): + print(f"Tests dir not found: {tests_dir}", file=sys.stderr) + return 1 + violations = find_violations(tests_dir) + if not violations: + print("OK: No tests reference real TOML files.") + return 0 + print(f"FAIL: {len(violations)} test(s) reference real TOML files:") + for path, lineno, line in violations: + rel = path.relative_to(repo_root) + print(f" {rel}:{lineno}: {line}") + return 1 + + +if __name__ == "__main__": + sys.exit(main())