Skip to content

refactor(go): remove dead code#1740

Open
s0up4200 wants to merge 2 commits into
developfrom
codex/deadcode-cleanup
Open

refactor(go): remove dead code#1740
s0up4200 wants to merge 2 commits into
developfrom
codex/deadcode-cleanup

Conversation

@s0up4200
Copy link
Copy Markdown
Collaborator

@s0up4200 s0up4200 commented Apr 7, 2026

This removes dead Go code reported by deadcode across the backend, services, models, and shared packages, dropping stale wrappers, unused store methods, and obsolete test helpers so the reachable code stays aligned with what the application actually builds and exercises while reducing maintenance surface.

Summary by CodeRabbit

  • Chores
    • Removed numerous deprecated/unused internal APIs and helper utilities to simplify the codebase.
    • Streamlined public surface by removing convenience/startup/shutdown variants.
    • Dropped some platform-specific implementations and adjustable configuration options.
    • Cleaned up test-only helpers and reduced redundant convenience wrappers to lower maintenance overhead.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3b59144c-d691-410c-a66c-2aa09c2f1995

📥 Commits

Reviewing files that changed from the base of the PR and between d23c90a and dca1e50.

📒 Files selected for processing (8)
  • internal/models/dirscan.go
  • internal/qbittorrent/client.go
  • internal/services/automations/evaluator_test.go
  • internal/services/automations/hardlink_index.go
  • internal/services/crossseed/crossseed_test.go
  • internal/services/jackett/client.go
  • internal/services/jackett/service.go
  • internal/services/jackett/service_test.go
💤 Files with no reviewable changes (8)
  • internal/services/jackett/service_test.go
  • internal/qbittorrent/client.go
  • internal/services/automations/evaluator_test.go
  • internal/services/jackett/service.go
  • internal/services/crossseed/crossseed_test.go
  • internal/services/automations/hardlink_index.go
  • internal/services/jackett/client.go
  • internal/models/dirscan.go

Walkthrough

This PR removes a large number of exported and unexported functions, methods, and small helpers across handlers, services, models, pkg libraries, and tests. No new functionality is introduced; remaining code relies on existing alternative APIs or omits previously provided convenience entrypoints.

Changes

Cohort / File(s) Summary
API Handlers
internal/api/handlers/health.go, internal/api/handlers/rss_sse.go, internal/api/handlers/torrents.go
Removed HealthHandler.Routes, RSSSSEHandler.Shutdown, and preferredCrossInstanceHashValue helper; routing/shutdown convenience removed.
Server / Metrics
internal/api/server.go, internal/metrics/server.go
Removed Server.ListenAndServe, Server.Open, and metrics Server.Stop / Server.Shutdown; readiness-start remains.
Backups / Restore
internal/backups/restore_execute.go, internal/models/backups.go
Removed Service.PreviewRestore and several BackupStore deletion/counting helpers (batch delete and related helpers removed).
BuildInfo / DB Test Utilities
internal/buildinfo/buildinfo.go, internal/database/db.go
Removed buildinfo JSON/print helpers and NewForTest DB constructor; related imports eliminated.
Dirscan / Orphan Scan Stores
internal/models/dirscan.go, internal/models/orphan_scan.go
Removed file lookup, status/match update, counts, and multiple orphan-scan run APIs; aggregation/count helpers removed.
Models / Utilities
internal/models/backups.go, internal/models/crossseed.go, internal/models/arr_instance_test.go
Removed several backup store methods, normalizeStringSlice, and a test pointer helper.
Services — Crossseed / Dirscan / Automations
internal/services/crossseed/parsing.go, internal/services/crossseed/variant_overrides.go, internal/services/dirscan/*, internal/services/automations/hardlink_index.go
Removed OptimizeContentTypeForIndexers, a variant-compat helper, batch Inject API, season-folder parser, eligibility/filter helpers, and hardlink cache invalidation/clear functions.
Jackett / External Clients
internal/services/jackett/*.go, pkg/gojackett/methods.go, pkg/prowlarr/client.go
Removed convenience APIs (SearchAll, GetCapabilitiesDirect, various non-ctx wrappers, category search types) and GetTrackerDomains; surface reduced to context-based methods.
License / Notifications
internal/services/license/checker.go, internal/services/notifications/types.go
Removed Checker.IsValid and AllEventTypes convenience function.
Hardlink Platform Implementations
pkg/hardlink/linkinfo_unix.go, pkg/hardlink/linkinfo_windows.go
Removed platform-specific LinkInfo implementations (Unix and Windows) and associated imports/logic.
Package Utilities / Options
pkg/pathcmp/normalize.go, pkg/sqlite3store/sqlite3store.go, internal/services/externalprograms/service_test.go
Removed NormalizePathFold, WithCleanupInterval option, and test mock/helper methods.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

Suggested labels

refactor, backend, tests

🐰
I nibbled through old helpers, neat and spry,
Removed the crumbs and let the code breathe high,
Convenience gone, the core stays in its den,
A tidy hop — I'll rest 'til next refactor then! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor(go): remove dead code' accurately summarizes the primary change—removing unused Go code identified by the deadcode tool across multiple files and packages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/deadcode-cleanup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…anup

# Conflicts:
#	internal/services/automations/hardlink_index.go
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