Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 49 additions & 106 deletions .agents/skills/verify-ferry/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,148 +5,91 @@ description: Build and verify ferry's macOS CLI, window movement and Space follo

# Verify ferry

Read [the feature map](features/README.md), then the feature being exercised.
The primary surface is a one-shot CLI that moves macOS windows; Raycast scripts
are a second entry point. There is no daemon, port, auth, database, or seed data.
Never substitute an installed Homebrew binary for the checkout's binary.
Choose a journey from the [feature map](features/README.md). Build the checkout's
executable for each run. Use only disposable fixture windows for desktop checks.

## Launch
## Build and check readiness

Run from the repository root in a persistent shell:
Run from the repository root in one shell.

```sh
FERRY_VERIFY="$PWD/.agents/skills/verify-ferry/scripts/verify.sh"
FERRY_EVIDENCE="$("$FERRY_VERIFY" launch)"
export FERRY_VERIFY FERRY_EVIDENCE
FERRY_BIN="$FERRY_EVIDENCE/scratch/ferry"
export FERRY_BIN
export FERRY_VERIFY FERRY_EVIDENCE FERRY_BIN
printf 'Evidence: %s\n' "$FERRY_EVIDENCE"
"$FERRY_VERIFY" doctor "$FERRY_EVIDENCE"
```

Launch builds with the existing Makefile into a fresh scratch directory. It needs
Apple silicon, Xcode Command Line Tools or Xcode, and a macOS 26+ SDK. The default
build is arm64, minimum macOS 26.0, version from `Makefile`. Readiness is a matching
source/binary fingerprint, correct `--version`, and passing architecture, minimum
OS, and AppKit linkage checks. A CLI invocation runs once and exits; launch does
not start a service. A failed build retains its logs and removes its scratch.
Launch uses the Makefile, Apple silicon, and the Xcode Command Line Tools or
Xcode with a macOS 26+ SDK. A failed build prints the evidence path and removes
its scratch directory. The supported runtime is macOS 26. Report the actual OS
version for compatibility runs.

The supported runtime is macOS 26. CLI-only checks can run without Accessibility
or a desktop. Results on a newer OS are compatibility observations, not proof on
the supported OS.
Doctor checks the source and binary fingerprints, version, architecture,
deployment target, and AppKit linkage. It runs without Accessibility or a
desktop. Launch again after changing the build inputs, tests, Raycast scripts,
or verification helper.

No app data isolation is needed for CLI checks, but **the desktop is shared**.
Never run two movement journeys together or move an existing user window.
The `desktop` helper reserves a per-user lock, uses the existing harness's own
two windows, and restores the prior app. It cannot isolate Mission Control from
the user, yabai, hotkeys, or other tools. Do not drive while they are moving
windows. If a lock already exists, stop; do not remove someone else's lock.
For manual journeys, reserve the same lock and release only the lock you created.
## Run a journey

## Doctor

```sh
"$FERRY_VERIFY" doctor "$FERRY_EVIDENCE"
```

This is read-only with respect to the app and desktop: it validates this run's
build and source without moving windows or requesting permissions. Run it first
when anything looks off. A source edit invalidates the run; launch a new one.
It does not assert desktop readiness. The live harness checks Accessibility
without prompting and requires two normal Spaces on the active display. A skip
returns `77` from `build/follow-test`; `make test-follow` typically returns `2`
instead, so read `desktop/stderr.txt` for `SKIP:` rather than treating it as pass.
Do not silently grant permissions, create Spaces, or alter Mission Control settings.

## Drive

CLI discovery and argument validation, in a separate real PTY:
For headless CLI verification, capture a terminal transcript.

```sh
/usr/bin/script -q "$FERRY_EVIDENCE/cli.pty.txt" \
"$FERRY_VERIFY" cli "$FERRY_EVIDENCE"
```

Require exit `0` and the `PASS:` line. The helper executes real `--help`, `-h`,
`--version`, and invalid input, verifies stream routing, and reuses `tests/cli.sh`.
All these paths return before WindowServer calls; inspect `main` in `src/ferry.m`
when changing the argument cases. There is **no dry-run flag**: a valid destination
can really move a window. Do not treat `--no-follow` as a dry run.
Require exit 0 and the final `PASS:` line. The helper preserves example
invocations and runs [the CLI contract](../../../tests/cli.sh) for help,
version, argument diagnostics, and stream routing. All cases exit during
argument parsing. A valid destination, including one passed with
`--no-follow`, can move a window.

Background explicit-window movement, already-there behavior, and no-follow:
For the live explicit-window regression, run the following command when the
desktop is available and idle.

```sh
"$FERRY_VERIFY" desktop "$FERRY_EVIDENCE"
```

This executes `make BIN="$FERRY_BIN" test-follow`, reusing `tests/follow.m`.
Require all three `ok:` messages, no `FAIL:` or `SKIP:`, and exit `0`. The test
checks actual WindowServer membership and active Space, including that the other
fixture window stays put. It does not cover focused-window selection or Raycast.
Those journeys require native desktop UI control and the matching feature recipe.
Missing UI control, permission, or suitable Spaces is an unmet precondition;
report it instead of weakening the journey.
The helper locks the shared desktop and runs `make test-follow` with the verified
binary. The harness creates two windows, checks the selected window's location
and the active Space, then closes its fixture and restores the prior app. Allow
it to finish. A passing run exits 0 and reports the background-follow,
already-there, and no-follow assertions. If it fails, inspect
`desktop/stderr.txt`. The harness returns 77 for missing Accessibility or two
normal Spaces on the active display. Make can surface this as exit 2. Report the
skip and keep the user's Spaces and permissions intact.

For a further command, preserve its action and streams with a fresh label:
The [feature map](features/README.md) describes lock ownership, fixture setup,
visual evidence, and restoration for manual focused-window and Raycast journeys.
Use the real launcher when verifying a Raycast action or hotkey. Record the
observed active Space and window membership for movement claims.

```sh
"$FERRY_VERIFY" capture "$FERRY_EVIDENCE" binary-contract \
tests/binary.sh "$FERRY_BIN" arm64 26.0
```

Each label is single-use. This prevents a retry from overwriting failed evidence.

## Evidence
## Retain evidence

`launch` prints the absolute artifact directory, normally under `$TMPDIR` as
`ferry-verification.XXXXXX`. It contains platform, revision, source diff/hashes,
binary hash, and per-action `command.txt`, `stdout.txt`, `stderr.txt`, and
`exit-code.txt`. The PTY transcript records the CLI session. Preserve the directory
and report its absolute path. The binary itself is scratch, not retained evidence.
For additional commands, use a fresh label each time.

Exercise the real CLI or launcher, never replace ferry with a mock or use private
setters to manufacture the result. Capture the action and resulting state.
For movement, a successful exit or `focus requested` is insufficient: observe
the window's destination **and** the active Space independently. The existing
live harness supplies those assertions for its three covered paths. A visual
journey also needs before/after screenshots of the fixture and a short recording
of movement/follow timing using available native UI capture; save them in this
artifact directory. Record the selected window ID and source/destination indexes.
Do not infer animation latency from ferry's verbose internal timing.

For manual CLI launches there should be no app data files, background service,
network activity, or git-ref changes; compare the relevant filesystem/process
state if the change could introduce them. No journey here mocks an external
boundary. Shell-running a Raycast script proves the script path only; the real
Raycast action/hotkey must be exercised separately for launcher claims.
```sh
"$FERRY_VERIFY" capture "$FERRY_EVIDENCE" version-check "$FERRY_BIN" --version
```

## Cleanup
Each label records the command, stdout, stderr, and exit status. The run directory
also contains the OS version, Git revision, tracked input changes against HEAD,
and input and binary hashes. Report its absolute path. Keep any screenshots or
recordings there. Copy it to durable storage if needed before OS temp cleanup.

Run after successful **and failed** iterations:
After a successful launch, clean up even when a journey fails.

```sh
"$FERRY_VERIFY" cleanup "$FERRY_EVIDENCE"
test ! -e "$FERRY_EVIDENCE/scratch"
test -s "$FERRY_EVIDENCE/build/command.txt"
test -s "$FERRY_EVIDENCE/source.sha256"
test -s "$FERRY_EVIDENCE/cleanup.txt"
```

The live harness normally closes its own windows and restores the previous app
in `@finally`. Let it finish; do not force-kill it mid-switch. After an abnormal
termination, inspect the exact fixture PID/window IDs from that run and close
only those windows/processes; restore the recorded source Space. Never kill by
process name. `cleanup` removes only the run's scratch, not evidence or the shared
`build/` directory. `make test-follow` may leave its reusable `build/follow-test`.
Manual recipes must stop their recorded fixture PID and release their own lock
before scratch removal. Verify the evidence files for the chosen feature still
exist after cleanup; copy artifacts to durable storage if needed before OS temp
cleanup. Do not commit desktop captures or local evidence by default.

## Helpers

[scripts/verify.sh](scripts/verify.sh) is executable and provides `launch`,
`doctor`, `cli`, `desktop`, `capture`, and `cleanup` as invoked above. It requires
the system Bash and existing Makefile/test tools, no package installation.
Feature-specific manual setup is documented in the map, not hidden in the helper.
Keep the map current with `/maintain-verification-skill` as ferry changes.
Cleanup removes the run-owned scratch binary and retains evidence and the
checkout's reusable `build/follow-test`. Manual journeys must first terminate
their recorded fixture PID, restore the original app and Space, and release
their lock. After an interrupted desktop run, inspect the fixture from that
run before attempting restoration.
25 changes: 15 additions & 10 deletions .agents/skills/verify-ferry/features/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,26 @@ before choosing a journey. One passing journey is not full application coverage.
## Driving conventions

Use the executable helper for command/stream/exit evidence and native UI tools
for visible app focus and launcher actions. Manual desktop recipes share this
setup after `doctor`; the first command reserves the lock:
for visible app focus and launcher actions. After `doctor`, record the original
frontmost app and Space. Build the fixture and reserve the same desktop lock as
the automated journey.

```sh
make build/follow-test && mkdir "${TMPDIR:-/tmp}/ferry-verification-desktop.lock"
```

Continue only after this command succeeds. If the lock exists, leave it in
place for its owner. Start the disposable fixture in the same shell.

```sh
mkdir "${TMPDIR:-/tmp}/ferry-verification-desktop.lock"
make build/follow-test
build/follow-test --fixture > "$FERRY_EVIDENCE/fixture-ids.txt" \
2> "$FERRY_EVIDENCE/fixture-stderr.txt" &
FERRY_FIXTURE_PID=$!
printf '%s\n' "$FERRY_FIXTURE_PID" > "$FERRY_EVIDENCE/fixture-pid.txt"
```

Wait for `fixture-ids.txt` to contain two nonzero decimal window IDs and for both
windows to appear on source Space 1. Record the original frontmost app and Space
with native UI control before starting. The titles are `Ferry follow test: target`
windows to appear on source Space 1. The titles are `Ferry follow test: target`
and `Ferry follow test: other window`. Read IDs only after readiness:

```sh
Expand All @@ -49,12 +54,12 @@ location and active Space. After each manual journey, close only this fixture:
```sh
kill -TERM "$FERRY_FIXTURE_PID"
wait "$FERRY_FIXTURE_PID" || true
rmdir "${TMPDIR:-/tmp}/ferry-verification-desktop.lock"
```

Restore the original app and Space with native UI control, then run the skill's
cleanup. If fixture startup fails, still stop the PID you started and release
your lock. Do not launch a second fixture to hide a broken first attempt.
Restore the original app and Space with native UI control, then release your
lock with `rmdir "${TMPDIR:-/tmp}/ferry-verification-desktop.lock"` and run the
skill's cleanup. If fixture startup fails, still clean up the fixture and lock
from this run.

## Proof and skip reporting

Expand Down
11 changes: 5 additions & 6 deletions .agents/skills/verify-ferry/features/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ argument errors with a distinct exit status.

- `cli-help`: `--help` and `-h` print identical usage to stdout, exit 0.
- `cli-version`: `--version` prints `ferry` and the Makefile version, exit 0.
- `cli-invalid`: absent, nonnumeric, zero, overflowing, duplicate, and unknown
arguments are rejected with exit 2; invalid/missing window IDs are rejected.
- `cli-invalid`: missing, nonnumeric, zero, or overflowing Space indexes, a
second index, unknown options, and invalid or missing window IDs exit with 2.
- `cli-streams`: success text goes to stdout; argument errors go to stderr.

## How to get to it (user POV)
Expand All @@ -24,15 +24,14 @@ Preconditions: launch and doctor passed; no live desktop or Accessibility needed
"$FERRY_EVIDENCE/cli.pty.txt" "$FERRY_VERIFY" cli "$FERRY_EVIDENCE"`.
Require exit 0 and the final `PASS:` line.
- **Inspect proof.** `help`, `help-short`, `version`, and `invalid-index` action
folders contain separate streams and statuses. `contract/stdout.txt` contains
ten `ok:` messages from the existing CLI tests; the helper additionally checks
identical help aliases and stream routing.
folders contain example streams and statuses. `contract/stdout.txt` records
the passing cases from `tests/cli.sh`, which checks help alias equivalence,
the version, stream routing, and argument diagnostics.
- **Confirm teardown.** Run the skill cleanup. The PTY transcript and all action
folders remain while `scratch/ferry` is removed.

## Gotchas

- Valid destination arguments would enter real window-management code. The safe
cases above exit during parsing, before WindowServer access; this is not a mock.
- `tests/cli.sh` merges streams internally, so its pass alone cannot prove routing.
- A `make test` pass does not prove a move or a Space focus change.
3 changes: 2 additions & 1 deletion .agents/skills/verify-ferry/features/explicit-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Spaces on its active display, and no other desktop journey running.
- **Inspect action evidence.** `desktop/command.txt` identifies the checkout binary
passed to `make`; `desktop/stdout.txt` includes real IDs, indexes, verbose
results, and assertions. Require overall exit 0 and no `SKIP:`/`FAIL:`.
- **Stale ID.** In a separate manual fixture journey from the index, retain
- **Stale ID.** Use a disposable desktop session containing only test windows,
since macOS can reuse a closed window's ID. In a separate manual fixture journey, retain
`FERRY_TARGET`, close that fixture through its recorded PID, and immediately run
`"$FERRY_VERIFY" capture "$FERRY_EVIDENCE" stale-window "$FERRY_BIN" --window
"$FERRY_TARGET" 2`. Require exit 1 and `window N not found` in stderr, with no
Expand Down
4 changes: 3 additions & 1 deletion .agents/skills/verify-ferry/features/raycast.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Preconditions: native desktop control, manual fixture baseline from the index,
Raycast installed and already configured for these scripts for action/hotkey
coverage. Do not modify the user's extension directory or hotkeys implicitly.

`make test` exercises script dispatch on a headless machine. The live journeys
below exercise the real executable and observe window and Space changes.

- **Shell script route.** Focus `Ferry follow test: target` and run `"$FERRY_VERIFY"
capture "$FERRY_EVIDENCE" raycast-shell env FERRY_BINARY="$FERRY_BIN"
/bin/zsh raycast/ferry-to-space-2.sh`. Require exit 0, empty streams, target on
Expand Down Expand Up @@ -52,4 +55,3 @@ coverage. Do not modify the user's extension directory or hotkeys implicitly.
- Scripts prefer `FERRY_BINARY`, then PATH and standard install directories,
then the checkout's `build/`. The isolated scratch binary needs the override.
- Homebrew installs the binary but does not install these scripts.
- Testing a wrapper with a fake binary proves neither movement nor real lookup.
Loading
Loading