Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,17 @@ jobs:
strategy:
fail-fast: true
matrix:
package: [redisctl-core, redisctl, redisctl-mcp]
# Target flags are per-package: redisctl is bin-only (no lib target),
# so --lib would error there, while redisctl-core has no bin. --bins
# runs the tests in main.rs (the MCP safety-tier registration tests),
# which ci-status would otherwise not gate.
include:
- package: redisctl-core
targets: "--lib"
- package: redisctl
targets: "--bins"
- package: redisctl-mcp
targets: "--lib --bins"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

Expand All @@ -82,11 +92,7 @@ jobs:
shared-key: "test-${{ matrix.package }}"

- name: Run unit tests
# --bins includes tests compiled into the binary targets (redisctl and
# redisctl-mcp main.rs), which hold the MCP safety-tier registration
# tests. Without it those only run in build-platforms, which ci-status
# does not check, so a green CI Status could hide a tier regression.
run: cargo test --package ${{ matrix.package }} --lib --bins --all-features
run: cargo test --package ${{ matrix.package }} ${{ matrix.targets }} --all-features

# Integration tests
test-integration:
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use redisctl_core::{Config, DeploymentType};
use serde_json::Value;

/// Parameters for API command execution
#[allow(dead_code)] // Used by binary target
pub struct ApiCommandParams {
pub config: Config,
pub config_path: Option<std::path::PathBuf>,
Expand All @@ -24,7 +23,6 @@ pub struct ApiCommandParams {
}

/// Handle raw API commands
#[allow(dead_code)] // Used by binary target
pub async fn handle_api_command(params: ApiCommandParams) -> CliResult<()> {
let connection_manager = ConnectionManager::with_config_path(params.config, params.config_path);

Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/account.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Cloud account command implementations
#![allow(dead_code)] // Used by binary target

use anyhow::Context;
use redis_cloud::AccountHandler;
use serde_json::Value;
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/acl.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(dead_code)]

use crate::cli::{CloudAclCommands, OutputFormat};
use crate::connection::ConnectionManager;
use crate::error::Result as CliResult;
Expand Down
98 changes: 0 additions & 98 deletions crates/redisctl/src/commands/cloud/acl_impl.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(dead_code)]

use crate::cli::OutputFormat;
use crate::commands::cloud::async_utils::{AsyncOperationArgs, handle_async_response};
use crate::connection::ConnectionManager;
Expand Down Expand Up @@ -99,44 +97,6 @@ fn print_redis_rules_table(data: &Value) -> CliResult<()> {
Ok(())
}

fn print_redis_rule_detail(data: &Value) -> CliResult<()> {
let mut rows = Vec::new();

let fields = [
("ID", "id"),
("Name", "name"),
("ACL", "acl"),
("Default", "isDefault"),
("Status", "status"),
];

for (label, key) in &fields {
if let Some(val) = data.get(*key) {
let display = match val {
Value::Null => continue,
Value::String(s) => s.clone(),
Value::Bool(b) => b.to_string(),
Value::Number(n) => n.to_string(),
_ => val.to_string(),
};
rows.push(DetailRow {
field: label.to_string(),
value: display,
});
}
}

if rows.is_empty() {
println!("No Redis rule information available");
return Ok(());
}

let mut table = Table::new(&rows);
table.with(Style::blank());
output_with_pager(&table.to_string());
Ok(())
}

fn print_acl_roles_table(data: &Value) -> CliResult<()> {
let items = match extract_items(data, "roles") {
Some(arr) if !arr.is_empty() => arr,
Expand Down Expand Up @@ -175,64 +135,6 @@ fn print_acl_roles_table(data: &Value) -> CliResult<()> {
Ok(())
}

fn print_acl_role_detail(data: &Value) -> CliResult<()> {
let mut rows = Vec::new();

let fields = [("ID", "id"), ("Name", "name"), ("Status", "status")];

for (label, key) in &fields {
if let Some(val) = data.get(*key) {
let display = match val {
Value::Null => continue,
Value::String(s) => s.clone(),
Value::Bool(b) => b.to_string(),
Value::Number(n) => n.to_string(),
_ => val.to_string(),
};
rows.push(DetailRow {
field: label.to_string(),
value: display,
});
}
}

if let Some(rules) = data.get("redisRules").and_then(|v| v.as_array()) {
let names: Vec<String> = rules
.iter()
.filter_map(|r| r.get("ruleName").and_then(|n| n.as_str()).map(String::from))
.collect();
if !names.is_empty() {
rows.push(DetailRow {
field: "Redis Rules".to_string(),
value: names.join(", "),
});
}
}

if let Some(users) = data.get("users").and_then(|v| v.as_array()) {
let names: Vec<String> = users
.iter()
.filter_map(|u| u.get("name").and_then(|n| n.as_str()).map(String::from))
.collect();
if !names.is_empty() {
rows.push(DetailRow {
field: "Users".to_string(),
value: names.join(", "),
});
}
}

if rows.is_empty() {
println!("No ACL role information available");
return Ok(());
}

let mut table = Table::new(&rows);
table.with(Style::blank());
output_with_pager(&table.to_string());
Ok(())
}

fn print_acl_users_table(data: &Value) -> CliResult<()> {
let items = match extract_items(data, "users") {
Some(arr) if !arr.is_empty() => arr,
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/cloud_account.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(dead_code)]

use crate::cli::{CloudProviderAccountCommands, OutputFormat};
use crate::commands::cloud::cloud_account_impl::{
self, CloudAccountOperationParams, CreateParams, UpdateParams,
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/cloud_account_impl.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(dead_code)]

use crate::cli::OutputFormat;
use crate::commands::cloud::async_utils::{AsyncOperationArgs, handle_async_response};
use crate::commands::cloud::utils::{confirm_action, handle_output, print_formatted_output};
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/connectivity/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Cloud connectivity command implementations
#![allow(dead_code)]

pub mod private_link;
pub mod psc;
pub mod tgw;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! AWS PrivateLink command implementations
#![allow(dead_code)]

use super::ConnectivityOperationParams;
use crate::cli::{OutputFormat, PrivateLinkCommands};
use crate::commands::cloud::async_utils::handle_async_response;
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/connectivity/psc.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Private Service Connect (PSC) command implementations
#![allow(dead_code)]

use super::ConnectivityOperationParams;
use crate::cli::{OutputFormat, PscCommands};
use crate::commands::cloud::async_utils::handle_async_response;
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/connectivity/tgw.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Transit Gateway (TGW) command implementations
#![allow(dead_code)]

use super::ConnectivityOperationParams;
use crate::cli::{OutputFormat, TgwCommands};
use crate::commands::cloud::async_utils::handle_async_response;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! VPC Peering command implementations
#![allow(dead_code)]

use super::ConnectivityOperationParams;
use crate::cli::{OutputFormat, VpcPeeringCommands};
use crate::commands::cloud::async_utils::handle_async_response;
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/cost_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//!
//! Handles generating and downloading cost reports in FOCUS format.

#![allow(dead_code)] // Functions used from main.rs binary

use crate::cli::{CloudCostReportCommands, OutputFormat};
use crate::commands::cloud::async_utils::{AsyncOperationArgs, handle_async_response};
use crate::connection::ConnectionManager;
Expand Down
29 changes: 0 additions & 29 deletions crates/redisctl/src/commands/cloud/database.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Cloud database command implementations

#![allow(dead_code)] // Used by binary target

use super::utils::DetailRow;
use super::utils::*;
use crate::cli::{CloudDatabaseCommands, OutputFormat};
Expand Down Expand Up @@ -532,33 +530,6 @@ fn print_databases_table(data: &Value) -> CliResult<()> {
Ok(())
}

/// Parse database ID into subscription and database IDs
fn parse_database_id(id: &str) -> CliResult<(u32, u32)> {
let parts: Vec<&str> = id.split(':').collect();
if parts.len() != 2 {
return Err(RedisCtlError::InvalidInput {
message: format!(
"Invalid database ID format: {}. Expected format: subscription_id:database_id",
id
),
});
}

let subscription_id = parts[0]
.parse::<u32>()
.map_err(|_| RedisCtlError::InvalidInput {
message: format!("Invalid subscription ID: {}", parts[0]),
})?;

let database_id = parts[1]
.parse::<u32>()
.map_err(|_| RedisCtlError::InvalidInput {
message: format!("Invalid database ID: {}", parts[1]),
})?;

Ok((subscription_id, database_id))
}

/// Format database memory
fn format_database_memory(db: &Value) -> String {
// Check for fixed subscription memory fields
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/fixed_database.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Fixed database command implementations
#![allow(dead_code)]

use crate::cli::{CloudFixedDatabaseCommands, OutputFormat};
use crate::commands::cloud::async_utils::handle_async_response;
use crate::commands::cloud::utils::{confirm_action, handle_output, print_formatted_output};
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/fixed_subscription.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Fixed subscription command implementations
#![allow(dead_code)]

use crate::cli::{CloudFixedSubscriptionCommands, OutputFormat};
use crate::commands::cloud::async_utils::handle_async_response;
use crate::commands::cloud::utils::{confirm_action, handle_output, print_formatted_output};
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/payment_method.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Cloud payment method command implementations
#![allow(dead_code)] // Used by binary target

use anyhow::Context;
use redis_cloud::AccountHandler;
use serde_json::Value;
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/subscription.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Cloud subscription command implementations
#![allow(dead_code)] // Used by binary target

use anyhow::Context;
use serde_json::Value;
use tabled::{Table, Tabled, settings::Style};
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/task.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Cloud task command implementations
#![allow(dead_code)]

use crate::cli::{CloudTaskCommands, OutputFormat};
use crate::connection::ConnectionManager;
use crate::error::{RedisCtlError, Result as CliResult};
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/cloud/user.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Cloud user command implementations
#![allow(dead_code)] // Used by binary target

use super::async_utils::{AsyncOperationArgs, handle_async_response};
use super::utils::DetailRow;
use super::utils::*;
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/curl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use serde_json::Value;
/// Format a curl command for a Cloud API request.
///
/// Auth headers are redacted by default.
#[allow(dead_code)] // Used by binary target
pub fn format_cloud_curl(
info: &CloudConnectionInfo,
method: &HttpMethod,
Expand Down Expand Up @@ -36,7 +35,6 @@ pub fn format_cloud_curl(
/// Format a curl command for an Enterprise API request.
///
/// Auth credentials are redacted by default.
#[allow(dead_code)] // Used by binary target
pub fn format_enterprise_curl(
info: &EnterpriseConnectionInfo,
method: &HttpMethod,
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/db.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Database command implementations
#![allow(dead_code)] // Functions called from bin target

use crate::cli::{DbCommands, OutputFormat};
use crate::connection::ConnectionManager;
use crate::error::RedisCtlError;
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/enterprise/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ pub enum ActionCommands {
}

impl ActionCommands {
#[allow(dead_code)]
pub async fn execute(
&self,
conn_mgr: &ConnectionManager,
Expand Down Expand Up @@ -239,7 +238,6 @@ impl ActionCommands {
}
}

#[allow(dead_code)]
pub async fn handle_action_command(
conn_mgr: &ConnectionManager,
profile_name: Option<&str>,
Expand Down
1 change: 0 additions & 1 deletion crates/redisctl/src/commands/enterprise/alerts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ pub enum AlertsCommands {
}

impl AlertsCommands {
#[allow(dead_code)]
pub async fn execute(
&self,
config: &Config,
Expand Down
2 changes: 0 additions & 2 deletions crates/redisctl/src/commands/enterprise/bdb_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ pub enum BdbGroupCommands {
}

impl BdbGroupCommands {
#[allow(dead_code)]
pub async fn execute(
&self,
conn_mgr: &ConnectionManager,
Expand Down Expand Up @@ -357,7 +356,6 @@ impl BdbGroupCommands {
}
}

#[allow(dead_code)]
pub async fn handle_bdb_group_command(
conn_mgr: &ConnectionManager,
profile_name: Option<&str>,
Expand Down
Loading
Loading