Files
releasekit/docs/roadmap/audit/11-deadcode.md

60 lines
3.6 KiB
Markdown

# Dead code and obsolete functionality audit
Reviewed baseline: `083bc83` on `main`. The review considered supported public
facades and CLI commands, internal package callers, tests and benchmarks,
maintained examples, documented decisions, and build-specific uses. Public
symbols were not classified as unused merely because this repository does not
call them. No production code or tests were changed.
The local code graph and a source reference scan identified candidates, which
were checked against current source and documentation. The graph contained a
stale build-function entry and excluded `internal/build` during indexing, so
its reachability results were not treated as conclusive. The scan is a
candidate-finding aid rather than a proof of whole-program reachability.
`go vet ./...` and the compiled public API/dependency-boundary check passed
offline. No dedicated dead-code analyzer was installed.
## 1. Committed-selection identity wrapper has no callers
**Relevant code:** [FromCommittedSelection](../../../internal/releaseidentity/identity.go).
The repository contains no call or function-value reference to this exported
internal wrapper, including in tests and maintained examples. It creates a
committed-path resolver and delegates to the private `fromCommittedSelection`.
The live `FromCommitted` path calls that private function directly with the
resolver it already used to select the directory. The independently used
`ResolveCommittedSelection` serves the CLI's asset-directory selection and
must not be confused with the unused wrapper.
Because Go's `internal` import restriction prevents ordinary external consumers
from importing this package, this is not a root-facade compatibility removal.
No documented retention or future use was found. Consider removing only the
unused wrapper after confirming that no maintained in-tree integration needs
it. Preserve the private implementation and the live selection APIs; the
wrapper's absence does not imply that committed identity derivation is dead.
## 2. Local tag inspection helper is used only by its own test
**Relevant code:** [InspectLocalTag](../../../internal/git/tag.go), its only
call in [TestTagOperationsAcceptFullSlashContainingRefs](../../../internal/git/source_test.go),
and the live local guard in [candidate.Recheck](../../../internal/candidate/check.go).
The helper checks that a local ref identifies the captured annotated tag
object, but no production caller invokes it. `candidate.Recheck` independently
performs the corresponding object-ID and type checks before publication. The
test calls the helper directly and then separately inspects the tagged source;
the public publication guard is exercised through the candidate and
publication tests. The helper is in an internal package, not the supported Go
facade. No documented reason to retain this separate test-only path was found.
Consider removing the unused helper and its direct test call while retaining
the test's full-tag and source assertions and the live publication-guard
coverage. Alternatively, evaluate using the existing helper in the live guard
as part of the [shared Git inspection work](10-equivalence.md#1-source-state-observations-are-independently-implemented),
provided error behavior, guard timing, and the exact captured-object check are
preserved. Do not remove the live guard merely because the duplicate is unused.
The `CandidateTree` accessors and root-scope constructor are also used by tests
or benchmarks, but those uses exercise meaningful tree behavior; this review
does not recommend removing them solely because production uses a different
entry point.