Skip to content

chore(agent): remove two functions nothing calls (sleepCtx, hashResource) - #1162

Merged
bpalermo merged 1 commit into
mainfrom
chore/deadcode-unreferenced-funcs
Oct 3, 2026
Merged

bpalermo merged 1 commit into
mainfrom
chore/deadcode-unreferenced-funcs

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 3, 2026

Copy link
Copy Markdown
Owner

What

Removes two unexported functions with zero callers:

Function File Dead since
sleepCtx agent/internal/spire/bridge.go #1135 (2026-10-02) removed its last caller
hashResource agent/internal/xds/cache/versionmemo.go added in #1114, never called

-15 lines, no behaviour change (the linker already dropped both: the cache_test binary is byte-identical, so Bazel served it from cache).

Proof

  • deadcode (golang.org/x/tools/cmd/deadcode) run through rules_go's gopackagesdriver over every first-party main package (GOPACKAGESDRIVER=<bazel run @rules_go//go/tools/gopackagesdriver> deadcode -filter '^aethermesh.dev/' ./agent/... ./cni/... ./registrar/... ./controller/... ./prober/... ./registry/... ./common/... ./e2e/... ./tools/... ./test/...) lists both as unreachable func.
  • grep -rnw sleepCtx agent/internal/spire and grep -rnw hashResource agent/internal/xds/cache match only the definition and its comment, in production and _test.go files alike. (agent/internal/proxy/hotrestart has its own, live sleepCtx, which is a different package.)

Checks

  • bazel test --config=race //agent/internal/spire:all //agent/internal/xds/cache:all: pass
  • bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation on both packages: clean
  • make format-check: clean

Found by the dead-code / dependency audit (2026-10-03).

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…hashResource in xds/cache)

- agent/internal/spire.sleepCtx lost its last caller in #1135 (the bridge's
  retry ladder moved to a context-bounded wait).
- agent/internal/xds/cache.hashResource was added in #1114 alongside
  versionMemo.hash and was never called; every caller uses the memo.

Proof: golang.org/x/tools/cmd/deadcode run through rules_go's
gopackagesdriver over every first-party main package reports both as
unreachable, and `grep -rnw` finds no reference outside the definition in
any .go file (production or test), chart, doc, e2e script or workflow.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit fe4cb28 into main Oct 3, 2026
24 checks passed
@bpalermo
bpalermo deleted the chore/deadcode-unreferenced-funcs branch October 3, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant