Dead code: wrap_r's single-run cost-graph branch has no caller (post-#159) #221

Closed
opened 2026-07-08 10:25:41 +02:00 by Brummel · 1 comment
Owner

Surfaced by the cycle-close audit of the #159 demo-retirement arc (adversarially verified against the current tree at ee70016).

Finding

wrap_r's cost-graph branch is dead: no caller ever passes Some(cost), so the entire branch and its supporting types/imports are statically unreachable.

  • crates/aura-cli/src/main.rs:1338if let Some((cfg, tx_net, tx_cost)) = cost { is the cost-graph branch.
  • All 6 wrap_r callers pass cost: Nonemain.rs:1101/1442/1486/1533/3345 and campaign_run.rs:735 (the complete caller set).
  • struct CostConfig (main.rs:1193) has zero construction sites (only its definition + the wrap_r signature type at 1258).
  • SLIP_VOL_LENGTH (main.rs:1189) is referenced only inside the Some(...)-guarded vol_proxy arm (guard at 1299), hence dead.
  • The 4 cost imports are inert: cost_graph (line 16, used only at 1355), ConstantCost/VolSlippageCost/CarryCost (lines 32-33, used only at 1344/1348/1351) — all inside the dead branch. (RollingMax/RollingMin/Sub are correctly excluded — live uses elsewhere; the cost_graph composite itself stays alive in aura-composites.)

Behaviour-preserving removal (if CUT)

  • the 1338-1390 branch,
  • the vol_proxy match arm + its price_targets push (1298-1308, 1315-1318),
  • CostConfig (1191-1197),
  • SLIP_VOL_LENGTH (1185-1189),
  • the 4 cost imports.

The suite stays green either way — the branch never executes.

The decision (why this is not folded into the audit tidy)

This is not the #152 sweep-cost scaffold: #152 targets the reduce-mode sweep path, whereas this branch only fires on the non-reduce single-run path. So the open question is a design call, not a mechanical tidy:

  • KEEP — single-run cost is a deliberate seam (a future aura run <bp.json> --cost …); then it should get a live caller, and this issue tracks that the intent currently survives only in code, not a wired path.
  • CUT — the seam was early cost-graph scaffolding superseded by the campaign/sweep cost path (C10: cost enters via net_r_equity on the reduce path); then delete per the list above.

Held out of the #159 cycle-close doc-tidy commit deliberately: a code deletion in the C10 cost subsystem deserves its own scrutiny and commit, not a ride-along in a prose sweep.

Surfaced by the cycle-close audit of the #159 demo-retirement arc (adversarially verified against the current tree at `ee70016`). ## Finding `wrap_r`'s cost-graph branch is dead: no caller ever passes `Some(cost)`, so the entire branch and its supporting types/imports are statically unreachable. - `crates/aura-cli/src/main.rs:1338` — `if let Some((cfg, tx_net, tx_cost)) = cost {` is the cost-graph branch. - All 6 `wrap_r` callers pass `cost: None` — `main.rs:1101/1442/1486/1533/3345` and `campaign_run.rs:735` (the complete caller set). - `struct CostConfig` (`main.rs:1193`) has zero construction sites (only its definition + the `wrap_r` signature type at 1258). - `SLIP_VOL_LENGTH` (`main.rs:1189`) is referenced only inside the `Some(...)`-guarded `vol_proxy` arm (guard at 1299), hence dead. - The 4 cost imports are inert: `cost_graph` (line 16, used only at 1355), `ConstantCost`/`VolSlippageCost`/`CarryCost` (lines 32-33, used only at 1344/1348/1351) — all inside the dead branch. (`RollingMax`/`RollingMin`/`Sub` are correctly excluded — live uses elsewhere; the `cost_graph` composite itself stays alive in aura-composites.) ## Behaviour-preserving removal (if CUT) - the `1338-1390` branch, - the `vol_proxy` match arm + its `price_targets` push (`1298-1308`, `1315-1318`), - `CostConfig` (`1191-1197`), - `SLIP_VOL_LENGTH` (`1185-1189`), - the 4 cost imports. The suite stays green either way — the branch never executes. ## The decision (why this is not folded into the audit tidy) This is **not** the `#152` sweep-cost scaffold: `#152` targets the reduce-mode sweep path, whereas this branch only fires on the non-reduce single-run path. So the open question is a design call, not a mechanical tidy: - **KEEP** — single-run cost is a deliberate seam (a future `aura run <bp.json> --cost …`); then it should get a live caller, and this issue tracks that the intent currently survives only in code, not a wired path. - **CUT** — the seam was early cost-graph scaffolding superseded by the campaign/sweep cost path (C10: cost enters via `net_r_equity` on the reduce path); then delete per the list above. Held out of the `#159` cycle-close doc-tidy commit deliberately: a code deletion in the C10 cost subsystem deserves its own scrutiny and commit, not a ride-along in a prose sweep.
Author
Owner

Decision (2026-07-09, orchestrator, autonomous run): CUT.

The fork posed in the issue body was KEEP (treat the branch as a deliberate seam for a future single-run aura run --cost …) vs CUT (delete the unreachable branch). Chosen: CUT — the settled cost design (ledger C10) routes cost through the sweep/campaign reduce path, so a single-run cost seam kept alive only as unreachable code contradicts the forward-queue discipline (intent lives in the tracker, not in dead code); git history preserves the wiring pattern should a single-run cost feature ever be specified, at which point it gets its own issue and a live caller.

Execution: behaviour-preserving removal per the issue's removal list, via a signature edit (drop wrap_r's cost parameter; the compiler enumerates the 6 call sites). Done-signal: clean build AND suite green unchanged.

Decision (2026-07-09, orchestrator, autonomous run): **CUT.** The fork posed in the issue body was KEEP (treat the branch as a deliberate seam for a future single-run `aura run --cost …`) vs CUT (delete the unreachable branch). Chosen: CUT — the settled cost design (ledger C10) routes cost through the sweep/campaign reduce path, so a single-run cost seam kept alive only as unreachable code contradicts the forward-queue discipline (intent lives in the tracker, not in dead code); git history preserves the wiring pattern should a single-run cost feature ever be specified, at which point it gets its own issue and a live caller. Execution: behaviour-preserving removal per the issue's removal list, via a signature edit (drop `wrap_r`'s `cost` parameter; the compiler enumerates the 6 call sites). Done-signal: clean build AND suite green unchanged.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Brummel/Aura#221