fix(cli): gate unix-only dispatch/daemon symbols - #2580
Open
1688mengdie wants to merge 1 commit into
Open
Conversation
Three dead_code/unused_imports warnings fire in CLI builds on Windows because the symbols' only production consumers live behind unix gates while their own definitions are unconditional: - dispatch/runner.rs: the std::time::Duration import is consumed only inside cfg(unix) code paths (the unix process-group wait and a unix-only test case), so gate the import with #[cfg(unix)]. - dispatch/runner.rs: arguments_match_action is called from the target_os = linux/macos service paths (both imply unix) and from the platform-agnostic unit tests, so gate it with #[cfg(any(unix, test))] to keep it available to tests on every platform. - daemon/service.rs: run_command is only called from macOS launchd and systemd service management paths, all of which are unix-only, so gate it with #[cfg(unix)]. All three changes are pure cfg attribute additions that mirror the real consumer surfaces: no behavior changes on any platform, no test removals, and no assertions weakened. Linux and macOS builds keep every symbol exactly as before. Test: cargo check --locked -p bitfun-cli (0 errors, 0 warnings on Windows) Test: cargo test --locked -p bitfun-cli dispatch::runner (7 passed, 0 failed) AI: AI-assisted change, lightly tested; the unix-side compilation is left to the repository CI platform matrix.
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.
Summary
The three metadata verification steps in the CI workflow run
cargo metadata --locked --no-depswithout an explicit output format, so cargo prints a compatibility hint about the default format changing in a future release on every step, and the step output stays coupled to whatever the toolchain currently considers current. This appends--format-version 1— the format version cargo uses today — to each of the three steps (Verify committed Cargo metadata,Verify committed release metadata,Verify projected release metadata) so the output contract is pinned explicitly.Fixes #2579
Type and Areas
Type: CI
Areas: GitHub Actions workflows
Motivation / Impact
The compatibility hint is repeated in every CI job that runs the metadata validation steps, adding noise to build logs and leaving the steps' output format implicit. Pinning
--format-version 1removes the hint and freezes the output contract at the format the steps already consume. No step logic or parsing behavior changes; no direct user-facing change.Verification
run:lines carry--format-version 1(grep audit: exactly 3 invocations in ci.yml, all flagged).AI-assisted change, lightly tested.
Reviewer Notes
--format-version 1is cargo's current default, so the steps' observed output is unchanged; only the implicitness (and the hint it triggers) goes away.linux-binaries.ymlandnightly-artifacts.ymlcontain similar barecargo metadatainvocations, deliberately left untouched to keep this PR focused; they can be aligned separately if desired.Checklist