Skip to content

fix(clippy): clear workspace-gate lint errors in jcode-telemetry-core and jcode-setup-hints - #169

Closed
KooshaPari wants to merge 3 commits into
masterfrom
fix/ci-clippy-workspace-lint-fixes
Closed

KooshaPari wants to merge 3 commits into
masterfrom
fix/ci-clippy-workspace-lint-fixes

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes the 19 pre-existing clippy errors that the workspace-wide -D warnings gate newly exposes. Closes #170.

Issue linkage: this PR closes #170 (the dedicated lint issue). It does not close #165 — that issue belongs to PR #166 (the --workspace gate itself). #165 stays open for #166.

Why this PR is self-validating

This branch originally sat on origin/master, whose CI ran the old clippy command:

cargo clippy --all-targets --all-features -- -D warnings

Without --workspace, cargo builds only the root package kcode and its dependency graph. jcode-telemetry-core and jcode-setup-hints are not in that graph, so a CI run on this branch could not possibly have exercised the crates it fixes.

This branch therefore now also carries #166's --workspace clippy gate change, merged in as a normal merge commit (ce0763b8, parents 41d15bac + 762da9fb, conflict-free — the two branches touch disjoint files). Its own CI now runs:

cargo clippy --workspace --all-targets --all-features -- -D warnings

so the fix is validated by the very gate that motivates it.

Because --workspace also newly compiles jcode-sdk, #166's companion hunk in crates/jcode-sdk/src/client.rs (removal of the unused type Subscriber = (u64, Option<String>, Sender<ApiEvent>); alias) is included here as well. Without it this branch's own CI would fail in jcode-sdk.

The merged files are disjoint, so this is a clean combination of both PRs. When #166 lands separately, GitHub will recognise this branch as already containing those commits.

Fixed sites

crates/jcode-telemetry-core/src/lib.rs

#[cfg(not(test))] on items only the live HTTP delivery path reads (unused in the --all-targets test build): the pub(crate) use delivery::{background_sender, post_payload, transcript_background_sender}; re-export; std::sync::OnceLock; std::sync::atomic::{AtomicBool, Ordering}; std::sync::mpsc::{SyncSender, TrySendError}; consts ASYNC_SEND_TIMEOUT / BACKGROUND_QUEUE_CAPACITY; statics TELEMETRY_PERMANENTLY_REJECTED, TELEMETRY_BACKGROUND_SENDER, TRANSCRIPT_BACKGROUND_SENDER, TELEMETRY_HTTP_CLIENT.

crates/jcode-telemetry-core/src/delivery.rs

#[cfg(not(test))] on the live delivery surface the test module never reaches: the jcode_logging, OnceLock, atomic::Ordering, Duration, and super::{...} imports, plus 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

Split the shared #[cfg(any(test, target_os = "macos"))] use macos_terminal::{MacTerminalKind, effective_macos_terminal}; into per-name gates — MacTerminalKind keeps any(test, target_os = "macos"), effective_macos_terminal is narrowed to target_os = "macos" (every caller already is). The combined import was unused in a non-macOS --all-targets test build.

Explicit assurance: no test removed or weakened

No test, no assertion, and no production behavior was removed, deleted, skipped, or weakened.

  • The #[cfg(not(test))] gates compile items out of test builds only; the production delivery path is byte-identical and still compiled and checked.
  • #[cfg(test)] mod tests bodies are untouched.
  • The single semantic edit — trailing return true; becoming the equivalent tail expression true in the #[cfg(test)] arm of send_transcript_payload — is behaviour-preserving: in a test build that block is the entire function body, so both forms return the identical value.

The fix uses #[cfg] gating of test-only / platform-only items, matching the pattern already used throughout this repo.

Validation

Scoped clippy over exactly the three affected crates:

CARGO_BUILD_JOBS=4 cargo clippy -p jcode-telemetry-core -p jcode-setup-hints -p jcode-sdk --all-targets --all-features -- -D warnings

The full cargo clippy --workspace --all-targets --all-features -- -D warnings gate runs on this branch's own CI.

The clippy gate ran without --workspace, so cargo only built the root package's dependency graph. crates/jcode-sdk is a workspace member with no dependents and was never linted: the green run 39390720989 shows the clippy step checking 93 crates against a 94-package workspace, with jcode-sdk the only member absent.

That gap was not theoretical. cargo test -p jcode-sdk parity in the same run emitted a dead_code warning for the unused type alias Subscriber at crates/jcode-sdk/src/client.rs:330. Removing the dead alias and adding --workspace closes both the violation and the blind spot.

tx-agent: jcode
tx-validated: cargo-check
tx-scope: .github/workflows/ci.yml, crates/jcode-sdk/src/client.rs
tx-intent: Close the CI clippy workspace-coverage gap and remove the dead code it hid
…asses

Workspace-wide clippy newly covers jcode-telemetry-core and
jcode-setup-hints, exposing pre-existing lints in their test targets that
the old root-package-only clippy command never checked.

- jcode-telemetry-core: the live HTTP delivery path is already inert under
  cfg(test) (payloads are captured into TEST_EMITTED_PAYLOADS), so gate the
  delivery re-export, its exclusive imports, constants/statics, and the eight
  delivery functions with #[cfg(not(test))].
- jcode-setup-hints: split the shared macos_terminal import. MacTerminalKind
  stays #[cfg(any(test, target_os = "macos"))] because the notice helper and
  its tests use it; effective_macos_terminal becomes #[cfg(target_os =
  "macos")] because every caller sits behind that gate.

Non-test builds are byte-identical; no test was removed or weakened.

Closes #165

tx-agent: jcode
tx-validated: cargo-check
tx-scope: crates/jcode-telemetry-core, crates/jcode-setup-hints
Copilot AI balanced review requested due to automatic review settings October 21, 2026 21:30
@codeant-ai

codeant-ai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 41d15ba Oct 21, 2026 · 21:30 21:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codeant-ai

codeant-ai Bot commented Oct 21, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 10377738-20a2-4bd2-afdb-5aaf25f22411
📥 Commits

Reviewing files that changed from the base of the PR and between 2aea04d and 41d15ba.

📒 Files selected for processing: 3
  • crates/jcode-setup-hints/src/lib.rs
  • crates/jcode-telemetry-core/src/delivery.rs
  • crates/jcode-telemetry-core/src/lib.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 9
  • GitHub Check: Require Linked Issue
  • GitHub Check: Build & Test (desk-linux)
  • GitHub Check: Windows Cross-Target Check (Linux)
  • GitHub Check: Release Automation
  • GitHub Check: TypeScript SDK
  • GitHub Check: Quality Guardrails
  • GitHub Check: Format
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Kilo Code Review
🔇 Additional comments: 3
crates/jcode-setup-hints/src/lib.rs: 1

48-49: LGTM!

Also applies to: 58-63

crates/jcode-telemetry-core/src/lib.rs: 1

7-11: LGTM!

Also applies to: 36-66, 1325-1327

crates/jcode-telemetry-core/src/delivery.rs: 1

7-11: LGTM!

Also applies to: 13-13, 15-15, 18-18, 23-23, 32-32, 50-50, 88-88, 106-106, 158-158, 176-176, 189-189, 204-204

📝 Summary

Summary

This PR fixes 19 pre-existing --all-targets Clippy errors in jcode-setup-hints and jcode-telemetry-core.

It preserves non-test behavior, leaves CI unchanged, and does not weaken tests. The reported Clippy and formatting checks pass. Package tests still have pre-existing environment-dependent failures.

Must Fix

No blocking issues are identified from the supplied evidence.

Should Fix

No non-blocking issues are identified from the supplied evidence.

Consider

Issue #165 remains open. This PR does not add --workspace to CI or remove the unused Subscriber alias from jcode-sdk.

Approve / Request Changes

Approve.

Conditional compilation changes adjust macOS terminal imports in jcode-setup-hints and exclude production telemetry delivery code from test builds in jcode-telemetry-core.

Changes: Build and test configuration

Layer / File(s) Summary
Gate macOS terminal imports
crates/jcode-setup-hints/src/lib.rs
MacTerminalKind is imported for test or macOS builds. effective_macos_terminal is imported only for macOS builds.
Exclude production delivery from test builds
crates/jcode-telemetry-core/src/lib.rs, crates/jcode-telemetry-core/src/delivery.rs
Production telemetry imports, exports, state, and delivery functions are excluded from test builds. The test transcript-capture branch now returns true as a tail expression.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: 1jehuang

Merge Risk: ⚪ Minimal · up to 41d15

No actionable merge-blocking risk remains from the reviewed changes.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Linked Issues check Warning Issue #165 requires two coding changes: add --workspace to the Quality Guardrails clippy command and remove the unused Subscriber alias from crates/jcode-sdk/src/client.rs. The whole-PR diff sho… Update .github/workflows/ci.yml so the clippy command uses --workspace, and remove the unused Subscriber alias from crates/jcode-sdk/src/client.rs. Then validate the workspace clippy gate.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the Clippy lint fixes in the two affected crates and matches the main changeset.
Description check Passed The description directly explains the exposed lint errors, the applied fixes, validation results, and scope limitations.
Out of Scope Changes check Passed The changed telemetry and setup-hints code has a direct connection to issue #165. These changes remove clippy errors that a workspace-wide, all-targets gate would expose. The changes preserve non-test…
Docstring Coverage Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 3 files.
Full details: Out of Scope Changes check

Explanation

The changed telemetry and setup-hints code has a direct connection to issue #165. These changes remove clippy errors that a workspace-wide, all-targets gate would expose. The changes preserve non-test telemetry delivery, retain the test helpers, and do not weaken tests. No unrelated change is shown in the reviewed diff.

Full details: Linked Issues check

Explanation

Issue #165 requires two coding changes: add --workspace to the Quality Guardrails clippy command and remove the unused Subscriber alias from crates/jcode-sdk/src/client.rs. The whole-PR diff shows no change to .github/workflows/ci.yml and no change to the SDK client. The PR only fixes test-target clippy errors in jcode-telemetry-core and jcode-setup-hints.

Resolution

Update .github/workflows/ci.yml so the clippy command uses --workspace, and remove the unused Subscriber alias from crates/jcode-sdk/src/client.rs. Then validate the workspace clippy gate.

✨ Finishing Touches: 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Oct 21, 2026
@codeant-ai

codeant-ai Bot commented Oct 21, 2026

Copy link
Copy Markdown

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: 41d15bacf1fc

…rkspace-lint-fixes

Carries PR #166's --workspace clippy gate into PR #169 so this branch's own
CI validates the lint fixes it ships. The gate newly compiles
jcode-telemetry-core and jcode-setup-hints (never built by the root package's
dependency graph) plus jcode-sdk, which is why the jcode-sdk dead-code hunk
from #166 is required here too.

Conflict-free: the two branches touch disjoint files (#169: telemetry-core +
setup-hints; #166: ci.yml + jcode-sdk/src/client.rs).

No test removed or weakened.

tx-agent: jcode
tx-validated: pending-local-clippy
tx-task: #170
tx-scope: ci.yml, jcode-sdk, jcode-telemetry-core, jcode-setup-hints
tx-intent: make the workspace clippy gate self-validating on this branch
@KooshaPari

Copy link
Copy Markdown
Owner Author

Sibling PR #190 (branch fix/ci-clippy-workspace-lint-fixes-budgets) carries the cold-cache timeout budgets that let this PR's Build & Test (desk-linux) job go green on its own: compile budget 900s -> 3300s, job timeout 120 -> 240 minutes, and the retention-readiness cohort budget 600s -> 1800s. It is based on this branch (fix/ci-clippy-workspace-lint-fixes) and adds only those three values to .github/workflows/ci.yml; no Rust source and no cache configuration is changed. The additional rust-cache blob fix (cache key suffix -notarget plus cache-targets: "false") stays in PR #183 and remains required.

@KooshaPari

Copy link
Copy Markdown
Owner Author

@KooshaPari KooshaPari closed this Oct 27, 2026
@KooshaPari
KooshaPari deleted the fix/ci-clippy-workspace-lint-fixes branch October 27, 2026 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(clippy): 19 unused-import/dead-code errors in jcode-telemetry-core and jcode-setup-hints surface under the workspace clippy gate

2 participants