Skip to content

Commit 1595d6e

Browse files
Claude Sonnet (coordinator)claude
andcommitted
fix(ci): resolve clippy errors and warnings blocking CI
- Add `json` feature to reqwest dep (fixes E0599 compile error under --all-features) - Gate blake3_file fn and its test under cfg(windows + self-update) - Use cfg_attr to suppress unused_mut on meta only on non-Windows - Convert module doc from /// to //! in plugin_info - Replace iter().any() with slice::contains() in tool_names_for - Use matches! macro in transition_allowed - Use fn pointer instead of redundant closure in ingest handler - Swap #![allow(unexpected_cfgs)] before #![cfg] in phase6 test - Replace &[x.clone()] with slice::from_ref(&x) in ledger-core tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent fb8d3f9 commit 1595d6e

8 files changed

Lines changed: 41 additions & 37 deletions

File tree

crates/ledger-core/tests/phase2_ingest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn reingest_is_idempotent() {
2626
};
2727

2828
let mut ledger = IngestedLedger::default();
29-
let first = ledger.ingest(&[tx.clone()]);
29+
let first = ledger.ingest(std::slice::from_ref(&tx));
3030
let second = ledger.ingest(&[tx]);
3131

3232
assert_eq!(first.len(), 1);

crates/ledger-core/tests/phase2_ingest_pipeline_remaining.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn ing_02_reingest_has_no_duplicate_journal_or_tx_rows() {
4242

4343
let mut ledger = IngestedLedger::default();
4444
let first = ledger
45-
.ingest_to_journal_and_workbook(&[row.clone()], &journal, &workbook)
45+
.ingest_to_journal_and_workbook(std::slice::from_ref(&row), &journal, &workbook)
4646
.unwrap();
4747
let second = ledger
4848
.ingest_to_journal_and_workbook(&[row], &journal, &workbook)

crates/ledger-core/tests/phase2_rustledger_journal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn ingest_to_journal_is_replay_safe() {
3636

3737
let mut ledger = IngestedLedger::default();
3838

39-
let first = ledger.ingest_to_journal(&[tx.clone()], &journal_path).unwrap();
39+
let first = ledger.ingest_to_journal(std::slice::from_ref(&tx), &journal_path).unwrap();
4040
let second = ledger.ingest_to_journal(&[tx], &journal_path).unwrap();
4141

4242
assert_eq!(first.len(), 1);

crates/ledgerr-mcp/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ thiserror = "2"
1717
sysinfo = { version = "0.33", default-features = false, features = ["system"] }
1818

1919
# self-update feature deps — only compiled when the feature is active
20-
reqwest = { version = "0.12", features = ["blocking", "rustls-tls"], default-features = false, optional = true }
20+
reqwest = { version = "0.12", features = ["blocking", "json", "rustls-tls"], default-features = false, optional = true }
2121
semver = { version = "1", optional = true }
2222

2323
# winreg — Windows-only, safe registry wrapper; gated at the cfg level in code

crates/ledgerr-mcp/src/events.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,13 @@ pub fn reconstruct_lifecycle(events: &[LifecycleEvent]) -> ReplayProjection {
283283
}
284284

285285
fn transition_allowed(previous: Option<&str>, next: &str) -> bool {
286-
match (previous, next) {
287-
(None, "ingest") => true,
288-
(Some("ingest"), "classification") => true,
289-
(Some("classification"), "reconciliation") => true,
290-
(Some("classification"), "adjustment") => true,
291-
(Some("reconciliation"), "adjustment") => true,
292-
(Some("adjustment"), "adjustment") => true,
293-
_ => false,
294-
}
286+
matches!(
287+
(previous, next),
288+
(None, "ingest")
289+
| (Some("ingest"), "classification")
290+
| (Some("classification"), "reconciliation")
291+
| (Some("classification"), "adjustment")
292+
| (Some("reconciliation"), "adjustment")
293+
| (Some("adjustment"), "adjustment")
294+
)
295295
}

crates/ledgerr-mcp/src/mcp_adapter.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub const TOOL_GROUP_AUDIT: &[&str] = &[QUERY_AUDIT_LOG_TOOL];
7979
pub const TOOL_GROUP_ONTOLOGY_WRITE: &[&str] =
8080
&[ONTOLOGY_UPSERT_ENTITIES_TOOL, ONTOLOGY_UPSERT_EDGES_TOOL];
8181

82+
#[allow(clippy::vec_init_then_push)]
8283
pub fn tool_names() -> Vec<String> {
8384
let mut features = Vec::new();
8485

@@ -109,31 +110,31 @@ pub fn tool_names() -> Vec<String> {
109110
pub fn tool_names_for(features: &[&str]) -> Vec<String> {
110111
let mut tools = Vec::new();
111112

112-
if features.iter().any(|f| *f == "core") {
113+
if features.contains(&"core") {
113114
tools.extend(TOOL_GROUP_CORE.iter().map(|s| s.to_string()));
114115
}
115-
if features.iter().any(|f| *f == "ontology") || features.iter().any(|f| *f == "tax") {
116+
if features.contains(&"ontology") || features.contains(&"tax") {
116117
tools.extend(TOOL_GROUP_ONTOLOGY.iter().map(|s| s.to_string()));
117118
}
118-
if features.iter().any(|f| *f == "reconciliation") || features.iter().any(|f| *f == "tax") {
119+
if features.contains(&"reconciliation") || features.contains(&"tax") {
119120
tools.extend(TOOL_GROUP_RECONCILIATION.iter().map(|s| s.to_string()));
120121
}
121-
if features.iter().any(|f| *f == "hsm") || features.iter().any(|f| *f == "tax") {
122+
if features.contains(&"hsm") || features.contains(&"tax") {
122123
tools.extend(TOOL_GROUP_HSM.iter().map(|s| s.to_string()));
123124
}
124-
if features.iter().any(|f| *f == "events") || features.iter().any(|f| *f == "tax") {
125+
if features.contains(&"events") || features.contains(&"tax") {
125126
tools.extend(TOOL_GROUP_EVENTS.iter().map(|s| s.to_string()));
126127
}
127-
if features.iter().any(|f| *f == "classification") {
128+
if features.contains(&"classification") {
128129
tools.extend(TOOL_GROUP_CLASSIFICATION.iter().map(|s| s.to_string()));
129130
}
130-
if features.iter().any(|f| *f == "tax") {
131+
if features.contains(&"tax") {
131132
tools.extend(TOOL_GROUP_TAX.iter().map(|s| s.to_string()));
132133
}
133-
if features.iter().any(|f| *f == "audit") {
134+
if features.contains(&"audit") {
134135
tools.extend(TOOL_GROUP_AUDIT.iter().map(|s| s.to_string()));
135136
}
136-
if features.iter().any(|f| *f == "ontology") {
137+
if features.contains(&"ontology") {
137138
tools.extend(TOOL_GROUP_ONTOLOGY_WRITE.iter().map(|s| s.to_string()));
138139
}
139140

@@ -653,7 +654,7 @@ pub fn handle_ingest_pdf<T: TurboLedgerTools>(
653654
request
654655
.extracted_rows
655656
.iter()
656-
.map(|row| deterministic_tx_id(row))
657+
.map(deterministic_tx_id)
657658
.collect::<Vec<_>>()
658659
} else {
659660
response.tx_ids

crates/ledgerr-mcp/src/plugin_info.rs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
/// plugin_info — version check, host metadata, decision log, and (Windows-only) self-update.
2-
///
3-
/// The `plugin_info` MCP tool is always available and returns:
4-
/// - current embedded version
5-
/// - latest GitHub release version (when reachable)
6-
/// - whether an update is available
7-
/// - host system metadata
8-
/// - path to the decision/update log
9-
///
10-
/// Subcommands (passed as the optional `subcommand` argument):
11-
/// - `"check"` (default) — version info + host metadata
12-
/// - `"upgrade"` — Windows-only; downloads and applies the latest release
13-
/// - `"cleanup"` — removes `*.old.exe` and `*.new.exe` backup files
1+
//! plugin_info — version check, host metadata, decision log, and (Windows-only) self-update.
2+
//!
3+
//! The `plugin_info` MCP tool is always available and returns:
4+
//! - current embedded version
5+
//! - latest GitHub release version (when reachable)
6+
//! - whether an update is available
7+
//! - host system metadata
8+
//! - path to the decision/update log
9+
//!
10+
//! Subcommands (passed as the optional `subcommand` argument):
11+
//! - `"check"` (default) — version info + host metadata
12+
//! - `"upgrade"` — Windows-only; downloads and applies the latest release
13+
//! - `"cleanup"` — removes `*.old.exe` and `*.new.exe` backup files
1414
1515
use std::path::PathBuf;
1616
use std::time::{SystemTime, UNIX_EPOCH};
@@ -108,6 +108,7 @@ pub fn host_metadata() -> Value {
108108
.map(|n| n.get())
109109
.unwrap_or(0);
110110

111+
#[cfg_attr(not(target_os = "windows"), allow(unused_mut))]
111112
let mut meta = json!({
112113
"os": std::env::consts::OS,
113114
"arch": std::env::consts::ARCH,
@@ -386,6 +387,7 @@ fn strip_zone_identifier(path: &std::path::Path) {
386387
}
387388

388389
/// BLAKE3 hex digest of a file's contents; returns `""` on any I/O error.
390+
#[cfg(all(target_os = "windows", feature = "self-update"))]
389391
fn blake3_file(path: &std::path::Path) -> String {
390392
std::fs::read(path)
391393
.map(|bytes| blake3::hash(&bytes).to_hex().to_string())
@@ -557,6 +559,7 @@ mod tests {
557559
assert!(schema["properties"]["subcommand"]["enum"].is_array());
558560
}
559561

562+
#[cfg(all(target_os = "windows", feature = "self-update"))]
560563
#[test]
561564
fn blake3_file_empty_for_missing_path() {
562565
assert_eq!(blake3_file(std::path::Path::new("/no/such/file.bin")), "");

crates/ledgerr-mcp/tests/phase6_mcp_exposure_gaps.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#![cfg(phase6_gap_tests)]
21
#![allow(unexpected_cfgs)]
2+
#![cfg(phase6_gap_tests)]
33

44
/// Phase 6: MCP Exposure Gaps — Failing Test Suite
55
///

0 commit comments

Comments
 (0)