From d71754625dcac8ed295fecb7dc983b8f3ef5698a Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Fri, 21 Aug 2026 02:30:24 -0700 Subject: [PATCH] ci: lint the cli/server native-CUDA paths, the last 12 cfg sites nothing compiles #1632 closed the native-CUDA compile-coverage gap for `onnx-genai-engine` (167 cfg sites) by adding a strict clippy lane to the CUDA job. It could not close the same gap for `onnx-genai-cli` (2 sites) and `onnx-genai-server` (10 sites): both crates link the downloaded ONNX Runtime, and the CUDA job deliberately excludes ORT-linked crates. This adds their lane to `CLI ORT`, which already has ORT staged and already runs clippy on the CLI -- but only with default features, under which every `#[cfg(feature = "native-cuda")]` block evaluates to false and is never parsed as code. Code that is never compiled cannot be linted, so a defect there is invisible rather than red. Kept as a separate step: the default configuration is what ships, so it must keep being checked on its own rather than replaced by a union of both. Verified (pinned 1.98.0, macOS aarch64, no CUDA toolkit -- CUDA is dynamically loaded, so the crate graph builds without one): cargo clippy --locked -p onnx-genai-cli -p onnx-genai-server \ --features onnx-genai-cli/native-cuda,onnx-genai-server/native-cuda \ --all-targets -- -D warnings -> exit 0 Paired negative control, one probe per crate, each run against BOTH lanes on the same tree so the comparison is not confounded: probe in onnx-genai-server/src/state.rs:316 (inside `#[cfg(native-cuda)]`) existing default lane -> exit 0, probe not mentioned new lane -> exit 101, `unused variable: probe_negative_control` probe in onnx-genai-cli/src/generate.rs:200 (inside `#[cfg(native-cuda)]`) existing default lane -> exit 0, probe not mentioned new lane -> exit 101 Both probes reverted; the tree is clean. That the existing lane stays green with a hard error sitting in the file is the point: it is not that the check was lenient, it is that those lines were not code in that configuration. Note on the first attempt, because it nearly produced a false pass: my initial probe was `let _probe... = 1u32;`. A leading underscore suppresses `unused_variables`, so the new lane returned exit 0 and looked blind. The probe was broken, not the lane. A negative control that fails to fail proves nothing until you have shown the control itself works. What I did not verify: the Windows leg. `cli-ort` is a ubuntu-latest + windows-latest matrix, so this step runs on both, but I have no Windows host and did not measure it. The crate graph builds with no CUDA toolkit on this host, which is evidence it does not need one, not proof for Windows. CI is the oracle for that leg. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 08760f2f-160f-41e5-828d-9d9b6045c00d --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1cce23551..c5e3938ff3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -885,6 +885,27 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} - name: Clippy onnx-genai-cli run: cargo clippy --locked -p onnx-genai-cli --all-targets -- -D warnings + # The step above builds these crates with their *default* features, under + # which every `#[cfg(feature = "native-cuda")]` block evaluates to false + # and is therefore never parsed as code -- it cannot be type-checked or + # linted, so a defect there is invisible rather than red. #1632 closed + # that hole for `onnx-genai-engine` on the CUDA job; these two crates + # could not go there because both link the downloaded ONNX Runtime, which + # that job deliberately excludes. This is their home instead. + # + # A separate step rather than adding the feature to the one above: the + # default configuration is what ships, so it must keep being checked on + # its own rather than being replaced by a union of both. + # + # `onnx-genai-cli/native-cuda` pulls in `onnx-genai-server/native-cuda` + # transitively, but `-D warnings` is only enforced for packages named + # with `-p`, so the server is listed explicitly. + - name: Clippy onnx-genai-cli and onnx-genai-server with native CUDA + run: >- + cargo clippy --locked + -p onnx-genai-cli -p onnx-genai-server + --features onnx-genai-cli/native-cuda,onnx-genai-server/native-cuda + --all-targets -- -D warnings cuda-compile-linux: name: CUDA compile (Linux x86_64)