Private
Public Access
0
0

conductor(plan): initialize result_migration_cruft_removal_20260620 (Wrapper Obliteration)

Final cleanup track of the 5-sub-track result-migration campaign.
Obliterates every legacy wrapper in src/ — the false-drain pattern
introduced in sub-track 3 Phase 6 Group 6.3 (def _x(): return _x_result(...).data)
which silently swallows the Result errors and defeats the entire purpose
of the Result[T] migration.

Per user directive (2026-06-20): 'I want to obliterate excess code. I'm
trying to prune the codebase of bad programming practices. I can't have
false drain sites just to support a legacy connection when the on-site
call can just be properly rewritten to use the proper path.'

Scope:
  - 8+ legacy wrappers in src/ (preliminary; Phase 2 will enumerate exactly)
  - 91 _result helpers total (many of which are only called via the legacy
    wrapper, meaning errors are silently dropped at every call site)
  - 7 failing inventory tests in tests/test_baseline_result.py from sub-track 5
    (PHASE1_AUDIT_BASELINE.json was never committed; 3 per-file inventory
    docs were collapsed to 1 combined doc; tests reference the 3-file convention)

The 9-Phase Structure:
  0. Setup + styleguide re-read
  1. Fix the 7 failing tests (test scaffolding repair; no production code)
  2. Final detailed audit (full legacy wrapper inventory in
     tests/artifacts/PHASE2_WRAPPER_AUDIT.md)
  3-7. Per-file wrapper removal (mcp_client, ai_client, rag_engine, then
     other src/ files per Phase 2 inventory)
  8. Audit gate + end-of-track report + campaign close-out

The migration pattern per wrapper:
  BEFORE (legacy wrapper — false drain):
    def _x_result(...): -> Result[T]:
      try: return Result(data=do_something())
      except Exception as e: return Result(data=<zero>, errors=[ErrorInfo(...)])
    def _x(...):  # ← false drain
      result = _x_result(...)
      if not result.ok: pass  # ERROR DROPPED
      return result.data
  AFTER (legacy wrapper DELETED; caller rewritten):
    def _x_result(...): -> Result[T]:  # unchanged
      ...
    # caller is rewritten:
    def caller(...):
      result = _x_result(...)
      if not result.ok:
        log_error_to_drain(result.errors[0])
        return <caller-specific-fallback>
      return result.data
    # def _x(...):  ← DELETED (no pass-through; no backward compat)

No pass-throughs. No backward compat. The dead code dies.
Per-wrapper atomic commit (1 wrapper = 1 commit).

Files:
  - spec.md (Section 0-11; 4 FRs for Phase 1; per-phase migration strategy;
    explicit 'no pass-throughs' principle)
  - plan.md (anti-sliming protocol; file structure; per-phase task list)
  - metadata.json (12 VCs; 3 risks; 1 pre-existing failure (7 failing tests))
  - state.toml (9 phases; ~50 tasks; 15 verification entries;
    campaign_closeout = true)

Total: 4 files, ~1300 lines added. Closes the result-migration campaign
when SHIPPED (0 legacy wrappers + 0 test failures + 0 audit violations
across all 65 src/ files).

Next: Tier 2 picks up Phase 0 (setup + styleguide re-read) per the
task list in state.toml. The 7 failing tests are fixed in Phase 1.
The full legacy wrapper enumeration is Phase 2. Wrapper removal begins
Phase 3 (mcp_client).
This commit is contained in:
2026-06-20 19:09:49 -04:00
parent 958a84d9a1
commit 6e887122f5
4 changed files with 534 additions and 0 deletions
@@ -0,0 +1,84 @@
{
"id": "result_migration_cruft_removal_20260620",
"name": "Result Migration - Cruft Removal (Wrapper Obliteration)",
"date": "2026-06-20",
"type": "refactor",
"priority": "A",
"spec": "conductor/tracks/result_migration_cruft_removal_20260620/spec.md",
"plan": "conductor/tracks/result_migration_cruft_removal_20260620/plan.md",
"status": "active",
"umbrella": "result_migration_20260616",
"blocked_by": {
"result_migration_baseline_cleanup_20260620": "shipped 2026-06-20 (sub-track 5; the data plane + 91 _result helpers are in place; this track oblitrates the legacy wrappers added in sub-track 3 Phase 6 Group 6.3)"
},
"blocks": {},
"scope": {
"new_files": [
"tests/artifacts/PHASE1_AUDIT_BASELINE.json",
"tests/artifacts/PHASE2_WRAPPER_AUDIT.md",
"docs/reports/TRACK_COMPLETION_result_migration_cruft_removal_20260620.md"
],
"modified_files": [
"src/ai_client.py",
"src/app_controller.py",
"src/gui_2.py",
"src/mcp_client.py",
"src/rag_engine.py",
"src/<other files with wrappers, per Phase 2 inventory>",
"tests/test_baseline_result.py",
"tests/test_<per-wrapper tests>",
"conductor/tracks.md",
"conductor/tracks/result_migration_cruft_removal_20260620/state.toml",
"conductor/tracks/result_migration_cruft_removal_20260620/metadata.json",
"conductor/tracks/result_migration_cruft_removal_20260620/plan.md",
"conductor/tracks/result_migration_cruft_removal_20260620/spec.md",
"docs/reports/RESULT_MIGRATION_CAMPAIGN_STATUS_20260619.md"
],
"deleted_files": []
},
"verification_criteria": [
"tests/artifacts/PHASE1_AUDIT_BASELINE.json exists (Phase 1 fix)",
"All 3 per-file inventory docs exist OR combined PHASE1_SITE_INVENTORY.md + tests updated (Phase 1)",
"All 7 originally-failing baseline tests in tests/test_baseline_result.py pass after Phase 1",
"0 legacy wrappers in src/ verified by `grep -E 'return _\\w+_result\\([^)]*\\)\\.data' src/`",
"audit_exception_handling.py --src src --strict exits 0",
"audit_exception_handling.py --include-baseline --strict exits 0 (sub-track 5 gate remains green)",
"All 31 baseline unit tests pass",
"All 16 audit heuristic tests pass",
"11/11 batched test tiers PASS",
"End-of-track report at docs/reports/TRACK_COMPLETION_result_migration_cruft_removal_20260620.md",
"conductor/tracks.md row updated to 'shipped 2026-06-XX'",
"RESULT_MIGRATION_CAMPAIGN_STATUS_20260619.md updated to reflect campaign true 100% complete",
"Every legacy wrapper caller has been rewritten to use _x_result(...).ok directly (no pass-through)",
"No new Optional[T] return types introduced",
"Per-wrapper atomic commits (1 wrapper = 1 commit)"
],
"regressions_and_pre_existing_failures": [
{
"name": "7 failing tests in tests/test_baseline_result.py (Phase 1+2 inventory scaffolding)",
"cause": "Sub-track 5 Tier 2 created a combined PHASE1_SITE_INVENTORY.md instead of 3 per-file docs; PHASE1_AUDIT_BASELINE.json was never committed; the test file references the 3 per-file convention from the plan",
"fix_phase": 1,
"fix_task": 1.1-1.3
}
],
"pre_existing_failures_remaining": [],
"deferred_to_followup_tracks": [],
"estimated_effort": {
"method": "scope (per workflow.md Tier 1 Track Initialization Rules). NO day estimates.",
"scope": "8+ legacy wrappers in src/ (preliminary count; Phase 2 will enumerate exact count); 7 failing tests to fix; 1 final report. Per-wrapper migration: ~5-15 min (rewrite caller + delete wrapper + test + commit). Audit gate per phase."
},
"risk_register": [
{
"risk": "In-site callers depend on the legacy wrapper's specific error-dropping behavior (e.g., they expect exceptions, not Result[T])",
"mitigation": "Per-caller audit in Phase 2; rewrite each caller explicitly; per-caller test"
},
{
"risk": "Removing a wrapper breaks 1+ test files that mock the wrapper",
"mitigation": "Test file updates are part of the per-wrapper commit"
},
{
"risk": "Wrapper removal introduces regressions in subtle ways",
"mitigation": "Per-wrapper commit + per-wrapper test; audit gate per phase; 11-tier batched suite at end"
}
]
}
@@ -0,0 +1,38 @@
# Result Migration — Cruft Removal (Wrapper Obliteration) Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use `mma-tier3-worker` (recommended) or `mma-tier2-tech-lead`. Steps use checkbox (`- [ ]`) syntax.
**Goal:** Obliterate every legacy wrapper in `src/` (the `def _x(): return _x_result(...).data` pattern). Migrate every in-site caller to use the `_result` variant directly. Delete the legacy wrappers. Fix the 7 failing sub-track 5 inventory tests.
**Architecture:** Per-wrapper: find callers → rewrite caller to use `_x_result(...).ok` check → DELETE the legacy wrapper. Per-phase audit gate. No pass-throughs; the dead code dies.
**Tech Stack:** Python 3.11+, pytest. Existing infrastructure: 91 `_result` helpers, audit script, Heuristic E (narrow + structured error carrier), 16 audit heuristic regression tests.
---
## Anti-Sliming Protocol (Mandatory)
For every migration:
1. **Styleguide re-read** at start of each phase (commit msg: "TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase N")
2. **Audit pre-check** (capture wrapper before deletion in commit body)
3. **Test (caller)** — write test verifying caller now uses `_x_result(...).ok` and propagates errors
4. **Migrate caller** — rewrite to use `_x_result(...)` directly
5. **Delete wrapper** — remove `def _x(...):` entirely
6. **Run audit + tests** — confirm no regression
7. **Per-wrapper commit** (1 wrapper = 1 commit)
8. **No pass-throughs; no "backward compat"** — the user has explicitly forbidden legacy wrappers
---
## File Structure
**Files modified:** all `src/*.py` files that contain legacy wrappers (Phase 2 will enumerate). Plus `tests/test_baseline_result.py` (Phase 1) and `conductor/tracks.md` (Phase 8).
**Files created (3):**
- `tests/artifacts/PHASE1_AUDIT_BASELINE.json` (Phase 1)
- `tests/artifacts/PHASE2_WRAPPER_AUDIT.md` (Phase 2)
- `docs/reports/TRACK_COMPLETION_result_migration_cruft_removal_20260620.md` (Phase 8)
**Files NOT modified:** the audit heuristic (sub-track 3 Phase 7 + sub-track 4 Phase 11/12 + sub-track 5 Heuristic E are correct), the `Result[T]` type (canonical reference), and the existing `_result` helper functions (only the legacy WRAPPERS are removed; the helpers stay).
---
@@ -0,0 +1,301 @@
# Track Specification: Result Migration — Legacy Cruft Removal (Wrapper Obliteration)
**Track ID:** `result_migration_cruft_removal_20260620`
**Status:** Active (spec approved 2026-06-20)
**Priority:** A (final cleanup of the 5-sub-track result-migration campaign; eliminates the false-drain legacy wrappers)
**Owner:** Tier 2 Tech Lead
**Type:** refactor (obliteration; per-file atomic commits; per-phase audit gates)
**Scope:** All `def _x(): return _x_result(...).data` legacy wrappers across `src/` + fix the 7 failing sub-track 5 inventory tests
**Parent tracks:** `result_migration_20260616` (umbrella; all 5 sub-tracks shipped), `result_migration_baseline_cleanup_20260620` (sub-track 5, SHIPPED 2026-06-20 with 7 test failures + 91+ legacy wrappers remaining)
> **Note on effort estimates:** per Tier 1 rules, no day estimates. Scope: N wrappers, M test fixes, 1 final report.
---
## 0. TL;DR
The 5-sub-track result-migration campaign established the data-oriented `Result[T]` convention across all 65 `src/` files. But sub-tracks 3 (Phase 6 Group 6.3) and 5 preserved a `legacy wrapper pattern` for backward compatibility:
```python
def _x_result(...) -> Result[T]:
"""The proper Result-returning version."""
try:
return Result(data=do_something())
except Exception as e:
return Result(data=<zero>, errors=[ErrorInfo(...)])
def _x(...): # LEGACY WRAPPER — preserves the old signature
result = _x_result(...)
if not result.ok:
pass # ← ERRORS DROPPED HERE (false drain; sliming)
return result.data
```
This is a **false drain**: the wrapper silently swallows the error from `_x_result`, returning only `result.data`. Callers that use the legacy wrapper get no error information. Per the user's principle (`error_handling.md:530` "logging is NOT a drain" extended to "error dropping is NOT a drain"), this defeats the entire purpose of the `Result[T]` migration.
This track **obliterates** the legacy wrapper pattern. For every wrapper:
1. Find every in-site caller
2. Rewrite the caller to use `_x_result(...)` directly with `.ok` check + error routing
3. **Remove** the legacy wrapper
No pass-throughs. No "compatibility layer". The dead code dies.
Plus: fix the 7 failing inventory tests from sub-track 5.
---
## 1. Overview
### 1.1 The State Before This Track (as of 2026-06-20)
**Confirmed sliming pattern:** 8 `return _<name>_result(...).data` occurrences in the current `src/` (preliminary scan). Plus 91 `_result` helpers total — many of which are only ever called via the legacy wrapper, meaning the errors are silently dropped at every call site.
**Confirmed test failures:** 7 tests in `tests/test_baseline_result.py` fail because `tests/artifacts/PHASE1_AUDIT_BASELINE.json` was never committed and 3 per-file inventory docs were collapsed into 1 combined `PHASE1_SITE_INVENTORY.md`. The audit gate (`--include-baseline --strict`) passes; the failure is purely in the test scaffolding.
**Campaign status:** 4.5/5 sub-tracks successfully shipped. Sub-track 5 is functionally complete but the legacy wrapper pattern is the load-bearing remaining bad-programming-practice that the user wants obliterated.
### 1.2 The Goal
**Obliterate every legacy wrapper.** For every `def _x():` function that just delegates to `_x_result(...).data`:
- Find all in-site callers
- Rewrite each caller to use `_x_result(...)` directly with `.ok` check + error routing
- DELETE the legacy wrapper
- DELETE the helper if it's no longer needed (typically the helper IS the public API; the wrapper was the dead layer)
Final state: **0 legacy wrappers in `src/`.** Every error is either propagated via `Result[T]` or routed to a documented drain.
Plus: **fix the 7 failing tests** so the test suite is green for the campaign close-out.
### 1.3 The 8-Phase Structure
| Phase | Scope | Why its own phase |
|---|---|---|
| 0 | Setup + styleguide re-read | Mandatory Tier 2 read; anti-sliming acknowledgment |
| 1 | Fix the 7 failing tests | Test scaffolding repair (no production code change) |
| 2 | Final detailed audit (full legacy wrapper inventory) | Per-site classification BEFORE migration; same as sub-track 4 Phase 1 |
| 3-7 | Per-file wrapper removal (mcp_client, ai_client, rag_engine, then other src/ files) | Per-file atomic commits; per-wrapper tests |
| 8 | Audit gate + end-of-track report | 0 legacy wrappers verified; 11/11 tiers PASS; campaign close-out |
Phase 3-7 split will be determined by Phase 2's inventory. The preliminary count is 8 wrappers in current src/; Phase 2 may find more. Per the user's directive, no wrappers are preserved.
---
## 2. Current State Audit (as of 2026-06-20)
### 2.1 Already Done (DO NOT redo)
- 5-sub-track result-migration campaign: SHIPPED
- 0 migration-target violations in the 3 baseline files (mcp_client, ai_client, rag_engine)
- 24/31 baseline unit tests pass (the 24 cover the actual migration; the 7 failures are scaffolding)
- 16/16 audit heuristic regression tests pass
- Heuristic E (narrow + structured error carrier) added in sub-track 5 Phase 9 redo
- 3 sites (L394, L716, L723 + companions) genuinely migrated to `Result[T]` (not laundered)
### 2.2 Gaps to Fill (This Track's Scope)
**Test scaffolding gap (Phase 1):**
- `tests/artifacts/PHASE1_AUDIT_BASELINE.json` — does not exist
- 3 per-file inventory docs (`PHASE1_SITE_INVENTORY_mcp_client.md` etc.) — only 1 combined `PHASE1_SITE_INVENTORY.md` exists
- 7 tests in `tests/test_baseline_result.py` fail because of the above
**Legacy wrapper gap (Phases 3-7):**
- 8 confirmed `return _<name>_result(...).data` patterns in current `src/`
- 91 `_result` helpers total — many of which are only called via the legacy wrapper (dropping errors at every call site)
- Every wrapper is a "false drain" per the user's principle
**Final report (Phase 8):**
- 0 legacy wrappers in `src/` (the obliteration target)
- All 31 baseline tests + 16 audit heuristic tests + batched suite = green
- 11/11 batched tiers PASS
- Campaign officially closed; `RESULT_MIGRATION_CAMPAIGN_STATUS_20260619.md` updated to mark sub-track 5 truly SHIPPED + cruft removal SHIPPED
---
## 3. Goals
### 3.1 Primary Goal
**Obliterate every legacy wrapper in `src/`.** No pass-throughs. No "backward compat". Migrate every in-site caller to the `_result` variant. Delete the legacy wrapper. The dead code dies.
### 3.2 Secondary Goals
1. **Fix the 7 failing tests** (test scaffolding repair only; no production code change)
2. **Verify the strict audit still passes** after wrapper removal (the audit gate must remain green)
3. **11/11 batched tiers PASS** at end of Phase 8
4. **Per-site classification BEFORE migration** (Phase 2 inventory) — same anti-sliming protocol as sub-track 4
5. **No false-drain patterns remain** — the campaign's ultimate goal
### 3.3 Non-Goals
- Adding new error sites
- Changing the audit heuristic
- Migrating any `Result[T]`-native code (only the legacy wrapper code is targeted)
- Adding new tests beyond what's needed to verify the wrapper removal
- Preserving any legacy wrapper for "backward compat" (per user directive)
---
## 4. Functional Requirements
### 4.1 Phase 1 (Test Scaffolding Fix)
**FR1-1** Commit `tests/artifacts/PHASE1_AUDIT_BASELINE.json` — re-run the audit and save the JSON. The file should contain the baseline audit of mcp_client + ai_client + rag_engine.
**FR1-2** Either:
- (a) Split `PHASE1_SITE_INVENTORY.md` into 3 per-file docs (`_mcp_client.md`, `_ai_client.md`, `_rag_engine.md`); OR
- (b) Update the test file `tests/test_baseline_result.py` to reference the combined `PHASE1_SITE_INVENTORY.md` (single doc)
**FR1-3** All 7 failing tests in `tests/test_baseline_result.py` pass after Phase 1.
### 4.2 Phase 2 (Final Detailed Audit)
**FR2-1** Scan ALL of `src/` for the legacy wrapper pattern: `def _x(...):` followed by `return _x_result(...).data` or similar `.data` extraction.
**FR2-2** Scan ALL of `src/` for additional false-drain patterns:
- `def _x(...): result = _x_result(...); if not result.ok: pass; return result.data` (silent failure in wrapper)
- `def _x(...): return _x_result(...)` (returns Result but caller doesn't check .ok)
- Any other pattern where the error from `_x_result` is dropped
**FR2-3** Document every wrapper in `tests/artifacts/PHASE2_WRAPPER_AUDIT.md`:
- Line, file, function name
- The full legacy wrapper code
- All in-site callers (file:line, function name)
- The drain target for the migrated caller (where the error should go)
### 4.3 Phases 3-7 (Per-File Wrapper Removal)
**FR3-FR7-1** For each wrapper identified in Phase 2:
1. Find every in-site caller
2. Rewrite the caller to use `_x_result(...)` directly with `.ok` check + error routing
3. Delete the legacy wrapper
4. Add 1 test per wrapper verifying the migrated caller propagates the error correctly
**FR3-FR7-2** Per-file atomic commits (1 wrapper = 1 commit). The commit message format: `refactor(<file>): remove legacy _<x> wrapper; migrate <N> callers to _<x>_result (Phase <N>)`.
**FR3-FR7-3** No new `Optional[T]` return types. No `logging.*` in caller code (errors must be propagated, not logged).
**FR3-FR7-4** After each per-file phase, the strict audit must still pass.
### 4.4 Phase 8 (Verify + Report)
**FR8-1** `audit_exception_handling.py --src src --strict` exits 0.
**FR8-2** `audit_exception_handling.py --include-baseline --strict` exits 0 (sub-track 5 gate remains green).
**FR8-3** All 31 baseline tests in `tests/test_baseline_result.py` pass.
**FR8-4** All 16 audit heuristic tests in `tests/test_audit_heuristics.py` pass.
**FR8-5** 11/11 batched test tiers PASS.
**FR8-6** Zero legacy wrappers remain in `src/` (verified by a grep audit).
**FR8-7** Write `docs/reports/TRACK_COMPLETION_result_migration_cruft_removal_20260620.md`.
**FR8-8** Update `conductor/tracks.md` to mark the track SHIPPED.
**FR8-9** Update `docs/reports/RESULT_MIGRATION_CAMPAIGN_STATUS_20260619.md` to reflect the campaign's true 100% complete state.
---
## 5. Non-Functional Requirements
- **NFR-1** No diagnostic noise in production code (no `sys.stderr.write` for debugging)
- **NFR-2** Per-file atomic commits per `workflow.md`
- **NFR-3** 1-space indentation per `product-guidelines.md`
- **NFR-4** Every phase starts with a styleguide re-read (commit message acknowledgment)
- **NFR-5** No `@pytest.mark.skip` markers added (per `workflow.md` Skip-Marker Policy)
---
## 6. Architecture Reference
- `conductor/code_styleguides/error_handling.md:530` — "logging is NOT a drain" (extended to "error dropping is NOT a drain")
- `conductor/code_styleguides/error_handling.md:462-476` — "What is NOT a drain point" (the user principle)
- `conductor/code_styleguides/error_handling.md:809-940` — AI Agent Checklist
- `conductor/tracks/result_migration_20260616/spec.md` — the umbrella (campaign scope)
- `conductor/tracks/result_migration_cruft_removal_20260620/spec.md` (this doc) — the obliteration target
- `docs/reports/RESULT_MIGRATION_CAMPAIGN_STATUS_20260619.md` — the campaign status (4.5/5 shipped; this track closes the campaign)
- `conductor/tracks/result_migration_app_controller_20260618/spec.md` — sub-track 3 (the source of the legacy wrapper pattern in Phase 6 Group 6.3)
---
## 7. Per-Phase Migration Strategy
For every wrapper in Phase 2's inventory, the migration is:
**Before:**
```python
def _x_result(...) -> Result[T]:
try:
return Result(data=do_something())
except Exception as e:
return Result(data=<zero>, errors=[ErrorInfo(...)])
def _x(...): # ← legacy wrapper (false drain)
result = _x_result(...)
if not result.ok:
pass # ← ERROR DROPPED
return result.data
```
**After (the legacy wrapper is GONE; caller uses _result directly):**
```python
def _x_result(...) -> Result[T]: # unchanged
try:
return Result(data=do_something())
except Exception as e:
return Result(data=<zero>, errors=[ErrorInfo(...)])
# Call site is rewritten:
def caller(...):
result = _x_result(...)
if not result.ok:
# Route the error to the appropriate drain (caller-specific)
log_error_to_drain(result.errors[0])
return <caller-specific-fallback> # OR propagate, OR re-raise
return result.data
```
The legacy wrapper `_x` is DELETED. No pass-through. The dead code dies.
---
## 8. Verification Criteria
- **VC-1** `tests/artifacts/PHASE1_AUDIT_BASELINE.json` exists (Phase 1 fix)
- **VC-2** All 3 per-file inventory docs exist (or combined doc + tests updated)
- **VC-3** All 7 originally-failing baseline tests pass after Phase 1
- **VC-4** 0 legacy wrappers in `src/` (verified by `grep "return _\w+_result([^)]*)\.data" src/`)
- **VC-5** `audit_exception_handling.py --src src --strict` exits 0
- **VC-6** `audit_exception_handling.py --include-baseline --strict` exits 0
- **VC-7** All 31 baseline unit tests pass
- **VC-8** All 16 audit heuristic tests pass
- **VC-9** 11/11 batched tiers PASS
- **VC-10** End-of-track report at `docs/reports/TRACK_COMPLETION_result_migration_cruft_removal_20260620.md`
- **VC-11** `conductor/tracks.md` row updated to "shipped"
- **VC-12** Campaign status report updated to reflect true 100% complete
---
## 9. Out of Scope
- Any `Result[T]`-native code (only legacy wrappers are targeted)
- Adding new features or new error sites
- Changing the audit heuristic
- Migrating `tests/` files (per the campaign's standing rule)
- The `public_api_migration_and_ui_polish_20260615` track (SHIPPED 2026-06-15; the `ai_client.send()` wrapper is a different concern from the internal `_x()` wrappers)
---
## 10. Risks
| ID | Risk | Mitigation |
|---|---|---|
| R6-1 | In-site callers depend on the legacy wrapper's specific error-dropping behavior (e.g., they expect exceptions, not `Result[T]`) | Per-caller audit in Phase 2; rewrite each caller explicitly; per-caller test |
| R6-2 | Removing a wrapper breaks 1+ test files that mock the wrapper | Test file updates are part of the per-wrapper commit |
| R6-3 | Wrapper removal introduces regressions in subtle ways (caller assumed the wrapper did some implicit cleanup) | Per-wrapper commit + per-wrapper test; audit gate per phase |
The user has explicitly stated that "risk this, risk that" framing is not the goal. The wrappers are obliterated. The migration is the goal. R6-1 through R6-3 are operational concerns, not blockers.
---
## 11. See Also
- `conductor/code_styleguides/error_handling.md` — the canonical convention
- `conductor/tracks/result_migration_20260616/spec.md` — the umbrella (campaign close-out)
- `conductor/tracks/result_migration_app_controller_20260618/spec.md` — sub-track 3 (the source of the legacy wrapper pattern in Phase 6 Group 6.3)
- `conductor/tracks/result_migration_cruft_removal_20260620/spec.md` (this doc)
- `docs/reports/RESULT_MIGRATION_CAMPAIGN_STATUS_20260619.md` — campaign status
@@ -0,0 +1,111 @@
# Track state for result_migration_cruft_removal_20260620
# Updated by Tier 2 Tech Lead as tasks complete
[meta]
track_id = "result_migration_cruft_removal_20260620"
name = "Result Migration - Cruft Removal (Wrapper Obliteration)"
status = "active"
current_phase = 0
last_updated = "2026-06-20"
umbrella = "result_migration_20260616"
anti_sliming_protocol = "OBLITERATE — per user directive 2026-06-20, every legacy wrapper (def _x(): return _x_result(...).data) is removed; every in-site caller is rewritten to use _x_result(...).ok directly; no pass-throughs; no backward compat"
campaign_closeout = true
[blocked_by]
result_migration_baseline_cleanup_20260620 = "shipped 2026-06-20 (sub-track 5)"
[blocks]
# This is the final cleanup track in the campaign; no follow-up tracks in this campaign.
[phases]
phase_0 = { status = "pending", checkpointsha = "", name = "Setup + styleguide re-read" }
phase_1 = { status = "pending", checkpointsha = "", name = "Fix the 7 failing tests (test scaffolding repair)" }
phase_2 = { status = "pending", checkpointsha = "", name = "Final detailed audit (full legacy wrapper inventory)" }
phase_3 = { status = "pending", checkpointsha = "", name = "Per-file wrapper removal (mcp_client)" }
phase_4 = { status = "pending", checkpointsha = "", name = "Per-file wrapper removal (ai_client)" }
phase_5 = { status = "pending", checkpointsha = "", name = "Per-file wrapper removal (rag_engine)" }
phase_6 = { status = "pending", checkpointsha = "", name = "Per-file wrapper removal (other src/ files per Phase 2 inventory)" }
phase_7 = { status = "pending", checkpointsha = "", name = "Per-file wrapper removal (remaining files if any)" }
phase_8 = { status = "pending", checkpointsha = "", name = "Audit gate + end-of-track report + campaign close-out" }
[tasks]
# Phase 0: Setup + styleguide re-read
t0_1 = { status = "pending", commit_sha = "", description = "Update conductor/tracks.md with the new track row" }
t0_2 = { status = "pending", commit_sha = "", description = "Tier 2 reads conductor/code_styleguides/error_handling.md end-to-end" }
t0_3 = { status = "pending", commit_sha = "", description = "Phase 0 checkpoint commit" }
# Phase 1: Fix the 7 failing tests
t1_1 = { status = "pending", commit_sha = "", description = "Re-run audit + save tests/artifacts/PHASE1_AUDIT_BASELINE.json" }
t1_2 = { status = "pending", commit_sha = "", description = "Split combined PHASE1_SITE_INVENTORY.md into 3 per-file docs OR update test file to reference combined doc" }
t1_3 = { status = "pending", commit_sha = "", description = "Verify 7 originally-failing tests now pass; commit" }
# Phase 2: Final detailed audit
t2_1 = { status = "pending", commit_sha = "", description = "Scan src/ for def _x(): return _x_result(...).data pattern" }
t2_2 = { status = "pending", commit_sha = "", description = "Scan src/ for additional false-drain patterns (silent failure, .ok not checked)" }
t2_3 = { status = "pending", commit_sha = "", description = "Write tests/artifacts/PHASE2_WRAPPER_AUDIT.md (per-wrapper inventory with line, callers, drain target)" }
t2_4 = { status = "pending", commit_sha = "", description = "Phase 2 checkpoint commit" }
# Phase 3: mcp_client wrappers
t3_0 = { status = "pending", commit_sha = "", description = "Phase 3 styleguide re-read + ack commit" }
t3_1 = { status = "pending", commit_sha = "", description = "Wrapper 1: rewrite caller, delete wrapper, add test, commit" }
t3_2 = { status = "pending", commit_sha = "", description = "Wrapper 2: rewrite caller, delete wrapper, add test, commit" }
t3_3 = { status = "pending", commit_sha = "", description = "Wrapper 3 (if any)" }
t3_4 = { status = "pending", commit_sha = "", description = "Wrapper 4 (if any)" }
t3_5 = { status = "pending", commit_sha = "", description = "Wrapper 5 (if any)" }
t3_6 = { status = "pending", commit_sha = "", description = "Phase 3 invariant test + checkpoint" }
# Phase 4: ai_client wrappers
t4_0 = { status = "pending", commit_sha = "", description = "Phase 4 styleguide re-read + ack commit" }
t4_1 = { status = "pending", commit_sha = "", description = "Wrapper 1: rewrite caller, delete wrapper, add test, commit" }
t4_2 = { status = "pending", commit_sha = "", description = "Wrapper 2: rewrite caller, delete wrapper, add test, commit" }
t4_3 = { status = "pending", commit_sha = "", description = "Wrapper 3 (if any)" }
t4_4 = { status = "pending", commit_sha = "", description = "Wrapper 4 (if any)" }
t4_5 = { status = "pending", commit_sha = "", description = "Wrapper 5 (if any)" }
t4_6 = { status = "pending", commit_sha = "", description = "Phase 4 invariant test + checkpoint" }
# Phase 5: rag_engine wrappers
t5_0 = { status = "pending", commit_sha = "", description = "Phase 5 styleguide re-read + ack commit" }
t5_1 = { status = "pending", commit_sha = "", description = "Wrapper 1: rewrite caller, delete wrapper, add test, commit" }
t5_2 = { status = "pending", commit_sha = "", description = "Wrapper 2: rewrite caller, delete wrapper, add test, commit" }
t5_3 = { status = "pending", commit_sha = "", description = "Wrapper 3 (if any)" }
t5_4 = { status = "pending", commit_sha = "", description = "Phase 5 invariant test + checkpoint" }
# Phase 6: other src/ files per Phase 2 inventory
t6_0 = { status = "pending", commit_sha = "", description = "Phase 6 styleguide re-read + ack commit" }
t6_1 = { status = "pending", commit_sha = "", description = "Per-file wrapper removal (file by file per Phase 2)" }
t6_2 = { status = "pending", commit_sha = "", description = "Phase 6 invariant test + checkpoint" }
# Phase 7: remaining files (if any)
t7_0 = { status = "pending", commit_sha = "", description = "Phase 7 styleguide re-read + ack commit" }
t7_1 = { status = "pending", commit_sha = "", description = "Per-file wrapper removal (if any remain)" }
t7_2 = { status = "pending", commit_sha = "", description = "Phase 7 invariant test + checkpoint" }
# Phase 8: Audit gate + end-of-track report
t8_1 = { status = "pending", commit_sha = "", description = "Run audit --src src --strict; verify 0 violations" }
t8_2 = { status = "pending", commit_sha = "", description = "Run audit --include-baseline --strict; verify 0 violations" }
t8_3 = { status = "pending", commit_sha = "", description = "Run tests/test_baseline_result.py + tests/test_audit_heuristics.py; verify 47 tests pass" }
t8_4 = { status = "pending", commit_sha = "", description = "Run scripts/run_tests_batched.py; verify 11/11 tiers PASS" }
t8_5 = { status = "pending", commit_sha = "", description = "Write TRACK_COMPLETION report + update RESULT_MIGRATION_CAMPAIGN_STATUS_20260619.md to reflect true 100% complete" }
t8_6 = { status = "pending", commit_sha = "", description = "Final checkpoint commit; campaign close-out" }
[verification]
phase_0_complete = false
phase_1_complete = false
phase_2_complete = false
phase_3_complete = false
phase_4_complete = false
phase_5_complete = false
phase_6_complete = false
phase_7_complete = false
phase_8_complete = false
audit_baseline_json_exists = false
inventory_docs_fixed = false
seven_failing_tests_pass = false
wrapper_audit_doc_exists = false
zero_legacy_wrappers_in_src = false
audit_strict_exits_0 = false
audit_baseline_strict_exits_0 = false
all_31_baseline_tests_pass = false
all_16_heuristic_tests_pass = false
batched_suite_11_of_11 = false
campaign_true_100_percent_complete = false