Watch
1
0
Fork
You've already forked souveraine
0
souveraine/docs/tasks/dead-code-cleanup.md
Fimeg 19b8566e4d docs: add task files for deferred safety/enhancement work
- remote-conversation-loading.md — implement list/load for RemoteBackend
- settings-error-display.md — wire validation errors to footer
- dead-code-cleanup.md — remove allow(dead_code), Letta aliases, unused imports
- numeric-cast-safety.md — add saturating cast helpers
2026-06-15 15:42:31 -04:00

59 lines
2.1 KiB
Markdown

# Task: Dead Code and Legacy Alias Cleanup
**Priority:** Low
**Effort:** 2-3 hours
**Files:** Multiple across `src/`
## Context
The codebase has accumulated dead code and legacy compatibility shims from the ratatui→tuie migration and the Letta→Souveraine rename.
## Items to Clean Up
### 1. `#[allow(dead_code)]` annotations
These structs/fields exist but aren't used:
- `src/core/sensorium/mod.rs:120,129,226,272` — bandwidth/discovery structs
- `src/core/chain/mod.rs:9,11,13` — chain fields
- `src/core/subagent/mod.rs:9` — subagent field
- `src/ui/tuie_app.rs:697,707` — unused helper methods
**Action:** For each, either:
- Remove the item if truly unused
- Remove the `#[allow(dead_code)]` if it's actually used (check carefully)
- Add a comment explaining why it's kept if it's a future seam
### 2. `LETTA_` environment variable aliases
`src/core/tools/defs.rs:128-139` injects `LETTA_MEMORY_DIR`, `LETTA_AGENT_ID` alongside `SOUVERAINE_` versions. The setup wizard also discovers `~/.letta` agents.
**Action:**
- Check if any external tooling still references `LETTA_*` vars
- If not, remove the aliases and the `discover_letta_agents()` function
- If yes, document why they're kept
### 3. Unused imports from dual-engine setup
The codebase has 289 compiler warnings, mostly unused imports from the ratatui/tuie dual-engine setup.
**Action:**
- Run `cargo fix --bin "souveraine" -p souveraine --tests --allow-dirty`
- Review and commit the auto-fixed imports
- Manual review for any remaining warnings
### 4. `animation.rs` ratatui `bloom` module
`src/ui/animation.rs:132-427` has a `pub mod bloom` that uses `ratatui::buffer::Buffer` — this is the old ratatui bloom renderer. The tuie version lives in `src/ui/screens/splash.rs`.
**Action:**
- Verify nothing imports `animation::bloom`
- If unused, remove the entire module
- Keep the `Animator` struct and utility functions (gradient, hsl_to_rgb, etc.)
## Acceptance Criteria
- [ ] `cargo test` passes with fewer warnings
- [ ] No functional regressions
- [ ] Each removal is a separate commit for easy revert
- [ ] Comments explain any kept legacy items