Skip to content

Refactor Phase 0: dead-code deletion (legacy init wizard, pipeline dead trio, repo-wide sweep) #447

Description

@rianjs

Part of the refactoring roadmap (see parent issue and docs/refactoring/roadmap.md). Phase 0 of 6, plus a parallel track.

Pure deletion first: no design decisions, zero behavior risk, and every later phase moves less code because of it. All items were adversarially verified as dead (no production callers) by whole-program reachability analysis plus repo-wide grep.

Tasks

  • Delete the legacy init-wizard path in credentialcmd (~750–840 LOC). Production always uses defaultInitDeps(), which never injects the legacy prompters — so runInjectedInteractiveInit, editInteractiveInitProfile/Step, newHuhInitPrompter, the 365-line huhInitPrompter.Run, huhInitRetentionPrompter.EditRetention, the huh-form EditKeyringBackend/editSecretsProfile, initOnePasswordDesktopDiscovery.Options/Selection/SelectionFor/LinearOptions, the secrets-profile-selection helper chain (credentialcmd.go:3152–3210), and initLinearDocument.addInput are unreachable outside tests. Migrate the ~37 test injections to the live menu/profileV2/bubbletea paths first, then delete in one pass.
  • Pipeline dead trio: reviewerReadableFiles, writeLLMTaskMetadata, writeFileAtomic (favor the already-exported llmlifecycle.WriteFileAtomic). Pre-executes part of the pipeline decomposition's llmlifecycle absorption.
  • Repo-wide dead-symbol sweep (~500 LOC): llm.RunStructured/RunStructuredWithSession + NewAnthropicAPIAdapter/NewOpenAIAPIAdapter (test-only); configedit's seven test-only mutation helpers (+ ErrReviewerCredentialsNotConfigured if orphaned); ledger.UpdateHeartbeat + heartbeat_at plumbing (never written — simplify heartbeatStale to StartedAt only); Store.GetPR; threadcontext's two dead FileScoped*Summaries + summaryLess; reviewplan.SortActions/actionOrder, formatUSD, threadanalysis.Options.ResumeSessionID, reviewcmd.ResponseRunner alias; benchmark/metrics.go WriteMetricsFile/IsMissingMetricsSource/writeJSONFile; four gate.Valid() methods; config.ValidateKeyring; write-only ItemTitlePrefix/ItemTag/ItemFieldTitle fields; BackendSourceSecretsProfile constant.

Why first

Unblocks the wizard split (moves ~1,700 fewer lines) and the pipeline decomposition, and shrinks the two largest test files before any structural migration touches them.

Details with file/line citations: docs/refactoring/tactical-simplifications-report.md (Tier 1 items 1–2, dead-code sweep sections).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:surfaceUser-visible command surface and lifecycle commands

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions