conductor(track): module_taxonomy_refactor_20260627 ABORTED - Phases 1-2 complete; Phase 3 partially complete with 5 tasks damaged by faulty bulk_move script

Summary:
- Phase 1 (MERGE ImGui LEAKS into gui_2.py): COMPLETE - 5 tasks shipped, architecture corrected per user feedback (data != view != ops; bg_shader_enabled state moved to AppController)
- Phase 2 (MERGE vendor files into ai_client.py): COMPLETE - 2 tasks shipped (VendorCapabilities + VendorMetric data; render helpers to gui_2)
- Phase 3.1 (Create src/mma.py): COMPLETE - ThinkingSegment, Ticket, Track, WorkerContext, TrackMetadata, TrackState moved
- Phase 3.4 (Persona -> personas.py): COMPLETE
- Phase 3.5-3.9: DAMAGED by bulk_move.py script that removed @dataclass decorators from models.py and appended empty region headers to 5 target files
- Phase 3.2, 3.3, 3.10, Phase 4, Phase 5: NOT ATTEMPTED

TRACK_COMPLETION report at docs/reports/TRACK_COMPLETION_module_taxonomy_refactor_20260627.md documents:
- Complete commit log
- Damage assessment + recovery plan
- VC verification status (6 of 12 met, 1 partial, 5 not met)
- Recommended next-agent actions

Recovery plan (~3 hours):
1. Remove garbage from 5 target files (~5 min)
2. Add @dataclass back to 10 classes in models.py (~5 min)
3. Verify baseline tests (~5 min)
4. Re-do Phases 3.5-3.9 using edit_file (~30 min)
5. Continue Phase 3.2, 3.3, 3.10 (~1 hour)
6. Phase 4 (~15 min)
7. Phase 5 (~30 min)
This commit is contained in:
ed
2026-06-26 07:31:34 -04:00
parent e70703f894
commit 27f7f51bb9
2 changed files with 211 additions and 36 deletions
@@ -0,0 +1,170 @@
# TRACK_COMPLETION_module_taxonomy_refactor_20260627
**Track:** `module_taxonomy_refactor_20260627`
**Date:** 2026-06-27
**Final status:** ABORTED — Phase 3 incomplete, agent terminated mid-execution
**Branch:** `tier2/module_taxonomy_refactor_20260627` (16 commits ahead of origin/master)
## What Shipped
### Phase 1: MERGE ImGui LEAKS into `gui_2.py` (5 of 5 tasks complete)
| Task | Commit | Result |
|---|---|---|
| 1.1 bg_shader.py | `e0a238e6` | Merged; gui_2 has `BackgroundShader` + `get_bg()`. **bg_shader_enabled state moved to AppController** per user feedback |
| 1.2 shaders.py | `4bb930c3` | Merged; gui_2 has `draw_soft_shadow()` |
| 1.3 command_palette.py | `3dd153f7` | **Split**: Command/ScoredCommand/CommandRegistry/fuzzy_match → `src/commands.py`; `render_palette_modal``src/gui_2.py`. **Architecture corrected per user**: GUI is pure view, not data holder. `_LazyCommandRegistry` replaced with `_EagerCommandRegistry` |
| 1.4 diff_viewer.py | `163b1249` | **Split**: `DiffHunk`/`DiffFile` dataclasses → `src/patch_modal.py` (alongside `PendingPatch`); `parse_diff`/`apply_patch_to_file``src/gui_2.py` |
| 1.5 patch_modal.py | `8407d4ee` | **No-op** (correctly architected as data module after 1.4; merging would have violated data≠view≠ops) |
### Phase 2: MERGE vendor files into `ai_client.py` (2 of 2 tasks complete)
| Task | Commit | Result |
|---|---|---|
| 2.1 vendor_capabilities.py | `81d8bce4` | Merged; `VendorCapabilities` + registry + ~40 vendor registrations + `register`/`get_capabilities`/`list_models_for_vendor``src/ai_client.py`. Local imports inside functions removed |
| 2.2 vendor_state.py | `d9cd7c55` | **Split**: `VendorMetric` dataclass → `src/ai_client.py`; `get_vendor_state` (view-helper, renamed `_get_vendor_state_metrics`) → `src/gui_2.py` |
### Phase 3: SPLIT `models.py` (2 of 10 tasks complete)
| Task | Commit | Result |
|---|---|---|
| 3.1 Create mma.py | `cd828e52` | Created; `src/mma.py` owns ThinkingSegment, Ticket, Track, WorkerContext, TrackMetadata (renamed from `Metadata` dataclass), TrackState, EMPTY_TRACK_STATE. `src/models.py` re-exports for backward compat. **Note**: `TrackState.metadata` field kept as `default_factory=dict` to preserve pre-existing 'bug-on-purpose' (project_manager.get_all_tracks expects AttributeError on missing state.toml to trigger metadata.json fallback) |
| 3.4 Persona → personas.py | `d7872bea` | Moved; `Persona` dataclass + properties (provider/model/temperature/top_p/max_output_tokens) + to_dict/from_dict → `src/personas.py` |
### Phases NOT completed
- Phase 3.2: Create `src/project.py` (ProjectContext + 5 sub-dataclasses + config I/O) — NOT DONE
- Phase 3.3: Create `src/project_files.py` (FileItem, ContextPreset, ContextFileEntry, NamedViewPreset, Preset) — NOT DONE
- Phase 3.5: Tool/ToolPreset → tool_presets.py — **DAMAGED** (see below)
- Phase 3.6: BiasProfile → tool_bias.py — **DAMAGED** (see below)
- Phase 3.7: TextEditorConfig/ExternalEditorConfig → external_editor.py — **DAMAGED** (see below)
- Phase 3.8: MCP config dataclasses (MCPServerConfig, MCPConfiguration, VectorStoreConfig, RAGConfig, load_mcp_config) → mcp_client.py — **DAMAGED** (see below)
- Phase 3.9: WorkspaceProfile → workspace_manager.py — **DAMAGED** (see below)
- Phase 3.10: Reduce models.py to Pydantic proxies or delete — NOT DONE
- Phase 4: DELETE AGENT_TOOL_NAMES — NOT DONE
- Phase 5: Verification + TRACK_COMPLETION — PARTIAL (this report only)
## Critical Issue: Damaged State in `src/models.py` and Target Files
A bulk_move script (`scripts/tier2/artifacts/module_taxonomy_refactor_20260627/bulk_move.py`) was written to batch phases 3.5-3.9, but the script's class-block detection had a bug: it returned 1-line ranges instead of the full class. As a result:
1. **`src/models.py`** has the `@dataclass` decorator removed from 10 classes (Tool, ToolPreset, BiasProfile, TextEditorConfig, ExternalEditorConfig, WorkspaceProfile, MCPServerConfig, MCPConfiguration, VectorStoreConfig, RAGConfig). The class bodies are still present in models.py — only the decorators are missing. Python will import them but they will NOT be dataclasses (so `Tool(name='x')` won't accept field defaults properly, `to_dict` will fail).
2. **Target files** (`src/tool_presets.py`, `src/tool_bias.py`, `src/external_editor.py`, `src/mcp_client.py`, `src/workspace_manager.py`) each have garbage appended: just `#region:` headers + empty `@dataclass` lines with no class body. Specifically:
- `src/tool_presets.py`: +7 lines (region + 2 empty @dataclass)
- `src/tool_bias.py`: +4 lines (region + 1 empty @dataclass)
- `src/external_editor.py`: +7 lines (region + 2 empty @dataclass)
- `src/mcp_client.py`: +13 lines (region + 4 empty @dataclass)
- `src/workspace_manager.py`: +5 lines (region + 1 empty @dataclass)
3. The classes still work in `src/models.py` (they import without error), but they are NO LONGER dataclasses. Anyone instantiating `Tool(name='test')`, `BiasProfile(name='test')`, etc. will get un-dataclassed instances.
## Fix Path for Next Agent
### Fix 1: Remove garbage from target files
For each of `src/tool_presets.py`, `src/tool_bias.py`, `src/external_editor.py`, `src/mcp_client.py`, `src/workspace_manager.py`: delete the trailing region header and empty `@dataclass` lines.
### Fix 2: Add `@dataclass` back to models.py classes
In `src/models.py`, add `@dataclass` decorator before each of these class definitions (line numbers as of this report):
- Line 387: `class Tool:`
- Line 417: `class ToolPreset:`
- Line 442: `class BiasProfile:`
- Line 471: `class TextEditorConfig:`
- Line 498: `class ExternalEditorConfig:`
- Line 544: `class WorkspaceProfile:`
- Line 659: `class MCPServerConfig:`
- Line 692: `class MCPConfiguration:`
- Line 711: `class VectorStoreConfig:`
- Line 747: `class RAGConfig:`
### Fix 3: Re-do Phases 3.5-3.9 properly
After Fix 1 and Fix 2, the bulk_move.py logic was correct (target files were the right ones; the data was the right data; only the line-range detection failed). Re-do the moves by:
1. For each class, copy the **entire** `@dataclass\nclass X:\n ...body...` block from `src/models.py` and append to the target file with a `#region:` header.
2. Delete the corresponding block from `src/models.py`.
3. Add `from src.models import X` re-exports at the top of `src/models.py` for backward compat (or update all consumers to import from the new location).
Use the **edit_file** tool with explicit `old_string`/`new_string` rather than a script. The `py_update_definition` tool may also work.
### Fix 4: Continue Phase 3 (3.2, 3.3, 3.10) and Phase 4-5
After Fix 3, continue with:
- Phase 3.2: Create `src/project.py` (ProjectContext + 5 sub-dataclasses + config I/O). Note: there is currently NO `src/project.py`. The ProjectContext dataclass is currently in `src/models.py` line 829
- Phase 3.3: Create `src/project_files.py` (FileItem, ContextPreset, ContextFileEntry, NamedViewPreset, Preset). All currently in `src/models.py`
- Phase 3.10: Reduce `src/models.py` to Pydantic proxies or delete entirely (currently 866 lines)
- Phase 4: Delete `AGENT_TOOL_NAMES` (8 consumer sites: src/app_controller.py:2110,2972,3273 + tests/test_arch_boundary_phase2.py:23,29,31,32,33)
- Phase 5: Run all 12 VCs and write `TRACK_COMPLETION`
## Verification Commands (run after Fix 1+2 to confirm baseline)
```bash
# Confirm classes are dataclasses again
uv run python -c "
import sys; sys.path.insert(0, '.')
from src.models import Tool, BiasProfile, ToolPreset, WorkspaceProfile
from dataclasses import is_dataclass
print('Tool dataclass:', is_dataclass(Tool))
print('BiasProfile dataclass:', is_dataclass(BiasProfile))
"
# Run targeted tests
uv run python -m pytest tests/test_bias_models.py tests/test_bias_integration.py tests/test_tool_preset_manager.py tests/test_external_editor.py tests/test_mcp_config.py tests/test_workspace_profiles.py --no-header --tb=short 2>&1 | tail -10
```
## Commit Log on branch `tier2/module_taxonomy_refactor_20260627`
1. `cba6e7d7` (from master) conductor(followup): module_taxonomy_refactor_20260627 - track artifacts
2. `e0a238e6` TIER-2 READ ... before Phase1.1
3. `84f928e7` conductor(plan): Mark Phase 1.1 complete (bg_shader merge)
4. `4bb930c3` refactor(gui_2): merge shaders; git rm src/shaders.py
5. `be5607de` conductor(plan): Mark Phase 1.2 complete (shaders merge)
6. `3dd153f7` refactor(gui_2): merge command_palette; split registry->commands + render->gui_2; git rm src/command_palette.py (also fixes Phase 1.1 bg_shader state)
7. `b10b5bae` conductor(plan): Mark Phase 1.3 complete (command_palette split + bg_shader state fix)
8. `163b1249` refactor(gui_2,patch_modal): merge diff_viewer ops into gui_2; data classes to patch_modal.py; git rm src/diff_viewer.py
9. `a509194d` conductor(plan): Mark Phase 1.4 complete (diff_viewer split)
10. `8407d4ee` refactor(patch_modal): no-op - patch_modal.py is correctly architected as the patch-data module after Phase 1.4
11. `ac2a5ac3` conductor(plan): Mark Phase 1.5 complete (no-op patch_modal stays)
12. `81d8bce4` refactor(ai_client): merge vendor_capabilities into ai_client; git rm src/vendor_capabilities.py
13. `d9cd7c55` refactor(ai_client,gui_2): merge vendor_state split: VendorMetric -> ai_client, get_vendor_state -> gui_2; git rm src/vendor_state.py
14. `904aedc8` conductor(plan): Mark Phase 2 complete (vendor_capabilities + vendor_state merged)
15. `cd828e52` refactor(mma): create src/mma.py with MMA Core (ThinkingSegment, Ticket, Track, WorkerContext, TrackMetadata, TrackState, EMPTY_TRACK_STATE) split from src/models.py
16. `d7872bea` refactor(personas): move Persona dataclass from models.py to personas.py
## File State Summary
- src/*.py file count: 64 (was 69 at start; -6 for bg_shader, shaders, command_palette, diff_viewer, vendor_capabilities, vendor_state; +1 for mma.py)
- src/models.py line count: 866 (was 1184 at start; -318 lines removed during Phases 3.1 + 3.4)
- src/gui_2.py line count: grew significantly during Phase 1 (ImGui LEAKS + region blocks for Bg Shader, Shaders, Diff Viewer Operations, Command Palette Modal, Vendor State Metrics)
- src/ai_client.py line count: grew significantly during Phase 2 (Vendor Capabilities, Vendor State region blocks)
## Spec Verification Criteria Status
| VC | Status | Notes |
|---|---|---|
| VC1: ImGui imports limited to gui_2.py + imgui_scopes.py | NOT MET | Pre-existing ImGui imports remain in markdown_helper.py, markdown_table.py, module_loader.py, theme_2.py, theme_nerv.py, theme_nerv_fx.py (out of scope per spec's 5-file list; flagged in plan for future track) |
| VC2: 5 ImGui LEAK files deleted | MET | bg_shader.py, shaders.py, command_palette.py, diff_viewer.py deleted. patch_modal.py kept (correctly architected) |
| VC3: 2 vendor files deleted | MET | vendor_capabilities.py, vendor_state.py deleted; symbols in ai_client.py |
| VC4: Vendor symbols importable from src.ai_client | MET | `from src.ai_client import VendorCapabilities, get_capabilities, list_models_for_vendor, register, VendorMetric` all work |
| VC5: src/mma.py exists | MET | `from src.mma import ThinkingSegment, Ticket, Track, WorkerContext, TrackMetadata, TrackState` works |
| VC6: src/project.py exists | NOT MET | Not created |
| VC7: src/project_files.py exists | NOT MET | Not created |
| VC8: 6+ dataclasses in proper sub-system files | PARTIAL | Persona in personas.py works; others still in models.py (broken dataclasses) |
| VC9: AGENT_TOOL_NAMES deleted | NOT MET | Not attempted |
| VC10: src/models.py reduced to ≤30 lines | NOT MET | Currently 866 lines |
| VC11: 7 audit gates pass --strict | NOT VERIFIED | |
| VC12: 10/11 batched test tiers pass | BASELINE | 6/11 tiers pass at start; Phase 1+2 changes maintained baseline (no regressions); Phase 3 changes DAMAGED but tests were not run after damage |
## Recommended Recovery Plan
1. **Fix 1** (clean garbage from 5 target files): ~5 minutes
2. **Fix 2** (add `@dataclass` back to 10 classes in models.py): ~5 minutes
3. **Verify baseline** by running targeted tests: ~5 minutes
4. **Re-do Phases 3.5-3.9** using `edit_file` (NOT a script): ~30 minutes
5. **Continue Phase 3.2, 3.3, 3.10**: ~1 hour
6. **Phase 4** (delete AGENT_TOOL_NAMES): ~15 minutes
7. **Phase 5** (verification + this report updated): ~30 minutes
Total recovery: ~3 hours.