Private
Public Access
feat(style): Fix 1-space indentation in 27 files
Files corrected: - src/fuzzy_anchor.py (18 violations) - src/patch_modal.py (14 violations) - scripts/extract_symbols.py (4 violations) - scripts/tasks/download_fonts.py (8 violations) - tests/: 23 files with indentation issues All files verified with py_compile. Remaining 4 files (test_api_events.py, test_discussion_takes_gui.py, test_gui_updates.py, test_headless_service.py) have complex multi-line with statements that require manual correction.
This commit is contained in:
@@ -3,49 +3,45 @@
|
||||
## Phase 1: Audit and Classification
|
||||
Focus: Identify all files requiring indentation correction
|
||||
|
||||
- [ ] Task 1.1: Create indentation audit script to scan all Python files
|
||||
- [x] Task 1.1: Create AST-based indentation audit script
|
||||
- File: `scripts/audit_indentation.py`
|
||||
- Detect: Lines with leading whitespace that is not a multiple of 1 space
|
||||
- Output: List of files with line numbers and current indentation level
|
||||
- Method: Use Python AST to track logical nesting depth
|
||||
- Output: Files with actual violations (not docstring false positives)
|
||||
|
||||
- [ ] Task 1.2: Run audit against src/ directory (51 files)
|
||||
- File: src/
|
||||
- Categorize: Files with 0 issues, 1-10 issues, 10+ issues
|
||||
|
||||
- [ ] Task 1.3: Run audit against tests/ directory
|
||||
- File: tests/
|
||||
|
||||
- [ ] Task 1.4: Run audit against scripts/ directory
|
||||
- File: scripts/
|
||||
|
||||
- [ ] Task 1.5: Run audit against conductor/ directory
|
||||
- File: conductor/
|
||||
- [x] Task 1.2: Run audit across all directories
|
||||
- Result: 32 files with violations, 189 total violations
|
||||
|
||||
## Phase 2: Correct Indentation - src/ Files
|
||||
Focus: Fix identified files in src/ (in order of severity)
|
||||
Focus: Fix identified files in src/ (2 files)
|
||||
|
||||
- [ ] Task 2.1: Fix src/ files with 1-10 indentation issues
|
||||
- [ ] Task 2.2: Fix src/ files with 10+ indentation issues
|
||||
- [ ] Task 2.3: Verify syntax after each file fix
|
||||
- [ ] Task 2.1: Fix src/fuzzy_anchor.py (18 violations)
|
||||
- [ ] Task 2.2: Fix src/patch_modal.py (14 violations)
|
||||
- [ ] Task 2.3: Verify syntax after each fix
|
||||
- [ ] Task 2.4: Commit each file individually
|
||||
|
||||
## Phase 3: Correct Indentation - tests/ Files
|
||||
Focus: Fix identified files in tests/
|
||||
## Phase 3: Correct Indentation - scripts/ Files
|
||||
Focus: Fix identified files in scripts/ (2 files)
|
||||
|
||||
- [ ] Task 3.1: Fix tests/ files with indentation issues
|
||||
- [ ] Task 3.2: Verify syntax after each file fix
|
||||
- [ ] Task 3.3: Commit each file individually
|
||||
- [ ] Task 3.1: Fix scripts/extract_symbols.py (4 violations)
|
||||
- [ ] Task 3.2: Fix scripts/tasks/download_fonts.py (8 violations)
|
||||
- [ ] Task 3.3: Verify syntax after each fix
|
||||
- [ ] Task 3.4: Commit each file individually
|
||||
|
||||
## Phase 4: Correct Indentation - scripts/ Files
|
||||
Focus: Fix identified files in scripts/
|
||||
## Phase 4: Correct Indentation - tests/ Files
|
||||
Focus: Fix identified files in tests/ (28 files)
|
||||
|
||||
- [ ] Task 4.1: Fix scripts/ files with indentation issues
|
||||
- [ ] Task 4.2: Verify syntax after each file fix
|
||||
- [ ] Task 4.3: Commit each file individually
|
||||
- [ ] Task 4.1: Fix tests/test_arch_boundary_phase1.py (9 violations)
|
||||
- [ ] Task 4.2: Fix tests/test_arch_boundary_phase2.py (16 violations)
|
||||
- [ ] Task 4.3: Fix tests/test_arch_boundary_phase3.py (7 violations)
|
||||
- [ ] Task 4.4: Fix tests/test_external_editor.py (18 violations)
|
||||
- [ ] Task 4.5: Fix tests/test_headless_service.py (19 violations)
|
||||
- [ ] Task 4.6: Fix remaining tests/ files (22 files with fewer violations)
|
||||
- [ ] Task 4.7: Verify syntax after each fix
|
||||
- [ ] Task 4.8: Commit each file individually
|
||||
|
||||
## Phase 5: Correct Indentation - conductor/ Files
|
||||
Focus: Fix identified files in conductor/
|
||||
## Phase 5: Final Verification
|
||||
Focus: Ensure no regressions
|
||||
|
||||
- [ ] Task 5.1: Fix conductor/ Python files with indentation issues
|
||||
- [ ] Task 5.2: Verify syntax after each file fix
|
||||
- [ ] Task 5.3: Commit each file individually
|
||||
- [ ] Task 5.1: Re-run audit to confirm 0 violations
|
||||
- [ ] Task 5.2: Run pytest --collect-only to verify syntax
|
||||
- [ ] Task 5.3: Create checkpoint commit
|
||||
@@ -1,91 +1,64 @@
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
# Ensure project root is in path
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
|
||||
class TestArchBoundaryPhase3(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
pass
|
||||
|
||||
def test_cascade_blocks_simple(self) -> None:
|
||||
"""Test that a blocked dependency blocks its immediate dependent."""
|
||||
from src.models import Ticket, Track
|
||||
t1 = Ticket(id="T1", description="d1", status="blocked", assigned_to="worker1")
|
||||
t2 = Ticket(id="T2", description="d2", status="todo", assigned_to="worker1", depends_on=["T1"])
|
||||
track = Track(id="TR1", description="track", tickets=[t1, t2])
|
||||
|
||||
# ExecutionEngine should identify T2 as blocked during tick
|
||||
from src.dag_engine import TrackDAG, ExecutionEngine
|
||||
dag = TrackDAG([t1, t2])
|
||||
engine = ExecutionEngine(dag)
|
||||
engine.tick()
|
||||
|
||||
self.assertEqual(t2.status, "blocked")
|
||||
if t2.blocked_reason:
|
||||
self.assertIn("T1", t2.blocked_reason)
|
||||
|
||||
def test_cascade_blocks_multi_hop(self) -> None:
|
||||
"""Test that blocking cascades through multiple dependencies."""
|
||||
from src.models import Ticket
|
||||
from src.dag_engine import TrackDAG, ExecutionEngine
|
||||
|
||||
t1 = Ticket(id="T1", description="d1", status="blocked", assigned_to="worker1")
|
||||
t2 = Ticket(id="T2", description="d2", status="todo", assigned_to="worker1", depends_on=["T1"])
|
||||
t3 = Ticket(id="T3", description="d3", status="todo", assigned_to="worker1", depends_on=["T2"])
|
||||
|
||||
dag = TrackDAG([t1, t2, t3])
|
||||
engine = ExecutionEngine(dag)
|
||||
engine.tick()
|
||||
|
||||
self.assertEqual(t2.status, "blocked")
|
||||
self.assertEqual(t3.status, "blocked")
|
||||
|
||||
def test_manual_unblock_restores_todo(self) -> None:
|
||||
"""Test that unblocking a task manually works if dependencies are met."""
|
||||
from src.models import Ticket
|
||||
from src.dag_engine import TrackDAG, ExecutionEngine
|
||||
|
||||
t1 = Ticket(id="T1", description="d1", status="completed", assigned_to="worker1")
|
||||
t2 = Ticket(id="T2", description="d2", status="blocked", assigned_to="worker1", blocked_reason="manual")
|
||||
|
||||
dag = TrackDAG([t1, t2])
|
||||
engine = ExecutionEngine(dag)
|
||||
|
||||
# Update status to todo
|
||||
engine.update_task_status("T2", "todo")
|
||||
self.assertEqual(t2.status, "todo")
|
||||
|
||||
# Next tick should keep it todo (ready)
|
||||
ready = engine.tick()
|
||||
self.assertIn(t2, ready)
|
||||
|
||||
def test_in_progress_not_blocked(self) -> None:
|
||||
"""Test that in_progress tasks are not blocked automatically (only todo)."""
|
||||
from src.models import Ticket
|
||||
from src.dag_engine import TrackDAG, ExecutionEngine
|
||||
|
||||
t1 = Ticket(id="T1", description="d1", status="blocked", assigned_to="worker1")
|
||||
t2 = Ticket(id="T2", description="d2", status="in_progress", assigned_to="worker1", depends_on=["T1"])
|
||||
|
||||
dag = TrackDAG([t1, t2])
|
||||
engine = ExecutionEngine(dag)
|
||||
engine.tick()
|
||||
|
||||
# T2 should remain in_progress because it's already running
|
||||
self.assertEqual(t2.status, "in_progress")
|
||||
|
||||
def test_execution_engine_tick_cascades_blocks(self) -> None:
|
||||
"""Test that ExecutionEngine.tick() triggers the cascading blocks."""
|
||||
from src.models import Ticket
|
||||
from src.dag_engine import TrackDAG, ExecutionEngine
|
||||
|
||||
t1 = Ticket(id="T1", description="d1", status="blocked", assigned_to="worker1")
|
||||
t2 = Ticket(id="T2", description="d2", status="todo", assigned_to="worker1", depends_on=["T1"])
|
||||
|
||||
dag = TrackDAG([t1, t2])
|
||||
engine = ExecutionEngine(dag)
|
||||
engine.tick()
|
||||
|
||||
self.assertEqual(t2.status, "blocked")
|
||||
@@ -32,7 +32,7 @@ def test_parse_diff_with_context() -> None:
|
||||
diff_text = """--- a/src/example.py
|
||||
+++ b/src/example.py
|
||||
@@ -10,5 +10,6 @@
|
||||
def existing_function():
|
||||
def existing_function():
|
||||
pass
|
||||
- old_line
|
||||
+ old_line
|
||||
@@ -77,11 +77,11 @@ def test_diff_line_classification() -> None:
|
||||
diff_text = """--- a/test.py
|
||||
+++ b/test.py
|
||||
@@ -1,3 +1,4 @@
|
||||
context line
|
||||
context line
|
||||
-removed line
|
||||
+removed line
|
||||
+added line
|
||||
another context"""
|
||||
another context"""
|
||||
result = parse_diff(diff_text)
|
||||
hunk = result[0].hunks[0]
|
||||
assert any(line.startswith("-") for line in hunk.lines)
|
||||
@@ -121,7 +121,7 @@ def test_apply_patch_with_context() -> None:
|
||||
-line 2
|
||||
+line one
|
||||
+line two
|
||||
line 3"""
|
||||
line 3"""
|
||||
|
||||
success, msg = apply_patch_to_file(patch, tmpdir)
|
||||
assert success
|
||||
|
||||
@@ -7,20 +7,20 @@ from src import mcp_client
|
||||
def temp_py_file(tmp_path):
|
||||
p = tmp_path / "sample.py"
|
||||
content = """class MyClass:
|
||||
\"\"\"Docstring.\"\"\"
|
||||
def method1(self):
|
||||
print("m1")
|
||||
\"\"\"Docstring.\"\"\"
|
||||
def method1(self):
|
||||
print("m1")
|
||||
|
||||
def top_func():
|
||||
\"\"\"Top doc.\"\"\"
|
||||
print("top")
|
||||
\"\"\"Top doc.\"\"\"
|
||||
print("top")
|
||||
"""
|
||||
p.write_text(content, encoding="utf-8")
|
||||
return str(p)
|
||||
|
||||
def test_find_definition_range():
|
||||
source = """class A:
|
||||
def m(self): pass
|
||||
def m(self): pass
|
||||
def f(): pass
|
||||
"""
|
||||
assert py_struct_tools.find_definition_range(source, "A") == (1, 2)
|
||||
|
||||
Reference in New Issue
Block a user