|
| 1 | +# Debt Remediation Plan — 2026-06-09 (lance-graph) |
| 2 | + |
| 3 | +> **Companion to** `DEBT_REVIEW_2026-06-09.md` (the findings) and the TD rows |
| 4 | +> `TD-UNUSED-DEPS-MACHETE-2026-06`, `TD-CLIPPY-ONTOLOGY-12`, |
| 5 | +> `TD-ENV-PROTOC-MISSING` in `TECH_DEBT.md`. |
| 6 | +> **Branch:** `claude/quirky-volta-m2r6ak` (rebased onto post-#479 main `4d26776`). |
| 7 | +> **Cross-repo twin:** `ndarray/.claude/board/DEBT_REMEDIATION_PLAN_2026-06-09.md`. |
| 8 | +
|
| 9 | +## Hard execution constraints (non-negotiable — set by the user 2026-06-09) |
| 10 | + |
| 11 | +1. **No autofix.** No `cargo clippy --fix` (it mangled `reader_state.rs` in |
| 12 | + #479). Work via **tightly-scoped Sonnet agents that reason and write**. |
| 13 | +2. **No deletion of unused code or dependencies — ever — without explicit |
| 14 | + per-item confirmation.** All "unused" findings are a **propose-and-confirm |
| 15 | + queue**, never an autonomous action list. **P0 fork policy makes this sharper:** |
| 16 | + removing `lancedb`/`lance`/`ndarray`-family deps must NOT break AdaWorldAPI-fork |
| 17 | + wiring — verify load-bearing-ness before a dep is even a candidate. |
| 18 | +3. **Every wave ends at a named review gate**, per |
| 19 | + `.claude/rules/agent-cargo-hygiene.md` (fleet without worktrees, edit-only, |
| 20 | + Opus orchestrator compiles + lints once). |
| 21 | + |
| 22 | +## State: lance-graph is the HEALTHY repo |
| 23 | + |
| 24 | +Unlike ndarray (suppression-masked, one RED), lance-graph's workspace clippy is |
| 25 | +**GREEN** (`cargo clippy --workspace --all-targets` exit 0, 53 warnings / ~38 |
| 26 | +unique), and member unsafe hygiene is sound (35 `unsafe {` / 33 `// SAFETY:`; |
| 27 | +the heavy FFI unsafe is quarantined in the *excluded* `holograph`). So there is |
| 28 | +**no P0 clippy fire here** — the work is hygiene + keeping the quarantine honest. |
| 29 | + |
| 30 | +Of the 53 warnings, **~17 are intentional** `I-LEGACY-API-FEATURE-GATED` v2 |
| 31 | +deprecation migrations (`CausalEdge64::inference_type()` / `set_temporal()`) — |
| 32 | +**LEAVE them**; they retire with the v2 layout migration. |
| 33 | + |
| 34 | +## P0 — Core (only one, and it's trivial) |
| 35 | + |
| 36 | +| # | Item | Why P0 | Effort | Owner / gate | |
| 37 | +|---|---|---|---|---| |
| 38 | +| **C3** | Add `protobuf-compiler` to CI image + dev bootstrap (`TD-ENV-PROTOC-MISSING`). | From clean, `cargo clippy --workspace`/`build` fails *"Could not find `protoc`"* (prost/tonic under the `lance` stack + lab `grpc` feature). Repro/CI fragility. | XS (CI YAML + docs) | CI | |
| 39 | + |
| 40 | +## Low-hanging fruit (additive/rewrite, scoped — no deletion) |
| 41 | + |
| 42 | +- **`lance-graph-ontology`: 12 lib clippy warnings** (`TD-CLIPPY-ONTOLOGY-12`) — |
| 43 | + the one member cluster in an otherwise-GREEN workspace. Mostly |
| 44 | + `needless_range_loop` + doc-indent; one scoped agent, rewrites not deletions. |
| 45 | +- **(Optional) `cognitive-shader-driver` 7 warnings** (`TD-CLIPPY-SHADER-DRIVER`, |
| 46 | + already logged) — small, fold into the same sweep if convenient. |
| 47 | + |
| 48 | +## Leave alone / gate |
| 49 | + |
| 50 | +- **v2 deprecation warnings (~17)** — intentional migration. Leave. |
| 51 | +- **`TD-DEEPNSM-CLIPPY-195`** — **already RESOLVED in #479** (deepnsm clippy swept, |
| 52 | + CI promoted advisory→gating). No action. |
| 53 | +- **`TD-BGZ-TENSOR-5-FAILURES-330`, `TD-FMT-STANDALONE-CRATES-4400`** — already |
| 54 | + logged, excluded-crate scope, separate efforts. |
| 55 | +- **Unused deps** → **propose-and-confirm queue** (bottom). Nothing removed |
| 56 | + without sign-off. |
| 57 | + |
| 58 | +## Structural fix (prevents recurrence) |
| 59 | + |
| 60 | +1. **Keep the excluded-crate quarantine honest.** The heavy unsafe + the |
| 61 | + bulk of clippy debt lives in *excluded* crates (`holograph`, |
| 62 | + `thinking-engine`, `deepnsm`, `bgz-tensor`). That's a deliberate boundary — |
| 63 | + but when a crate graduates `exclude → members` (the Phase-3 plan does this for |
| 64 | + `bgz17`), it MUST pass the member clippy gate first. Add that as a graduation |
| 65 | + checklist item. |
| 66 | +2. **Unused-dep discipline under P0 fork policy.** Track in `TECH_DEBT.md`; remove |
| 67 | + only on per-item sign-off; never let a removal silently drop fork wiring. |
| 68 | +3. **`protoc` is a documented prereq** (C3) — no more clean-env breakage. |
| 69 | + |
| 70 | +## Wave sequencing (lance-graph slice) |
| 71 | + |
| 72 | +| Wave | Scope | Agent(s) | Gate | Acceptance | |
| 73 | +|---|---|---|---|---| |
| 74 | +| **W0** | C3 (CI YAML + build-prereq docs) | CI/`integration-lead` | Opus `--workspace` lint w/ protoc | clean-env build/clippy succeeds | |
| 75 | +| **W1** | `lance-graph-ontology` 12-warning sweep (one scope) | Sonnet, `product-engineer`-style review | Opus `cargo clippy -p lance-graph-ontology` GREEN at `-D warnings` | rewrites only, tests green | |
| 76 | +| **W2** | Present the propose-and-confirm queue → act ONLY on confirmed items | (review) | **user sign-off per item** | nothing deleted without a tick | |
| 77 | + |
| 78 | +### Scoped-agent mission template (every wave) |
| 79 | +> Scope: ONE crate/file. Model: Sonnet. **Edit-only; no worktree; no |
| 80 | +> `cargo build`/`check`; NO `clippy --fix`; NO deletion of any dep or item.** |
| 81 | +> Read `DEBT_REVIEW_2026-06-09.md` + this plan + `AGENT_LOG.md` first; prepend an |
| 82 | +> `AGENT_LOG.md` entry on completion. Opus compiles + lints centrally. |
| 83 | +
|
| 84 | +## Propose-and-confirm queue (lance-graph) — NOTHING removed without your sign-off |
| 85 | + |
| 86 | +**Member-crate unused deps (`cargo-machete`, verified on post-#479 tree):** |
| 87 | + |
| 88 | +| crate | candidate deps | note | |
| 89 | +|---|---|---| |
| 90 | +| `lance-graph` (core) | `bgz17`, `bgz-tensor`, `lancedb`, `datafusion-expr` | first 3 = **0 src refs**; `lancedb` removal is **P0-fork-sensitive** — verify first | |
| 91 | +| `lance-graph-planner` | `bgz17`, `p64`, `p64-bridge`, `serde`, `serde_yml` | | |
| 92 | +| `surreal_container` | `futures`, `lance`, `lancedb`, `snafu`, `tokio` | `lance`/`lancedb` fork-sensitive | |
| 93 | +| `lance-graph-callcenter` | `axum`, `tokio-tungstenite`, `tower-http` | | |
| 94 | +| `lance-graph-ontology` | `arrow-array`, `once_cell` | | |
| 95 | +| `lance-graph-catalog` | `snafu` | | |
| 96 | +| `lance-graph-archetype` | `lance-graph-contract` | | |
| 97 | +| `lance-graph-supervisor` | `lance-graph-callcenter`, `lance-graph-contract` | | |
| 98 | + |
| 99 | +⚠️ **Verified FALSE POSITIVE — keep:** `cognitive-shader-driver → prost` |
| 100 | +(`optional = true`, lab-only `grpc` feature). Triage rule: every machete hit |
| 101 | +needs a per-entry check; optional/feature-gated + `-src` deps are false positives. |
| 102 | + |
| 103 | +(Excluded crates also flagged — `osint` 8, `holograph` 8, `thinking-engine` |
| 104 | +`hf-hub`, `deepnsm` `ndarray`, `learning`/`cognitive` `contract` — lower |
| 105 | +priority, not CI-gated.) |
| 106 | + |
| 107 | +Cross-ref: `DEBT_REVIEW_2026-06-09.md`, `TECH_DEBT.md` (TD-UNUSED-DEPS-MACHETE-2026-06). |
0 commit comments