Repository navigation
Scripts: a test copy of your own, and turns on the screen and the Neural Engine - #130
Merged
Merged
Conversation
… together Two overlay demos at once captured each other's pill, and a benchmark beside another agent's measured its load. The screen lock was a recipe typed by hand from CLAUDE.md, and benchmarks had none. lock.sh runs a command holding `screen` or `ane`, waits for the holder, gives the lock back however the command ends, and takes over a lock whose holder is gone, by PID and start time, never one taken by hand. overlay-demo.sh and make-screenshots.sh take `screen` themselves after their build; CLAUDE.md's Verify and docs/BENCHMARKS.md run benchmarks and polish timings under `ane`. scripts.yml checks the lock's semantics on Ubuntu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r reacts to A test copy was typed by hand from CLAUDE.md each time, and the chord it named only avoided the default Option+Space, while the copy in use holds fn and toggles on Option+Space. test-copy.sh reads the live settings file without writing it, picks the first of ⌃⌥⌘T and its neighbours whose key no live chord uses and that holds no live modifier-only chord, bundles dist/Pladder.app, writes /tmp/<branch>/settings.json before the launch so Settings never opens and takes the paste, and prints the PID. --stop sends SIGTERM only to the process whose command line is this worktree's binary. scripts.yml checks the chord against fixture homes. Closes #125. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #125
Why
CLAUDE.md said how to launch a test copy, but agents had to type it by hand each time:
PLADDER_SETTINGS_PATH, a chord of their own, the bare binary, and apkill -fby path to stop it. "A different chord" was also not enough. The copy in use on this Mac holds fn alone, toggles on Option+Space and sends on Left Control. And a chord that Carbon cannot register falls back to Option+Space, which is the live toggle.Worktrees also share the screen and the Neural Engine and GPU. Two overlay demos at once record each other's pill, and a benchmark run next to another agent's measures that agent's load. Until now the only guard was a hand-written
mkdirrule for the screen.Change
scripts/lock.sh [--wait <s>] <screen|ane> -- <command>, new. It keeps the samemkdirlocks the hand-written rule used,/tmp/pladder-<resource>.lock:--status: printsane: held by <worktree> (<branch>), pid N, since …: <command>.lock.shrunning inside the same lock just runs its command.PLADDER_LOCK_DIRpoints the script at a scratch directory, so tests never touch the real locks.scripts/test-copy.sh [--stop | --dry-run], new.Start: bundles
dist/Pladder.appand writes a fresh/tmp/<branch>/settings.json. Without a settings file the app would open Settings and take focus from the paste in progress. Then it launches the bare binary and prints its PID.The chord: it reads the hold, toggle and send chords from the live settings file, with
jqand read only, and adds the defaults. It then takes the first chord from ⌃⌥⌘T, ⌃⌥⇧T, ⌃⇧⌘T, ⌥⇧⌘T and ⌃⇧T, then the same five with G, that passes two rules:The chord has one regular key and no fn, so Carbon can register it, and the test copy never falls back to Option+Space. An unreadable live file launches nothing.
--stop: sends SIGTERM only to the process whose command line is exactly this worktree'sdistbinary.Other worktrees: a running test copy from another worktree gets a warning, not a refusal.
scripts/overlay-demo.shandscripts/make-screenshots.sh: once their build is done, they run themselves again under thescreenlock, so the lock covers only the recording.make-screenshots.shrepeatsbundle.sh --dev-modesinside the lock, because atest-copy.shthat ran during the wait would have put a plain bundle in the samedist..github/workflows/scripts.yml: two steps in the requiredscriptsjob.--status, the order of two runs,--wait 0;--helppassed through to the command.## Commands: a line each for the two scripts.test-copy.shand its--stop.## Verify: the bundle row runstest-copy.sh. Benchmarks and polish timings run underscripts/lock.sh ane --. "One at a time" is rewritten around the script, with a three-line example. The rule now reads "never remove a lock while its holder is alive".## Shipis untouched.anelock. The lock keeps benchmarks apart, not builds, so the load average still decides.These questions were settled with the planner's recommendation:
scripts.yml, not a newcheck-*.sh.No path the build reads changed (
Sources,Package.*,Assets,scripts/bundle.sh, the entitlements).Verified
On this Mac, beside the copy in use (
/Applications/Pladder.app, pid 1430):The two copies never share a chord:
scripts/test-copy.sh --dry-runagainst the live file picked ⌃⌥⌘T,{"hotkey":{"keyCodes":[17,55,58,59]},"toggleHotkey":{"keyCodes":[]}}. The live copy holds fn alone, toggles on Option+Space and sends on Left Control.--stopleaves/Applicationsrunning: a realscripts/test-copy.shprinted pid 10919. The copy ran withPLADDER_SETTINGS_PATH=/tmp/t3/125-test-copy-locks/settings.json.--stopprinted "stopped test copy 10919", and pid 1430 was still running before and after.Two overlay demos started at once ran one after the other: the second printed
lock.sh: waiting for screen: held by … pid 12011 … overlay-demo.sh /tmp/…/demo-a. Thedemo.logranges are …452 to …482 and …502 to …532, so they do not overlap. Eachsheet-plain.pngshows one pill.--status anenames the holder, and a failed command frees the lock: duringscripts/lock.sh ane -- sleep 4it printedane: held by …/t3-125-test-copy-locks-… (t3/125-test-copy-locks), pid 14868, since 21:29:22 (0 min): sleep 4.scripts/lock.sh ane -- falseexited 1, and the lock was free afterwards.A fresh agent ran
## Verifyunaided: given only## Verifyand the section it refers to, a new agent produced the overlay contact sheets and abench-coordinatortable under theanelock, without help:--statusnamed it as the holder of each lock in turn. Its notes on the section were minor: a branch with a slash makes a nested/tmpdirectory, and the demo always writes six sheets.The new CI steps: both pass under macOS
/bin/bash3.2 and on Ubuntu 26.04 (code-box, the runner's coreutils).The other checks:
shellcheck scripts/*.shis clean;--help,-handx --help;check-doc-pointers.sh,check-doc-commands.shandcheck-site-numbers.shpass.Not checked:
Follow-ups, not in this PR:
lock.shholds TERM until its command ends.mkdirand the ownership mark.test-copy.shrefuses the v1 hotkey format.Benchmark
Only scripts, CI and docs changed, so no benchmark.
Review loop
Fixed:
--helppassthrough check failed on Ubuntu, under both GNU and uutils coreutils;make-screenshots.shcould launch a plain bundle thattest-copy.shbuilt while it waited;TAKINGwas cleared after thermdir, not before.Declined, listed under Follow-ups:
🤖 Generated with Claude Code