让 Windows CI 实际运行 Rust-only 后端单测#374
Merged
H-Chris233 merged 5 commits intoMay 9, 2026
Merged
Conversation
Windows cannot reliably execute the full Tauri lib test harness in CI because the process exits before Rust tests start in the desktop runtime loader path. Split the coordinator session state transitions into a Tauri-free Rust module used by coordinator.rs, and add a small Rust-only backend test crate that path-includes coordinator/hotkey/recorder/insertion logic for real Windows execution. Constraint: User scoped this follow-up to backend-only Rust-to-Rust tests, not app/runtime smoke tests. Constraint: Existing Windows CI still keeps full lib --no-run cfg/link coverage. Rejected: Keep trying to execute cargo test --lib on Windows | it starts the full Tauri-linked test binary and fails before unit tests run. Rejected: Rework release/runtime DLL handling | outside the backend unit-test scope. Confidence: high Scope-risk: moderate Directive: Keep Windows actual unit execution on the Rust-only backend-tests manifest unless the full Tauri lib harness is proven runnable on clean Windows CI. Tested: cargo test --manifest-path openless-all/app/src-tauri/backend-tests/Cargo.toml Tested: cargo test --manifest-path openless-all/app/src-tauri/Cargo.toml --lib Tested: cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml Tested: python yaml parse for .github/workflows/ci.yml; git diff --check Not-tested: Windows runner execution; intended to be verified by GitHub Actions. Related: Open-Less#295 Co-authored-by: OmX <omx@oh-my-codex.dev>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
PR Reviewer Guide 🔍(Review updated until commit c63c69f)Here are some key observations to aid the review process:
|
Windows intentionally normalizes cmd/command shortcut modifiers to ctrl, while macOS and Linux keep the super bit. The Rust-only backend test crate now executes these source tests on Windows, so the assertion must follow the same platform contract as production parsing instead of assuming the non-Windows result.\n\nConstraint: Keep the fix inside Rust backend tests and avoid changing shortcut behavior.\nRejected: Change normalize_modifier_tag to keep cmd as super on Windows | would alter user-facing hotkey semantics.\nConfidence: high\nScope-risk: narrow\nTested: cargo test --manifest-path openless-all/app/src-tauri/backend-tests/Cargo.toml\nTested: cargo test --manifest-path openless-all/app/src-tauri/Cargo.toml --lib\nNot-tested: GitHub Windows runner rerun result pending after push.\n\nCo-authored-by: OmX <omx@oh-my-codex.dev>
|
Persistent review updated to latest commit f339209 |
The backend-tests crate is intentionally an integration-test harness, but declaring the target explicitly makes Cargo discovery and review intent unambiguous. The harness comment also records that path-included modules run their own cfg(test) unit tests for hotkey, recorder, and insertion without linking the full Tauri library.\n\nConstraint: Stay within Rust-only backend tests; do not add a Tauri lib/runtime target.\nRejected: Add src/lib.rs just to satisfy target discovery | would introduce an unused crate surface instead of the actual test harness.\nConfidence: high\nScope-risk: narrow\nTested: cargo test --manifest-path openless-all/app/src-tauri/backend-tests/Cargo.toml -- --list | grep -E '^(hotkey|recorder|insertion)::'\nTested: cargo test --manifest-path openless-all/app/src-tauri/backend-tests/Cargo.toml\nTested: git diff --check\nNot-tested: GitHub Windows runner rerun result pending after push.\n\nCo-authored-by: OmX <omx@oh-my-codex.dev>
|
Persistent review updated to latest commit 02ccac2 |
The Rust-only backend harness already ran existing hotkey, recorder, and insertion unit tests, but the review could not see target edge coverage directly in this diff. Add focused edge tests for modifier trigger filtering/re-emission, recorder callback no-op inputs, and insertion fallback status so the coverage is explicit in the changed files.\n\nConstraint: Keep scope to backend Rust unit tests and avoid app/runtime integration.\nRejected: Add UI or Tauri runtime tests | conflicts with the Rust-only backend boundary.\nConfidence: high\nScope-risk: narrow\nTested: cargo test --manifest-path openless-all/app/src-tauri/backend-tests/Cargo.toml\nTested: cargo test --manifest-path openless-all/app/src-tauri/Cargo.toml --lib\nTested: git diff --check\nNot-tested: GitHub Windows runner result after push.\n\nCo-authored-by: OmX <omx@oh-my-codex.dev>
|
Persistent review updated to latest commit 044799e |
The backend-only test PR needs to cover the concrete recorder paths named in the ticket, not just empty input handling. This adds focused Rust unit coverage for non-target sample-rate resampling, emitted PCM shape, scaled RMS levels, and peak tracking while keeping the production recorder unchanged.\n\nConstraint: Scope is Rust-only backend tests; do not launch or link extra Tauri runtime paths for Windows CI.\nConfidence: high\nScope-risk: narrow\nTested: cargo test --manifest-path openless-all/app/src-tauri/backend-tests/Cargo.toml recorder:: -- --nocapture\nTested: cargo test --manifest-path openless-all/app/src-tauri/backend-tests/Cargo.toml\nTested: cargo test --manifest-path openless-all/app/src-tauri/Cargo.toml --lib\nCo-authored-by: OmX <omx@oh-my-codex.dev>
|
Persistent review updated to latest commit c63c69f |
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.
User description
背景
跟进 #295 的 Windows CI 可执行性问题。上一版尝试让 Windows 直接运行完整
cargo test --lib,但完整 Tauri lib test harness 会在桌面运行时/系统 DLL 路径里于 Rust 单测启动前退出,所以这次按“只做后端单侧、只做 Rust 到 Rust”收敛处理。改动
coordinator_state.rs,由生产coordinator.rs继续调用同一套 helper。src-tauri/backend-tests纯 Rust 测试 crate:按源码路径编入coordinator_state/hotkey/recorder/insertion等后端逻辑,不链接完整 Tauri app lib。cargo test --lib --no-run做 cfg/link 覆盖,并新增实际执行的 Rust-only 后端单测步骤。验证
cargo test --manifest-path openless-all/app/src-tauri/backend-tests/Cargo.toml(33 passed)cargo test --manifest-path openless-all/app/src-tauri/Cargo.toml --lib(169 passed)cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml.github/workflows/ci.ymlYAML parse OKgit diff --checkRefs #295
PR Type
Enhancement, Tests
Description
Extract coordinator session state machine into new
coordinator_state.rsmoduleAdd
backend-testscrate to run Rust-only backend unit tests on Windows CIUpdate CI workflow with dedicated Windows step for backend tests
Expand unit tests for hotkey modifier edges, recorder resampling/RMS, and insertion fallback
Fix shortcut binding test to respect Windows modifier normalization
Diagram Walkthrough
File Walkthrough
4 files
Add backend-only test harness entry pointAdd Windows/Linux modifier edge detection testsAdd empty insertion clipboard fallback test for non-macOSAdd recorder resampling and RMS unit tests2 files
Delegate session state transitions to coordinator_state moduleExtract pure session state machine functions1 files
Register coordinator_state module1 files
Fix shortcut test for Windows modifier normalization2 files
Add Windows CI step for Rust-only backend testsAdd Cargo manifest for backend-test crate