Files
Lahfirandvercel-v[bot] d3c0a797ef fix: close gaps in window lookup, select verification and dismiss results (#668)
* fix: close gaps in window lookup, select verification and dismiss results

- Windows scroll and select report what happened; add tests that pin the Windows guard behavior.
- Window lookup agrees across commands, and macOS polls for the window postcondition.
- macOS dismiss-all returns a partial result instead of failing as a whole.
- Linux select verifies its result and guards stale tokens.
- Remove core forwarder functions and simplify code found redundant.
- check-no-app-names covers the cases it missed; contract notes in the docs are updated.

* fix(windows): find the select item with one explicit search

The search for the named item kept its state in four locals. It swept the
whole list to look for a second item with the same name, then searched
only the last scroll window again, so a row that matched earlier and was
scrolled out of a virtualized list was lost and select failed with
ELEMENT_NOT_FOUND.

The search is now one state machine over an abstract item source, with a
phase that scrolls back to where the item was seen. It has no Windows
dependency, so its tests run the whole sequence.

The container lookup also names whether Realize was sent. An item the
lookup returned already built is used as it is, instead of being looked up
a second time and failing the select when that second call fails.

* fix: make the app-name gate give the same verdict on every machine

Rule 1 seeded its name list from the applications installed on the machine
that ran it, so a tree could pass in CI and fail on a laptop. It now uses
only the committed list. Rule 3 also reports an identity field compared
through a getter or through as_deref or as_str.

* fix(macos): fail dismiss-all when the listing fails before anything was sent

Entries that were already gone counted as dismissed, so a listing failure
after only such entries came back as a verified delivery that stopped
partway. Nothing was sent, so it is now the command's error.

* fix(windows): fail a combo selection the control refused

The answer to CB_SETCURSEL was dropped, so a refused index still reported a
delivered selection. A refusal can clear the selection, so it now fails as
delivered and unverified.

* test(windows): cover the clipboard owner check and successful window plans

The owner decision moves into a pure function so a hung owner can be tested
without one. The window tests gain the resize, move and show plans and the
readback tolerance.

* fix(ffi): fail the app list when applications were skipped

A partial inventory came back as a full list, and the C struct has no field
to say otherwise.

* test: pin the clipboard write step in the inventory goldens

The stub returned a report with no steps, so the goldens could not catch a
dropped clipboard_write step.

* fix: suggest --force, not headed mode, for a blocked key combo

Headed mode does not lift the block, so the suggestion sent callers into a
retry that failed the same way.

* fix(ffi): keep the suggestion and details of an error carried in an io error

The conversion rebuilt the error from its message, so a privacy refusal
reached C callers without its path or its fix.

* docs: mark the commands that need --headed

clipboard-set, clipboard-clear, focus-window and an unscoped press are
refused in the default headless mode, and the examples now run as written.

* test: pin the --force suggestion for a blocked key combo

Nothing failed when the suggestion went back to the headed hint, which
sends callers into a retry that is refused the same way.

* test(macos): drop a dismiss test that passes without the dismissal

It asserted only is_ok, which dismiss_turn also returns when no entry
matches; the failing-attempt test already proves a held entry is attempted.

* fix(windows): report a realize only when one was sent

Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>

---------

Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
2026-11-27 16:51:23 -08:00
..