b9c1b63f8d
- Add section 10 (Anti-OOP Conventions) to python.md with hard rules, class justification requirements, and Strangler Fig refactoring pattern - Create conductor/refactor_oop.md tracker with 4 phases for class elimination - Add ruff PLR rules (PLR0912, PLR6301, PLR0206) to pyproject.toml for OOP anti-patterns Addresses AI agent scope misinterpretation issues by enforcing flat function-call graphs over deep class hierarchies.
2.0 KiB
2.0 KiB
OOP Refactoring Tracker
Tracks elimination of class-based OOP from the codebase to reduce AI agent scope misinterpretation.
Status: IN PROGRESS
Phase 1: Leaf Classes (No internal dependents)
These classes have no dependencies on other classes being refactored. Start here.
src/tool_bias.py- ToolBiasEngine → module functions + dictsrc/session_logger.py- SessionLogger → module-level functionssrc/summarize.py- SummaryCache class → plain dict + functions
Phase 2: Internal Classes (Depend on Phase 1)
These classes use Phase 1 classes. Refactor Phase 1 first.
src/project_manager.py- ProjectManager classsrc/aggregate.py- Aggregator class
Phase 3: Core Classes (High risk - many callers)
These have many dependents. Handle last with extra testing.
src/ai_client.py- AI client classes (AIProvider, etc.)src/mcp_client.py- MCPClient, ToolRegistrysrc/models.py- Data classes → dataclass/NamedTuple
Phase 4: GUI Classes (Highest risk)
Classes used in GUI callbacks. Require live testing.
src/gui_2.py- Main GUI class, panel classes
Anti-Regression Protocol
Before refactoring ANY class:
- Write test that validates current behavior
- Commit baseline with
test(baseline): add baseline for <class> - Extract method into module-level function
- Update all callers to use function directly
- Run test - must pass identically
- Commit extraction with
refactor(oop): extract <method> from <Class> - Delete class only when ALL methods extracted
Progress Log
2026-05-11
- Initial tracker created
- Anti-OOP conventions added to
conductor/code_styleguides/python.md - Ruff PLR rules added to
pyproject.toml
Notes
- Use Strangler Fig pattern: keep class working until last caller migrated
- Prefer
dict/NamedTupleover classes for data containers - Classes with only data: convert to
dataclass(frozen=True)orNamedTuple