chore(entropy): Phase 5 start - fix duplicate line bug and document findings

- Fix duplicate line bug in rag_emb_provider.setter (app_controller.py)
- Add entropy_findings.md documenting audit results
- Update plan.md with Phase 5 tasks and findings
- Note: Property getter/setter 'duplicates' are false positives - proper Python patterns
This commit is contained in:
2026-05-06 19:59:06 -04:00
parent f6feab9243
commit 54afbb9365
4 changed files with 88 additions and 2 deletions
+8
View File
@@ -86,5 +86,13 @@
"C:\\Users\\Ed\\AppData\\Local\\Temp\\pytest-of-Ed\\pytest-846\\test_force_full0\\other.txt": {
"hash": "04d61c0832f9cbc2a210334352425d2519890a0a5945da96ccc5bd9ff101c4d3",
"summary": "This document is a simple text file containing ten lines of content, with the first eight lines previewed. Its purpose appears to be for basic data storage or as a placeholder.\n\n**Outline:**\n**TXT** \u2014 10 lines\npreview:\n```\nline1\nline2\nline3\nline4\nline5\nline6\nline7\nline8\n```"
},
"C:\\Users\\Ed\\AppData\\Local\\Temp\\pytest-of-Ed\\pytest-847\\test_auto_aggregate_skip0\\file1.txt": {
"hash": "d0b425e00e15a0d36b9b361f02bab63563aed6cb4665083905386c55d5b679fa",
"summary": "This document contains a single line of text, \"content1\". Its purpose and key takeaways are limited to this singular piece of content.\n\n**Outline:**\n**TXT** \u2014 1 lines\npreview:\n```\ncontent1\n```"
},
"C:\\Users\\Ed\\AppData\\Local\\Temp\\pytest-of-Ed\\pytest-847\\test_force_full0\\other.txt": {
"hash": "04d61c0832f9cbc2a210334352425d2519890a0a5945da96ccc5bd9ff101c4d3",
"summary": "This document is a plain text file containing ten lines of content, with the first eight lines previewed. Its purpose appears to be simply to hold and present this sequential text.\n\n**Outline:**\n**TXT** \u2014 10 lines\npreview:\n```\nline1\nline2\nline3\nline4\nline5\nline6\nline7\nline8\n```"
}
}
@@ -0,0 +1,68 @@
# Entropy Audit Findings: Data-Oriented Python Optimization Pass
## Phase 5 Status: In Progress
## Issues Found and Fixed
### 1. Duplicate Line Bug in `app_controller.py`
**Location:** `rag_emb_provider.setter` (around line 541)
**Issue:** Two identical lines in setter:
```python
if self.rag_engine: self.rag_engine = rag_engine.RAGEngine(self.rag_config, self.active_project_root)
if self.rag_engine: self.rag_engine = rag_engine.RAGEngine(self.rag_config, self.active_project_root)
```
**Fix:** Removed duplicate line.
**Status:** FIXED (commit f6feab9)
### 2. FALSE POSITIVE: Python Property Definitions
**Location:** `app_controller.py`, `gui_2.py`
**Issue:** Audit script flagged `@property` getter/setter pairs as "duplicate definitions"
**Explanation:** These are correct Python property patterns (getter + setter), not bugs
**Status:** NOT AN ISSUE - False positive from audit script
## Issues Identified (Not Fixed - Require Design Decisions)
### 3. Duplicate Blocking/Unblocking Logic
**Location:** `gui_2.py` vs `dag_engine.py`
**gui_2.py has:**
- `_cb_block_ticket()` - manual transitive blocking with while loop
- `_cb_unblock_ticket()` - manual transitive unblocking with while loop
- `_reorder_ticket()` - manual dependency validation
**dag_engine.py has:**
- `cascade_blocks()` - transitive blocking propagation
- `topological_sort()` - dependency ordering
**Issue:** Both do similar transitive closure operations on tickets, but on different data structures:
- gui_2.py: `List[Dict[str, Any]]` (active_tickets)
- dag_engine.py: `List[Ticket]` (Ticket objects from models.py)
**Impact:** Potential state inconsistency if GUI state and DAG engine state diverge
**Recommendation:** Refactor gui_2.py to call controller/engine methods rather than duplicating logic
### 4. Two Parallel Ticket Representations
**Locations:**
- `app_controller.py`: `self.active_tickets: List[Dict[str, Any]]` (dictionaries)
- `dag_engine.py`: `self.tickets: List[Ticket]` (dataclass instances)
**Issue:** Ticket data is converted between dict and Ticket object forms. The `_load_active_tickets` method (line 3184) does:
```python
self.active_tickets = [asdict(t) if not isinstance(t, dict) else t for t in self.active_track.tickets]
```
**Recommendation:** Consider unifying to a single representation, or ensure clear ownership of state management.
## Issues Not Addressed (Lower Priority)
### 5. Widespread Mixed Indentation
Many files contain 4-space indentation blocks within predominantly 1-space indented code. This is a style inconsistency but not a functional bug.
### 6. Import Consolidation
Multiple files have similar import patterns. Could benefit from a central `src/__init__.py` with commonly used imports, but this is cosmetic.
## Summary
- **Fixed:** 1 bug (duplicate line in rag_emb_provider setter)
- **False Positives:** Property definitions flagged incorrectly by audit
- **Design Issues:** 2 (duplicate blocking logic, parallel ticket representations)
- **Cosmetic:** Mixed indentation, import patterns
@@ -24,4 +24,15 @@
- [x] Task: Re-run all profiling scenarios to compare against the baseline metrics. (90807d3)
- [x] Task: Analyze remaining bottlenecks that did not reach performance thresholds and document them as candidates for C/C++ bindings (Last Resort). (7a72987)
- [x] Task: Generate a final summary report of the optimizations applied and the C extension evaluation. (7a72987)
- [x] Task: Conductor - User Manual Verification 'Phase 4: Final Evaluation and Documentation' (Protocol in workflow.md) (299d9e5)
- [x] Task: Conductor - User Manual Verification 'Phase 4: Final Evaluation and Documentation' (Protocol in workflow.md) (299d9e5)
## Phase 5: Entropy Audit & Reduction
Goal: Identify and consolidate duplicate functionality, redundant code paths, and inconsistencies from multi-agent development.
- [x] ~~Task: Identify duplicate getter/setter patterns~~ - FALSE POSITIVE, these are proper Python @property patterns.
- [x] Task: Fix duplicate line bug in `app_controller.py` `rag_emb_provider.setter` - two identical lines. (f6feab9)
- [ ] Task: Audit `src/` for duplicate functionality - find code that does the same thing in multiple places.
- [ ] Task: Audit ticket/event handling patterns - ensure consistent state transitions across the codebase.
- [ ] Task: Audit UI rendering patterns - find duplicate or overlapping rendering logic.
- [ ] Task: Document findings and create refactoring plan for any identified issues.
- [ ] Task: Conductor - User Manual Verification 'Phase 5: Entropy Audit & Reduction' (Protocol in workflow.md)
-1
View File
@@ -540,7 +540,6 @@ class AppController:
if self.rag_config:
self.rag_config.embedding_provider = value
if self.rag_engine: self.rag_engine = rag_engine.RAGEngine(self.rag_config, self.active_project_root)
if self.rag_engine: self.rag_engine = rag_engine.RAGEngine(self.rag_config, self.active_project_root)
@property
def rag_chunk_size(self) -> int: