Skip to content

ci: Ungate the shell's clippy hook, so Linux-only code meets -D warnings - #326

Merged
omesser merged 1 commit into
mainfrom
ci/321-lint-linux
Sep 4, 2026
Merged

omesser merged 1 commit into
mainfrom
ci/321-lint-linux

Conversation

@omesser

@omesser omesser commented Sep 4, 2026 •

Copy link
Copy Markdown
Owner

Why

No job denied warnings over Linux-only code. Every other platform arm is linted
somewhere; src-tauri/src/platform/x11/ and every target_os = "linux" arm
were compiled and never linted.

The hook that should have done it refused to. cargo-clippy-shell already ran
cargo clippy -p ai-buddy --all-targets -- -D warnings, but its entry began
if [ "$(uname -s)" != Darwin ]; then echo "skipped"; exit 0; fi — so it was a
no-op on Linux, including inside the Ubuntu CI job that runs pre-commit. The
Windows job denies warnings and never compiles those arms; Ubuntu compiled them
under cargo test, which does not fail on a warning.

What changed

The guard is deleted. One file, .pre-commit-config.yaml.

That is the whole gate: the Ubuntu job already runs pre-commit and already
installs the Tauri headers, so ungating the hook is enough. The alternative —
a new cargo clippy --workspace step in the workflow — was rejected for adding
a second cargo invocation beside the pre-commit one, and for putting the Linux
rule in a workflow while the identical macOS rule lives in the hook file, which
is two places for one rule to drift.

The hook's comment said the shell "needs macOS". That has not been true since
tests.yml started installing the Linux headers, so it is replaced.

A machine whose window layer the shell cannot link now fails here rather than
printing "skipped", and the error names the missing library. That is the honest
answer: a skip claimed the crate had been checked.

How to verify

Proven by planting use std::collections::BTreeSet; at the top of
platform/x11/settings_window.rs — 1136 lines that no linter had ever seen —
and dispatching the workflow on that commit:
run 33889642478.

The same hook, the same command, the same commit:

Job cargo clippy (shell)
macos-latest Passed — it cannot compile that file, so it never saw the import
ubuntu-latest Failed — error: unused import: std::collections::BTreeSet

That asymmetry is the gap, demonstrated. The planted commit was then removed;
this branch is the one-file change.

The gate was not green over the tree, and that is the result. Its first run
over the real branch failed Ubuntu on two findings in code no linter had ever
seen, both fixed here:

Most of the previously unlinted code had been checked before pushing, which is
why only two survived: x11rb is pure Rust, so temporarily widening the
dependency table from cfg(all(unix, not(target_os = "macos"))) to
cfg(unix) — dropping only gtk, which has no pkg-config on macOS — compiles
six of the eight platform/x11 files locally, and all 938 lines pass
-D warnings. That harness was validated by planting an unused import and a
let_and_return and confirming clippy flagged them, then reverted in full.
settings_window.rs is the one file it could not reach, and that is where the
real finding was.

cargo fmt, cargo clippy --workspace --all-targets -- -D warnings and
cargo test are clean locally (205 shell, 414 core).

Notes

Findings this gate does not force, spotted while reading the one file that
still cannot be compiled here. None is a default lint, so all are out of scope
for a ci: change, and two look worth their own issues:

  • platform/x11/overlay.rs:40 — configure_overlay opens a fresh
    RustConnection::connect(None) instead of the shared
    super::connection::connection() that every other call site uses.
  • window_class is duplicated verbatim between platform/x11/sensing.rs and
    platform/x11/window_source.rs.
  • platform.rs — due() has two byte-identical bodies under different cfgs,
    and the comment on the second describes a difference the code no longer has.
  • platform/x11/settings_window.rs — should_omit_row filters the two consent
    ids in build_section, and build_row re-checks them, so one check is
    unreachable; help_line's doc comment opens with a line describing pack.

Closes #321

— Claude Code, on @omesser's behalf.

The Ubuntu job already runs pre-commit and already installs the Tauri
headers, so deleting the uname guard is the whole gate — no new workflow
step. Unverified until CI runs: `platform/x11/` does not build on macOS.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@omesser

omesser commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

Correcting a claim I made in the description before the first run: I said the gate was green over the current tree. It was not.

Ubuntu failed on two findings, both now fixed in this branch, and both in code no linter had seen:

Which is the argument for the change, made better than the issue made it: the gate caught a defect shipped hours earlier, in exactly the class of code it exists to cover, and nothing else in the repository could have.

— Claude Code, on @omesser's behalf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: Nothing lints Linux-only code with -D warnings

1 participant