One copy of the tray injector and of fzt-files' command list #130

Merged
merge-queue merged 2 commits from fp17-one-copy into main 2026-11-28 01:19:19 -08:00
Owner

One copy of the tray injector per sign-in, and one copy of fzt-files' command list, through one-copy v0.1.0. Work package: https://openproject.home.romaine.life/wp/FP-17

Which runs take the lock

  • Injector (fzt-picker.exe): every run, lock fzt-picker. It is the first thing in run(), before Handoff::create/publish and before the hook goes in, so a refused copy of a newer release can't republish its hook path and leave the shims on a release whose injector isn't running. A second copy logs injector already running, so this one exits to fzt-picker.log and exits 0, with no tray icon and no hook. A lock that can't be checked is logged as a warning and the injector runs anyway. The lock is held for the process's life (the binding lives through the message loop).
  • fzt-files: only the command list, fzt-files with no command (with or without --start-dir), lock fzt-files. It is claimed after the arguments are read and before the log line, the window title and the terminal open, so a refused copy prints fzt-files is already open and exits 1 with the terminal untouched.
  • Outside the lock: fzt-files rename|move|copy|delete <path> and new-folder [<in>] (how another app gives one key to a command), help, and a bad --start-dir (still exit 1 with its own message).

Both claims wait 5 s for a copy still ending (home-sync's restart, a respawn-pane -k update of a manage files window).

What it adds

  • one-copy v0.1.0 in go.mod and the injector's Cargo.toml (and Cargo.lock).
  • tools/hidden-desktop/hook_test.py and swap_test.py start their injectors under an ONE_COPY_SCOPE of their own, so his running injector's lock doesn't refuse them; swap_test.py overlap gives the old and new injector different scopes so they still overlap, as its scenario needs.
  • CLAUDE.md (injector, fzt-files, changelog) and TESTING.md (ONE_COPY_SCOPE=qa in the fzt-files real terminal check, a one-copy check, the hook test's scope).

What it leaves alone

The hook, shim, frontend DLL, standalone frontend and test-trigger are unchanged. Who starts the injector at sign-in (the Startup shortcut and home-sync's sign-in step) is home-sync's, not changed here; home-sync's kill-and-wait restart is romaine-life/at-home-tools PR 549.

Proof (nelsonpc)

A scratch program held the locks with ONE_COPY_SCOPE=fp17test:

  • fzt-files (no arguments, same scope): fzt-files is already open, exit 1 after 5 s; on a throwaway tmux server the pane showed that line and died with status 1.
  • fzt-files rename <test file> while the lock was held: opened on rename a.txt to, Escape exited 130. fzt-files help exited 0.
  • Holder released: fzt-files opened the command list.
  • Injector (the release build, copied alone into a scratch folder with no shim or hook beside it, FZT_PICKER_LOG in scratch): with the lock held, exit 0 after 8 s and its log's one line info injector already running, so this one exits, no injector hooked. Holder released: it passed the claim and stopped at fzt_picker_shim.dll not found, so no hook went in.

ci-check: all 6 check jobs passed. hook_test.py and swap_test.py were not run: each installs a test injector's global hook, which takes an entry in this PC's hook DLL table (RLFP-1).

One copy of the tray injector per sign-in, and one copy of fzt-files' command list, through one-copy v0.1.0. Work package: https://openproject.home.romaine.life/wp/FP-17 ## Which runs take the lock - **Injector (`fzt-picker.exe`)**: every run, lock `fzt-picker`. It is the first thing in `run()`, before `Handoff::create`/`publish` and before the hook goes in, so a refused copy of a newer release can't republish its hook path and leave the shims on a release whose injector isn't running. A second copy logs `injector already running, so this one exits` to `fzt-picker.log` and exits 0, with no tray icon and no hook. A lock that can't be checked is logged as a warning and the injector runs anyway. The lock is held for the process's life (the binding lives through the message loop). - **fzt-files**: only the command list, `fzt-files` with no command (with or without `--start-dir`), lock `fzt-files`. It is claimed after the arguments are read and before the log line, the window title and the terminal open, so a refused copy prints `fzt-files is already open` and exits 1 with the terminal untouched. - **Outside the lock**: `fzt-files rename|move|copy|delete <path>` and `new-folder [<in>]` (how another app gives one key to a command), `help`, and a bad `--start-dir` (still exit 1 with its own message). Both claims wait 5 s for a copy still ending (home-sync's restart, a `respawn-pane -k` update of a manage files window). ## What it adds - `one-copy` v0.1.0 in `go.mod` and the injector's `Cargo.toml` (and `Cargo.lock`). - `tools/hidden-desktop/hook_test.py` and `swap_test.py` start their injectors under an `ONE_COPY_SCOPE` of their own, so his running injector's lock doesn't refuse them; `swap_test.py overlap` gives the old and new injector different scopes so they still overlap, as its scenario needs. - CLAUDE.md (injector, fzt-files, changelog) and TESTING.md (`ONE_COPY_SCOPE=qa` in the fzt-files real terminal check, a one-copy check, the hook test's scope). ## What it leaves alone The hook, shim, frontend DLL, standalone frontend and test-trigger are unchanged. Who starts the injector at sign-in (the Startup shortcut and home-sync's sign-in step) is home-sync's, not changed here; home-sync's kill-and-wait restart is romaine-life/at-home-tools PR 549. ## Proof (nelsonpc) A scratch program held the locks with `ONE_COPY_SCOPE=fp17test`: - `fzt-files` (no arguments, same scope): `fzt-files is already open`, exit 1 after 5 s; on a throwaway tmux server the pane showed that line and died with status 1. - `fzt-files rename <test file>` while the lock was held: opened on `rename a.txt to`, Escape exited 130. `fzt-files help` exited 0. - Holder released: `fzt-files` opened the command list. - Injector (the release build, copied alone into a scratch folder with no shim or hook beside it, `FZT_PICKER_LOG` in scratch): with the lock held, exit 0 after 8 s and its log's one line `info injector already running, so this one exits`, no `injector hooked`. Holder released: it passed the claim and stopped at `fzt_picker_shim.dll not found`, so no hook went in. `ci-check`: all 6 check jobs passed. `hook_test.py` and `swap_test.py` were not run: each installs a test injector's global hook, which takes an entry in this PC's hook DLL table (RLFP-1).
swap_test: two blank lines before start_injector
All checks were successful
Suite go / check-test-windows (pull_request) Successful in 1m26s
Suite release / home-sync (pull_request) Has been skipped
Suite rust / check-audit (pull_request) Has been skipped
Suite default / reused-checks (pull_request) Successful in 34s
Suite rust / check-typos (pull_request) Has been skipped
Suite release / module (pull_request) Has been skipped
Suite rust / check-format (pull_request) Successful in 36s
Suite release / check-build (go, ubuntu-latest) (, go, false, ubuntu-latest, , go) (pull_request) Successful in 1m2s
Suite release / build (go, ubuntu-latest) (, go, false, ubuntu-latest, , go) (pull_request) Has been skipped
Suite rust / check-services (pull_request) Has been skipped
Suite release / build (rust, x86_64-pc-windows-msvc) (, rust-x86_64-pc-windows-msvc, x86_64-pc-windows-msvc, false, windows-latest, x86_64-pc-windows-msvc, rust) (pull_request) Has been skipped
Suite release / scope (pull_request) Successful in 48s
Suite release / reserve (pull_request) Has been skipped
Suite release / finalize (pull_request) Has been skipped
Suite release / deploy-image (pull_request) Has been skipped
Suite rust / check-machete (pull_request) Has been skipped
Suite release / publish (pull_request) Has been skipped
Suite release / dispatch (pull_request) Has been skipped
Suite release / build (go, windows-amd64-c-shared) (, go-windows-amd64-c-shared, false, windows-latest, windows-amd64-c-shared, go) (pull_request) Has been skipped
Suite default / check-fetches (pull_request) Successful in 35s
Suite default / check-rules (pull_request) Successful in 37s
Suite go / check-format (pull_request) Successful in 43s
Suite rust / check-test-windows (pull_request) Successful in 1m31s
Suite release / check-build (rust, x86_64-pc-windows-msvc) (, rust-x86_64-pc-windows-msvc, x86_64-pc-windows-msvc, false, windows-latest, x86_64-pc-windows-msvc, rust) (pull_request) Successful in 1m15s
Suite go / reused-checks (pull_request) Successful in 34s
Suite rust / reused-checks (pull_request) Successful in 43s
Suite release / check-build (go, windows-amd64-c-shared) (, go-windows-amd64-c-shared, false, windows-latest, windows-amd64-c-shared, go) (pull_request) Successful in 1m40s
Suite release / check-package (pull_request) Successful in 41s
Suite release / reused-checks (pull_request) Successful in 22s
merge-queue landed on main
ddca199915
merge-queue deleted branch fp17-one-copy 2026-11-28 01:19:20 -08:00
Sign in to join this conversation.
No description provided.