fix(build): unblock CI native gate — autobenches + clippy clean (R-00261) - #1
Merged
Conversation
…261)
`.github/workflows/repository-policy.yml` job `native` was red on main:
`cargo clippy --workspace --all-targets -- -D warnings` exited 101 for two
independent reasons.
(a) bench target compile failure
`crates/lumio-platform/benches/clock.rs` is compiled as a `cfg(test)` module
via `#[path]` from `lib.rs` (criterion is not approved; EXTERNAL_ALLOWLIST is
empty). Living under `benches/` also made Cargo auto-register it as a bench
target, where `use crate::{MonotonicClock, StdMonotonicClock}` does not resolve
(E0432), so `--all-targets` and `--benches` both failed. `cargo test` never
builds bench targets, which is why this stayed hidden.
Fixed with `autobenches = false`, keeping the file and its `cargo test`
coverage exactly where they were.
(b) 14 clippy diagnostics
13 `new_without_default` across platform/kernel/job/spatial/codec/test-support
and 1 `collapsible_if` in `xtask/src/baseline.rs`. Every flagged `new()` is a
no-arg empty constructor, so `Default` is semantically sound; each forwards to
`Self::new()`. No lint is silenced with `#[allow]`.
No behaviour change, no public API semantics change, no new dependency
(Cargo.lock untouched, external deps still 0).
Verified at this commit on x86_64-apple-darwin and aarch64-apple-darwin:
cargo clippy --workspace --all-targets -- -D warnings exit 0
cargo clippy --workspace --all-targets --all-features -- -D warnings exit 0
cargo build --workspace --benches exit 0
cargo test --workspace exit 0 90 passed/0 failed
cargo test --workspace --all-features exit 0
cargo test --workspace --no-default-features exit 0
cargo fmt --all -- --check exit 0
cargo xtask check-dep-dag / dump-symbols / check-baseline exit 0
node .spec/tools/spec-lint.mjs && node --test spec-lint.test.mjs exit 0
clock_benchmark::clock_benchmark_reports_distribution ... ok
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
背景
.github/workflows/repository-policy.yml的nativejob 在 main (0e18106) 上是红的:cargo clippy --workspace --all-targets -- -D warnings退出 101。两个互相独立的成因。对应 Workflow 需求 R-00261(需求室 RM-00002)。
成因与修法
(a) bench target 编译失败
crates/lumio-platform/benches/clock.rs的设计是经lib.rs的#[path]当cfg(test)模块编译(criterion 未获批准,EXTERNAL_ALLOWLIST为空)。但文件位于benches/会被 Cargo 额外自动登记为 bench target,而在 bench crate root 里use crate::{MonotonicClock, StdMonotonicClock}不解析:cargo test不构建 bench target,所以此前一直没暴露。修法是autobenches = false,文件与其cargo test覆盖原地不动。(b) 14 条 clippy 诊断
13 条
new_without_default(platform / kernel / job / spatial / codec / test-support)+ 1 条collapsible_if(xtask/src/baseline.rs)。被标记的new()全是无参空构造,Default语义成立,各自转发Self::new()。没有用#[allow]抑制任何一条。验证证据
RED(本 PR 之前,main
0e18106):cargo build --workspace --benchescargo clippy --workspace --all-targets -- -D warningscargo clippy --workspace --all-targets --all-features -- -D warningsGREEN(本 PR
ec315dc,x86_64-apple-darwin与aarch64-apple-darwin双腿各跑一遍):cargo clippy --workspace --all-targets -- -D warningscargo clippy --workspace --all-targets --all-features -- -D warningscargo build --workspace --benchescargo test --workspacecargo test --workspace --all-featurescargo test --workspace --no-default-featurescargo fmt --all -- --checkcargo xtask check-dep-dag/dump-symbols/check-baselinenode .spec/tools/spec-lint.mjs+node --test .spec/tools/spec-lint.test.mjs关键回归点:
clock_benchmark::clock_benchmark_reports_distribution ... ok—— bench 那条测试覆盖没有因为关掉 autobenches 而丢失。边界
Cargo.lock未改动,外部依赖数仍为 0。#[allow(clippy::len_without_is_empty)]属另一条 lint,本 PR 未触及。🤖 Generated with Claude Code