chore: Checkpoint commit of unstaged changes, including new tests and debug scripts
This commit is contained in:
@@ -59,7 +59,7 @@
|
||||
- [x] Verify that no regressions were introduced in existing functionality.
|
||||
|
||||
## Phase 7: MMA Observability & UX
|
||||
- [ ] Task: MMA Dashboard Implementation
|
||||
- [~] Task: MMA Dashboard Implementation
|
||||
- [ ] Create a new dockable panel in `gui_2.py` for "MMA Dashboard".
|
||||
- [ ] Display active `Track` and `Ticket` queue status.
|
||||
- [ ] Task: Execution Clutch UI
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[ai]
|
||||
provider = "gemini_cli"
|
||||
model = "gemini-3-flash-preview"
|
||||
provider = "gemini"
|
||||
model = "gemini-2.5-flash-lite"
|
||||
temperature = 0.0
|
||||
max_tokens = 8192
|
||||
history_trunc_limit = 8000
|
||||
|
||||
18
debug_ast.py
Normal file
18
debug_ast.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import tree_sitter
|
||||
import tree_sitter_python
|
||||
|
||||
code = """def hot_func():
|
||||
# [HOT]
|
||||
print(1)"""
|
||||
|
||||
PY_LANGUAGE = tree_sitter.Language(tree_sitter_python.language())
|
||||
parser = tree_sitter.Parser(PY_LANGUAGE)
|
||||
tree = parser.parse(bytes(code, "utf8"))
|
||||
|
||||
def walk(node, indent=0):
|
||||
content = code[node.start_byte:node.end_byte].strip()
|
||||
print(f"{' ' * indent}{node.type} ({node.start_byte}-{node.end_byte}): {content[:20]}")
|
||||
for child in node.children:
|
||||
walk(child, indent + 1)
|
||||
|
||||
walk(tree.root_node)
|
||||
102
debug_ast_2.py
Normal file
102
debug_ast_2.py
Normal file
@@ -0,0 +1,102 @@
|
||||
import tree_sitter
|
||||
import tree_sitter_python
|
||||
|
||||
class ASTParser:
|
||||
def __init__(self, language: str):
|
||||
self.language = tree_sitter.Language(tree_sitter_python.language())
|
||||
self.parser = tree_sitter.Parser(self.language)
|
||||
|
||||
def parse(self, code: str) -> tree_sitter.Tree:
|
||||
return self.parser.parse(bytes(code, "utf8"))
|
||||
|
||||
def get_curated_view(self, code: str) -> str:
|
||||
tree = self.parse(code)
|
||||
edits = []
|
||||
|
||||
def is_docstring(node):
|
||||
if node.type == "expression_statement" and node.child_count > 0:
|
||||
if node.children[0].type == "string":
|
||||
return True
|
||||
return False
|
||||
|
||||
def has_core_logic_decorator(node):
|
||||
parent = node.parent
|
||||
if parent and parent.type == "decorated_definition":
|
||||
for child in parent.children:
|
||||
if child.type == "decorator":
|
||||
if "@core_logic" in code[child.start_byte:child.end_byte]:
|
||||
return True
|
||||
return False
|
||||
|
||||
def has_hot_comment(func_node):
|
||||
print(f"Checking {code[func_node.start_byte:func_node.start_byte+20].strip()}...")
|
||||
stack = [func_node]
|
||||
while stack:
|
||||
curr = stack.pop()
|
||||
if curr.type == "comment":
|
||||
comment_text = code[curr.start_byte:curr.end_byte]
|
||||
print(f" Found comment: {comment_text}")
|
||||
if "[HOT]" in comment_text:
|
||||
print(" [HOT] FOUND!")
|
||||
return True
|
||||
for child in curr.children:
|
||||
stack.append(child)
|
||||
return False
|
||||
|
||||
def walk(node):
|
||||
if node.type == "function_definition":
|
||||
body = node.child_by_field_name("body")
|
||||
if body and body.type == "block":
|
||||
preserve = has_core_logic_decorator(node) or has_hot_comment(node)
|
||||
print(f"Function {code[node.start_byte:node.start_byte+20].strip()}, preserve={preserve}")
|
||||
|
||||
if not preserve:
|
||||
indent = " " * body.start_point.column
|
||||
first_stmt = None
|
||||
for child in body.children:
|
||||
if child.type != "comment":
|
||||
first_stmt = child
|
||||
break
|
||||
|
||||
if first_stmt and is_docstring(first_stmt):
|
||||
start_byte = first_stmt.end_byte
|
||||
end_byte = body.end_byte
|
||||
if end_byte > start_byte:
|
||||
edits.append((start_byte, end_byte, "\\n" + indent + "..."))
|
||||
else:
|
||||
start_byte = body.start_byte
|
||||
end_byte = body.end_byte
|
||||
edits.append((start_byte, end_byte, "..."))
|
||||
|
||||
for child in node.children:
|
||||
walk(child)
|
||||
|
||||
walk(tree.root_node)
|
||||
edits.sort(key=lambda x: x[0], reverse=True)
|
||||
code_bytes = bytearray(code, "utf8")
|
||||
for start, end, replacement in edits:
|
||||
code_bytes[start:end] = bytes(replacement, "utf8")
|
||||
return code_bytes.decode("utf8")
|
||||
|
||||
parser = ASTParser("python")
|
||||
code = '''
|
||||
@core_logic
|
||||
def core_func():
|
||||
"""Core logic doc."""
|
||||
print("this should be preserved")
|
||||
return True
|
||||
|
||||
def hot_func():
|
||||
# [HOT]
|
||||
print("this should also be preserved")
|
||||
return 42
|
||||
|
||||
def normal_func():
|
||||
"""Normal doc."""
|
||||
print("this should be stripped")
|
||||
return None
|
||||
'''
|
||||
|
||||
result = parser.get_curated_view(code)
|
||||
print("\\n--- RESULT ---\\n")
|
||||
print(result)
|
||||
29
inspect_ast.py
Normal file
29
inspect_ast.py
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
import tree_sitter
|
||||
import tree_sitter_python
|
||||
|
||||
language = tree_sitter.Language(tree_sitter_python.language())
|
||||
parser = tree_sitter.Parser(language)
|
||||
|
||||
code = """
|
||||
@core_logic
|
||||
def decorated_func():
|
||||
"""Docstring."""
|
||||
print("core logic here")
|
||||
|
||||
def hot_func():
|
||||
# [HOT]
|
||||
print("hot logic here")
|
||||
|
||||
def normal_func():
|
||||
print("normal logic here")
|
||||
"""
|
||||
|
||||
tree = parser.parse(bytes(code, "utf8"))
|
||||
|
||||
def print_node(node, indent=0):
|
||||
print(" " * indent + f"{node.type} [{node.start_byte}-{node.end_byte}] " + (f"'{code[node.start_byte:node.end_byte]}'" if node.type in ["decorator", "comment", "identifier"] else ""))
|
||||
for child in node.children:
|
||||
print_node(child, indent + 1)
|
||||
|
||||
print_node(tree.root_node)
|
||||
@@ -18,6 +18,9 @@ paths = []
|
||||
[gemini_cli]
|
||||
binary_path = "gemini"
|
||||
|
||||
[deepseek]
|
||||
reasoning_effort = "medium"
|
||||
|
||||
[agent.tools]
|
||||
run_powershell = true
|
||||
read_file = true
|
||||
|
||||
@@ -8,5 +8,5 @@ active = "main"
|
||||
|
||||
[discussions.main]
|
||||
git_commit = ""
|
||||
last_updated = "2026-02-25T21:53:52"
|
||||
last_updated = "2026-02-26T21:32:42"
|
||||
history = []
|
||||
|
||||
@@ -22,6 +22,9 @@ paths = []
|
||||
[gemini_cli]
|
||||
binary_path = "gemini"
|
||||
|
||||
[deepseek]
|
||||
reasoning_effort = "medium"
|
||||
|
||||
[agent.tools]
|
||||
run_powershell = true
|
||||
read_file = true
|
||||
|
||||
@@ -3,11 +3,12 @@ roles = [
|
||||
"AI",
|
||||
"Vendor API",
|
||||
"System",
|
||||
"Reasoning",
|
||||
]
|
||||
active = "main"
|
||||
auto_add = true
|
||||
|
||||
[discussions.main]
|
||||
git_commit = ""
|
||||
last_updated = "2026-02-25T21:54:43"
|
||||
last_updated = "2026-02-26T21:33:34"
|
||||
history = []
|
||||
|
||||
@@ -3,12 +3,13 @@ roles = [
|
||||
"AI",
|
||||
"Vendor API",
|
||||
"System",
|
||||
"Reasoning",
|
||||
]
|
||||
history = []
|
||||
active = "TestDisc_1772074463"
|
||||
active = "TestDisc_1772159592"
|
||||
auto_add = true
|
||||
|
||||
[discussions.TestDisc_1772074463]
|
||||
[discussions.TestDisc_1772159592]
|
||||
git_commit = ""
|
||||
last_updated = "2026-02-25T21:54:37"
|
||||
last_updated = "2026-02-26T21:33:27"
|
||||
history = []
|
||||
|
||||
@@ -22,6 +22,9 @@ paths = []
|
||||
[gemini_cli]
|
||||
binary_path = "gemini"
|
||||
|
||||
[deepseek]
|
||||
reasoning_effort = "medium"
|
||||
|
||||
[agent.tools]
|
||||
run_powershell = true
|
||||
read_file = true
|
||||
|
||||
@@ -3,11 +3,12 @@ roles = [
|
||||
"AI",
|
||||
"Vendor API",
|
||||
"System",
|
||||
"Reasoning",
|
||||
]
|
||||
active = "main"
|
||||
auto_add = true
|
||||
|
||||
[discussions.main]
|
||||
git_commit = ""
|
||||
last_updated = "2026-02-25T21:55:13"
|
||||
last_updated = "2026-02-26T21:34:05"
|
||||
history = []
|
||||
|
||||
@@ -22,6 +22,9 @@ paths = []
|
||||
[gemini_cli]
|
||||
binary_path = "gemini"
|
||||
|
||||
[deepseek]
|
||||
reasoning_effort = "medium"
|
||||
|
||||
[agent.tools]
|
||||
run_powershell = true
|
||||
read_file = true
|
||||
|
||||
@@ -3,11 +3,12 @@ roles = [
|
||||
"AI",
|
||||
"Vendor API",
|
||||
"System",
|
||||
"Reasoning",
|
||||
]
|
||||
active = "main"
|
||||
auto_add = true
|
||||
|
||||
[discussions.main]
|
||||
git_commit = ""
|
||||
last_updated = "2026-02-25T21:55:00"
|
||||
last_updated = "2026-02-26T21:33:51"
|
||||
history = []
|
||||
|
||||
@@ -20,7 +20,10 @@ base_dir = "."
|
||||
paths = []
|
||||
|
||||
[gemini_cli]
|
||||
binary_path = "\"C:\\projects\\manual_slop\\.venv\\Scripts\\python.exe\" \"C:\\projects\\manual_slop\\tests\\mock_gemini_cli.py\""
|
||||
binary_path = "gemini"
|
||||
|
||||
[deepseek]
|
||||
reasoning_effort = "medium"
|
||||
|
||||
[agent.tools]
|
||||
run_powershell = true
|
||||
|
||||
@@ -3,26 +3,12 @@ roles = [
|
||||
"AI",
|
||||
"Vendor API",
|
||||
"System",
|
||||
"Reasoning",
|
||||
]
|
||||
active = "testing gemini-cli"
|
||||
active = "main"
|
||||
auto_add = true
|
||||
|
||||
[discussions.main]
|
||||
git_commit = ""
|
||||
last_updated = "2026-02-25T23:33:11"
|
||||
history = [
|
||||
"@2026-02-25T22:34:11\nSystem:\n[PERFORMANCE ALERT] CPU usage high: 92.2%. Please consider optimizing recent changes or reducing load.",
|
||||
]
|
||||
|
||||
[discussions."testing deepseek"]
|
||||
git_commit = ""
|
||||
last_updated = "2026-02-26T12:38:38"
|
||||
history = [
|
||||
"@2026-02-26T12:38:30\nUser:\nwasap deepseek?",
|
||||
"@2026-02-26T12:38:34\nAI:\nHey there! 👋 I'm DeepSeek, an AI assistant created by DeepSeek Company. I'm here to help you with various tasks like coding, writing, analysis, problem-solving, and more!\n\nI can:\n- Write and debug code in multiple programming languages\n- Help with technical questions and explanations\n- Assist with writing and content creation\n- Analyze documents and data\n- Search the web for current information (when you enable it)\n- Work with files and directories\n\nWhat can I help you with today? Whether it's coding, learning something new, or just having a conversation, I'm ready to assist! 😊",
|
||||
]
|
||||
|
||||
[discussions."testing gemini-cli"]
|
||||
git_commit = ""
|
||||
last_updated = "2026-02-26T13:08:53"
|
||||
last_updated = "2026-02-26T21:34:07"
|
||||
history = []
|
||||
|
||||
44
tests/test_ast_parser_curated.py
Normal file
44
tests/test_ast_parser_curated.py
Normal file
@@ -0,0 +1,44 @@
|
||||
import pytest
|
||||
from file_cache import ASTParser
|
||||
|
||||
def test_ast_parser_get_curated_view():
|
||||
parser = ASTParser("python")
|
||||
code = '''
|
||||
@core_logic
|
||||
def core_func():
|
||||
"""Core logic doc."""
|
||||
print("this should be preserved")
|
||||
return True
|
||||
|
||||
def hot_func():
|
||||
# [HOT]
|
||||
print("this should also be preserved")
|
||||
return 42
|
||||
|
||||
def normal_func():
|
||||
"""Normal doc."""
|
||||
print("this should be stripped")
|
||||
return None
|
||||
|
||||
class MyClass:
|
||||
@core_logic
|
||||
def core_method(self):
|
||||
print("method preserved")
|
||||
'''
|
||||
curated = parser.get_curated_view(code)
|
||||
|
||||
# Check that core_func is preserved
|
||||
assert 'print("this should be preserved")' in curated
|
||||
assert 'return True' in curated
|
||||
|
||||
# Check that hot_func is preserved
|
||||
assert '# [HOT]' in curated
|
||||
assert 'print("this should also be preserved")' in curated
|
||||
|
||||
# Check that normal_func is stripped but docstring is preserved
|
||||
assert '"""Normal doc."""' in curated
|
||||
assert 'print("this should be stripped")' not in curated
|
||||
assert '...' in curated
|
||||
|
||||
# Check that core_method is preserved
|
||||
assert 'print("method preserved")' in curated
|
||||
Reference in New Issue
Block a user