Repository navigation
fix(cli): publish refuses a repo with no recorded version instead of going over newer work - #1179
Conversation
|
Review (GPT 6.1 Sol, xhigh) on 059055c: PASS, no findings.
|
Acceptance: PASS with notesChecked I ran everything on a Done means
CLI lines from the refusal and recovery$ patchy publish # patchy.json names a patch, no version
Unknown base version: patchy.json names patch <patch> but no version, so publish can't tell whether anyone published since this copy. Pull a fresh copy into a new folder with `patchy pull <patch>` and make the change there, or, once the person you are working for agrees to replace whatever is live, publish with --allow-behind; that publish records the version.
exit 1
versions: 1,2; served: v1
$ patchy publish --allow-behind
Updated patch
Version: 3
"version": 3
$ (cd notes && patchy publish --json) # after rollback 3; this copy is from v4
{"kind":"rejected","code":"behind","baseVersion":4,"latestVersion":5}
exit 2
$ patchy publish # pending attempt, then version deleted
Updated patch
Version: 7
exit 0
"version": 7
versions: 1,2,3,4,5,6,7; served: v7Golden journeys
Rollback answers: they match the diff. There is no migration, wire change or stored shape ( Not run
Notes
|
…going over newer work Co-Authored-By: Claude Opus 5.5 <[email protected]>
059055c to
8932680
Compare
…ges publish (#1241) ## What changed This adds release 36's What's new entry, written from `1acc968`. It covers everything merged since release 35's `through` (`dd0e2ec`), and sets the `patchy` release to `0.36.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. | Change | PRs | | --- | --- | | Improved: shortcuts work where you use them (keys for one part of a patch, the closest wins, text boxes keep their typing keys) | #1231 | | Improved: the shortcuts sheet shows what works where you are (Ctrl+/ and ⌘/ open it, its commands run, it opens from a patch's menu and in view on a narrow screen, keeps the look, spells keys out away from a Mac) | #1231, #1181, #1178, #1180, #1177 | | Fixed: keys pressed while a patch opens reach it | #1183 | | Fixed: pages styled with Tailwind 4 publish, and a look with the same rule saves | #1191 | | Fixed: an old copy of a patch no longer replaces newer work (**Breaking** for such a copy: it needs `patchy pull` or one `--allow-behind` publish) | #1179 | | Improved: your agent can check a publish before sending it | #1188 | | Improved: your agent hears what changed when it updates a patch | #1186, #1185 | | Fixed: your agent stops chasing false alarms (`pnpm install` exit codes, `manifest.json` bytes, the description notice, a copied dev record) | #1176, #1174, #1175 | | Behind the scenes: fuller hotkeys instructions for agents; fewer redraw costs for patches with many shortcuts | #1182, #1187 | `patchChanges` has three sentences for the agent refreshing a patch across this release: - #1231's, from its PR: text fields keep their keys, `preventDefault()`, and the sheet's Mod+/ and `.hotkey-row` buttons. - The sheet's dialog renders in `document.body`, and element-only page rules don't reach it (#1178, #1180). Its own row lists last (#1181). The hotkey label helpers take only valid literals (#1177). - Publish's `unknown_base_version` (#1179). It also rewords release 33's "Press ? to see every shortcut a patch has". That was true only for a patch that mounts the shortcuts sheet, so it now says a patch *can* list its shortcuts. The rest get no line: - #1206, #1207, #1209 and #1220 are `pnpm dev eval` tooling. - #1222 is release 35's own entry. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`, and release 33's reworded line. - **Rollback safety, from the live commit `d28fdd0` (release 35) to `1acc968`:** - #1191 is labelled `one-way`. Its Release impact: a company look published after this release with a nested `@supports` condition stays stored after a revert. Release 35 refuses any bundle carrying it, so repo publishes in that company would fail until an admin runs `patchy look restore` to an earlier revision. Pages and Tailwind 4 repos already published stay published. - #1183 is the only change to what the server serves browsers: the shell's script, under a digest-named URL. Its revert leaves nothing behind. - The hotkeys PRs change `patchy/hotkeys`, which patches bundle when they are built. Published patches keep their copy. - The CLI PRs change what a CLI writes and refuses. Release 35 reads everything they leave behind: #1176's `allowBuilds` entry, #1174's indented `manifest.json`, and the `version` recorded by an `--allow-behind` publish. **Rollback line:** If this release misbehaves, roll back to `d28fdd0` (release 35). First check that no company's look has a nested `@supports` condition, and `patchy look restore` an earlier revision where one does (#1191). ## How it was verified - **Tests.** `whatsNew.test.ts`, `WhatsNewPages.test.ts` and `schemas.test.ts` pass (22 tests), and `bun fmt` passes on the changed files. - **Facts.** The sheet's new `document.body` home and its element-rule reset were checked against `hotkeys.ts` and `hotkeySheet.ts` on main. - **Deploy state.** I pinned the live commit from `/healthz/deep`: `d28fdd0` (release 35). 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 Text and version numbers only. Like every release, the `0.36.0` bump tells CLIs and patch repos installed before this deploy to upgrade. - **What does a revert leave behind?** Nothing. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed
A repo publish sends
patchy.json'sversionso the instance can refuse it asbehindwhen someone published since. A repo last published before the CLI recordedversionhas none, so publish left the check out and went over whatever was live, including a newer version that had been rolled back. Publish now refuses a bound repo with no recorded version locally, before building or sending anything, withunknown_base_version: pull a fresh copy, or publish with--allow-behindonce the person agrees. That publish records a version, so a legacy repo needs the flag once.Closes #1164
Look at
packages/patchy/src/commands.ts): it applies only whenpatchy.jsonnames apatchand has noversion, and--allow-behindisn't passed. It runs beforeprepareRepoPublish, so a refused repo isn't built and itspatchy.json(description sync included) is untouched. Recovering a pending publish still comes first. A repo's first publish (nopatchyet) and file publishing don't reach it, and a repo with a version sends it as before, so a rollback still refuses it asbehind.On the base, the legacy repo silently publishes v3 over a rolled-back v2; on the head it is refused before anything is built or sent, and one
--allow-behindpublish records its version.Transcript
unknown-base-versionBefore is
1f187a9(where this branch left main) and after is059055c(fix/publish-unknown-base-version), both on theteamscenario, frompnpm dev transcript.Each line ran in its own
bash -cfrom the side's agent workspace, as the scenario's signed-in CLI, with stdin closed. Each side's origin reads<origin>, its environment folder<env>, its checkout<checkout>and the home folder~; nothing else is normalized. Nothing in it matched a collected secret (each side's CLI state, machine-token, login-code, API-key and access-token shapes, email addresses outside the scenarios' example domains, secret-named variables, and any accounts the run acts as).4 of 4 lines changed.
A patch with two versions, rolled back to the first
Changed. Before, exit 0 in 4.2 s; after, exit 0 in 3.9 s.
Its repo, as a CLI from before patchy.json kept a version left it
Changed. Before, exit 0 in 0.0 s; after, exit 0 in 0.0 s.
{ "instance": "<origin>", - "patch": "<before-patch-id>", + "patch": "<after-patch-id>", "description": "Team notes", - "descriptionSyncedAt": "2026-11-01T16:17:23.171Z" + "descriptionSyncedAt": "2026-11-01T16:17:29.773Z" }Publishing it
Changed. Before, exit 0 in 1.3 s; after, exit 1 in 0.2 s.
Publishing over what is live, once the person agrees
Changed. Before, exit 0 in 1.3 s; after, exit 0 in 1.1 s.
How it was verified
cliRepoPublish.test.ts: a bound legacy repo is refused withkind: "local",code: "unknown_base_version", namingpatchy pull <id>and--allow-behind. Nothing is sent,patchy.jsonis unchanged and no attempt is saved.--allow-behindthen publishes with nobaseVersionand recordsversion: 3.baseVersion: 1on the next one (cliRepoPublish), recovery of a pending attempt in a repo whosepatchy.jsonhas no version (cliRepoRecovery,cliLifecycle), and file publishing (cliPublish).patchy.jsonwith no version only as setup. They now carryversion: 1.pnpm vitest runoncliRepoPublish,cliRepoDescriptionsandcliRepoRecoverypassed, 25 of 25.cliLifecycleandcliPublishfail a different handful of tests on each run, on a strayGET /from the local editor's port probe; this is a known local-only failure that CI doesn't see, and those tests don't reach the changed path.pnpm format:check,pnpm lintandpnpm typecheck(the workspace, tests included) pass. I didn't run a fullpnpm verifyor the whole offline suite locally; CI runs them on this PR.Release impact
A compatibility change to the CLI: a repo bound to a patch with no
versioninpatchy.json, last published by a CLI from before versions were recorded, is now refused at its next publish withunknown_base_version, exit 1. The upgrade path is in the message, the README, ADR-0004's local codes table andpatchy-loop: pull a fresh copy withpatchy pull <patch>, or publish once with--allow-behindafter the person agrees to replace what's live. From then on the repo has a version and publishes as before. It reaches a repo only through a release and a refresh.--allow-behindkeep theversionthat any publish records.baseVersion.Built by Claude Opus 5.5 (
claude-opus-5-5) in Claude Code, through T3 Code.