Skip to content

fix(cli): the patchy CLI survives a Node version change - #944

Merged
allisonmahmood merged 3 commits into
mainfrom
fix/cli-survives-node-change
Oct 26, 2026
Merged

allisonmahmood merged 3 commits into
mainfrom
fix/cli-survives-node-change

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

What changed

After a Node version manager switched Node versions, patchy was gone: the installer had put it in the old Node's npm prefix. The installer now puts the CLI in ~/.patchy/cli, beside the skill copy it already made there, with the command at ~/.local/bin/patchy, so switching Node keeps it. Rerunning the install line moves an earlier install.

Closes #943

Look at

A real mise switch, 26.12.0 → 26.12.1. A throwaway HOME with its own mise data dir holding two Node installs, against this branch's pnpm dev instance; <tmp> is the throwaway root, and main-install.mjs is main's installer with this instance's address baked in. Each step runs as a fresh shell, as an agent's commands do.

Before: main's installer, then the switch
## main's installer under Node 26.12.0

$ node main-install.mjs
Installed patchy 0.19.0 from http://127.0.0.1:37576.
Executable: <tmp>/home/.local/share/mise/installs/node/26.12.0/bin/patchy
Skill: <tmp>/home/.patchy/skills/patchy/SKILL.md
Linked for agents: <tmp>/home/.agents/skills/patchy, <tmp>/home/.claude/skills/patchy
Read the skill next: <tmp>/home/.patchy/skills/patchy/SKILL.md

$ patchy --version
0.19.0

## mise switches Node to 26.12.1

$ switch 26.12.1; node --version
v26.12.1

$ patchy --version
mise ERROR No version is set for shim: patchy
Set a global default version with one of the following:
mise use -g [email protected]

## The same, through mise shims only

$ shims; patchy --version
mise ERROR No version is set for shim: patchy
Set a global default version with one of the following:
mise use -g [email protected]

$ ls $MISE_DATA_DIR/installs/node/*/bin/patchy
<tmp>/home/.local/share/mise/installs/node/26.12.0/bin/patchy
After: this branch's install line over main's install, then the switch
## Before this branch: main's installer under Node 26.12.0

$ node main-install.mjs | grep Executable
Executable: <tmp>/home/.local/share/mise/installs/node/26.12.0/bin/patchy

$ patchy --version
0.19.0

## This branch's installer, from the instance's install line

$ work=$(mktemp -d) && curl -fsS "http://127.0.0.1:37576/install.mjs" -o "$work/install.mjs" && node "$work/install.mjs"
Installed patchy 0.19.0 from http://127.0.0.1:37576.
Executable: <tmp>/home/.local/bin/patchy
Skill: <tmp>/home/.patchy/skills/patchy/SKILL.md
Linked for agents: <tmp>/home/.agents/skills/patchy, <tmp>/home/.claude/skills/patchy
Removed the earlier install from <tmp>/home/.local/share/mise/installs/node/26.12.0/lib/node_modules/patchy; open a new terminal if one that ran patchy before still looks for it there.
Read the skill next: <tmp>/home/.patchy/skills/patchy/SKILL.md

$ ls $MISE_DATA_DIR/installs/node/26.12.0/lib/node_modules
npm

$ command -v patchy && patchy --version
<tmp>/home/.local/bin/patchy
0.19.0

## mise switches Node to 26.12.1

$ switch 26.12.1; node --version
v26.12.1

$ patchy --version
0.19.0

## The same, through mise shims only

$ shims; node --version; patchy --version
v26.12.1
0.19.0

## And back to 26.12.0

$ switch 26.12.0; patchy --version
0.19.0

Leftover copies in other Node versions. The installer removes only the copy in the current Node's npm prefix, and only one that carries Patchy's skill, which tells it apart from npm's unrelated patchy package. It never touches other Node installs. A mise shim kept alive by another version's copy hands over to ~/.local/bin/patchy by default. So when ~/.local/bin is on PATH, the check also accepts a patchy ahead of it whose patchy --version exits 0 with the installed release within 30 seconds. When the shim doesn't hand over (mise with not_found_system_fallback = false, or an asdf shim), the installer names the fix:

Transcript
## Earlier installs in 26.12.0 and 26.12.1; this branch's installer under 26.12.1, mise shims before ~/.local/bin

$ ls $MISE_DATA_DIR/installs/node/*/bin/patchy $MISE_DATA_DIR/shims/patchy
<tmp>/home/.local/share/mise/installs/node/26.12.0/bin/patchy
<tmp>/home/.local/share/mise/installs/node/26.12.1/bin/patchy
<tmp>/home/.local/share/mise/shims/patchy

$ shims; work=$(mktemp -d) && curl -fsS "http://127.0.0.1:37576/install.mjs" -o "$work/install.mjs" && node "$work/install.mjs" | grep -E "Removed|Read the skill"
Removed the earlier install from <tmp>/home/.local/share/mise/installs/node/26.12.1/lib/node_modules/patchy; open a new terminal if one that ran patchy before still looks for it there.
Read the skill next: <tmp>/home/.patchy/skills/patchy/SKILL.md

$ ls $MISE_DATA_DIR/installs/node/*/bin/patchy $MISE_DATA_DIR/shims/patchy
<tmp>/home/.local/share/mise/installs/node/26.12.0/bin/patchy
<tmp>/home/.local/share/mise/shims/patchy

$ patchy --version
0.19.0

## mise configured not to fall back past its shims

$ MISE_NOT_FOUND_SYSTEM_FALLBACK=false patchy --version
mise ERROR No version is set for shim: patchy
Set a global default version with one of the following:
mise use -g [email protected]

$ MISE_NOT_FOUND_SYSTEM_FALLBACK=false node "$work/install.mjs" | grep -v "^Linked\|^Skill"
<tmp>/home/.local/share/mise/shims/patchy comes before <tmp>/home/.local/bin/patchy on PATH and runs another patchy. Put <tmp>/home/.local/bin first on PATH, or remove that copy (for a version manager's shim, run npm uninstall --global patchy under each Node version that still has one), then open a new terminal.
Installed patchy 0.19.0 from http://127.0.0.1:37576.
Executable: <tmp>/home/.local/bin/patchy

PATH. ~/.local/bin is where Claude Code's and uv's installers put their commands, so it is usually already on PATH. When it isn't, the installer says so with the export PATH=… line, as it did for npm's bin, and the skill tells agents to call the printed executable by path until then. The installer edits no shell profile and no Windows user PATH. On Windows the command is %USERPROFILE%\.local\bin\patchy.cmd, a one-line forwarder to npm's patchy.cmd. A ~/.local/bin/patchy the installer didn't make is refused before anything downloads. The exception is npm's own link for an earlier install when npm's prefix was ~/.local, which is migrated like any other earlier install.

Whichever Node is current. The command now runs on the current Node, so the package's bin is a new dist/bin.js that refuses Node older than 22.22.0 before it loads the bundle. On real Node 20.19.5 and 22.12.0:

$ node dist/bin.js status --json
{"ok":false,"error":"Patchy needs Node.js 22.22.0 or newer; this is 20.19.5. Switch to a newer Node with your version manager, or install the current Node.js LTS from https://nodejs.org.","kind":"local"}

Before, Node 20 died in undici with TypeError: webidl.util.markAsUncloneable is not a function. Node 22.12 ran some commands with no guarantee.

How it was verified

  • packages/sdk/src/install.test.ts: the CLI installs outside Node's npm prefix and runs after that prefix is deleted; an earlier global install is moved, from a per-Node prefix and from ~/.local as npm's prefix; when that removal fails the CLI still works, and the cleanup it names plus a rerun restores the launcher; a shim that hands over passes, but not with ~/.local/bin off PATH; a patchy that runs first and doesn't hand over is refused; a foreign ~/.local/bin/patchy is refused before any download; the existing integrity, old-Node, no-npm and not-on-PATH cases still pass. The EACCES and Volta cases are gone, because the installer no longer writes npm's prefix.
  • packages/patchy/src/cli.test.ts: dist/bin.js runs the CLI, and refuses Node 22.21.1 as text and as --json.
  • pnpm test:packed-cli-e2e: runs /llms.txt's line on a clean HOME and checks Executable: ~/.local/bin/patchy, the skill links, the login handoff on both runs, and an empty npm prefix.
  • The repo-pinned pnpm patchy is unchanged apart from its bin moving to dist/bin.js. pnpm links that the same way. The packed tier 1 and tier 2 e2e suites drive a repo's node_modules/.bin/patchy.
  • The skill's Publishing text, /llms.txt, the CLI README, ADR-0004, docs/SKILL_DISTRIBUTION.md, docs/product.md, the glossary, docs/API.md and the throwaway-machine recipe in docs/DEVELOPMENT.md follow the change. The skills-lock.json hash is refreshed.
  • pnpm verify on 02ab557: format, lint, typecheck, synth, test, postgres-concurrency, cli-smoke, tier2-smoke and browser all pass. CI is green on the same head.
  • Not tested: macOS, Windows and PowerShell (the patchy.cmd forwarder and the %-safe npm arguments are untested), nvm, fnm, asdf, and fish or zsh shells. An independent trace checked nvm and mise mechanics with copied Node installs; what ran here is Linux with real mise.

Release impact

  • Breaking — requires action from anyone already running this
  • Not breaking — no action required

Existing installs keep working. On their next upgrade, the install line moves the CLI to ~/.patchy/cli and removes the copy in the current Node's npm prefix. Where ~/.local/bin isn't on PATH, that upgrade stops after installing and asks for it (export PATH="$HOME/.local/bin:$PATH"), so the release note should say so. A contributor's own ~/.local/bin/patchy is refused until moved aside.

  • What does a revert leave behind? No server state. On machines that ran this installer: the CLI in ~/.patchy/cli, the ~/.local/bin/patchy link, and no copy in Node's npm prefix.
  • Does the release before it still work with that? Not fully, so this is one-way. The server does, and CLIs this installer placed keep running. But on machines where ~/.local/bin comes before Node's bin on PATH, the older release's install line refuses after installing, so its install-and-login line stops before login ("~/.local/bin/patchy comes before <Node's bin>/patchy on PATH"). That install line is also the upgrade path after a rollback. Those machines need ~/.local/bin/patchy and ~/.patchy/cli deleted, or that PATH order changed, before it works again. Acceptance reproduced it. Rolling production back past this PR means telling affected people that cleanup, so fix forward instead.

Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and accepted by GPT-6.1-Sol (xhigh).

The installer put the CLI in the current Node's global npm prefix, so a
Node version manager switching versions left the new Node without it.
It now installs into ~/.patchy/cli and links ~/.local/bin/patchy
(patchy.cmd on Windows), removes the copy an earlier installer left in
the current Node's prefix, and accepts a version manager's shim that
hands over to the new install. The package's executable refuses a Node
older than 22.22.0 before loading the CLI.

Closes #943

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood allisonmahmood added the bug Something isn't working label Oct 25, 2026
@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area size:m 100-500 changed lines labels Oct 25, 2026
allisonmahmood and others added 2 commits October 26, 2026 01:00
Review round 1: an earlier install whose npm prefix is ~/.local owns
~/.local/bin/patchy and now migrates instead of being refused; a shim
that hands over is accepted only when ~/.local/bin is itself on PATH,
exits 0, and answers within 30 seconds; dist/bin.js is executable in
the checkout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review round 2: when npm's prefix is ~/.local, the advised
npm uninstall --global patchy also removes the new launcher, so the
advice now ends with rerunning the installer, which restores it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review rounds (GPT-6.1-Sol, xhigh)

Round 1 on 16cc840: nothing blocking, four should-fix. All fixed in b781b62.

  1. install.mjs: an earlier global install whose npm prefix is ~/.local already owns ~/.local/bin/patchy, and was refused as foreign. Fixed: npm's link into the earlier Patchy package counts as the earlier install. It is migrated, and the test runs for a per-Node prefix and for ~/.local.
  2. install.mjs: the shim probe accepted a patchy printing the same release while ~/.local/bin was off PATH, so the CLI could still vanish. Fixed: the launcher itself must be on PATH before a shim ahead of it can pass, and the probe must exit 0. Test added.
  3. install.mjs: the probe had no timeout, so a hanging patchy could stall the installer. Fixed: 30 seconds, after which it counts as not handing over. No automated test, because it would cost 30 s; round 2 agreed and checked it by hand.
  4. build-patchy-package.mjs: dist/bin.js was 0644 in the checkout, so the README's contributor symlink failed. Fixed: the build chmods bin.js as well as index.js.

Round 2 on b781b62: nothing blocking, one should-fix. Fixed in 02ab557.

  1. install.mjs: with npm's prefix at ~/.local, the advice after a failed removal (npm uninstall --global patchy) also deletes the new launcher. Fixed: the advice now ends with "then run this again", and the rerun restores the launcher. A focused test covers the failure, the cleanup and the rerun.

Round 2 also confirmed both prefix migrations, setup failing after migration, the bounded probe, both files' modes in the checkout and tarball, the installed command on Node 26.12.1 and 22.22.0, and pnpm patchy --version from a packed repo pin. Windows got static review only in both rounds.

@allisonmahmood allisonmahmood added the one-way Rolling production back past this PR would break the release before it label Oct 26, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 02ab5573a66015037027f98e6b909f6a9f61905b (base fe8a0f2086f31ce17f39f5c582c3c8ed269e9f37, main) on fresh team instances, by GPT-6.1-Sol (xhigh) in the Codex harness through T3 Code.

All five Done means pass, and the earlier classification blocker is resolved. This follow-up checked the unchanged head, updated PR body and labels against the original isolated acceptance evidence below. The PR now has one-way, accurately describes the older installer's refusal when ~/.local/bin comes first, names cleanup or PATH reordering as recovery, and advises fixing forward. No switch scenarios or tests were rerun: the implementation commit is identical. The platform coverage gaps and rollback limitation remain notes.

Done means

  • Node switch: passed. Actual mise 2026.10.18 switches from Node 26.12.0 to 26.12.1 and back, in fresh shells. Both a clean head install and an upgrade from main print 0.19.0 without reinstalling, with the selected Node's bin first on PATH and with mise shims as the only Node entry on PATH.
  • Earlier install moves: passed. Main's served install line first installed into the throwaway Node 26.12.0 prefix. Head's served line then installed under the throwaway ~/.patchy/cli, linked ~/.local/bin/patchy, removed that earlier package and executable, and preserved both skill links. Neither copied Node prefix held Patchy after migration.
  • Old Node: passed. Real Node 20.19.5 exits 1 before loading the bundle, naming Node 22.22.0 as the minimum; status --json emits {ok:false,error,kind:"local"}. Real Node 22.22.0 prints 0.19.0.
  • Global skill guidance: passed. Publishing no longer tells agents to reinstall after a Node switch. Its SHA-256 matches skills-lock.json.
  • Repo-pinned CLI: passed. The installed CLI initialized a new tier 0 patch repo against the head instance; pnpm patchy --version in that repo printed 0.19.0, and its local executable was runnable.

Golden journeys

  • Log a machine in and out: passed. The actual /llms.txt line reached the login handoff. Ada confirmed on the head's persona instance; the installed executable completed login, whoami identified Ada's machine, and logout revoked it with hasToken:false afterwards.
  • Sign-in door and publish a page: passed. The installed CLI published a scenario HTML fixture. Signed out: HTTP 401, sign-in header and private, no-store. Ben: the page opened at its address and appeared on Home. Retire showed the retired notice; restore returned the page at the same address.
  • Other packed CLI/runtime paths: latest-head CI cli-smoke (including Node 26), tier2-smoke, browser, and clerk-live passed. These broad suites were not rerun locally.

Checks and isolation

  • Local vitest run packages/sdk/src/install.test.ts packages/sdk/src/FrontDoor.test.ts packages/patchy/src/cli.test.ts: 3 files, 37 tests passed. This includes integrity refusal, PATH/foreign-launcher conflicts, both legacy prefix migrations, cleanup failure/rerun, and setup/remove.
  • All 14 reported PR checks passed. The CI run names the exact checked head; rollback-rehearsal is green, but this diff has no migration and that check does not exercise the client installer layout.
  • Each machine was a fresh directory under /tmp with its own HOME, npm cache, npm_config_userconfig=/dev/null, all six requested mise paths (MISE_DATA_DIR, MISE_CONFIG_DIR, MISE_CACHE_DIR, MISE_STATE_DIR, MISE_GLOBAL_CONFIG_FILE, MISE_SYSTEM_DIR), and XDG directories. MISE_SYSTEM_DIR remained empty. Node and npm were copied into the temp mise data directories; no real Node install was used as an npm destination. The old Node download was checked against nodejs.org's SHA-256 manifest.
  • Both servers came from disposable checkouts at the named commits, ran one at a time on fresh scenario data, and have been taken down. Installers and CLI commands used those local instances only. Before/after recursive content, symlink and metadata snapshots of the real ~/.patchy and ~/.local/bin/patchy are identical.
  • Surface sweep: CLI/package bin, front door, API description, README/ADR, skill/hash and domain docs apply and are consistent. No migration, company-resource caller, package-layout or rendered HTML/CSS change.

Rollback answers: They now match the diff and the evidence. A revert leaves the CLI in ~/.patchy/cli, its ~/.local/bin/patchy launcher and no earlier copy in the current Node's npm prefix, with no server-state change. In the original run, after migrating with head, I restarted the exact base instance and ran its served install-and-login line on that machine. With ~/.local/bin first it installed a global copy, then exited 1 before login because head's launcher still ran first. The existing CLI continued printing 0.19.0; the older installer succeeded with the Node bin first and through mise shims. The revised answer correctly limits the failure to the affected PATH order, identifies deleting the new launcher/install or reordering PATH as recovery, and advises fixing forward. The one-way label is present, so the classification blocker is resolved.

Not run

  • macOS. This machine is Linux.
  • Windows/PowerShell, including patchy.cmd and Windows PATH handling. No Windows environment was available.
  • nvm, fnm, asdf, Volta, fish and zsh. The real version-manager exercise was mise in Bash.
  • A full local pnpm verify rerun; the focused local tests above and exact-head green CI provide the remaining suite evidence.

Notes

  • The previous FAIL was solely for the missing one-way classification. The updated label and rollback answers resolve it without changing 02ab557.
  • A rollback past this change still requires cleanup or PATH reordering on affected machines; the label and fix-forward advice now record that limitation.
  • macOS and Windows/PowerShell remain untested; all behavior and transcript results below are carried forward from the original run. All 14 reported PR checks remain green on this unchanged head.
Main reproduces the bug

Paths and instance origins are normalized; login JSON is omitted.

$ mise use --global --pin [email protected] && mise reshim && mise config ls && npm prefix --global
mise <migration>/mise-config/config.toml tools: [email protected]
<migration>/mise-config/config.toml  node
<migration>/mise-data/installs/node/26.12.0
[exit 0]

$ work=$(mktemp -d) && curl -fsS '<base-instance>/install.mjs' -o "$work/install.mjs" && node "$work/install.mjs" && patchy login --api-url '<base-instance>' --json
Installed patchy 0.19.0 from <base-instance>.
Executable: <migration>/mise-data/installs/node/26.12.0/bin/patchy
Skill: <migration>/home/.patchy/skills/patchy/SKILL.md
Linked for agents: <migration>/home/.agents/skills/patchy, <migration>/home/.claude/skills/patchy
Read the skill next: <migration>/home/.patchy/skills/patchy/SKILL.md
[exit 0]

$ mise reshim && command -v patchy && patchy --version
<migration>/mise-data/installs/node/26.12.0/bin/patchy
0.19.0
[exit 0]

$ mise use --global --pin [email protected]
mise <migration>/mise-config/config.toml tools: [email protected]
[exit 0]

$ node --version && patchy --version
v26.12.1
/bin/bash: line 1: patchy: command not found
[exit 127]

$ command -v node && node --version && patchy --version
<migration>/mise-data/shims/node
v26.12.1
mise ERROR No version is set for shim: patchy
Set a global default version with one of the following:
mise use -g [email protected]
mise ERROR Version: 2026.10.18 linux-x64 (2026-10-23)
mise ERROR Run with --verbose or MISE_VERBOSE=1 for more information
[exit 1]

$ mise use --global --pin [email protected] && patchy --version
mise <migration>/mise-config/config.toml tools: [email protected]
0.19.0
[exit 0]
PASS: main reproduces the Node-switch bug; the earlier per-Node install is retained for migration.
Head: fresh install, migration, and both PATH modes

Paths and instance origins are normalized; login JSON is omitted.

## fresh

$ mise current node && node --version && npm prefix --global
26.12.0
v26.12.0
<fresh>/mise-data/installs/node/26.12.0
[exit 0]

$ work=$(mktemp -d) && curl -fsS '<head-instance>/install.mjs' -o "$work/install.mjs" && node "$work/install.mjs" && patchy login --api-url '<head-instance>' --json
Installed patchy 0.19.0 from <head-instance>.
Executable: <fresh>/home/.local/bin/patchy
Skill: <fresh>/home/.patchy/skills/patchy/SKILL.md
Linked for agents: <fresh>/home/.agents/skills/patchy, <fresh>/home/.claude/skills/patchy
Read the skill next: <fresh>/home/.patchy/skills/patchy/SKILL.md
[exit 0]

$ command -v patchy && patchy --version && readlink "$HOME/.local/bin/patchy" && readlink "$HOME/.agents/skills/patchy" && readlink "$HOME/.claude/skills/patchy"
<fresh>/home/.local/bin/patchy
0.19.0
<fresh>/home/.patchy/cli/node_modules/.bin/patchy
<fresh>/home/.patchy/skills/patchy
<fresh>/home/.patchy/skills/patchy
[exit 0]
PASS: CLI and skill links belong to throwaway HOME; neither Node prefix contains patchy.

$ mise reshim && mise use --global --pin [email protected]
mise <fresh>/mise-config/config.toml tools: [email protected]
[exit 0]

$ mise current node && command -v node && node --version && command -v patchy && patchy --version
26.12.1
<fresh>/mise-data/installs/node/26.12.1/bin/node
v26.12.1
<fresh>/home/.local/bin/patchy
0.19.0
[exit 0]

$ mise current node && command -v node && node --version && command -v patchy && patchy --version
26.12.1
<fresh>/mise-data/shims/node
v26.12.1
<fresh>/home/.local/bin/patchy
0.19.0
[exit 0]

$ mise use --global --pin [email protected] && node --version && patchy --version
mise <fresh>/mise-config/config.toml tools: [email protected]
v26.12.0
0.19.0
[exit 0]

$ mise use --global --pin [email protected]
mise <fresh>/mise-config/config.toml tools: [email protected]
[exit 0]

## migration

$ mise current node && node --version && npm prefix --global
26.12.0
v26.12.0
<migration>/mise-data/installs/node/26.12.0
[exit 0]

$ work=$(mktemp -d) && curl -fsS '<head-instance>/install.mjs' -o "$work/install.mjs" && node "$work/install.mjs" && patchy login --api-url '<head-instance>' --json
Installed patchy 0.19.0 from <head-instance>.
Executable: <migration>/home/.local/bin/patchy
Skill: <migration>/home/.patchy/skills/patchy/SKILL.md
Linked for agents: <migration>/home/.agents/skills/patchy, <migration>/home/.claude/skills/patchy
Removed the earlier install from <migration>/mise-data/installs/node/26.12.0/lib/node_modules/patchy; open a new terminal if one that ran patchy before still looks for it there.
Read the skill next: <migration>/home/.patchy/skills/patchy/SKILL.md
[exit 0]

$ command -v patchy && patchy --version && readlink "$HOME/.local/bin/patchy" && readlink "$HOME/.agents/skills/patchy" && readlink "$HOME/.claude/skills/patchy"
<migration>/home/.local/bin/patchy
0.19.0
<migration>/home/.patchy/cli/node_modules/.bin/patchy
<migration>/home/.patchy/skills/patchy
<migration>/home/.patchy/skills/patchy
[exit 0]
PASS: CLI and skill links belong to throwaway HOME; neither Node prefix contains patchy.

$ mise reshim && mise use --global --pin [email protected]
mise <migration>/mise-config/config.toml tools: [email protected]
[exit 0]

$ mise current node && command -v node && node --version && command -v patchy && patchy --version
26.12.1
<migration>/mise-data/installs/node/26.12.1/bin/node
v26.12.1
<migration>/home/.local/bin/patchy
0.19.0
[exit 0]

$ mise current node && command -v node && node --version && command -v patchy && patchy --version
26.12.1
<migration>/mise-data/shims/node
v26.12.1
<migration>/home/.local/bin/patchy
0.19.0
[exit 0]

$ mise use --global --pin [email protected] && node --version && patchy --version
mise <migration>/mise-config/config.toml tools: [email protected]
v26.12.0
0.19.0
[exit 0]

$ mise use --global --pin [email protected]
mise <migration>/mise-config/config.toml tools: [email protected]
[exit 0]
PASS: fresh install and migration both survive real mise switches and fresh shells on both PATH modes.
Real old Node, minimum Node, and installer rerun

Paths and instance origins are normalized; login JSON is omitted.

$ mise use --global --pin [email protected] && mise reshim
mise <fresh>/mise-config/config.toml tools: [email protected]
[exit 0]

$ node --version && patchy --version
v20.19.5
Patchy needs Node.js 22.22.0 or newer; this is 20.19.5. Switch to a newer Node with your version manager, or install the current Node.js LTS from https://nodejs.org.
[exit 1]

$ patchy status --json
{"ok":false,"error":"Patchy needs Node.js 22.22.0 or newer; this is 20.19.5. Switch to a newer Node with your version manager, or install the current Node.js LTS from https://nodejs.org.","kind":"local"}
[exit 1]

$ mise use --global --pin [email protected]
mise <fresh>/mise-config/config.toml tools: [email protected]
[exit 0]

$ node --version && patchy --version
v22.22.0
0.19.0
[exit 0]

$ mise use --global --pin [email protected]
mise <fresh>/mise-config/config.toml tools: [email protected]
[exit 0]

$ work=$(mktemp -d) && curl -fsS '<head-instance>/install.mjs' -o "$work/install.mjs" && node "$work/install.mjs"
Installed patchy 0.19.0 from <head-instance>.
Executable: <fresh>/home/.local/bin/patchy
Skill: <fresh>/home/.patchy/skills/patchy/SKILL.md
Linked for agents: <fresh>/home/.agents/skills/patchy, <fresh>/home/.claude/skills/patchy
Read the skill next: <fresh>/home/.patchy/skills/patchy/SKILL.md
[exit 0]

$ node --version && patchy --version
v26.12.1
0.19.0
[exit 0]
PASS: actual Node 20 is refused before bundle loading, Node 22.22.0 works, and a head installer rerun works.
Rollback installer: passing and failing PATH layouts

Paths and instance origins are normalized; login JSON is omitted.

## Previous installer with the current Node bin first

$ work=$(mktemp -d) && curl -fsS '<base-instance>/install.mjs' -o "$work/install.mjs" && node "$work/install.mjs" && patchy login --api-url '<base-instance>' --json
Installed patchy 0.19.0 from <base-instance>.
Executable: <migration>/mise-data/installs/node/26.12.1/bin/patchy
Skill: <migration>/home/.patchy/skills/patchy/SKILL.md
Linked for agents: <migration>/home/.agents/skills/patchy, <migration>/home/.claude/skills/patchy
Read the skill next: <migration>/home/.patchy/skills/patchy/SKILL.md
[exit 0]
## Previous installer with ~/.local/bin first (also supported by head)

$ export PATH="$HOME/.local/bin:$PATH"; work=$(mktemp -d) && curl -fsS '<base-instance>/install.mjs' -o "$work/install.mjs" && node "$work/install.mjs" && patchy login --api-url '<base-instance>' --json
Installed patchy 0.19.0 from <base-instance>.
Executable: <migration>/mise-data/installs/node/26.12.1/bin/patchy
Skill: <migration>/home/.patchy/skills/patchy/SKILL.md
Linked for agents: <migration>/home/.agents/skills/patchy, <migration>/home/.claude/skills/patchy
<migration>/home/.local/bin/patchy comes before <migration>/mise-data/installs/node/26.12.1/bin/patchy on PATH, so patchy runs another copy. Remove that copy or put <migration>/mise-data/installs/node/26.12.1/bin first on PATH, then open a new terminal.
[exit 1]

$ export PATH="$HOME/.local/bin:$PATH"; command -v patchy && patchy --version
<migration>/home/.local/bin/patchy
0.19.0
[exit 0]

$ work=$(mktemp -d) && curl -fsS '<base-instance>/install.mjs' -o "$work/install.mjs" && node "$work/install.mjs" && patchy login --api-url '<base-instance>' --json
Installed patchy 0.19.0 from <base-instance>.
Executable: <migration>/mise-data/installs/node/26.12.1/bin/patchy
Skill: <migration>/home/.patchy/skills/patchy/SKILL.md
Linked for agents: <migration>/home/.agents/skills/patchy, <migration>/home/.claude/skills/patchy
Read the skill next: <migration>/home/.patchy/skills/patchy/SKILL.md
[exit 0]
Observed: existing CLI still runs, but the previous release install-and-login line aborts with ~/.local/bin first.

@allisonmahmood
allisonmahmood merged commit cb7606d into main Oct 26, 2026
14 checks passed
@allisonmahmood
allisonmahmood deleted the fix/cli-survives-node-change branch October 26, 2026 10:41
allisonmahmood added a commit that referenced this pull request Oct 26, 2026
Stacked on #944 (ticket #943); merges with #944, after it.

## What changed

Every CI job ran on Linux. So the installer's Windows path (cmd quoting,
the new `patchy.cmd` launcher, `patchy setup`'s junctions, the
PowerShell install line) and everything on macOS had never run in CI.
This adds an `install` job on Linux, macOS and Windows for the code that
runs on people's machines.

## Look at

- **`scripts/packed-install-e2e.mjs`.** A dependency-free script run
against the release packed once on Linux and served from a stub
instance. On throwaway machines whose home has a space (and a `%` on
Windows), with one npm prefix per Node as version managers keep them, it
runs:
1. the platform's own install line from `/llms.txt`: POSIX through `sh`
and `curl`, PowerShell through Windows PowerShell 5.1, then `patchy
--version` in the same shell;
2. a Node switch, 22.22.0 → 26.11.1, with Node 22 removed from PATH and
a preload recording which Node actually ran `patchy`, then `validate`
and `status --json`;
  3. the old-Node refusal;
  4. a rerun over its own launcher;
5. `setup --remove`, checked with `lstat` so a dangling link counts,
then `setup`, with both links resolving to the copy;
6. `auth set`, then `whoami` and the same file (its name has a space)
published twice against the stub, the second as an update from the
cached patch id. Each runs in a fresh shell with bare `patchy`, which is
Windows PowerShell on Windows;
  7. an install an earlier installer left in Node's npm prefix moving;
  8. the not-on-PATH message.
- **`.github/workflows/ci.yml`.**
- `release-tarball` packs the release on `ubuntu-24.04` and uploads
`packages/patchy/artifacts`.
- `install (linux|macos|windows)` downloads it on `ubuntu-24.04`,
`macos-15` and `windows-2025`, sets up both Nodes and runs the script.
These jobs need no `pnpm install`.
- **`pnpm verify`** runs the same script on the local platform (`pnpm
test:packed-install-e2e`), and `docs/DEVELOPMENT.md` says so.

**On the head, 535d897**
([run](https://github.com/allisonmahmood/patchy-cloud/actions/runs/40254949092)),
all three pass, as they did on every earlier head. The first try of the
run failed on `test (24)` with #723, a known dev-server flake in code
this PR doesn't touch, and passed on a rerun. The Windows log for this
head:

```text
[packed-install-e2e] Node a C:\hostedtoolcache\windows\node\22.22.0\x64\node.exe, Node b C:\hostedtoolcache\windows\node\26.11.1\x64\node.exe, release 0.19.0
[packed-install-e2e] a fresh install through the install line, then a Node switch
[packed-install-e2e] the executable refuses a Node older than the package needs
[packed-install-e2e] a rerun under the other Node reinstalls over its own launcher
[packed-install-e2e] setup --remove takes the skill links and copy, and setup puts them back
[packed-install-e2e] a saved key, whoami and a file published twice, from a fresh shell with bare patchy
[packed-install-e2e] an install an earlier installer left in Node a's npm prefix moves
[packed-install-e2e] without ~/.local/bin on PATH it installs, then names the directory to add
[packed-install-e2e] PASS on win32
```

`install (macos)` prints the same steps ending `PASS on darwin`. Run
against `main`'s installer, the script fails at the first step, because
that installer's `Executable:` is in Node's npm prefix.

## How it was verified

- Locally on Linux with real Node 22.22.0 and 26.12.1: PASS in 14 s. It
also runs with Node 22.22.0 itself running the script, which imports
`packages/api/src/install.ts` through Node's type stripping.
- `actionlint` on `ci.yml`, prettier, `eslint scripts/verify.ts` and
`pnpm typecheck:tests` pass.
- The new jobs aren't required checks. Once a week of runs shows their
queue times and flake rate, Allison can add `release-tarball`, `install
(linux)`, `install (macos)` and `install (windows)` to the ruleset.
`release-tarball` has to be in that list: if it fails, GitHub skips the
install jobs, and a skipped required check counts as passing.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

CI and a test script only; nothing ships to the server or the package.

- **What does a revert leave behind?** Nothing.
- **Does the release before it still work with that?** Yes.

Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and
accepted by GPT-6.1-Sol (xhigh).

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Oct 28, 2026
… patchy survives a Node update (#962)

## What changed

This PR adds release 20's What's new entry, written from `c5175bd`. It
covers everything merged since release 19's `through` (`156a228`), and
it sets the `patchy` release to `0.20.0` in
`packages/patchy/package.json` and `CURRENT_RELEASE`. With this release
patches can read and answer a company email address on Pidgeon, and the
`patchy` command keeps working after a Node version change.

| Change | PRs |
| --- | --- |
| New: Patches can read and answer a company email address | #921, #954,
#955 |
| Fixed: The patchy command survives a Node update | #944 |
| Behind the scenes: Patchy keeps only a key for the connected address,
never the Pidgeon admin key | #921 |

Two merged PRs get no line: #941 is release 19's own entry, and #945
adds CI install checks on macOS and Windows, which is tooling.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`. Its labels are the pages' own:
Integrations, Read, Read and send. The 200 sends a day is
`pidgeon.sends.daily`'s default. The Node fix says what #944's Release
impact asks of the note: people whose terminal doesn't look in
`~/.local/bin` are shown the line to add when they rerun the install
line.
- **Rollback safety, from the live commit `fe8a0f2` to `c5175bd`.**
Three PRs in the range are labelled `one-way`:
- **#921 and #954 (Pidgeon).** Release 19 hides Pidgeon connections and
ignores the new `pidgeon_sends` table, but a patch whose current version
declares or calls Pidgeon needs this release to serve. Recovering it
means rolling forward.
- **#944 (CLI install).** On machines where the new installer put
`~/.local/bin/patchy` ahead of Node's own bin on PATH, release 19's
install-and-login line refuses after installing. Those people would need
to clean that up by hand.
- **#955 and #945** answer both Release impact questions with "Yes".
`rollback-rehearsal` passed on every landed head, including #954's
migration `0028`.

## How it was verified

- **Tests.** `whatsNew.test.ts` (4), `WhatsNewPages.test.ts` (6),
`schemas.test.ts` (11) and the skill lock (1) pass. Typecheck passes for
core, api and the CLI, and so do prettier and eslint on the changed
files.
- **The stack.** #921, #954 and #955 each had GPT 6.1 Sol reviews to
merge-ready and an acceptance verdict of PASS with notes. Each landed
after all 21 checks passed on its rebased head, `Pidgeon live` included.
Each rebase left the tree byte-identical to the accepted head, and
`main`'s tree at `c5175bd` is identical to #955's accepted `cce5019`.
- **Deploy state.** The live commit was pinned from `/healthz/deep`:
`fe8a0f2`, release 19. The Deploy run updated last succeeded, and none
is unfinished.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

This PR changes only the changelog text and the `patchy` version. As
with every release, a CLI installed before this deploy is told to
upgrade.

- **What does a revert leave behind?** Nothing. People whose seen marker
reached 20 would just see no new release.
- **Does the release before it still work with that?** Yes.

Rolling back past #921 and #954 would stop any patch whose current
version uses a Pidgeon connection from serving, and rolling back past
#944 would break the install-and-login line on machines where the new
installer put `~/.local/bin/patchy` ahead of Node on PATH; fix forward
instead.

Made by Claude Opus 5.5 in Claude Code, running in T3 Code.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area area:server Touches the server area bug Something isn't working one-way Rolling production back past this PR would break the release before it size:m 100-500 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): a Node version change removes the patchy CLI

1 participant