Repository navigation
Description
Root cause
The CI clippy gate in .github/workflows/ci.yml (Quality Guardrails step) was:
cargo clippy --all-targets --all-features -- -D warnings
Without --workspace, cargo builds only the root package kcode plus its dependency graph. jcode-telemetry-core and jcode-setup-hints are not in the root package's dependency graph, so they were never compiled and their lints were never checked. The errors below are pre-existing on master; they were latent, not newly introduced.
Adding --workspace (the fix in #166) newly compiles those two crates and therefore surfaces 19 unused_imports / dead_code / needless_return errors that -D warnings then turns into a hard build failure.
Affected crates
| Crate | Files |
|---|---|
jcode-telemetry-core |
src/lib.rs, src/delivery.rs |
jcode-setup-hints |
src/lib.rs |
Error sites
crates/jcode-telemetry-core/src/lib.rs
#[cfg(not(test))] added to items that only the #[cfg(not(test))] live HTTP delivery path reads, so they are unused in the --all-targets test build:
- re-export
pub(crate) use delivery::{background_sender, post_payload, transcript_background_sender}; use std::sync::OnceLock;use std::sync::atomic::{AtomicBool, Ordering};use std::sync::mpsc::{SyncSender, TrySendError};consts ASYNC_SEND_TIMEOUT,BACKGROUND_QUEUE_CAPACITYstatics TELEMETRY_PERMANENTLY_REJECTED,TELEMETRY_BACKGROUND_SENDER,TRANSCRIPT_BACKGROUND_SENDER,TELEMETRY_HTTP_CLIENT
Plus one needless_return at the end of the #[cfg(test)] arm of send_transcript_payload (a trailing return true; where the block is the whole function body in a test build) — converted to the equivalent tail expression true.
crates/jcode-telemetry-core/src/delivery.rs
#[cfg(not(test))] added to the live delivery surface, which the test module never reaches:
- imports:
jcode_logging as logging,std::sync::OnceLock,std::sync::atomic::Ordering,std::time::Duration, and thesuper::{ASYNC_SEND_TIMEOUT, BACKGROUND_QUEUE_CAPACITY, TELEMETRY_BACKGROUND_SENDER, TELEMETRY_ENDPOINT, TELEMETRY_HTTP_CLIENT, TELEMETRY_PERMANENTLY_REJECTED, TRANSCRIPT_BACKGROUND_SENDER}glob - functions:
http_client,post_payload,post_payload_with_retry,post_transcript_payload,init_background_sender,sender,background_sender,transcript_background_sender
crates/jcode-setup-hints/src/lib.rs
The two names MacTerminalKind and effective_macos_terminal shared one gate:
#[cfg(any(test, target_os = "macos"))]
use macos_terminal::{MacTerminalKind, effective_macos_terminal};Every effective_macos_terminal() caller is behind #[cfg(target_os = "macos")], so the combined import is unused in a non-macOS --all-targets test build. The gate is split so each name carries its own cfg:
#[cfg(any(test, target_os = "macos"))]
use macos_terminal::MacTerminalKind;
#[cfg(target_os = "macos")]
use macos_terminal::effective_macos_terminal;Fix approach
#[cfg] gating of test-only and platform-only items, matching the pattern already used throughout this repo (#[cfg(test)], #[cfg(target_os = "macos")], #[cfg(not(test))], #[cfg(windows)]). The production code paths are byte-identical; only the compile-time visibility of items that production code does not read changes.
Explicit assurance: no test was removed or weakened
No test, no assertion, and no production behavior was removed, deleted, skipped, or weakened. Specifically:
- The
#[cfg(not(test))]gates arecfg(not(test))— they compile items out of test builds only. The production delivery path is unaffected and still compiled and checked. #[cfg(test)] mod testsbodies are untouched.- The one semantic edit (
return true;->true) is an equivalent rewrite: in a test build that block is the entire function body, soreturn true;and the tail expressiontrueproduce the identical value. No assertion changed.
Fix reference
PR #169 (fix/ci-clippy-workspace-lint-fixes), which also carries #166's --workspace clippy gate so its own CI validates the fix.
Note on the parallel jcode-sdk change
The workspace gate additionally requires the crates/jcode-sdk/src/client.rs change in #166 (removal of the unused type Subscriber = (u64, Option<String>, Sender<ApiEvent>);), because jcode-sdk is now compiled by the workspace-wide clippy and would otherwise trip -D warnings. That hunk is included in #169 as well, so #169 is self-validating.
Activity
Merge branch 'fix/ci-clippy-workspace-coverage' into fix/ci-clippy-wo…