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
10 changes: 5 additions & 5 deletions apps/chat2db-web/src/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11186,12 +11186,12 @@ mod tests {

let column = &request.new_table.column_list[0];
assert_eq!(column.primary_key_order, 0);
assert!(column.comment.is_empty());
assert!(column.char_set_name.is_empty());
assert_eq!(column.comment, "");
assert_eq!(column.char_set_name, "");
let index = &request.new_table.index_list[0];
assert!(index.index_type.is_empty());
assert!(index.comment.is_empty());
assert!(index.column_list[0].index_name.is_empty());
assert_eq!(index.index_type, "");
assert_eq!(index.comment, "");
assert_eq!(index.column_list[0].index_name, "");
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion apps/chat2db-web/tests/native_mysql_editable_ddl_docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,7 @@ async fn verify_transfer_routes(
entry
.read_to_string(&mut contents)
.expect("generated class entry must be UTF-8");
assert!(!contents.is_empty());
assert_ne!(contents, "");
}

let generated = directory.join("generated-classes");
Expand Down
11 changes: 7 additions & 4 deletions crates/chat2db-agent/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ impl fmt::Debug for SummaryError {
}

/// Optional summarization boundary used only for complete historical turns.
// `async_trait` stamps `#[must_use]` on the generated boxed futures, which
// `clippy::double_must_use` rejects because the type is already `#[must_use]`.
#[allow(clippy::double_must_use)]
#[async_trait]
pub trait ContextCompactor: Send + Sync {
async fn summarize(
Expand Down Expand Up @@ -475,7 +478,7 @@ mod tests {
#[test]
fn adjacent_users_are_not_a_complete_compaction_turn() {
let messages = vec![Message::system("s"), Message::user("a"), Message::user("b")];
assert!(compactable_turns(&messages).is_empty());
assert_eq!(compactable_turns(&messages).len(), 0);
}

#[test]
Expand All @@ -491,7 +494,7 @@ mod tests {
),
Message::user("latest"),
];
assert!(compactable_turns(&messages).is_empty());
assert_eq!(compactable_turns(&messages).len(), 0);
}

#[test]
Expand Down Expand Up @@ -524,7 +527,7 @@ mod tests {
Message::text(Role::Assistant, "terminal"),
Message::user("latest"),
];
assert!(compactable_turns(&missing).is_empty());
assert_eq!(compactable_turns(&missing).len(), 0);

let duplicate_call =
ToolCall::new("duplicate", "query", serde_json::json!({})).expect("valid call");
Expand All @@ -548,7 +551,7 @@ mod tests {
Message::text(Role::Assistant, "terminal"),
Message::user("latest"),
];
assert!(compactable_turns(&duplicate).is_empty());
assert_eq!(compactable_turns(&duplicate).len(), 0);
}

#[test]
Expand Down
3 changes: 3 additions & 0 deletions crates/chat2db-agent/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ pub type ProviderEventStream =
Pin<Box<dyn Stream<Item = Result<ProviderEvent, ProviderError>> + Send + 'static>>;

/// Direct model-provider boundary used by the agent loop.
// `async_trait` stamps `#[must_use]` on the generated boxed futures, which
// `clippy::double_must_use` rejects because the type is already `#[must_use]`.
#[allow(clippy::double_must_use)]
#[async_trait]
pub trait Provider: Send + Sync {
/// Identifies the wire family without exposing its DTOs.
Expand Down
3 changes: 3 additions & 0 deletions crates/chat2db-agent/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ impl Default for AgentLimits {
}

/// Host boundary for executing one already-validated tool call.
// `async_trait` stamps `#[must_use]` on the generated boxed futures, which
// `clippy::double_must_use` rejects because the type is already `#[must_use]`.
#[allow(clippy::double_must_use)]
#[async_trait]
pub trait ToolExecutor: Send + Sync {
/// Implementations receive cancellation and must return one bounded
Expand Down
2 changes: 1 addition & 1 deletion crates/chat2db-contract/src/community_dashboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ mod tests {
"refreshCycle": {"unit": "seconds", "value": 30}
}))
.expect("dashboard request decodes");
assert!(request.chart_ids.is_empty());
assert_eq!(request.chart_ids.len(), 0);
let encoded = serde_json::to_value(request).expect("dashboard request encodes");
assert_eq!(encoded["name"], "Sales");
assert_eq!(encoded["refreshCycle"]["value"], 30);
Expand Down
3 changes: 2 additions & 1 deletion crates/chat2db-core/src/agent/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,8 @@ mod tests {
.await
.expect("sessions list after delete")
.items
.is_empty()
.is_empty(),
"a deleted session must not be listed"
);
let missing = application
.list_agent_messages(&updated.id, "0", "10")
Expand Down
3 changes: 3 additions & 0 deletions crates/chat2db-core/src/agent/hub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ impl AgentRunHub {

async fn mark_terminal(&self, entry: &AgentRunEntry) {
cancel_current_permission(entry).await;
// `AtomicU64::fetch_update` is deprecated in favour of `try_update`,
// which is unstable before Rust 1.95 while the workspace MSRV is 1.88.
#[allow(deprecated)]
let order = self
.inner
.next_terminal_order
Expand Down
2 changes: 1 addition & 1 deletion crates/chat2db-core/src/datasource_compatibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ mod tests {
.expect("JDBC-only registry is valid");
let application = Application::with_native_drivers_for_test(registry);

assert!(application.list_drivers().items.is_empty());
assert_eq!(application.list_drivers().items.len(), 0);
let compatibility = application
.native_driver_compatibility("JDBC_ONLY", NativeDriverAction::Download)
.expect("JDBC-only compatibility resolves");
Expand Down
2 changes: 1 addition & 1 deletion crates/chat2db-core/src/driver_pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ mod tests {
let directory = TempDir::new().expect("temporary directory");
let prepared =
discover_test(&directory.path().join("missing")).expect("missing root is optional");
assert!(prepared.inventory().is_empty());
assert_eq!(prepared.inventory().len(), 0);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/chat2db-core/src/native_dm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ mod tests {
database_query.sql,
"SELECT NAME AS DATABASE_NAME FROM V$DATABASE"
);
assert!(database_query.parameters.is_empty());
assert_eq!(database_query.parameters.len(), 0);

let table_query = list_tables_query("APP' OR 1=1 --", "Order_%")
.expect("quoted schema names are valid metadata values");
Expand Down
4 changes: 4 additions & 0 deletions crates/chat2db-core/src/native_driver.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// `async_trait` stamps `#[must_use]` on the generated boxed futures, which
// `clippy::double_must_use` rejects because the type is already `#[must_use]`.
#![allow(clippy::double_must_use)]

use std::{
collections::{HashMap, HashSet},
sync::Arc,
Expand Down
3 changes: 3 additions & 0 deletions crates/chat2db-core/src/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ impl OperationHub {
state.journal.push_back(envelope.clone());
let _ = entry.live.send(envelope);
if state.status != OperationStatus::Running {
// `AtomicU64::fetch_update` is deprecated in favour of `try_update`,
// which is unstable before Rust 1.95 while the workspace MSRV is 1.88.
#[allow(deprecated)]
let terminal_order = self
.inner
.next_terminal_order
Expand Down
2 changes: 1 addition & 1 deletion crates/chat2db-core/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ mod tests {

assert!(request.error_continue);
assert_eq!(request.result_set_id, None);
assert!(request.database_name.is_empty());
assert_eq!(request.database_name, "");
}

#[test]
Expand Down
5 changes: 4 additions & 1 deletion crates/chat2db-core/tests/java_community_mysql_product.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,10 @@ async fn verify_sql_tools(application: &Application, datasource_id: &str, databa
.await
.expect("Core must invoke real MySQL SQL validation");
assert!(!validation.valid);
assert!(!validation.diagnostics.is_empty());
assert!(
!validation.diagnostics.is_empty(),
"invalid SQL must report diagnostics"
);

let source_sql = "select id,label from items where id=1";
let formatted = application
Expand Down
7 changes: 5 additions & 2 deletions crates/chat2db-core/tests/java_community_product.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ async fn product_services_invoke_the_fixed_community_h2_compatibility_slice() {
.await
.expect("Core SQL validation must not require a datasource or JDBC session");
assert!(!validation.valid);
assert!(!validation.diagnostics.is_empty());
assert!(
!validation.diagnostics.is_empty(),
"invalid SQL must report diagnostics"
);

let formatted = application
.format_community_sql(FormatCommunitySqlRequest {
Expand Down Expand Up @@ -1095,7 +1098,7 @@ async fn verify_trigger_metadata(
})
.await
.expect("escaped H2 trigger-list identifiers must remain a safe metadata query");
assert!(injected_list.items.is_empty());
assert_eq!(injected_list.items.len(), 0);
for trigger_name in ["MISSING_TRIGGER", "AUDIT_TRIGGER' OR '1'='1"] {
let error = application
.get_community_trigger(GetCommunityTriggerRequest {
Expand Down
2 changes: 1 addition & 1 deletion crates/chat2db-core/tests/large_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ fn binary_chunks_round_trip_and_range_validation_is_closed() {
.read_chunk("execution-1", token(&preview), 13, 1)
.expect("offset at the end should be valid");
assert!(eof.eof);
assert!(eof.value.is_empty());
assert_eq!(eof.value.len(), 0);
}

#[test]
Expand Down
5 changes: 3 additions & 2 deletions crates/chat2db-core/tests/native_mysql_product.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,8 @@ async fn verify_native_workspace_metadata(
.await
.expect("table pins must relist")
.items
.is_empty()
.is_empty(),
"an unpinned table must disappear from the listing"
);
assert_java_dormant(application);
}
Expand Down Expand Up @@ -530,7 +531,7 @@ async fn verify_native_metadata(
})
.await
.expect("MySQL schema route must stay native");
assert!(schemas.items.is_empty());
assert_eq!(schemas.items.len(), 0);

let tables = application
.list_community_tables(ListCommunityTablesRequest {
Expand Down
4 changes: 2 additions & 2 deletions crates/chat2db-core/tests/native_oracle_smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ async fn verify_database_and_schema_metadata(
.items
.first()
.expect("Oracle must expose its current database");
assert!(!database.name.is_empty());
assert!(!database.owner.is_empty());
assert_ne!(database.name, "");
assert_ne!(database.owner, "");

let schemas = application
.list_community_schemas(ListCommunitySchemasRequest {
Expand Down
2 changes: 1 addition & 1 deletion crates/chat2db-core/tests/native_postgres_smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ async fn verify_oversized_scalar_cleanup(
datasource_id: &str,
data_dir: &Path,
) {
assert!(retained_result_files(data_dir).is_empty());
assert_eq!(retained_result_files(data_dir).len(), 0);
let scalar_bytes = wire::JdbcProtocolLimit::MaxScalarBytes as usize + 1;
let query = application
.start_query(StartQueryRequest {
Expand Down
8 changes: 7 additions & 1 deletion crates/chat2db-java-bridge/src/supervisor/community.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,10 @@ impl CommunityClasspath {
}

/// Returns the canonical JARs in deterministic classpath order.
#[must_use]
// A bare `#[must_use]` satisfies `clippy::must_use_candidate` on Rust 1.88
// but fails `clippy::double_must_use` on Rust 1.99; the explicit reason
// satisfies both.
#[must_use = "the canonical classpath order must be consumed"]
pub fn artifacts(&self) -> impl ExactSizeIterator<Item = &Path> {
self.artifacts
.iter()
Expand Down Expand Up @@ -2777,6 +2780,9 @@ fn validate_metadata_session(
Ok(())
}

// `AtomicU64::fetch_update` is deprecated in favour of `try_update`, which is
// unstable before Rust 1.95 while the workspace MSRV is 1.88.
#[allow(deprecated)]
fn next_sql_completion_datasource_scope() -> Result<u64, BridgeError> {
NEXT_SQL_COMPLETION_DATASOURCE_SCOPE
.fetch_update(Ordering::Relaxed, Ordering::Relaxed, next_java_long_scope)
Expand Down
9 changes: 6 additions & 3 deletions crates/chat2db-java-bridge/tests/java_community_h2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ async fn verify_programmability_metadata(
.list_function_parameters(session, "H2", database_name, "APP", "ADD_ONE", None)
.await
.expect("H2Meta must list function parameters");
assert!(function_parameters.is_empty());
assert_eq!(function_parameters.len(), 0);

let procedures = community
.list_procedures(session, "H2", database_name, "APP", None)
Expand Down Expand Up @@ -971,14 +971,17 @@ async fn verify_parser(community: &CommunityClient) {
.expect("Community parser must validate well-formed SQL");
assert!(valid.valid);
assert_eq!(valid.statements.len(), 1);
assert!(valid.diagnostics.is_empty());
assert_eq!(valid.diagnostics.len(), 0);

let invalid = community
.validate_sql("H2", "SELECT FROM;")
.await
.expect("Community parser must return bounded syntax diagnostics");
assert!(!invalid.valid);
assert!(!invalid.diagnostics.is_empty());
assert!(
!invalid.diagnostics.is_empty(),
"invalid SQL must report diagnostics"
);
assert!(
invalid
.diagnostics
Expand Down
5 changes: 4 additions & 1 deletion crates/chat2db-java-bridge/tests/java_jdbc_h2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,10 @@ async fn collect_rows(session: &Session, sql: &str) -> Vec<JdbcRow> {
match next_event(&mut stream).await {
QueryEvent::Started(metadata) => {
assert!(!started, "query metadata must be emitted once");
assert!(!metadata.columns.is_empty());
assert!(
!metadata.columns.is_empty(),
"query metadata must carry columns"
);
started = true;
}
QueryEvent::Batch(batch) => rows.extend(batch.rows),
Expand Down
8 changes: 5 additions & 3 deletions crates/chat2db-storage/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4377,7 +4377,7 @@ mod tests {
assert_eq!(messages[0].ordinal, 0);
assert_eq!(messages[0].role, AgentMessageRole::System);
assert_eq!(messages[0].content_json, message_json("rules"));
assert!(!messages[0].id.is_empty());
assert_ne!(messages[0].id, "");
assert!(messages[0].run_id.is_none());

let appended = storage
Expand Down Expand Up @@ -4870,7 +4870,8 @@ mod tests {
storage
.list_agent_messages(&session.id, 0, 10)
.expect("messages list")
.is_empty()
.is_empty(),
"rejected messages must not be persisted"
);
}

Expand Down Expand Up @@ -6175,7 +6176,8 @@ mod tests {
storage
.list_agent_messages(&session.id, 0, 10)
.expect("messages list")
.is_empty()
.is_empty(),
"rejected messages must not be persisted"
);

storage
Expand Down
3 changes: 2 additions & 1 deletion crates/chat2db-storage/src/community_dashboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,8 @@ mod tests {
.expect("dashboard reads")
.expect("dashboard exists")
.chart_ids
.is_empty()
.is_empty(),
"a default dashboard must not define charts"
);
assert!(
storage
Expand Down
3 changes: 2 additions & 1 deletion crates/chat2db-storage/src/datasource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,8 @@ mod tests {
storage
.list_datasources()
.expect("datasources list")
.is_empty()
.is_empty(),
"a rolled back create must not leave datasources behind"
);
assert!(vault.values.lock().expect("vault lock").is_empty());
assert_eq!(storage.reconcile_secrets().expect("queue reads").pending, 0);
Expand Down
2 changes: 1 addition & 1 deletion crates/chat2db-storage/src/result_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1827,7 +1827,7 @@ mod tests {
.read_result_page(&metadata.id, PageRequest::default())
.expect("empty page reads");
assert_eq!(page.schema, schema());
assert!(page.rows.is_empty());
assert_eq!(page.rows.len(), 0);
assert!(!page.has_more);
}

Expand Down
Loading