Skip to content

fix(cli): refresh, dev and publish write the same manifest.json bytes - #1174

Merged
allisonmahmood merged 1 commit into
mainfrom
fix/manifest-bytes-1168
Nov 4, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
fix/manifest-bytes-1168

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

What changed

Refresh, dev and publish each wrote patchy/_generated/manifest.json with different bytes for the same manifest: refresh pretty-printed it with a final newline, dev wrote it compact with none, publish compact with one. Dev and publish also put a members declaration first in uses, where refresh kept the config's order. So every switch between commands left a change in git, and agents restored the file by hand.

Now every writer (init, refresh, dev and publish) goes through one encoder, Project.manifestFile: the schema-encoded manifest, indented, with a final newline. Stamping keeps uses in config order, as refresh already did.

Closes #1168

Look at

  • Project.manifestFile in packages/patchy/src/Project.ts, and resolveStamps in executeConfig.ts, which now copies members in place instead of first.

  • The dev test fails on main for the ordering half, which a single encoder alone would not have fixed:

    × writes the manifest file refresh and publish write, with uses in config order
      [
    -   "contacts",
        "members",
    +   "contacts",
      ]
    

    With the fix: Test Files 2 passed (2), Tests 56 passed (56) for devPreparation.test.ts and executeConfig.test.ts.

  • The init → publish test now asserts publish leaves init's manifest.json byte for byte (cliRepoPublish.test.ts, passes).

How it was verified

  • vitest run src/devPreparation.test.ts src/executeConfig.test.ts: 56 passed; the new dev case failed before the resolveStamps change.
  • vitest run src/cliRepoPublish.test.ts -t "publishes the starter": passes with the new byte-for-byte assertion.
  • pnpm lint, effect-tsgo on the package and tsconfig.test.json: clean.
  • pnpm verify on a shared machine at load average 60 to 84: format, lint, typecheck, synth, cli-smoke, install and tier2-smoke passed. test, test (bun), postgres-concurrency and browser failed. Every failure was a 20 to 30 s timeout, a vitest worker killed by SIGKILL, or a stray GET / in a stub's request log. That last one comes from a local port probe on this machine and doesn't happen on CI. None of the failures were in the manifest paths.
  • CI on this head: every check passes (22 pass, 2 skipped).
  • Not run: a before/after pnpm dev transcript of refresh, dev and publish followed by git diff. The shared machine's heavy-command lock had a queue hours long.

Release impact

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

The first refresh, dev or publish after upgrading rewrites manifest.json once into the shared format, the same one init and refresh already wrote. The file's content is unchanged, and nothing reads its bytes.

  • What does a revert leave behind? Repos whose manifest.json is in the indented format, which the previous release already wrote at init and refresh.
  • Does the release before it still work with that? Yes. It reads the file by decoding JSON, whatever its formatting or key order.

Built by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, through T3 Code.

@github-actions github-actions Bot added area:cli Touches the cli area size:m 100-500 changed lines labels Nov 1, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review (GPT 6.1 Sol, xhigh) on 1a59c29: approve, no findings. All four writers share the schema encoding, indentation and final newline, and stamping keeps config order. Existing manifests stay compatible. Reintroducing either the old formatting or the old ordering makes the new regression test fail.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 1a59c29e4c62235eea811bcf1fb662f7892f73d9 (base 1f187a92b2c20da81e8a1d647ea28a60a075d6ef) on team, by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, through T3 Code.

Done means

  • Refresh, dev and publish write identical bytes for the same manifest: passed. A pnpm dev transcript ran on both commits. Each side published a tier 1 source patch with a shared notes table, then made a tier 2 board repo that declares that table and then members, and committed. Then it ran dev + dev stop, publish and refresh, committing after each one.

    Step Before (1f187a9) After (1a59c29)
    init + add 31 lines, 557 bytes; notes, members 31 lines, 557 bytes; notes, members
    dev M manifest.json, 0 lines, 374 bytes; members, notes unchanged, nothing to commit
    publish M manifest.json, 1 line, 375 bytes; members, notes unchanged (only patchy.json takes the patch id)
    refresh M manifest.json, back to 31 lines unchanged

    Both halves of the issue showed on the base and are gone on the head: compact bytes, and members moved first. The after side's dev line exits 1 only because the script's own git commit found nothing to commit.

  • Each half is guarded by a test. I put each part of the fix back to its base form and reran the tests:

    • resolveStamps back to members-first: devPreparation.test.ts › "…with uses in config order" fails.
    • Dev writing compact JSON again: the same test fails (expected '{"manifestVersion":1,…' to equal '{\n "manifestVersion": 1,…').
    • Publish writing compact JSON again, with dist/ rebuilt (CLI tests run the build): cliRepoPublish.test.ts › "…publishes the starter…" fails on the new byte-for-byte assertion.
    • Restored and rebuilt, all pass. At the head, devPreparation.test.ts + executeConfig.test.ts give 56 passed, and the publish case passes.
  • Every manifest.json writer goes through Project.manifestFile. The callers of transaction.activate and writeInitialGeneration are refresh (also used by pull), init and dev, and repo publish writes through manifestFile itself. Nothing else writes the file.

Golden journeys

  • None is on this diff's path. File publishing ("Publish a page") doesn't write manifest.json, and brightline's repos declare only members, so they send the same uses either way. Repo publish is the closest path. The transcript's tier 1 and tier 2 publishes exit 0 at the head, and CI's tier2-smoke, cli-smoke, rollback-rehearsal and test jobs pass on this head.

Rollback answers: they match the diff. Nothing touches migrations, packages/api, infra or CLI flags. A revert leaves indented manifest.json files with uses in config order. The base already writes that at init and refresh, and the base's dev and publish read the file by decoding it. No one-way label needed.

Not run

  • Nothing in scope was skipped.

Notes

Transcript: refresh, dev and publish before and after

Transcript manifest

Before is 1f187a9 (where this branch left main) and after is 1a59c29 (HEAD), both on the team scenario, from pnpm dev transcript.

Each line ran in its own bash -c from 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).

3 of 5 lines changed.

A source patch publishes a shared notes table

$ patchy init source --tier 1 --purpose "Notes other patches read" >/dev/null 2>&1 && cd source && sed…: no change, exit 0 in 3.3 s
$ patchy init source --tier 1 --purpose "Notes other patches read" >/dev/null 2>&1 && cd source && sed -i 's/{ title: t.text() })/{ title: t.text() }, { shared: true })/' patchy.config.ts && patchy publish >/dev/null 2>&1 && echo published
published

A tier 2 repo declares that table, then the member directory, and commits what init and add wrote

$ patchy init board --tier 2 --purpose "A board of notes" >/dev/null 2>&1 && cd board && git init -q &…: no change, exit 0 in 2.7 s
$ patchy init board --tier 2 --purpose "A board of notes" >/dev/null 2>&1 && cd board && git init -q && patchy add shared-table "$(node -p 'require("../source/patchy.json").patch')/notes" --as notes >/dev/null && patchy add members >/dev/null && git add -A && git -c user.name=Ada -c [email protected] commit -qm start && wc -lc patchy/_generated/manifest.json && node -p '"uses: " + Object…
 31 557 patchy/_generated/manifest.json
uses: notes, members

Lines are cut at 400 characters. --json has it all.

patchy dev and dev stop, then what git sees

Changed. Before, exit 0 in 5.3 s; after, exit 1 in 3.9 s.

$ cd board && patchy dev >/dev/null && patchy dev stop >/dev/null && git status --short && wc -lc patchy/_generated/manifest.json && node -p '"uses: " + Object.keys(require("./patchy/_generated/manifest.json").uses).join(", ")' && git add -A && git -c user.name=Ada -c [email protected] commit -qm dev
 31 557 patchy/_generated/manifest.json
uses: notes, members
On branch master
nothing to commit, working tree clean
- M patchy/_generated/manifest.json
-  0 374 patchy/_generated/manifest.json
-uses: members, notes
+ 31 557 patchy/_generated/manifest.json
+uses: notes, members
+On branch master
+nothing to commit, working tree clean

patchy publish, then what git sees

Changed. Before, exit 0 in 2.2 s; after, exit 0 in 2.5 s.

$ cd board && patchy publish >/dev/null 2>&1 && git status --short && wc -lc patchy/_generated/manifest.json && node -p '"uses: " + Object.keys(require("./patchy/_generated/manifest.json").uses).join(", ")' && git add -A && git -c user.name=Ada -c [email protected] commit -qm publish
 M patchy.json
 31 557 patchy/_generated/manifest.json
uses: notes, members
  M patchy.json
- M patchy/_generated/manifest.json
-  1 375 patchy/_generated/manifest.json
-uses: members, notes
+ 31 557 patchy/_generated/manifest.json
+uses: notes, members

patchy refresh, then what git sees

Changed. Before, exit 0 in 1.1 s; after, exit 0 in 1.3 s.

$ cd board && patchy refresh >/dev/null && git status --short && wc -lc patchy/_generated/manifest.json && node -p '"uses: " + Object.keys(require("./patchy/_generated/manifest.json").uses).join(", ")'
 M patchy/_generated/index.json
 31 557 patchy/_generated/manifest.json
uses: notes, members
  M patchy/_generated/index.json
- M patchy/_generated/manifest.json
  31 557 patchy/_generated/manifest.json
 uses: notes, members

@allisonmahmood
allisonmahmood force-pushed the fix/manifest-bytes-1168 branch 2 times, most recently from 8025ff4 to 43a75ae Compare November 3, 2026 23:34
@allisonmahmood allisonmahmood reopened this Nov 3, 2026
@allisonmahmood
allisonmahmood force-pushed the fix/manifest-bytes-1168 branch from 43a75ae to 7ae964b Compare November 3, 2026 23:50
@allisonmahmood
allisonmahmood force-pushed the fix/manifest-bytes-1168 branch from 7ae964b to e30df95 Compare November 4, 2026 00:01
@allisonmahmood
allisonmahmood merged commit a2dce1b into main Nov 4, 2026
24 checks passed
@allisonmahmood
allisonmahmood deleted the fix/manifest-bytes-1168 branch November 4, 2026 00:12
allisonmahmood added a commit that referenced this pull request Nov 4, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli Touches the cli area size:m 100-500 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

patchy/_generated/manifest.json is written three ways

1 participant