chore(windows): make unsafe operations explicit - #1573
Merged
Conversation
Add explicit unsafe blocks and safety rationales around Windows UIA, MSAA, input, capture, and WebView2 FFI calls. Use an unaligned read for TOKEN_MANDATORY_LABEL buffers while preserving existing behavior.
Update the ReviewPlatform manifest assertion to use deferred_tool_names after the deferred execution terminology migration. This fixes the bitfun-core test compilation failure caused by the removed collapsed_tool_names field.
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
unsafeblocks around Windows UIA, MSAA, input, capture, D3D11, and WebView2 FFI operations.read_unalignedwhen readingTOKEN_MANDATORY_LABELfrom a byte buffer.Type and Areas
Type:
Other (Rust compile hygiene)
Areas:
Desktop/Tauri, WebDriver adapter
Motivation / Impact
Eliminate
unsafe_op_in_unsafe_fnwarnings from Windows-specific Rust code and make each native safety boundary explicit and auditable.No direct user-facing change.
Verification
cargo check -p bitfun-desktop- passed with no warnings.cargo check --workspace- passed with no warnings.cargo test -p bitfun-desktop --lib computer_use::windows_- passed, 3 tests.git diff --cached --name-only -- '*.rs' | ForEach-Object { rustfmt --edition 2021 --check $_ }- passed.git diff --cached --check- passed.cargo fmt --all -- --check- passed.Reviewer Notes
The native API call order, error handling, and resource cleanup order are unchanged. The only meaningful low-level adjustment is replacing a potentially unaligned
TOKEN_MANDATORY_LABELreference withread_unaligned.The focused tests cover Windows input FFI layout and adjacent pure logic. UIA, MSAA, WGC, and native input injection were not manually exercised.
Checklist