Skip to content

feat(#27): add bounded Windows Terminal active-tab guard - #28

Merged
rblake2320 merged 4 commits into
masterfrom
feat/27-wt-active-tab-guard
Jul 18, 2026
Merged

feat(#27): add bounded Windows Terminal active-tab guard#28
rblake2320 merged 4 commits into
masterfrom
feat/27-wt-active-tab-guard

Conversation

@rblake2320

@rblake2320 rblake2320 commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Scope

Adds the bounded Windows Terminal active-tab guard tracked by #27.

  • Retains the live UIA TabItem and binds its opaque RuntimeId, selected state, focused TermControl RuntimeId, guarded top-level target, and peer birth_id into the immutable operation and signed peer ACK.
  • Uses SelectionItem.Select, CompareElements, and before/after checkpoints around every native body batch and Enter.
  • Treats pre-call drift as refusal and post-call drift as ambiguous.
  • Packages the implementation, contract tests, live drill, redacted result, and bounded claim documentation.

Evidence

  • python -m pytest -q: 830 passed, 10 skipped.
  • Focused active-tab/guard tests: 168 passed.
  • Ruff: clean.
  • python -m build: sdist and wheel built; wheel contains the module, drill, result, and documentation.
  • Real controlled duplicate-title Windows Terminal drill: PASS for retained identity after reorder, background-window denial, wrong-tab denial, split-pane TermControl mismatch, post-call ambiguity, close denial, and reopen denial.

Boundary

This does not claim exclusive per-tab hardware or message routing. UIA selection and later PostMessage/SendInput calls are not atomic. RuntimeIds are desktop-session opaque and reusable; title and tab index are never identity. Exact preventive routing remains a separate birth-ID-bound named-pipe/control-plane transport.

Issue #27 remains open pending independent review and merge evidence.

Review amendment

Fails closed unless exactly one TextPattern candidate contains the focused UIA element; document-length fallback removed. Native-batch entry remains ambiguous through result validation and the post-call checkpoint; explicit returned zero acceptance remains refused. Caller-asserted birth_id is digest-bound, not live-registry-attested by this module.

Strict zero refusal amendment: only the exact typed CASCADIA postmessage result schema (ok=false, requested=1, accepted=0, target-bound, no missing/extra fields) clears native-entry ambiguity. Seven malformed/inconsistent zero-result vectors remain ambiguous.

Production-integration amendment: _production_send_body now emits the canonical typed delivery-result schema for class/override denial, deadline, PostMessage rejection, and success. A real monkeypatched _send_char_postmessage=False result passes the exact-zero classifier and the guarded-submit integration refuses; malformed zeros remain ambiguous.

@rblake2320
rblake2320 marked this pull request as ready for review July 18, 2026 18:59
@rblake2320
rblake2320 merged commit 54b80e4 into master Jul 18, 2026
1 check passed
@rblake2320
rblake2320 deleted the feat/27-wt-active-tab-guard branch July 18, 2026 18:59
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