Skip to content

Chore/cleanup dead code docs#120

Draft
gaurangkudale wants to merge 3 commits into
mainfrom
chore/cleanup-dead-code-docs
Draft

Chore/cleanup dead code docs#120
gaurangkudale wants to merge 3 commits into
mainfrom
chore/cleanup-dead-code-docs

Conversation

@gaurangkudale
Copy link
Copy Markdown
Owner

What does this PR do?

Why?

How was it tested?

Commands run

make lint
make test
make build
# optional when relevant:
# make test-e2e

Scope

  • This PR is focused on one concern (feature, fix, docs, test, or chore)
  • This PR is in scope for the current roadmap phase (docs/phases/PHASE1_ARCHITECTURE.md)

Checklist

  • PR title follows Conventional Commits format (type(scope): short description)
  • make lint passes
  • make test passes with no new failures
  • make build compiles cleanly
  • CHANGELOG.md updated under [Unreleased]
  • New public functions have Go doc comments
  • Docs updated (if applicable)
  • CRD/API docs updated in docs/reference/ when changing api/v1alpha1/

Risk and rollout

Breaking changes

  • No breaking changes
  • Yes (describe below)

Related issue

Fixes #

Notes for reviewers

@gaurangkudale gaurangkudale force-pushed the chore/cleanup-dead-code-docs branch from 3bbdbeb to 71620d4 Compare May 30, 2026 07:13
gaurangkudale and others added 3 commits May 30, 2026 12:50
Dead Go code removed (195 lines, confirmed unreachable via deadcode -test):
- internal/otel/spans.go — span-helper wrappers (Tracer, StartReconcileSpan,
  StartSignalSpan, StartRuleSpan, StartIncidentSpan, TraceIDFromContext) that
  were never wired into any call site; OTel provider setup lives in provider.go
- internal/signals/deduplicator.go — Deduplicator/IsDuplicate/purgeOld; dedup
  is handled by watcher.ChannelEventEmitterOptions.DedupWindow instead
- collectors.NewChannelSignalEmitter — superseded by NewChannelSignalEmitterWithOptions
- correlator/graph.ClusterBuilder.Build — trivial wrapper; only BuildWithOptions
  is called by the dashboard handler
- engine.WithCorrelationWindow, engine.WithRuleEngine, engine.WithConsumerOption
  — option constructors with zero call sites

Documentation / config cleanup:
- AGENTS.md: remove multi-group kubebuilder conversion guide (irrelevant to this
  single-group project) and stale config/webhook/manifests.yaml reference
- CONTRIBUTING.md: update internal/otel/ description to reflect that span
  helper wrappers are gone; package now only owns OTLP provider setup
- config/manager/manager.yaml: remove two resolved kubebuilder TODO(user)
  boilerplate comments (nodeAffinity covered by Helm, resources already set)

All tests pass, build clean, helm lint clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Gaurang Kudale <gaurangkudaleworks@gmail.com>
Dead Go code:
- collectors.NewChannelSignalEmitter — superseded by NewChannelSignalEmitterWithOptions,
  no callers
- correlator/graph.ClusterBuilder.Build — trivial wrapper around BuildWithOptions,
  only BuildWithOptions is called by the dashboard handler
- engine.WithCorrelationWindow, engine.WithRuleEngine, engine.WithConsumerOption
  — option constructors with zero call sites in main or tests

Documentation / config:
- AGENTS.md: remove multi-group kubebuilder conversion guide (irrelevant to
  this single-group project) and stale config/webhook/manifests.yaml reference
- CONTRIBUTING.md: update internal/otel/ description now that span helpers
  are gone; package owns OTLP provider setup only
- config/manager/manager.yaml: remove two resolved kubebuilder TODO(user)
  boilerplate comments (nodeAffinity handled by Helm, resources already set)

All tests pass, build clean, helm lint clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Gaurang Kudale <gaurangkudaleworks@gmail.com>
The global RegisterRule/RegisteredRules registry has been dead since all
correlation rules were moved to CRD-driven RCACorrelationRule objects. No
production code ever called RegisterRule, so ruleRegistry was always empty.

Removed:
- RegisterRule(), RegisteredRules(), ruleRegistry var, ruleRegistryMu (rules.go)
- registeredRule struct and its Name/Priority/Evaluate methods (rules.go)
- extractNodeForFailure(), failurePodKey() helpers and their tests
  TestExtractNodeForFailure, TestFailurePodKey (correlator_test.go)
- Orphaned test event builders imagePull, nodeNotReady, podEvicted that were
  only used by the now-deleted helper tests (correlator_test.go)

Refactored:
- NewCorrelator: rules initialised to nil instead of RegisteredRules()
- rules.go now contains only the ruleFunc type alias with a clear comment
- testutil_test.go: new file in package correlator that exposes testRule()
  and ruleDouble as an explicit test-double for injecting rules into a
  Correlator or Consumer in tests — replaces the in-production registeredRule
  struct that was leaking test infrastructure into production code
- consumer_test.go: three tests updated to use testRule() instead of
  constructing registeredRule{} struct literals directly

All tests pass. deadcode reports zero unreachable functions in internal/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Gaurang Kudale <gaurangkudaleworks@gmail.com>
@gaurangkudale gaurangkudale force-pushed the chore/cleanup-dead-code-docs branch from 3076a45 to 5e8d258 Compare May 30, 2026 07:20
@gaurangkudale gaurangkudale marked this pull request as draft May 30, 2026 07:22
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