Skip to content

refactor: drop the redundant redisctl lib target#1051

Merged
joshrotenberg merged 3 commits into
mainfrom
chore/code-12-drop-lib
Jul 24, 2026
Merged

refactor: drop the redundant redisctl lib target#1051
joshrotenberg merged 3 commits into
mainfrom
chore/code-12-drop-lib

Conversation

@joshrotenberg

Copy link
Copy Markdown
Collaborator

Summary

Phase 2a of the de-complexification (#1049), finding CODE-12. Structural, behavior-preserving.

The redisctl crate had both a lib target (lib.rs, declaring every module pub(crate)) and a bin target (main.rs, re-declaring the same modules), so the whole tree compiled twice. The lib exposed no public API and nothing used it (no test or bench imports redisctl::...); it existed only for a docs.rs page, and lib.rs itself states redisctl is not meant to be used as a library.

Change

  • Delete crates/redisctl/src/lib.rs.
  • Move its overview into a module doc (//!) at the top of main.rs, now stating plainly that redisctl is a binary and pointing library users at the redis-cloud / redis-enterprise crates.

cargo metadata confirms redisctl now has a single bin target and no lib. Builds are one compilation instead of two.

Validation

  • cargo build --workspace, cargo fmt --all -- --check, cargo clippy --workspace --all-targets --all-features -- -D warnings, cargo test --workspace --all-features: all pass, zero failures. (The workspace test-group count drops by two: the now-removed empty lib unit-test and doctest targets. No real tests lost.)

Next (phase 2b)

With the lib gone, the 110 #[allow(dead_code)] annotations that were suppressing the lib target's "everything is unused" warnings are pointless. Removing them turns the dead-code lint back on for the binary, which will reveal genuinely dead code to delete. That is the follow-up PR, where anything ambiguous (scaffolding labeled "will be used in future PRs") gets flagged for a keep-or-cut decision rather than deleted unilaterally.

The redisctl crate had both a lib target (lib.rs, declaring every module
pub(crate)) and a bin target (main.rs, re-declaring the same modules),
so the whole tree compiled twice. The lib exposed no public API and was
used by nothing (no test or bench imports redisctl::...); it existed
only for a docs.rs page, and lib.rs itself says redisctl is not meant to
be used as a library.

Delete lib.rs and move its overview into a module doc on main.rs. The
crate now compiles once, as a binary. This is the structural half of the
lib/bin cleanup; removing the 110 now-pointless #[allow(dead_code)]
annotations and deleting the dead code the lint then reveals is the
follow-up.

Part of #1049 (CODE-12), phase 2a.
Removed all 106 #[allow(dead_code)] annotations from crates/redisctl/src
(42 blanket module-level, 64 item-level), which existed only because the
now-deleted lib target used nothing. The lint then flagged 24 genuinely
dead items; deleted 20:

- Superseded LDAP path: rbac.rs handle_ldap_command and five rbac_impl.rs
  LDAP functions (the live path is ldap.rs).
- Superseded debuginfo handlers handle_debuginfo_all/node/database (the
  _binary variants are live).
- Unused helpers: two ACL detail printers, parse_database_id, the
  OptimizationResult struct + method, two keyring helpers,
  build_database_payload, WorkflowResult::failure,
  ConnectionManager::save_config, and WorkflowContext.wait_timeout (set
  but never read, so init-cluster already ignored --wait-timeout).

Kept with a targeted #[allow(dead_code)] and a comment (see #1049):

- error.rs NoProfileConfigured / MissingCredentials /
  UnsupportedDeploymentType: intended error types with messages and
  suggestions that no code path constructs yet. To be wired up, not cut.
- connection.rs CloudConnectionInfo / EnterpriseConnectionInfo credential
  fields: populated but not read by the curl builder, so `api ... --curl`
  omits its auth headers. Likely a real bug; kept pending that fix.

Net ~670 lines removed; 5 documented allows remain instead of 106
blanket ones, and the dead-code lint now covers the whole crate.

Part of #1049 (CODE-12), phase 2b.
Dropping the redisctl lib target broke the test-unit job: it ran
cargo test --package <pkg> --lib --bins, and --lib errors with
"no library targets found" for redisctl, which now has only a bin.

Give each matrix package its own target flags: redisctl-core --lib,
redisctl --bins, redisctl-mcp --lib --bins. --bins still runs the tests
in main.rs (including the MCP safety-tier registration tests), so
ci-status keeps gating them.
@joshrotenberg
joshrotenberg merged commit 240da6d into main Jul 24, 2026
16 checks passed
@joshrotenberg
joshrotenberg deleted the chore/code-12-drop-lib branch July 24, 2026 02:43
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