Skip to content

fix(serving): a page that doesn't use the SDK opens without "could not start" - #1044

Merged
allisonmahmood merged 4 commits into
mainfrom
tier-fold/2-shell-no-handshake
Oct 29, 2026
Merged

allisonmahmood merged 4 commits into
mainfrom
tier-fold/2-shell-no-handshake

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

What changed

A page that doesn't load the Patchy SDK, such as a hand-written HTML page, was stopped after 10 seconds with "This patch could not start". Single files are about to publish as tier 1, so every one of them would hit that. Now the shell treats a silent page as normal: it renders, with no notice and no stream.

Part of #986 (PR 2 of 4).

Look at

A plain HTML tier 1 page, 11 seconds after opening (company address, Chromium, from the browser test harness):

Before After
before after

When the stream opens (packages/serving/src/broker.ts):

  • The 10 s bootstrap_failed timer is gone. The immediate bootstrap_failed for missing frame attributes and the wire stale() path stay.
  • Tier 2 still opens its stream at mount. The stream carries the cold start, so the company's tools start while the frame loads.
  • Tier 1 opens its stream on the frame's valid ready. The ready handler starts it if none exists, and otherwise replays the tier 2 stream's lifecycle state as before. Public scope is unchanged.
  • No new manifest bit, and authorization is unchanged.

A page without the SDK has no stream, so it isn't offered a new version and isn't stopped on retirement until it is reloaded. That matches a tier 0 page today. A broken SDK bundle now shows a broken page instead of the notice, as the plan accepts.

Test, red then green: stream.spec.ts › "a page that never handshakes renders without a notice and opens no stream". On the base broker it fails as the shell leaves for the notice:

- navigated to "https://127.0.0.1:39663/~shell/notice/bootstrap_failed?return=%2Fpatchy-dev%2Fplain-page"
> 37 |   await expect(heading).toBeVisible();

On this head it passes.

How it was verified

  • New and changed tests:
    • stream.spec.ts: a plain page on a company address still shows its content after the clock jumps 30 s, makes no runtime request and opens no stream.
    • starting.spec.ts: a tier 2 page's first stream opens while its frame's content is still held. It names no earlier generation, so its host warms the version, and it reaches ready before the frame loads. A server.call then runs on that one stream.
    • tier1.spec.ts: a ready carrying another document's nonce leaves the page up with no runtime call. It used to end on the timer's notice. The hostile-envelope case now waits for the stream's first admission before snapshotting runtime requests.
    • Six stream.spec.ts tests paused the clock right after the first hello, assuming the empty desired set was already admitted. A tier 1 stream now opens at ready, so its 1 s repair timer could still be armed; they now also wait for admitted 0 (reconciledEmpty).
  • Tier 1 SDK pages still get their stream and live queries: subscriptions.spec.ts and the rest of stream.spec.ts pass unchanged.
  • pnpm verify on the rebased head: format, lint, typecheck, synth, postgres-concurrency, cli-smoke, install, tier2-smoke and browser (83 passed) pass. The offline test stage failed only in cases that don't touch this diff:
    • CLI and server stub-server cases that received an unexpected GET /. A desktop app on the build machine probes new localhost ports, and ss traced the request to it. CI doesn't run that app.
    • One Supervisor workerd case that times out on this machine. It passes in CI's test (22/24/26).
  • Rebased onto main after TypeScript 7 landed: format, lint and typecheck pass. The browser suite passed 82 of 83; the one failure is the hostile-navigation case's foreign-origin check catching that same port probe.
  • Independent review (GPT 6.1 Sol, xhigh), four rounds: no P0 or P1 in any round. Each round's test-synchronisation findings were fixed, and the last round found nothing; see the PR comments.
  • Acceptance (Claude Opus 5.5, a separate agent): PASS with notes on this head; see its verdict comment.
  • Docs: ADR-0010, docs/product.md, the stream route's description in packages/api (and docs/API.md), and the notice copy, which drops "in time".

Release impact

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

The browser shell's timing only; no schema, API shape or configuration change.

  • What does a revert leave behind? Nothing. No stored data or contract changes.
  • 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.

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:docs Touches the docs area size:m 100-500 changed lines labels Oct 29, 2026
@allisonmahmood
allisonmahmood force-pushed the tier-fold/2-shell-no-handshake branch from 30cec36 to f301570 Compare October 29, 2026 10:20
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Independent review (GPT 6.1 Sol, xhigh) on e05e050: no P0 or P1.

  • P2: the hostile-envelope case could count the stream's first POST. Fixed in f301570. A tier 1 stream now opens on ready, so its first replace POST can land after open() returns and after the beforeMalformed snapshot. The case now waits for the first admitted frame before taking it.
  • P3: the tier 2 case proved an eager connection, not eager warming. Addressed in f301570 without switching to local-fleet. The case now asserts that the first stream carries no X-Patchy-Generation, which is what makes its host warm the version (RuntimeStream.test.ts › "keeps a ready document's version warm until it disconnects, warming only its first stream"). It also asserts that the stream reaches ready, clearing the starting cover, while the frame's content is still held. Warming itself is server code this PR doesn't touch, so the browser test covers the shell's half.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Second review round (GPT 6.1 Sol, xhigh) on f301570: no P0 or P1. Both earlier fixes held.

  • P2: loadLazy in pinned-viewer.spec.ts returned before the stream settled. Fixed in 824ad38. A tier 1 stream now opens on ready, so the account-switch, expiry and deactivation cases could change the session while that stream was still being admitted. The stream could then stop the document before the case's own write or read ran. loadLazy now waits for the stream's first admitted frame. pinned-viewer.spec.ts passed 28/28 (two runs each).

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Third review round (GPT 6.1 Sol, xhigh) on 824ad38: no P0 or P1. The loadLazy fix held.

  • P2: the real-sessions case changed the cookie straight after open(). Fixed in 1fc92ad. open() waits for me, which can finish before the tier 1 stream that opens on ready is admitted, so that stream could stop the document before the case's own read and detach its frame. A shared streamAdmitted(frame) helper in fixtures.ts now replaces the three ad hoc waits, and that case uses it. A sweep for other session changes, clock pauses and request snapshots right after a page opens found two more in pinned-viewer.spec.ts that waited only for the stream's connection; they now wait for its admission too. stream.spec.ts 29/29, pinned-viewer.spec.ts 28/28 over two runs, and tier1.spec.ts passed apart from the local port-probe artifact.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Fourth review round (GPT 6.1 Sol, xhigh) on 1fc92ad: no findings at any severity. The streamAdmitted waits hold, and the diff matches the plan's PR 2: tier 1 starts its stream on a valid ready, tier 2 stays eager at mount, public is unchanged, and the immediate bootstrap_failed and stale() paths stay.

@allisonmahmood
allisonmahmood force-pushed the tier-fold/2-shell-no-handshake branch from 1fc92ad to 72f39e0 Compare October 29, 2026 11:25
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 72f39e0 (base eb414ed) on brightline and team, by Claude Opus 5.5 in Claude Code, through T3 Code.

This replaces the verdict on 1fc92ad. The rebase carried the PR's four commits over unchanged: git range-diff b800aed..1fc92ad eb414ed..72f39e0 marks all four =, and the PR's diff against its base differs only by a hunk offset in docs/product.md. None of main's six new commits (#1000, #1009, #1010, #1041, #1042, #1046) touches the broker. I re-checked what they could change underneath it: the broker bundle, the boot nonce, the browser suite, stream timing on tiers 1 and 2, and every journey the last verdict covered. There's no Done means on #986, so I checked against What changed and the plan's PR 2.

What the rebase could move

  • Broker bundle: identical. scripts/build-serving-broker.mjs gives byte-identical output at 1fc92ad and 72f39e0 (sha256 ecf19e8f…), so TypeScript 7 changes nothing the shell runs.
  • Boot nonce: same shape. refactor: ids, tokens and hashes come from Cryptography #1042 moves it to Cryptography.internalId, which still makes boot_ plus 24 characters from the old alphabet, inside the stream's documentId rule. The streams below were all admitted.

Done means

  • The 10 s "could not start" timer is gone: passed. On brightline I published a tier 1 page with no SDK through the publish API. 12 real seconds after opening, it still shows at its own address with no notice, and its inline script is still ticking. That held for Jordan (company scope) and for a signed-out reader (public scope). A plain tier 1 repo in local patchy dev behaves the same. The PR's new test is red on the new base's broker and green on this head:
    base eb414ed: ✘ stream.spec.ts:30 › a page that never handshakes renders without a notice and opens no stream
                    - navigated to "…/~shell/notice/bootstrap_failed?return=%2Fpatchy-dev%2Fplain-page"
    head 72f39e0: ✓ stream.spec.ts:30 › a page that never handshakes renders without a notice and opens no stream
    
  • A tier 1 company or local shell opens its stream on ready, so a page without the SDK opens none: passed. The plain pages made no /api/runtime/* requests (company and public) and no stream request (local). Kudos opened one stream per person, after its frame's content request, in the cloud and in local patchy dev.
  • A tier 1 page with the SDK keeps its stream and live queries: passed. Kudos is live between two people on the company address and in local patchy dev. subscriptions.spec.ts and the rest of stream.spec.ts pass.
  • Tier 2 still opens its stream at mount: passed. On New Business, both Jordan's and Allison's stream requests went out before the frame's content request. starting.spec.ts › "a tier 2 page opens its stream, which starts its tools, before its frame loads" passes.
  • Public scope is unchanged: passed. The public plain page made no runtime requests, and the members.spec.ts public-directory cases pass.
  • The immediate bootstrap_failed and wire stale() paths stay: passed. Neither line changes (broker.ts:350–351), and the tier1.spec.ts stale case still ends on shell_outdated.
  • Suites: the full pnpm test:browser on this head passed locally, 83 of 83. The port-probe failure noted in the last verdict didn't recur. In CI, every check on this head is green except pidgeon-suite, including browser (83 passed), test (22/24/26), lint (format, Oxlint and the effect-tsgo typecheck), tier2-smoke, cli-smoke, install on all three platforms, rollback-rehearsal and clerk-live.
Direct checks on the brightline instance and in local patchy dev
PASS plain company page: status 200, heading visible after 12 s: true, url unchanged: true, page script ticks: 12, runtime requests: 0
PASS plain public page: status 200, heading visible after 12 s: true, url unchanged: true, page script ticks: 12, runtime requests: 0
PASS kudos live: Priya saw Jordan's kudos without a reload (content loads 1); streams Jordan 1, Priya 1; Jordan's stream opened after the frame's content request: true
PASS kudos stays up past 10 s: url /brightline/kudos
PASS new business live: "Saltwater Hotels, Loyalty app concept" moved Lead → Discovery → Lead by Jordan, followed on Allison's open board without a reload (content loads 1); Allison's stream opened before the frame's content request: true; Jordan's: true
PASS spend self-approval: jordan's Approve on their own waiting request shows "You can't approve your own request."
PASS tier 0 brief: status 200, h1 "Harbor & Pine Coffee: a brand that tastes like the coast.", runtime requests 0
PASS local plain page: heading visible after 12 s: true, url unchanged: true, page script ticks: 12, stream requests: 0
PASS local kudos live: the colleague's open page showed the owner's kudos; stream requests owner 1, colleague 1
PASS local kudos stays up past 10 s

Golden journeys

  • Use a tier 1 tool live (brightline, Jordan and Priya): passed. Jordan's kudos appeared on Priya's open page without a reload.
  • Use a tier 2 tool (brightline, Jordan and Allison): passed. New Business opened with its sample deals. Jordan moved Saltwater Hotels from Lead to Discovery, and Allison's open board followed; it followed again when Jordan moved the deal back. Spend refused Jordan's Approve on a waiting request Jordan had submitted.
  • Publish a page (team, Ada and Ben): passed. Ada's environment CLI published an HTML file (tier 0, which this PR doesn't change). Ben got 200 at its address with the page's content, and Home links to it. After retire, Ben got "launch-notes is retired" without the content; after restore, the content came back.
  • The brightline tier 0 kickoff brief still opens.

Rollback answers: they match the diff. The PR has no migration, writes no rows and changes no wire shape; in packages/api it changes only the stream route's description text. A revert puts back the 10 s timer and the tier 1 stream at mount, and nothing else. I ran the rollback rehearsal with --live set to this PR's base, since its default reads the production commit. It passed: eb414ed → 72f39e0 → eb414ed → 72f39e0, in 104 s.

Not run

  • pnpm verify as one command: every stage it runs passed in CI on this head, and I ran the browser suite locally.
  • pidgeon-suite: still pending in CI when I posted. It's the live Pidgeon suite, and nothing in this diff touches Pidgeon.

Notes

  • The wrong-nonce case in tier1.spec.ts waits 300 ms, so it would also pass on the base broker, whose notice came only after 10 s. It shows that a mismatched nonce binds nothing; the stream.spec.ts case above pins the timer's removal. That's a nit, carried over from the last verdict.
  • No test exercises the missing-attributes bootstrap_failed path. That line is unchanged here, so the gap predates this PR.
  • For the rollout: once PR 3 (R2) publishes single files as tier 1, a release from before R1 would stop those pages after 10 s. That makes R1 the floor for rolling R2 back, and PR 3's rollback line should say so.

A plain tier 1 page without the SDK, 12 s after opening on a company address
Priya's open Kudos page showing Jordan's kudos live
Allison's open New Business board after Jordan moved Saltwater Hotels to Discovery
Spend refusing Jordan's approval of a request Jordan submitted
Local patchy dev: a plain tier 1 repo without the SDK, 12 s after opening
Local patchy dev: the colleague's Kudos page showing the owner's kudos live

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Rebased onto 0aa8d48. The acceptance verdict above (at 72f39e0) still covers this PR:

allisonmahmood and others added 4 commits October 29, 2026 22:28
…t start"

The shell stopped any frame that stayed silent for ten seconds with "This
patch could not start". A hand-written page never loads the SDK, so once
single files publish as tier 1 every one of them would hit that notice.

The timer goes. A tier 1 shell now opens its document stream on the frame's
valid ready instead of at mount, so a page that never handshakes just renders,
with no stream and no notice. Tier 2 still opens its stream at mount, because
it carries the cold start. The missing-attributes bootstrap_failed path and
the wire stale() path stay.

Part of #986 (PR 2 of 4).

Co-authored-by: Claude Opus 5.5 <[email protected]>
…starting before its frame

The hostile-envelope case snapshots runtime requests right after open(). A
tier 1 stream now opens on ready, so its first replace POST could land after
that snapshot; the case now waits for the first admitted frame.

The tier 2 case now also shows its first stream names no earlier generation,
so its host warms the version, and reaches ready while the frame is still
held.

Co-authored-by: Claude Opus 5.5 <[email protected]>
…g the session

A tier 1 stream now opens on ready, so loadLazy could return while it was
still connecting. A case that then switched account, expired the session or
deactivated the viewer could see the stream stop the document before its own
operation ran. loadLazy now waits for the stream's first admission.

Co-authored-by: Claude Opus 5.5 <[email protected]>
A tier 1 stream opens on ready, which can be after open() returns. The real
sessions case changed the cookie straight after open(), so the stream could
stop the document before the case's own read ran. A shared streamAdmitted
helper now replaces the three ad hoc waits, and that case uses it too.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the tier-fold/2-shell-no-handshake branch from 690cf28 to deeedd2 Compare October 29, 2026 21:28
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Rebased onto main after #1047 merged (570bf36). Resolved the four conflicts as described above. Those files are byte-identical to the combined tree Sol reviewed with no findings. The four commits are otherwise unchanged.

@allisonmahmood
allisonmahmood merged commit 9ee90e3 into main Oct 29, 2026
23 checks passed
@allisonmahmood
allisonmahmood deleted the tier-fold/2-shell-no-handshake branch October 29, 2026 21:40
allisonmahmood added a commit that referenced this pull request Oct 29, 2026
## What changed

This adds release 24's What's new entry, written from `9ee90e3`. It
covers everything merged since release 23's `through` (`ed80fc7`) and
sets the `patchy` release to `0.24.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`. This is the first of three releases for #986. In
it, tier 1 stops reaching anything outside its own patch, and the shell
stops requiring Patchy's code on a page.

| Change | PRs |
| --- | --- |
| Improved: Company data goes through a patch's own rules. Company
connections, other patches' shared data and the member directory are
read from server code (tier 2) only. A browser-only patch reaches its
own tables and files. One that already read these stops getting that
data until it moves to tier 2, and the CLI's refusal names the fix. |
#1047 |
| Fixed: Plain pages no longer say they could not start. A page that
never loads the SDK isn't covered by "This patch could not start" after
ten seconds any more. | #1044 |

Two merged PRs get no line, because nobody using Patchy would notice
them. #972 is the Patchy MCP docs pass and #1051 is live Pidgeon test
churn. #1050 is release 23's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **Rollback safety, from the live commit `0aa8d48` (release 23) to
`9ee90e3`:**
  - No PR in the range is labelled `one-way`, and none adds a migration.
- #1047 changes no stored data. A revert puts tier 1's direct
connection, shared and member reads back. Repos that moved to tier 2
meanwhile stay valid on release 23.
- #1044 is broker-only. Release 23's shell shows a page without the SDK
the way it did before.

**Rollback line:** If this release misbehaves, roll back to `0aa8d48`
(release 23).

## How it was verified

- **Tests.** `whatsNew.test.ts`, `WhatsNewPages.test.ts` and
`schemas.test.ts` pass (21 tests), and prettier passes on the changed
files.
- **The range.** #1047 and #1044 each had GPT 6.1 Sol reviews with every
finding resolved and an acceptance PASS with notes. They landed with all
12 required checks green on their rebased heads, `rollback-rehearsal`
against release 23 included. Their conflict resolutions got a separate
Sol review with no findings.
- **Deploy state.** The live commit, pinned from `/healthz/deep`, is
`0aa8d48` (release 23). The Deploy run updated last (#25) succeeded, and
none is unfinished.
- **Known effect.** One patch in production is a tier 1 patch that reads
the member directory. Its member reads stop until it's republished at
tier 2. Its owner has been told.

## Release impact

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

Text and version numbers only. The `0.24.0` bump tells CLIs and patch
repos installed before this deploy to upgrade, as every release does.

- **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]>
allisonmahmood added a commit that referenced this pull request Oct 29, 2026
…1045)

## What changed

`patchy publish page.html` made a tier 0 static page: no script,
rendered through `srcdoc`. Now a single file publishes as a tier 1 page.
Its inline script runs in the sandboxed frame, it must carry every
resource it uses, and it can be up to 10 MiB. On the portal a tier 1
patch is a Page and a tier 2 patch is a Tool, so a tier 1 repo patch
shelves as a Page.

Nothing in this release publishes tier 0 any more. A repo still
configured at tier 0 is refused, `patchy init` offers tiers 1 and 2, and
the server refuses a tier 0 manifest. R3 tightens the tier CHECK to 1–3
while R2 hosts may still run, during its rolling overlap and after any
rollback to R2, so R2 must never write a tier 0 version.

Part of #986 (PR 3 of 4). It deploys after release 24 (#1047 and #1044)
is live.

## Look at

**Home and All patches.** The earlier before/after screenshots predated
the rebase onto #1047 and are gone. #1047 made `kudos` tier 2, so on
`brightline` it stays in Tools, and the kickoff brief stays in Pages
whether it's tier 0 or tier 1. On that scenario this release doesn't
visibly change the shelves. The acceptance verdict on `8309978` checked
them on `brightline` and `team`: Tools holds the tier 2 patches with
monograms, Pages holds every tier 1 page with the page mark, and Ada's
first single-file `welcome` page shows "Your welcome page is live".

**What a file publish sends and refuses**
(`packages/patchy/src/commands.ts`,
`packages/patchy/src/bundleCheck.ts`):

- The manifest is `tier: 1` with no `sdkImports` and empty definitions.
The server already took this shape: the title comes from
`documentTitle`, the cap is the bundle cap, and the filename is recorded
and names the patch. Its tier 0 branch stays until PR 4.
- `validate` and file publish run `checkBundle`, the self-contained
check `repoBuild.ts` used, moved into its own module. Repo builds,
`patchy dev`'s watch and file publishes now share it. Inline script and
style and `data:` URLs pass. A `<script src>`, `<link>`, or an image,
font, CSS `url()` or `@import` from an address is refused, each one
named. The shared message now ends "Inline every resource in the HTML,
for example as a data: URL." in place of a pointer to Patchy
integrations, which no HTML bundle reaches. The cap is 10 MiB, and one
byte over is `too_large`. `validateHtml` leaves the CLI's file path; it
stays in core for PR 4.

On a dev instance:

```
$ patchy publish counter.html --new --name counter --json
{"ok":true,…,"title":"Counter","name":"counter",…,"tier":1,…}
$ patchy publish remote.html --new --json
{"ok":false,"error":"The HTML bundle is not self-contained or uses unsupported external dependencies:\n- <img> src is not embedded\nInline every resource in the HTML, for example as a data: URL.","kind":"local"}
```

The counter page's inline script ran when opened.

**One predicate for page or tool**
(`packages/core/src/patch-presentation.ts`). `isPage` is `tier <= 1` in
this release, because tier 0 rows remain; PR 4 makes it `tier === 1`. It
drives:

- the Home and All patches shelves, including their empty-tab copy;
- `patchMark`;
- `isWelcomePage`, which Home's live note, the guide and
`patch.first_opened`'s `welcomePage` read.

Pidgeon's address tiles called `patchMark(…, 1)` to get a monogram. They
now call `monogram` directly.

**Nothing writes tier 0** (`packages/patchy/src/repoBuild.ts`,
`devPreparation.ts`, `commands.ts`,
`packages/patches/src/PatchesApi.ts`):

- **Repo config at tier 0:** refused before the build by repo publish,
by `patchy dev`'s preparation, and by the shared bundle validation that
watched builds use. The message is "Tier 0 is now tier 1. Set `tier: 1`
and run `patchy refresh`.", with code `tier_mismatch`. The config type
is unchanged; PR 4 narrows it.
- **`patchy init --tier`:** takes 1 or 2.
- **Server:** `PatchesApi` publish answers a tier 0 manifest with a 422
`tier_mismatch` before any content check. Its tier 0 validation branch,
now unreachable, goes. Tier 0 versions already stored are still served
until R3 migrates them.
- **Test helpers:** the server and patches publish helpers, the Clerk
browser fixture and `pnpm seed:dev` now publish tier 1.
- `test/browser-tier1/static.spec.ts` now checks the same-page link on a
tier 1 single file, the shape a republished srcdoc-era page takes.
- The `devServer.test.ts` case for the tier 0 dev shell is deleted:
`patchy dev` can no longer reach that shell.
- **Rollback rehearsal:** each step publishes with its own release's CLI
to its own server. The head step publishes a tier 1 file page and a tier
2 agent area, and `brightline` has no tier 0 repo. Nothing at the head
needs tier 0.
- **On a dev instance**
([addendum](#1045 (comment))):
publish and dev on a repo switched to `tier: 0` both exit 1 with the
message above and build nothing. `init --tier 0` exits 1. A hand-made
tier 0 `POST /api/publish` gets HTTP 422 `tier_mismatch`.

**The look preview.** The single-look specimen still passes `validate`
for all four look fixtures. Published, it renders as a tier 1 page with
its embedded fonts and logo under the scripted CSP. The `--compare` page
was never publishable, because tier 0 refused its script and frames. It
is still refused, now because its frames start with `<base
href="about:srcdoc">`. No flow publishes it: the skill tells an agent to
publish the single-look file.

## How it was verified

- **Tests:**
- `cli.test.ts`: `validate` passes inline script and a `data:` image,
refuses `<script src>`, accepts exactly 10 MiB, and calls one byte over
`too_large`.
- `cliPublish.test.ts`: a file publish sends `tier: 1` with no
`sdkImports`, and a remote image is refused before `/api/publish`.
- `PortalPages.test.ts`: tools are tier 2. A tier 1 page and a tier 0
page both shelve as Pages, and republishing a page at tier 2 moves it to
Tools.
  - `patch-presentation.test.ts`: the welcome page follows `isPage`.
- `cliRepoPublish.test.ts`: a refreshed repo switched to `tier: 0` is
refused by `publish` and `dev` with the exact message. Nothing is built,
generated or sent, and `init --tier 0` is refused.
- `repoBuild.test.ts`: the shared bundle validation refuses tier 0
before inspecting the page.
- `PatchesApi.test.ts`: a tier 0 update to a live page is refused,
naming tier 1, and leaves its content unchanged. A tier 0 create joins
the unsupported-tier cases and charges no quota.
- **Packed CLI e2e:** the public viewer now follows the shell's
`data-content-src`. The content URL serves exactly the uploaded bytes
under the scripted sandbox CSP, and stored versions are tier 1.
- **Checks:**
- `pnpm verify`: format, lint, typecheck, synth, postgres-concurrency,
cli-smoke (the packed CLI e2e above), install and tier2-smoke pass.
- Its offline tests and browser suite failed only on stub servers that
received a request they didn't send: CLI stubs and the browser suite's
foreign endpoint each got a stray `GET /`, the local port probe #1044
traced. Each run failed a different set. The browser suite alone then
passed 83 of 83, and CI's `test` and `browser` jobs pass on this head.
- **Every surface:**
- CLI: `README`, ADR-0004, and the global skill with its
`skills-lock.json` hash, including the `init --tier` and repo-tier
lines.
- Vocabulary: the portal, patches, patchy and companies glossaries, and
`docs/product.md`'s single-file and shelf lines.
  - Served pages: the portal's shelves.
- Wire contract: the publish route's description in `packages/api` says
a tier 0 manifest answers `tier_mismatch`, and `docs/API.md` is
regenerated. The wire shape is unchanged.
- Dev loop: `docs/DEVELOPMENT.md`'s `seed:dev` and `brightline` lines,
and `scenarios/README.md`.
- No migration. Tier 0 code that is now dead (dev's tier 0 shell, the
core policy and its fixtures, the config type) is left for PR 4.

## Release impact

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

A file publish is now tier 1. A page that loads a remote image, font or
stylesheet is refused at publish, with each one named. Embed it as a
`data:` URL instead. None of production's current single-file pages
loads one.

A repo still configured at tier 0 is refused by `publish` and `dev`. Set
`tier: 1` and run `patchy refresh`. `patchy init --tier 0` is gone, and
the API answers a tier 0 publish with 422 `tier_mismatch`.

- **What does a revert leave behind?** Tier 1 versions published from
single files, and no tier 0 version. The older portal shelves them as
Tools with a monogram, and a welcome page published in this release
reads "<title> is live" and reports `welcomePage: false`. Nothing
breaks.
- **Does the release before it still work with that?** Yes, once #1044
is live: its shell renders a tier 1 page that never loads the SDK. This
must not deploy before #1044, so no `one-way` label.

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]>
allisonmahmood added a commit that referenced this pull request Oct 29, 2026
…1070)

## What changed

This adds release 25's What's new entry, written from `18b39ae`. It
covers everything merged since release 24's `through` (`9ee90e3`) and
sets the `patchy` release to `0.25.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`. This is the second of three releases for #986:
single files publish as tier 1 pages, and nothing publishes tier 0 any
more.

| Change | PRs |
| --- | --- |
| New: Pages published from one HTML file can run script. A single file
is a tier 1 page of up to 10 MiB with inline script and style. An image,
font or stylesheet loaded from an address is refused at publish and
named. | #1045 |
| Improved: Pages and Tools sort by what a patch runs. Browser-only
patches shelve as Pages and patches with server code as Tools. | #1045 |

#1060 is release 24's own entry. #1045's tier 0 refusals (a repo still
at `tier: 0`, `init --tier 0` and the API's 422) get no line, because
production has no tier 0 repo.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **Rollback safety, from the live commit `dce0967` (release 24) to
`18b39ae`:**
  - No PR in the range is labelled `one-way`, and none adds a migration.
- A revert leaves tier 1 versions published from single files. Release
24's shell renders them with no notice, because #1044 dropped the 10 s
timer. Release 24's portal shelves them as Tools with a monogram, and
nothing breaks. Acceptance checked this by running release 24's server
on data this branch published.
- Rolling back further, to release 23, would cover those pages with
"This patch could not start" after 10 s, so release 24 is the floor.

**Rollback line:** If this release misbehaves, roll back to `dce0967`
(release 24). Rolling back past release 24 would put "This patch could
not start" over single-file pages published in this release, so don't go
further.

## How it was verified

- **Tests.** `whatsNew.test.ts`, `WhatsNewPages.test.ts` and
`schemas.test.ts` pass (21 tests), and prettier passes on the changed
files.
- **The range.** #1045 had GPT 6.1 Sol reviews with every finding
resolved, and its rebase onto #1047 had a separate Sol review with no
findings. Acceptance was PASS with notes at its merged head. It landed
with all 12 required checks green, including `rollback-rehearsal`
against release 24.
- **Deploy state.** The live commit, pinned from `/healthz/deep`, is
`dce0967` (release 24). The Deploy run updated last (#26) succeeded, and
none is unfinished.
- **Known effect.** One public page in production uses `about:srcdoc#`
links for its table of contents. They keep working until the page is
republished, and its owner is told before this deploys.

## Release impact

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

Text and version numbers only. The `0.25.0` bump tells CLIs and patch
repos installed before this deploy to upgrade, as every release does.

- **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]>
allisonmahmood added a commit that referenced this pull request Oct 29, 2026
## What changed

Tier 0 is gone. Stored tier 0 pages become tier 1 pages, served in the
sandboxed frame from their content URL like any other page. Tiers now
count from 1. A repo config that still says `tier: 0` is refused with
the fix, and a tier 0 publish an older CLI left pending is cleared
instead of wedging publishing.

Closes #986 (PR 4 of 4). It lands on main after release 25 (#1045),
which is live.

- **Migration `0029_tier_zero_is_tier_one`** (patches capability). In
one transaction, every `patch_versions` row at tier 0, deleted patches'
included, gets `tier = 1`, `manifest.tier = 1` and
`publish_response.tier = 1`. `payload_digest` is untouched, so a
same-key retry still replays. The CHECK becomes `tier BETWEEN 1 AND 3`.
- **Wire.** `Manifest.tier` and the publish response's `tier` are `1 | 2
| 3`. A raw tier 0 manifest answers `tier_mismatch` before decoding, in
#1045's words; #1045's post-decode check goes with the narrowed type.
Replay runs before release validation, so migrated receipts replay as
they are. `InvalidHtml` leaves the publish contract, because only tier 0
could raise it.
- **Server.**
  - The safe-HTML branch and `PATCHY_MAX_HTML_BYTES` are gone.
- Owner actions keep their own 1.5 MiB request cap, the same value as
before.
  - The publish envelope stays three times both bundle caps.
- **Serving.**
- Every shell frames its version's content URL. The srcdoc path and the
static CSPs are gone, leaving one content policy and one shell policy.
- `PATCH_CONTENT_SECURITY_POLICY` stays for notices, without the
`about:` allowances only srcdoc needed.
  - `framedDocument` stays for `patchy look preview --compare`.
- **CLI.**
  - `init --tier` takes 1 or 2, and the config type is `1 | 2 | 3`.
- A `tier: 0` config gets "Tier 0 is now tier 1. Set `tier: 1` and run
`patchy refresh`." (`tier_mismatch`, exit 1) from config execution
itself, so refresh refuses it too, not only publish and dev. #1045's
`refuseTierZero` goes; it can't see tier 0 through the narrowed type.
- A pending tier 0 attempt is cleared with a message to run `patchy
list` and publish again if the page is missing.
- The tier 0 branches are gone from `repoBuild`, `bundleCheck`,
`devServer` (always `documentTitle`, always a colleague URL),
`initProject`, `Project`, `generateClient` and the scenario schema.
- **Core.** `validateHtml`, its accept/reject fixtures and their readers
are gone. `isPage` is `tier === 1`. The parse-bound coverage now runs
through `documentTitle`. The look tests' Inter subset moved to
`packages/core/fixtures/looks/inter.css`, licence line kept.
- **Sweep.**
  - Test helpers and fixtures publish tier 1.
  - `seed:dev` publishes two inline single-file pages.
  - The packed Preact e2e uses tier 1.
  - CI's ambient poison is `PATCHY_MAX_BUNDLE_BYTES: "1"`.
- The rollback rehearsal expects live-query deliveries only for pages
that subscribe, or that step 1 saw deliveries for. Every repo page used
to be required to deliver, which a page without the SDK never does after
#1044.
- **Docs.** The tier sections of `docs/product.md`, AGENTS/CLAUDE and
README; ADR-0004, 0006 and 0010; DEVELOPMENT, OPERATIONS and
SKILL_DISTRIBUTION; scenarios; the patches, portal and serving
glossaries and the map; the `patchy-look`, `patchy-loop` and
`patchy-server` project skills; the global skill with its lock hash; the
`ui-consistency` review spec; `docs/API.md` re-rendered.

## Look at

**The migration**, on a database at the schema before it, in
`apps/server/src/migrations.test.ts` › "the tier 0 fold":

- A live tier 0 page, a deleted patch's tier 0 page, and tier 1 and tier
2 versions are inserted as old publishes stored them.
- After `migrate`, both tier 0 rows read `tier: 1` in the column, the
manifest and the receipt, with their digests unchanged. The tier 1 and 2
rows are untouched.
- A tier 1 insert, as the release before writes, still goes in. A tier 0
insert is a `ConstraintError`.

```
✓ apps/server/src/migrations.test.ts > the tier 0 fold > makes every stored static page tier 1, deleted ones too, in its row, manifest and receipt, and refuses tier 0 after
```

**A formerly static page, served scripted.**
`test/browser-tier1/single-file.spec.ts` replaces the srcdoc spec. A
single-file page (tier 1, no tables, files or SDK) opens with
`sandbox="allow-scripts allow-modals"` and a content URL, with no
`srcdoc`. Its `#sellers` link scrolls within the frame with no request.

```
✓ [chromium] › test/browser-tier1/single-file.spec.ts:5:1 › a single-file page opens in the scripted frame and its same-page link scrolls (231ms)
```

**The CLI's way out of tier 0.**

```
✓ packages/patchy/src/executeConfig.test.ts > refuses a config still at tier 0, saying how to move it, with resolution true
✓ packages/patchy/src/executeConfig.test.ts > refuses a config still at tier 0, saying how to move it, with resolution false
✓ packages/patchy/src/State.test.ts > clears an older patchy's tier 0 attempt, which can't be sent again, saying what to check
```

A raw tier 0 manifest is refused by name at the API, before decoding,
with #1045's exact answer, so the contract doesn't change between R2 and
R3:

```
✓ packages/patches/src/PatchesApi.test.ts > refuses unsupported tiers and missing connections before writing content
  → 422 { ok: false, code: "tier_mismatch", error: "Tier 0 is now tier 1. Publish with a tier 1 manifest; a current patchy CLI sends one." }
✓ packages/patchy/src/cliRepoPublish.test.ts > refuses a tier 0 repo by publish and dev before building, and init at tier 0   (#1045's test, kept)
```

<!-- patchy-dev:transcript:tier-zero -->

#### Transcript `tier-zero`

Recorded before the rebase onto main. Before is `1d53fee` (--base
origin/tier-fold/3-file-pages-tier1) and after is `d400586`
(tier-fold/4-no-tier0), whose tree is the head's (`6a0d3ec` only rebased
onto `1d53fee`), 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 and login-code shapes, email addresses outside the
scenarios' example domains, secret-named variables, and any accounts the
run acts as).

1 of 2 lines changed.

##### A repo whose config still says tier 0 refreshes, then publishes

**Changed.** Before, exit 0 in 1.7 s; after, exit 1 in 1.5 s.

```console
$ patchy init brief --purpose "A one-page brief" --json > /dev/null && sed -i 's/tier: 1,/tier: 0,/' brief/patchy.config.ts && cd brief && pnpm patchy refresh --json
[stderr]
{"ok":false,"error":"Tier 0 is now tier 1. Set `tier: 1` and run `patchy refresh`.","kind":"local","code":"tier_mismatch"}
```

```diff
-{"ok":true,"release":{"from":"0.22.0","to":"0.22.0"},"changed":{"pin":false,"generated":["patchy/_generated/manifest.json"],"skills":[],"fixtures":[]},"addedCapabilities":[],"warnings":[]}
+[stderr]
+{"ok":false,"error":"Tier 0 is now tier 1. Set `tier: 1` and run `patchy refresh`.","kind":"local","code":"tier_mismatch"}
```

<details><summary><code>$ cd brief &amp;&amp; pnpm patchy publish
--json</code>: no change, exit 1 in 0.6 s</summary>

```console
$ cd brief && pnpm patchy publish --json
[stderr]
{"ok":false,"error":"Tier 0 is now tier 1. Set `tier: 1` and run `patchy refresh`.","kind":"local","code":"tier_mismatch"}
```

</details>

<!-- /patchy-dev:transcript:tier-zero -->

## How it was verified

- `pnpm check` steps (format, lint, typecheck, synth) pass.
- The focused suites pass: migrations, Server, ApiGuard,
StreamLifecycle, patches, serving, core, portal, mcp, primitives, api,
SDK, runtime, the dev scripts and the touched CLI files.
- `pnpm test:browser` passes all 83, the new spec and look preview
included.
- `pnpm verify` passes postgres-concurrency, cli-smoke, install and
tier2-smoke.
- The full offline `pnpm test`: 2544 of 2566 pass. The failures are only
in the CLI stub suites (`cli*.test.ts`) and two execution timing tests
(`LocalTaskProvider`, `Supervisor`). They are a different set on every
run, always an unauthenticated `GET /` arriving at a local stub, from
the shared machine's local port probing. PR 1, 2 and 3's verifies on
this machine show the same rotating set. CI, without that prober, is the
arbiter.
- **Rollback rehearsal, run locally with live = #1045 (before the rebase
onto #1047, #1044 and #1045; see the acceptance verdict for runs at the
current head):** `pnpm test:rollback-rehearsal --live 6d9ac75` passed
every step, before #1045's tier 0 refusal (4473d2f) and the rebase onto
it. The rebase adds only refusals; the migration and serving are
unchanged.

  ```
  Rehearsing 6d9ac75 → 5008d4d → 6d9ac75 → 5008d4d on one set of data.
  ▶ Step 1: the live commit (6d9ac75) seeds the data      passed in 48s
  ▶ Step 2: HEAD (5008d4d) upgrades it                     passed in 25s
  ▶ Step 3: the live commit (6d9ac75) comes back           passed in 21s
  ▶ Step 4: HEAD (5008d4d) comes back                      passed in 21s
Exercised rollback paths passed: 6d9ac75 → 5008d4d → 6d9ac75 → 5008d4d,
in 115s.
  ```

**CI's `rollback-rehearsal`** replays live → head → live against
production's live commit, now release 25 (`38e0c37`). Before release 25
was live, the live step published a file page as tier 0, which the
narrowed CHECK refuses on the way back. That's why its earlier runs here
failed. The acceptance verdict on `b55f247` reran the rehearsal locally
with `--live 38e0c37` and `--live 18b39ae`, and both passed.

**Not done here.**

- **`pullKind`.** The snapshots stack (#996 → #1003 → #1004) hasn't
merged, so `pullKind` is unchanged. When it lands, `pullKind` should
become `repo === null && originalFilename !== null`, with the snapshot
check still first.
- **Migration id.** #996 (`0029_version_repo_snapshots`) and #995
(`0029_company_guests`) also claim `0029`. Whichever lands first, this
migration renumbers at rebase.
- **A known, accepted break.** A page whose links are written
`about:srcdoc#…` stops jumping once it's served scripted. Its owner is
being told separately; there's no workaround here.

## Release impact

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

The manifest and config no longer accept tier 0, and the migration
rewrites stored rows.

**Upgrade path:**

- A repo whose `patchy.config.ts` says `tier: 0` is refused with the
fix: set `tier: 1` and run `patchy refresh`.
- `patchy init --tier 0` is gone.
- An instance that set `PATCHY_MAX_HTML_BYTES` can drop it; nothing
reads it now.

- **What does a revert leave behind?** Migrated rows: stored tier 0
versions are tier 1 in their column, manifest and replayed receipt. The
CHECK is narrowed to `tier BETWEEN 1 AND 3`.
- **Does the release before it still work with that?** Yes, for R2
(#1045) and later. R2 serves tier 1 rows through the scripted frame and
its CLI publishes single files as tier 1, so it reads the migrated rows
and writes nothing the CHECK refuses. The same holds while R2 and R3
hosts overlap during the deploy. Rolling back past R2, to a release
whose CLI publishes tier 0 file pages, is not safe, so rollback is only
safe to R2 or later. Given that, this PR carries no `one-way` label.
#1045 refuses tier 0 repo configs and tier 0 manifests (4473d2f), so an
R2 host never tries a tier 0 write against the narrowed CHECK.

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:ci CI, shared testing infrastructure, development scripts and tooling area:docs Touches the docs area area:server Touches the server area size:m 100-500 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant