Skip to content

chore(windows): make unsafe operations explicit - #1573

Merged
wsp1911 merged 2 commits into
GCWing:mainfrom
wsp1911:dev
Jul 16, 2026
Merged

chore(windows): make unsafe operations explicit#1573
wsp1911 merged 2 commits into
GCWing:mainfrom
wsp1911:dev

Conversation

@wsp1911

@wsp1911 wsp1911 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add explicit unsafe blocks around Windows UIA, MSAA, input, capture, D3D11, and WebView2 FFI operations.
  • Document the safety invariants for native handles, COM interfaces, callbacks, buffers, and raw pointers.
  • Use read_unaligned when reading TOKEN_MANDATORY_LABEL from a byte buffer.

Type and Areas

Type:

Other (Rust compile hygiene)

Areas:

Desktop/Tauri, WebDriver adapter

Motivation / Impact

Eliminate unsafe_op_in_unsafe_fn warnings 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_LABEL reference with read_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

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

wsp1911 added 2 commits July 16, 2026 15:10
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.
@wsp1911
wsp1911 merged commit 30a8fa1 into GCWing:main Jul 16, 2026
5 checks passed
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