Skip to content

Fix focused Wire cancellation - #945

Merged
coneilen merged 1 commit into
mainfrom
coneilen-collect-post-fix-parity-evidence
Oct 28, 2026
Merged

coneilen merged 1 commit into
mainfrom
coneilen-collect-post-fix-parity-evidence

Conversation

@coneilen

Copy link
Copy Markdown
Collaborator

Summary

Fix the canonical focused-capture Wire flow so Escape cancellation uses the repository's existing native key-down/key-up path instead of calling a method omitted from the focused helper.

Changes

  • Add the live UIA gate's PostKeyboard and foreground-query fragments to the shared focused capture helper.
  • Bound the exact armed-Wire status wait and refuse Escape injection when the owned shell is not foreground or an owned native dialog is present.
  • Add behavioral positive coverage for cancellation and scene continuation, plus timeout, wrong-focus, dialog-present, and rejected-send negatives.

Test plan

RED: pwsh -NoProfile -Command "Import b881b2b UiCaptureDriver.psm1; invoke base Send-CapMatchedEscape" -> GraphCodeUiaGateState does not contain a method named PostKeyboard
GREEN: pwsh -NoProfile -File Tools\windows\Tests\UiCaptureDriver.Tests.ps1 -MatchedScenarioContractOnly -ScratchRoot C:\m7 -> 8/8 passed
REGRESSION: pwsh -NoProfile -File Tools\windows\Tests\ValidationRunner.Tests.ps1 -> UiCaptureDriver 182/182 passed; ValidationRunner.Tests.ps1 PASS

Additional validation:

  • pwsh -NoProfile -File Tools\windows\Tests\UiCaptureDriver.Tests.ps1 -RequireRealSeed ... -ScratchRoot C:\v7 -> 185/185 passed, 0 failed, 0 skipped.
  • pwsh -NoProfile -File Tools\windows\Tests\Hardening.Tests.ps1 -> deterministic fixtures passed, repeated runs 3/3.
  • PowerShell parser, git diff --check, and git ls-files --eol -> passed; touched files are LF.

Checklist

  • I have read the Contributing Guidelines
  • I have signed off my commits (git commit -s) per the DCO
  • Tests pass locally (make test)
  • Code follows the existing style (make check)
  • I added the test/contract before the implementation and observed the intended RED failure

Add the canonical keyboard helper to focused capture, bound the armed-wire wait, refuse wrong focus or modal dialogs, and cover positive and negative cancellation behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
@coneilen
coneilen merged commit 085fb28 into main Oct 28, 2026
25 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