Skip to content

fix(build): unblock CI native gate — autobenches + clippy clean (R-00261) - #1

Merged
Go1c merged 1 commit into
mainfrom
fix/ci-native-gate-r-00261
Aug 28, 2026
Merged

fix(build): unblock CI native gate — autobenches + clippy clean (R-00261)#1
Go1c merged 1 commit into
mainfrom
fix/ci-native-gate-r-00261

Conversation

@Go1c

@Go1c Go1c commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

背景

.github/workflows/repository-policy.ymlnative job 在 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} 不解析:

error[E0432]: unresolved imports `crate::MonotonicClock`, `crate::StdMonotonicClock`
 --> crates/lumio-platform/benches/clock.rs:6:13

cargo test 不构建 bench target,所以此前一直没暴露。修法是 autobenches = false,文件与其 cargo test 覆盖原地不动。

(b) 14 条 clippy 诊断

13 条 new_without_default(platform / kernel / job / spatial / codec / test-support)+ 1 条 collapsible_ifxtask/src/baseline.rs)。被标记的 new() 全是无参空构造,Default 语义成立,各自转发 Self::new()没有用 #[allow] 抑制任何一条。

验证证据

RED(本 PR 之前,main 0e18106):

命令 退出码
cargo build --workspace --benches 101
cargo clippy --workspace --all-targets -- -D warnings 101
cargo clippy --workspace --all-targets --all-features -- -D warnings 101

GREEN(本 PR ec315dcx86_64-apple-darwinaarch64-apple-darwin 双腿各跑一遍):

命令 退出码
cargo clippy --workspace --all-targets -- -D warnings 0
cargo clippy --workspace --all-targets --all-features -- -D warnings 0
cargo build --workspace --benches 0
cargo test --workspace 0(90 passed / 0 failed / 0 ignored
cargo test --workspace --all-features 0
cargo test --workspace --no-default-features 0
cargo fmt --all -- --check 0
cargo xtask check-dep-dag / dump-symbols / check-baseline 0 / 0 / 0
node .spec/tools/spec-lint.mjs + node --test .spec/tools/spec-lint.test.mjs 0

关键回归点:clock_benchmark::clock_benchmark_reports_distribution ... ok —— bench 那条测试覆盖没有因为关掉 autobenches 而丢失。

边界

  • 无行为变更、无公共 API 语义变更。
  • 未新增任何依赖,Cargo.lock 未改动,外部依赖数仍为 0
  • 不夹带重构;仅修上述 14 条 lint 与 bench target 问题。
  • 既有的 3 处 #[allow(clippy::len_without_is_empty)] 属另一条 lint,本 PR 未触及。

🤖 Generated with Claude Code

…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>
@Go1c
Go1c merged commit 03d6bd7 into main Aug 28, 2026
2 checks passed
@Go1c
Go1c deleted the fix/ci-native-gate-r-00261 branch August 28, 2026 11:54
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.

1 participant