Chore/cleanup dead code docs#120
Draft
gaurangkudale wants to merge 3 commits into
Draft
Conversation
3bbdbeb to
71620d4
Compare
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>
3076a45 to
5e8d258
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Why?
How was it tested?
Commands run
Scope
docs/phases/PHASE1_ARCHITECTURE.md)Checklist
type(scope): short description)make lintpassesmake testpasses with no new failuresmake buildcompiles cleanlyCHANGELOG.mdupdated under[Unreleased]docs/reference/when changingapi/v1alpha1/Risk and rollout
Breaking changes
Related issue
Fixes #
Notes for reviewers