Skip to content

fix(ci): decouple Rust lib test compilation from 5-minute regression execution timeout (Ref #4043, Ref #4103, Ref #4104, Ref #4114) - #4116

Open
zainulhasan wants to merge 1 commit into
lbjlaq:betafrom
zainulhasan:fix/ci-rust-regression-compile-timeout
Open

zainulhasan wants to merge 1 commit into
lbjlaq:betafrom
zainulhasan:fix/ci-rust-regression-compile-timeout

Conversation

@zainulhasan

Copy link
Copy Markdown

变更类型

  • 修复(bug / 回归)
  • 功能
  • 文档 / 规范 / 发版基建(不夹带进功能 PR;同类文档改动合并为一个 PR)
  • 是否为大功能更改、修复、更新

基于的分支与版本号

当前问题、对用户使用体验会产生什么问题或影响

  • 中文:
    1. 在 beta 合入 84b9f2ea 并随后在 06e99876 更新 Cargo.lock 后,CI run 46101969413 的 Check Rust Code (macos-latest) 与 Check Rust Code (windows-2025) 均在 Run critical-path Rust regression tests 步骤触发 5 分钟 超时失败。
    2. 原因是前面的 cargo clippy 与 cargo check 仅生成 .rmeta 元数据,不生成完整 .rlib 代码生成产物和 test profile 二进制;一旦 Swatinem/rust-cache@v2 未命中缓存,Run critical-path Rust regression tests 必须在 timeout-minutes: 5 内从零编译并链接 450+ 个 crate,导致步骤在测试运行前就超时中止,连带跳过 Post Cache Rust dependencies,使后续基于 beta 的 PR 也持续卡在冷编译超时上。
  • English:
    1. Following commit 84b9f2ea and the Cargo.lock version bump in 06e99876, CI run 46101969413 failed on both Check Rust Code (macos-latest) and Check Rust Code (windows-2025) with The action 'Run critical-path Rust regression tests' has timed out after 5 minutes.
    2. cargo clippy --all-targets --all-features and cargo check only emit .rmeta metadata rather than full .rlib codegen or a linked test binary. On a cold Swatinem/rust-cache@v2 cache miss, compiling and linking 450+ crates inside the timeout-minutes: 5 step exceeded 5 minutes before any test executed, which also skipped Post Cache Rust dependencies and left beta's cache unpopulated for downstream PRs.

解決方案

  • 中文:
    1. 将 check-rust 中与前一步 cargo clippy --all-targets --all-features 重复的 Check Rust compilation(cargo check)替换为 Compile critical-path Rust test binary(cargo test --lib --no-run,timeout-minutes: 20)。
    2. 保持 Run critical-path Rust regression tests 与 Run admin & deep-health parity tests (Linux) 的 timeout-minutes: 5 不变,使其严格守卫测试执行耗时(~0.4s–1s)而非冷编译耗时,并恢复 Swatinem/rust-cache@v2 缓存保存。
  • English:
    1. Replace the redundant Check Rust compilation (cargo check) step—already covered by cargo clippy --all-targets --all-features—with Compile critical-path Rust test binary (cargo test --lib --no-run, timeout-minutes: 20).
    2. Keep timeout-minutes: 5 on Run critical-path Rust regression tests and Run admin & deep-health parity tests (Linux) so the 5-minute timeout strictly guards test execution rather than cold crate compilation, allowing Swatinem/rust-cache@v2 to persist build artifacts on beta.

提交清单(组内独立、可单独回退)

提交 作用 可否单独 revert
5eee1564 fix(ci): 将 Rust 测试二进制编译与 5 分钟回归执行超时门禁解耦 / Decouple Rust test compilation from 5-minute regression timeout 可独立 revert

每项提交引起的变化和影响面

  • 仅修改 .github/workflows/ci.yml 的 check-rust 作业。
  • 对应用运行时逻辑、Rust/TS 源码、发版流程及 release.yml 零影响。

自检(与 CI 相同的命令)

  • cd src-tauri && cargo fmt -- --check(未修改 Rust 源码;actionlint .github/workflows/ci.yml 与 yq '.' .github/workflows/ci.yml > /dev/null 均零报错通过)
  • cd src-tauri && cargo clippy --all-targets --all-features(未修改 Rust 源码;已跑 cargo test --lib --no-run 验证最新 beta 测试目标编译)
  • npm run build(未修改前端文件;PR 合入触发 Build Frontend 与全平台 check-rust 验证)
  • 改动涉及的模块已在本地针对性运行单测:在 macOS 本地依次执行 cargo test --lib --no-run(1m 02s)及 CI 同款 13 模块回归套件 cargo test --lib -- --test-threads=1 ...(186 passed; 0 failed in 0.90s)

防回归与并发安全检查

  • 已审计修改函数/共享结构的全部调用方,确认冷启动、空账号池、Free/Pro/Ultra 档位、Headless 及既有默认行为未被破坏(仅 CI 工作流调整,无源码变动)
  • 若涉及 RwLock / Mutex / 全局状态:已确认持锁区间无同锁重入、无调用可能隐式加锁的跨层公开方法、无跨 .await 持同步锁或持锁 I/O(不涉及代码锁改动)
  • 若涉及代理核心链路 / 启动刷新:已确认 /health?deep=1 与 /v1/models 在刷新后可正常响应(不涉及代理代码改动)
  • 若为同一 Issue 的重复修复 PR(≥2 次),或涉及 CI 无法模拟的真机/系统级交互(如 macOS Keychain 分区与 ACL、签名身份、真实客户端切号、系统托盘/自启):已在 macOS 实机验证包含 cd791f70 在内的全部 modules::integration::tests 与 13 模块关键路径测试(186/186 通过,securityd 日志零弹窗)

署名

@zainulhasan

…execution timeout (Ref lbjlaq#4043, Ref lbjlaq#4103, Ref lbjlaq#4104, Ref lbjlaq#4114)

- Replace the redundant cargo check step (already covered by cargo clippy --all-targets --all-features) in Check Rust Code with cargo test --lib --no-run (timeout-minutes: 20).
- Keep timeout-minutes: 5 on Run critical-path Rust regression tests so it strictly bounds test execution (~0.4s-1s) rather than cold compilation and linking of 450+ crates on macos-latest and windows-2025 after Cargo.lock cache invalidation, allowing Swatinem/rust-cache@v2 to persist beta test build artifacts.

This branch has not been deployed

No deployments
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