Repository navigation
Conversation
The Linux desktop crate declared gio and glib 0.22, but no source file in it uses either. The GTK crates it depends on use gio and glib 0.20, so only this crate pulled in the 0.22 line and a second copy of both libraries and their -sys crates. Remove the two dependencies. The crate's lockfile loses seven packages: gio, gio-sys, glib, glib-macros, glib-sys, gobject-sys and system-deps 9.0.0. With a single version of each left, the remaining entries drop their version suffixes. Also remove the axis-daemon and axis-pty entries from the root [workspace.dependencies] table. No member crate inherits them, so they only add noise and would be reported by an unused-dependency check. Signed-off-by: Teemu Kuusisto <[email protected]>
Unused dependencies had accumulated unnoticed, among them two in the Linux desktop crate and two workspace entries, because nothing in CI looks for them. They slow builds and widen the dependency surface that has to be audited. Install a pinned cargo-shear in the existing Clippy job and fail when a dependency is unused in either Cargo workspace, the root one and gui/linux. cargo-shear is used rather than cargo-machete because it also checks dev, build and target-specific dependencies, and it works on the pinned toolchain. Document the check in DEVELOPMENT.md, including the [package.metadata.cargo-shear] ignored list for a dependency used in a way the tool cannot see. Signed-off-by: Teemu Kuusisto <[email protected]>
The cargo-shear step runs in the Clippy job on every PR, but the local checks listed it only under dependency changes, so a source-only change could fail it in CI without the contributor having run it. Move both invocations into the block that applies to every change. The suppression advice named only [package.metadata.cargo-shear], which does not clear an unused entry in the root [workspace.dependencies] table. Name both places, and the ignored-paths key for a source file that must stay unlinked. With --deny-warnings the check also fails on unlinked source files and on an ignore entry that suppresses nothing, so say so in the documentation and in the step name. Signed-off-by: Teemu Kuusisto <[email protected]>
The local-checks paragraph about cargo-shear had grown into a block of loosely related claims, several of them inaccurate when run against cargo-shear 1.13.4: - The CI/CD item said one command covers both Cargo workspaces. The root excludes gui/linux, so that command covers only the root; say that CI runs it once for each. - "ignored-paths in the same table" did not say what the paths are relative to. They are relative to the crate in the package table and to the repository root in the workspace table, and a pattern written against the wrong one fails and adds a redundant-pattern warning. - Only an ignore entry that matches nothing was named as a failure. Any cargo-shear warning fails under --deny-warnings, a suppression that is no longer needed included. - A root [workspace.dependencies] entry is flagged when no member crate declares it by name, not when no crate inherits it. Keep a one-line install note under the command block and move the suppression guidance into its own short item. The sentence about GitHub annotations for the gui/linux run is not a local check and is dropped. Signed-off-by: Teemu Kuusisto <[email protected]>
siloteemu
force-pushed
the
ci/unused-dependency-check
branch
from
November 25, 2026 15:59
6ff8098 to
fea0ebe
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Technical Details
gui/linux) declaredgioandglib0.22, but no source file in it uses either, and the GTK crates it depends on use 0.20, so these two pulled in a second copy of both libraries. Removing them drops seven packages fromgui/linux/Cargo.lock(gio, gio-sys, glib, glib-macros, glib-sys, gobject-sys, system-deps 9.0.0); the other entries only lose their version suffix, no remaining package changes version or checksum, and nothing is added. The unusedaxis-daemonandaxis-ptyentries are removed from the root[workspace.dependencies]; no member crate uses them, and the rootCargo.lockis unchanged.cargo-shear1.13.4 with--locked, then runscargo shear --locked --deny-warningsfor the root workspace and again forgui/linux, which is a separate Cargo workspace excluded from the root. It fails on an unused dependency, an unlinked source file, or a suppression that is no longer needed, and names the dependency as a GitHub annotation. There is no new job, soscripts/release_tools.pyandscripts/verify_workflow_structure.pyare unchanged, and the step is in a job that is already part of the publication gate. No permissions, actions, digests, or release, nightly or GUI jobs change.DEVELOPMENT.mdadds the two commands to the first block of Local Checks, explains how to suppress a false positive with a stated reason (ignoredorignored-pathsunder[package.metadata.cargo-shear]in the crate'sCargo.toml, or[workspace.metadata.cargo-shear]in the rootCargo.tomlfor a workspace entry), and mentions the check under CI/CD.[dependencies], so an unused dev-, build- or platform-specific dependency passes, and its latest release does not compile on the pinned Rust 1.95.0. cargo-udeps needs nightly. rustc'sunused_crate_dependencieslint is noisy per test target. cargo-shear checks every dependency section, sees code for every platform and optional feature, exits non-zero, and installs with--lockedlike the other pinned CI tools (cargo-audit,cargo-deny). 1.13.4 is the newest version that installs with--lockedon 1.95.0.tokio-tungstenite) and one hidden by a module with the same name as the crate (windowsinaxis-pty). Both predate this change and are left for a follow-up.AGENTS.md, edits to.github/workflows/and to lockfiles are "ask first" areas. This PR edits both deliberately: the new CI step, and the removal of the seven packages fromgui/linux/Cargo.lock. Please review those two with that in mind.Security impact: none to the runtime or to enforcement. The desktop crate loses two unused direct dependencies and seven lockfile packages, so the dependency surface gets smaller. CI gains a check that only reads the repository and installs one pinned tool from crates.io with
--locked.Test Plan
Platforms: Linux aarch64 (Ubuntu-class host, Rust 1.95.0) for everything below; Windows and macOS through CI only.
cargo fmt --all -- --check,cargo fmt --manifest-path gui/linux/Cargo.toml -- --check,cargo clippy --locked --all-targets -- -D warnings, andcargo check --locked --workspace --all-targets.cargo shear --locked --deny-warningsfor the root workspace and forgui/linux, on this branch and on unmodifiedorigin/main.python3 scripts/verify_workflow_structure.py ., andcargo auditandcargo denyforgui/linux.cargo test --locked,bash scripts/test_security_tier0.shandpython3 -m unittest discover -s scripts, compared against a pristineorigin/maincopy.Test Result
cargo check;cargo shearexits 0 on both workspaces on this branch. Onorigin/mainit exits 1 for the root workspace, namingaxis-daemonandaxis-pty, and forgui/linux, naminggioandglib.scripts/verify_workflow_structure.pyreports OK (with PyYAML installed);cargo auditandcargo denypass forgui/linux.gui/linuxbuild: it was not compiled, because the host has no GTK4 or WebKitGTK development libraries. The "Build Linux desktop" CI job is the only compile check of removinggioandglib.policies/or the launch path changed.origin/main:cargo test --locked,scripts/test_security_tier0.shandpython3 -m unittest discover -s scripts, because the host has no trusted bwrap and filters seccomp-based tests. The failure sets are identical, so these tests give no signal for this change.cargo auditandcargo denyreport RUSTSEC-2026-0592 onurl, onorigin/maintoo; the rootCargo.lockis unchanged here, and an open PR addresses it.bash scripts/check_linux_mxc_packaging.shexits 1 with no output on this host, both on this branch and on an unmodifiedorigin/maincopy. I did not find why, so it says nothing either way about this change.