Skip to content

chore(deps): bring the remaining dependencies up to date - #1424

Merged
allisonmahmood merged 17 commits into
mainfrom
deps/remaining-dependencies
Nov 18, 2026
Merged

allisonmahmood merged 17 commits into
mainfrom
deps/remaining-dependencies

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

What changed

Brings every outdated dependency outside the Effect, TypeScript, TanStack Hotkeys and workerd lanes up to the newest release pnpm's one-day minimumReleaseAge installs, and clears the repo's open Dependabot alerts (undici, minimatch). People using Patchy notice nothing. Their next CLI release ships Preact 11.2.0, parse5 8.1.1 and undici 8.12.4.

Supersedes the Dependabot PRs in the table, which stay open for Allison to close. One commit per package or group.

Package From To Supersedes
@aws-sdk/client-s3, @aws-sdk/client-ecs 3.1146.0 3.1167.0 #1399, #1390
@clerk/backend 3.23.0 3.27.0 #1398
tough-cookie 6.0.2 6.1.0 #1397
rolldown 1.2.15 1.3.2 #1396
rolldown-plugin-dts 0.28.8 0.30.2 #1388
posthog-node 5.55.0 5.69.0 #1395
@babel/parser, @babel/types 8.0.8 8.1.2 #1394, #1393
preact (bundled in the CLI) 11.1.0 11.2.0 #1392
vitest 5.0.5 5.1.0 #1389
@playwright/test 1.63.0 1.65.0 #1387
parse5 (catalog) 8.0.1 8.1.1 #1386
imapflow 2.10.2 2.11.0 #1385
aws-cdk / aws-cdk-lib 2.1144.0 / 2.272.0 2.1148.1 / 2.276.0 #1383
oxlint, @oxlint/plugins / oxlint-tsgolint 1.90.0 / 7.0.2005 1.93.0 / 7.0.2006 #1382
npm, turbo, @electric-sql/pglite, semver, vite 12.2.1, 2.11.9, 0.5.10, 7.8.5, 8.3.4 12.2.2, 2.11.11, 0.5.16, 7.8.6, 8.3.8 #1401
papaparse 5.7.0 5.7.1 none
minimatch 10.2.6 11.0.8 none (alerts 21, 22)
undici (transitive, lockfile only) 8.11.2 8.12.4 none (alerts 13 to 18)

Newer releases exist for @aws-sdk/* (3.1168.0), @clerk/backend (3.28.0), posthog-node (5.71.0) and oxlint-tsgolint (7.0.2007), but they were still under a day old.

Look at

Why the three red Dependabot PRs failed, and the fixes.

  1. parse5 (chore(deps): Bump parse5 from 8.0.1 to 8.1.1 #1386, every test job). html-policy.test.ts expected <b><div> + 6,000 <br> + </b> to cross the HTML repair bound. parse5 8.1 now moves the children of an element closed out of order last child first (inikulin/parse5@e2901d06). That cost used to grow with the square of the child count, and the repair bound charges for exactly that cost. The old test described the old parser, not a product rule. The same page now parses in milliseconds and reads its title, as a browser does. The test now asserts that a 15,000-child block reads its title, and the comment on locate says why. Timed through documentTitle with 64 KB inputs, the bound that fires on each version:

    Input (64 KB) parse5 8.0.1 parse5 8.1.1
    <b><div> + <br>… + </b> repair bound, null 19 ms, title read
    <a><div> + <br>… + <a> repair bound, null 11 ms, title read
    <table><b><div> + <br>… repair bound, null 9 ms, title read
    500 distinct <b a=n> + x<p>… created bound, null created bound, null (234 ms)
    deep <span><div> pairs depth bound, null depth bound, null

    Every other shape I tried parses in under 20 ms on 8.1.1.

    The sibling-repair bound keeps a test of its own. On 8.1.1 no known input reaches MAX_REPAIR_WORK. A fuzz of about 22,000 generated documents and fragments, repeated motifs over tables, formatting elements, foster parenting and adoption, never had a single move pass more than one sibling. With the check removed, every parse test still passed, because their refusals come from the created-node and attribute bounds. The bound stays as the guard against a parser release that moves front first again, as parse5 did before 8.1, and the comment on locate now says so. Its test drives the bounded tree adapter directly (boundedTreeAdapter, now exported from the module for it; core's package exports are unchanged). Detaching 6,000 children last first passes, and detaching them front first is refused with the repair message. With line 91's check deleted, the test fails:

    × bounds error recovery that moves nodes from the front of a long sibling list 112ms
     FAIL  packages/core/src/html-policy.test.ts > boundedTreeAdapter > bounds error recovery that moves nodes from the front of a long sibling list
    AssertionError: expected [Function] to throw an error
          Tests  1 failed | 31 passed (32)
    

    With the check in place, 32 of 32 pass. parse5 8.1 also brings a series of security fixes: mutation-XSS cases where parse5's tree differed from a browser's, and quadratic parse times. bundleCheck and the HTML policy now see the tree a browser builds in those cases. The rest of packages/core, serving/src/shell, bundleCheck, repoBuild.test.ts and pageImports pass unchanged.

  2. Babel (chore(deps-dev): Bump @babel/parser from 8.0.8 to 8.1.2 #1394, lint). @babel/parser takes its AST types from @babel/types. With only the parser on 8.1.0, the CLI had two copies of the types, and editUses.ts, packagePin.ts and pageImports.ts failed to typecheck (Type 'ArrayExpression' is not assignable to type 'Node', plus an excessive-stack-depth error). Both now move to 8.1.2 together, and pnpm typecheck:tests is clean.

  3. Patch group (build(deps): Bump the patch-updates group across 1 directory with 6 updates #1401, test on Node). cliRepo.test.ts and cliRepoBuild.test.ts expect the loaded vite to match packages/patchy/src/toolchain.json's testedAgainst (expected 'Loaded vite 8.3.7 is unsupported' to contain 'Loaded vite 8.3.4 is unsupported'). Those files are Node-only, which is why Bun passed. testedAgainst and the patchy-loop skill's toolchain table now say 8.3.8, as chore(deps): bump 17 patch releases, including Effect 4.0.5 #899 did for the last vite bump. The accepted range stays ^8.3.0.

CDK synth. I synthesized the production example (synth:example's context) before and after the aws-cdk bump. Both templates differ only in the CDKMetadata analytics blob, which encodes the library version. No resource changed. The new feature flags are left unset and keep their old behaviour.

rolldown-plugin-dts 0.30 folds dtsInput into dtsOnly, so the release build now names the new option. The published .d.ts files are byte-identical except that preact.d.ts and the two JSX runtime entries keep their bare import "./preact/runtime.js". rolldown emits that as one _types/runtime-*.d.ts holding export {}. The plugin forces internal modules to keep side effects in dtsOnly mode, so there's no option to drop it. TypeScript reads it as an empty module.

Behaviour changes in changelogs, and why none needed a change here:

  • @clerk/backend 3.26.1 refuses the legacy cl_I7d4PD111III JWT category, which Clerk no longer issues. 3.28.0, not taken here, will refuse session JWTs without a cat header. We only call authenticateRequest on Clerk-issued tokens.
  • tough-cookie 6.1 refuses Secure cookies set from plain-http origins other than loopback, and wants an explicit Path=/ on __Host- cookies. It is used only in auth's tests, which pass.
  • posthog-node 5.57 to 5.69 change local flag evaluation, exception autocapture and email. We use only capture and shutdown, with GeoIP off.
  • @electric-sql/pglite 0.5.12 runs initdb with TZ=UTC, so new local .patchy/ databases default to UTC, as production does. 0.5.15 rejects committing an aborted transaction instead of resolving.
  • Preact 11.1.1 and 11.2.0 reach every page the CLI bundles. An on* prop with a non-function value no longer registers an event handler. A thrown null or undefined now reaches error boundaries as itself instead of a TypeError. A node that unmounts keeps its handlers, so an event already bubbling through it finishes. <template> in SVG and MathML now renders and hydrates. These are fixes to what a page observes. No change to patchy/preact was needed, and the packed Preact suite (one runtime, hooks, compat, signals, useQuery, dev debugging) passes.
  • imapflow 2.11 only adds an opt-in sessionExpires option.
  • The @aws-sdk clients gain features and fixes. S3 and ECS keep their protocols. @aws-sdk/client-ecs now sets a default socket timeout of 900,000 ms. That's moot here: every ECS call runs under our own Effect.timeout, which aborts the request through its abortSignal at 10 s for management calls, 40 s for list and 50 s for starts.
  • aws-cdk 2.1148 rejects a single-value option given twice. The deploy workflow repeats only -c, which takes many.
  • Playwright 1.64 forwards a device descriptor's screen, and 1.65 loads .css imports in test files as empty modules. The CI browser cache keys on playwright --version, so it follows the bump without a change.

How it was verified

  • Each red Dependabot failure was reproduced locally first, then the targeted suites ran green: html-policy.test.ts, typecheck:tests, cliRepo, cliRepoBuild, initProject, the Babel-using CLI suites, the auth suites that use tough-cookie, the IMAP suites, company-database, CSV, the labeler test, the lint plugin's tests and apps/infra.
  • pnpm audit went from 9 advisories (8 undici, 1 minimatch) to none. Under minimatch 10 and 11, every one of the 54 label globs matches the same 1,457 tracked files.
  • papaparse 5.7.1 parses the CSV test's 500,000-row input in about 300 ms, against about 470 ms on 5.7.0.
  • pnpm check: format, lint, typecheck and synth pass. The offline tests passed 3,603 of 3,613. The 10 failures were this shared machine, not the change: two timeouts under a load average near 40, and install.test.ts, which needs npm beside the Node that runs it while this shell's first node was a system build without one. Rerun alone on Node 24.20.0 (CI's and mise.toml's), those three files pass, 90 of 90.
  • pnpm verify on Node 24.20.0: format, lint, typecheck, synth, postgres-concurrency, cli-smoke, install, tier2-smoke and browser (Chromium and Firefox) pass. test and test (bun) failed on timeouts while the shared machine ran near load 45: 25 Node cases in 18 files and 9 Bun cases in 8 files, nearly all Test timed out. Rerun alone, the 8 Bun files pass (149 of 149), and 17 of the 18 Node files pass. The last one, PgliteCompanyDatabases.test.ts, timed out its 5 s case once more among the 18 and passes alone twice in about 1.6 s. PGlite 0.5.16 boots a fresh database as fast as 0.5.10 (1.1–2.4 s against 1.4–2.4 s over three cold boots each). CI's test (24) and test (bun) passed on this branch.
  • Not run locally: the live Clerk, Pidgeon, Attio and IMAP suites, which create real accounts and send mail, the server image and the rollback rehearsal. CI runs them.

Left out: embedded-postgres 18.6.0-beta.19. It swaps async-exit-hook, which patches/[email protected] fixes, for exit-hook 5. That honours process.exitCode on beforeExit, so the patch could go. But exit-hook also installs exit and IPC message listeners, and prints a termination notice on any explicit process.exit() while Postgres's async hook is registered. The dev supervisor, packed-cli-e2e.mjs and rollback-rehearsal.ts all manage those handlers by hand, so moving needs its own pass over their signal and exit codes.

Release impact

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

Library and tooling bumps. No API, schema, CLI flag or configuration change. The CLI release bundles a newer Preact, parse5 and undici. CDK templates are unchanged.

  • What does a revert leave behind? Nothing. Lockfile, manifests and one test change. No migration, data or infrastructure moves.
  • Does the release before it still work with that? Yes.

Made by Claude Opus 5.5 in T3 Code via Claude Code.

🤖 Generated with Claude Code

@allisonmahmood allisonmahmood changed the title build(deps): bring the remaining dependencies up to date chore(deps): bring the remaining dependencies up to date Nov 13, 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:core Touches the core area area:docs Touches the docs area area:primitives Patch tables and files area:integrations Company connections and integration implementations area:ui Portal and first-party browser pages, shared rendering and styles size:m 100-500 changed lines labels Nov 13, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Code review (GPT 6.1 Sol, xhigh) at c35d4a82: no runtime regression found.

Checked and held: parse5 8.1.1's trees differ from 8.0.1's only around foreign elements and misnested-markup recovery, matching upstream's browser-alignment fixes, with no newly permissive resource policy in pageImports, bundleCheck or the serving shell; Babel's parser and types resolve together at 8.1.2; every statement of the tested vite version agrees and 8.3.0, 8.3.4 and 8.3.7 are still accepted; the packed package's nine type and runtime entry points compile for a NodeNext consumer with skipLibCheck: false; minimatch 11 matches the same files for all 54 label globs across 1,457 tracked files; undici moved through an existing range with no new override; the CDK templates differ only in CDKMetadata; Clerk, PostHog, S3, ECS, IMAP and PGlite keep their behaviour on the paths this repo calls. effect stays single-version at 4.0.5 and workerd, TypeScript, the Effect checker and TanStack Hotkeys are untouched.

One finding, fixed in de67c503: after the parse5 test was rewritten, nothing covered the sibling-repair bound (repairWork > MAX_REPAIR_WORK). With the check disabled, all 31 HTML-policy tests still passed. No input was found that reaches the bound on parse5 8.1.1 (the review's probes, then a fuzz of about 22,000 generated documents). The bound stays as the guard against a parser release moving nodes front first again, and is now tested through the bounded tree adapter directly; that test fails with the check removed.

Two wording gaps in the body, also fixed: Preact 11.1.1 and 11.2.0 carry observable event and error-boundary fixes, and the ECS client's new default socket timeout is moot under this repo's own timeouts.

allisonmahmood and others added 16 commits November 18, 2026 20:38
…30.2

rolldown-plugin-dts 0.30 folds dtsInput into dtsOnly; the release build
now names the new option. The published declarations are unchanged
except that preact's entries now keep their bare runtime import, which
rolldown emits as one empty _types chunk.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The parser's AST types come from @babel/types, so moving one alone gives
the CLI two copies whose nodes don't assign to each other.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The CI browser cache keys on the installed Playwright version, so it
follows without a change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
parse5 8.1 moves the children of an element closed out of order from
the last one back (inikulin/parse5@e2901d06), so a long block under a
misnested <b> no longer costs the square of its children. The repair
bound counted that cost, and the test that a 6,000-child block crosses
it described the old parser: the same page now parses in tens of
milliseconds and reads its title, as a browser does. The bound stays for
any move that would pass a long list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The synthesized production templates are unchanged apart from the
CDK metadata that records the library version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…h releases

npm 12.2.2, turbo 2.11.11, @electric-sql/pglite 0.5.16, semver 7.8.6,
vite 8.3.8 and papaparse 5.7.1. The CLI tests expect the loaded vite to
be toolchain.json's testedAgainst, so it and the patchy-loop skill's
table move to 8.3.8; the accepted range stays ^8.3.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clears GHSA-g3hv-75wg-m249 (globparts amplification). The labeler test
only builds Minimatch objects and calls match(), which 11 keeps; every
label glob matches the same tracked files under 10 and 11.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@effect/platform-node 4.0.5 asks for undici ^8.11.2, and the lockfile
still held 8.11.2, which eight advisories cover (patched in 8.12.2). The
CLI bundles it through NodeHttpClient.layerUndici.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
parse5 8.1 makes every sibling move at the end of a list, so no known
input reaches the repair bound and no parse test would notice it gone.
It stays for a parser release that moves front first again, as parse5
did before 8.1, and its test now drives the bounded tree adapter
directly: detaching 6,000 children front first is refused, last first
is not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the deps/remaining-dependencies branch from fada193 to 0bc66ed Compare November 18, 2026 20:38
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 0bc66eda5916c9d93d07659f435e7fa59f024079 (base 4ee004becdd7532b37bdbad3c05b5f0fda52765f) on fresh team and brightline instances, by GPT 6.2 Sol in T3 Code.

Done means

  • Frozen install passed. pnpm 12.20.0 accepted the committed lockfile under the repository's one-day minimum release age. The lockfile's SHA-256 matched before and after, and the checkout was clean.
  • Updated tooling passed. pnpm check on Node 24 passed format, lint, typecheck, offline CDK synth and all 3,724 tests across 336 files. This included the 32 HTML-policy tests, the CLI repo-build tests and the PGlite, S3 and ECS suites.
  • Dependency alerts passed. The lockfile resolves minimatch 11.0.8 and undici 8.12.4, outside the affected ranges for the open alerts. pnpm audit reported No known vulnerabilities found. Dependency review
  • Runtime coverage passed. The offline run passed 57 GitHub and 56 Pidgeon tests in their provider suites, including connection pages and operations. The PostHog adapter flushed one synthetic event to a loopback receiver with GeoIP disabled. This head also passed the live Pidgeon suite. Pidgeon CI
  • Packed CLI and rendering passed. The packed CLI published and rendered a single-file page with 15,000 children in misnested markup and preserved its title. It rejected a page referencing an external image as non-self-contained. The head's CI passed the packed CLI and Preact smoke, tier 2 smoke, release tarball, server image, Bun tests, Postgres concurrency, and live Clerk and IMAP checks. CI · Server image · IMAP

Golden journeys

  • Sign in passed. Signed-out Home answered 401 with the sign-in door and private, no-store. Ben signed in with a dev persona, landed on Home and signed out to the same door.
  • Log a machine in passed. The packed CLI returned a URL and code. Ada confirmed the code in Chromium, whoami returned the named machine, and whoami refused after logout.
  • Publish a page passed. Ada published the page. Ben found it on Home and used its button in the patch frame. Retiring removed it from Home and took down the frame. Restoring brought the frame back at the same address.
  • Share and unshare passed. The signed-out kickoff page went 401 → 200 → 401 as Allison shared and unshared it. The public version rendered in its frame with public, max-age=60, Vary: Cookie and no session cookie.
  • Find and open a tool passed. Jordan saw Kudos on Home, found it by searching All patches and opened its frame.
  • Use a tool live passed. Jordan's kudos appeared on Priya's open page with zero page or frame navigations.
  • Use a tier 2 tool passed. Jordan moved a sample deal Lead → Discovery → Lead, and Allison saw both moves on her open board with zero navigations. Spend refused Jordan's attempt to approve his own request and left it waiting.
  • Invite and join passed. Ada invited a new dev persona, who chose Join Acme Co and landed on Home. Ada revoked a second pending invitation, deactivated Ben and reactivated him.

Rollback answers

Both answers match the diff. It changes dependency and build inputs, with no migrations, persisted-data changes, API or CLI contract changes, or declared infrastructure changes. Reverting returns to the prior dependencies. The rollback check passed its change detector. Rollback check

Not run

  • Live GitHub was skipped by CI because the test credentials were unavailable. GitHub coverage for this verdict is offline. GitHub workflow
  • The disposable run used dev personas, a loopback analytics receiver, and local storage and execution. It did not exercise live vendor accounts, production services, or deploy and rollback. The live CI results above are separate from the disposable run.

Notes

  • At posting time, the full Chromium and Firefox suites, Node 22 suite, Linux installer and live Attio were pending in CI. The Chromium journeys above finished independently on this head. PR checks

@allisonmahmood
allisonmahmood merged commit 47deb91 into main Nov 18, 2026
29 checks passed
@allisonmahmood
allisonmahmood deleted the deps/remaining-dependencies branch November 18, 2026 20:56
@allisonmahmood allisonmahmood mentioned this pull request Nov 18, 2026
1 of 2 tasks
allisonmahmood added a commit that referenced this pull request Nov 19, 2026
…1426)

## What changed

Effect moves from 4.0.5 to 4.1.4 (`effect`, `@effect/platform-node`,
`@effect/sql-pg`, `@effect/sql-pglite`, `@effect/vitest`). People using
Patchy see no difference. Nothing stored changes: tokens, digests, HMACs
and sealed values are still made and checked by the same `node:crypto`
code. This supersedes #1380, whose CI was red because 4.1 stores
`HttpApiSchema.status` where our `refuse()` didn't look, so every
refusal answered 400.

Beside the Effect group, the lockfile moves only ws, to 8.23.0, which
`@effect/platform-node-shared` 4.1.4 pins exactly. undici 8.12.4 and
PGlite 0.5.16, which the 4.1 packages need, are already on main from
#1424, so the workspace holds one PGlite again.

## Look at

**Crypto.** 4.1 replaces `effect/Crypto` with per-family services and
drops crypto from the runtime `*Services` bundles. The `Cryptography`
seam stays as it was. `NodeCryptography.layer` now also provides
Effect's `SecureRandom` and `Digest`, using Effect's own Web Crypto
layers: no new dependency, nothing at import time, and the same
behaviour on Node and Bun. Every entrypoint and test layer already
provides it, so "provide `NodeCryptography.layer`" stays the one rule.
The seven direct `effect/Crypto` users take `SecureRandom` or `Digest`
instead. `@patchy/limits` can't depend on core, so `Digest` is what it
uses. AGENTS.md, the service-conventions spec and the oxlint messages
say this now.

**Refusal statuses.** 4.1's `HttpApiSchema.status` writes a key
annotation, which `SchemaAST.resolveAt` doesn't read. HttpApi's own
reader, `getStatusErrorSchema`, is internal and missing from the
published types, so `respond.ts` follows its rules exactly:
1. The last check that sets a status wins, looking into check groups
too.
2. Otherwise the schema's own annotation counts, and an explicit
`undefined` clears the status.
3. Otherwise the key annotation counts.
4. With none of those, the status is 500.

`respond.test.ts` compares each case with HttpApi's own reader. One
consequence: a schema with no status now answers 500, where it used to
answer 400. No current refusal schema lacks one.

**Request targets.** 4.1's server adapter turns an absolute-form target
into its path, and sets `Host` to the target URL's host, which drops
userinfo and the scheme's default port. The door's `Host` gate then saw
a cleaned-up host, so `POST http://<public host>/mcp` and `POST
https://user@<public host>/mcp` reached the bearer check instead of
answering 421. `RequestTrust.requestAuthority` now reads the target and
the `Host` fields from the Node request as the client sent them
(`request.source`). Sources without raw fields, such as a web `Request`
or the in-memory test client, keep the old reading. I also checked
everything else that reads the target or `Host`:
- The API guard, serving and the portal resolve `request.url` against
the configured origin, and compare `Origin` rather than `Host`. They
don't trust the target's authority, and the rewrite makes an absolute
target reduce to its path.
- The CLI dev server's DNS-rebinding guard compares `Host`. Browsers
send origin-form, which the adapter leaves alone, so the guard still
does its job.
- Two private listeners now accept an absolute-form target where they
used to refuse it before authentication, and the behaviour stays as it
is. The callback gateway (`CallbackGatewayApi.ts`) used to answer `POST
https://anything/callback` with 200 `invalid_request`; now it reaches
the bearer and identity checks. The supervisor's callback proxy
(`supervisor.ts`) looks up its callback path from the rewritten target.
Neither grants anything the checks behind it don't already require.

**Oversized uploads.** Under 4.1, an undeclared (chunked) body over its
cap is answered instead of reset. But the adapter then keeps reading up
to 256 KiB more with no deadline, so a sender that stalled kept its
connection until the runtime's own timeout. A declared length over the
cap had the same problem below 256 KiB, on origin/main as well.

A size refusal now closes the connection, through one hook:
`closeAfterAnswer` in `@patchy/api`. It adds `Connection: close` to the
current request's answer, and the adapter then ends the socket and
destroys it within its 500 ms grace. Measured here, the server closed it
about 7 ms after answering, on Node and on Bun. Every capped reader runs
the hook, for a cap crossed mid-stream and for a declared length over
the cap. Each keeps its existing status and body:
- `readBody`, for every JSON API route that reads one: 400 "Malformed
request body." mid-stream, 413 declared.
- The 16 form readers in auth and portal, through `capBody(maxBytes)`:
beta links, device login, the OAuth token request and consent answer,
machines, shortcuts, logout, terms, What's new, patch pages, sharing,
home (two), feedback, user lifecycle, and pinning. Their declared-length
prechecks run the hook too.
- The runtime's call, file and stage readers (413), and the
subscriptions stream (413).
- The callback gateway: the file bound and the byte budget answer, as
before, with a 200 refusal body.
- The supervisor's callback proxy (413).

One reader is left out: the MCP door reads a chunked body to its end by
design, so its refusal is unchanged. The device start, device poll and
shortcuts descriptions, and `docs/API.md`, say what the code does.
Nothing is stored on any refusal.

**Row ids.** 4.1's `SecureRandom.uuidV7` counts within a millisecond: 42
counter bits and 32 random. #214's contract test pins 74 random bits per
id, and Effect's own docs say a monotonic id reveals the one minted
before it. So `TableOperations` builds the UUIDv7 itself from the Effect
clock and 16 bytes from `SecureRandom`, clamping the timestamp to the
48-bit field as 4.0 did.

**Other behaviour 4.1 changed that tests asserted:**
- A failed migration step is a typed `MigrationError` (`kind: "Failed"`)
instead of a defect. Startup still fails and the process exits.
- The CLI parser now splits `-json=true` into `-j -s -o -n`, so
`jsonRequested` stops treating it as `--json`. A global flag's bad value
(`--log-level loud`) now goes through Effect's usage path like any other
parse error. That made the entrypoint's `InvalidValue` catch dead, so it
is gone. Under `--json` stdout stays empty; without it, usage comes
before the one line, as ADR-0004 allows.

**Mechanical.** `SqlClient.make` takes a `driver`, and `sql.insert`
takes a non-empty array. `docs/API.md` drops the eight duplicate
`RuntimeFailure_N` components that differed only by status.

**On top of the GitHub integration.** Everything on main since #1427 was
written against 4.0.5: the GitHub App connection (#1448) and its reads
(#1451), workerd binding its own port (#1444), CLI refresh (#1446) and
sidebar pins (#1437). Checked against each 4.1 change:
- **Crypto.** None of it uses `effect/Crypto`. `Cryptography` gains
`rsaSha256Sign` for the App's JWT, which runs on `node:crypto` like the
rest, and `NodeCryptography.layer` still provides it beside
`SecureRandom` and `Digest`.
- **Statuses.** It adds no routes and no status-bearing refusal schemas.
GitHub's refusals reach clients through the existing connection pages,
`ConnectionsApi` (whose declared errors HttpApi encodes itself) and the
runtime, which takes its status from the error. The GitHub, connections
and dev-read suites assert those statuses over `HttpApiTest` and real
sockets, and pass on 4.1.
- **Body reads.** The one new body read is the pin form, which provided
`MaxBodySize` directly. It now goes through `capBody`. GitHub's connect
flow adds none: its filter is a GET, and its choices post through the
connection page's existing form read, which #1434 caps.
- **Targets and `Host`.** The GitHub sign-in's redirect URI is built
from the configured origin, and nothing new reads `Host`.
- **The rest.** Nothing new calls `SqlClient.make`, the Migrator,
`uuidV7` or `ws`, and no new flag uses a single-dash long spelling.

**On top of Pidgeon's new API.** #1458 rewrote the Pidgeon integration
against 4.0.5, and nothing in it needed a 4.1 change:
- Its crypto goes through `Cryptography`.
- It adds no routes, status-bearing refusal schemas, body reads or CLI
flags. Its connect page posts through the connection page's existing
form read, which #1434 caps.
- It doesn't call `SqlClient.make`, the Migrator or `uuidV7`.
- Its migration `0044_pidgeon_drafts` joins the record behind this
branch's, and the record and upgrade tests pass.

## How it was verified

**Red, then green, on Effect 4.1.4:**

| Case | At 8980889 | Now |
| --- | --- | --- |
| `RequestTrust.test.ts`, the gate behind the real `NodeHttpServer`
adapter: `POST http://cloud.patchyhq.com/mcp` | passed the gate | 421 |
| `McpDoor.test.ts`, the whole server: `POST http://user@<host>/mcp` |
400 (past the gate) | 421 |
| Same tests: origin form, the door's own absolute target (200), two
`Host` fields | — | unchanged |
| `AuthApi.socket.test.ts` (JSON) and `AuthPages.socket.test.ts` (form):
an unterminated 8 KiB chunked upload | 400, connection still open at 3
s, on Node and Bun | 400, then closed, on Node and Bun |
| `AuthApi.socket.test.ts`: `Content-Length: 8192` sent with no body
(open on origin/main too) | 413, still open at 3 s, on Node and Bun |
413, then closed |
| `RuntimeApi.test.ts`: a call streamed just past its cap, a stage
upload streamed past its cap, and a stage upload declared past it | 413,
still open at 3 s, on Node and Bun | 413, then closed |
| `RuntimeStreamApi.test.ts`: a subscriptions body streamed past its cap
| 413, still open at 3 s, on Node and Bun | 413, then closed |
| `CallbackGatewayApi.test.ts`: a callback file body streamed past its
bound | 200 refusal, still open at 3 s, on Node and Bun | 200 refusal,
then closed |
| `respond.test.ts`: a status set inside a check group | 409 | 403, as
HttpApi |
| UUIDv7 contract: a clock at −1 ms | timestamp field all ones | 0 |

**Suites:**
- On the head rebased onto main at 2a17d16, which now carries the
Effect checker at 0.68 (#1425), `pnpm check` passes in full (3741
offline tests).
- `pnpm verify` on the previous head, on main at 47deb91:
- Pass in the full run: format, lint, typecheck, synth, the offline
tests on Node (3732) and Bun (3405), postgres-concurrency and install.
- Pass rerun alone: cli-smoke, tier2-smoke and the Chromium browser
suite (189). In the full run they couldn't find the browser builds that
Playwright 1.65 (from #1424) asks for; once installed, all three pass.
- Could not start: the Firefox suite, because Firefox there lacks the
system libraries it needs. CI's required `browser-firefox` job covers
it, and it passed in an earlier round (186 tests).
- The suites the Pidgeon rewrite touches pass on Node and on Bun (646
tests across 72 files each): all of `packages/integrations` and
`packages/api`, the CLI's `pidgeon`, dev-resource and dev-preparation
tests, and the server's migration record test.
- The GitHub integration's suites, run alone on 4.1, pass on Node (361
tests across 27 files, with portal and the CLI's repo, global-CLI and
dev-resource files) and on Bun (286 tests across 24 files; the CLI files
run on Node only). They cover:
- `github/Connections.test.ts`: connecting through the App against a
stub GitHub on real sockets.
  - `github/Operations.test.ts`: the reads.
  - `github/Pages.test.ts`: the connect pages.
- `github/Source.test.ts` and `Generate.test.ts`: the source and
generated tables.
- `ConnectionsApi.test.ts`, `ConnectionPages.test.ts` and
`DevReads.test.ts`, with their status assertions.
  - `NodeCryptography.test.ts`, including RS256 signing.
- Each rebase took main's lockfile and regenerated it with `pnpm
install`; it differs from main's only in the Effect group and ws.
- `install.test.ts` builds its PATH from the running Node, so these runs
put the repo's pinned Node 24 first.
- The supervisor's callback proxy gets the same hook, but has no socket
test: reaching it needs a live workerd resident to register the callback
path and capability.
- Not checked: the server image (`server-image` needs Docker; CI runs
it), live Clerk, and a deploy.

## Release impact

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

This is a dependency bump, and the stored formats and the API's statuses
and bodies are unchanged. Three things a client could notice:
- An oversized chunked upload now gets its refusal and a closed
connection, where it used to get a reset.
- A declared length over a cap gets its 413 and a closed connection,
where the connection used to stay open.
- The undocumented single-dash `-json=<b>` spelling is no longer read as
`--json`. `--json` and `--json=<b>` are unchanged.

- **What does a revert leave behind?** Nothing: no migration, no new
stored shape. Ids, tokens, digests and sealed values are made the same
way on both sides.
- **Does the release before it still work with that?** Yes.

Built by Claude Opus 5.5 in T3 Code via Claude Code.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 19, 2026
## What changed

A few forms never got a body cap, so the server read whatever was sent
to them: creating or joining a company, People and Agent access, Teams,
the integration connection forms, and the local dev server's agent door
and shortcuts form. They now cap their reads as the rest of Patchy's
forms do. A submission over the cap gets the answer that page already
gives a form it can't read, and the connection closes.

Builds on #1426, now merged, which added `closeAfterAnswer`.

## Look at

**`capBody` now refuses a declared length over its cap before reading.**
Until now it noticed an overflow only once the bytes arrived, so a
sender that declared `content-length: 4097` to a 4 KiB form and sent
nothing got no answer until Node's request timeout. It now fails at
once, with the same `HttpServerError` the platform raises mid-stream.
Each page answers it as it answers any unreadable form, and the
connection closes after the answer. The forms in auth and portal that
already read through `capBody` alone get the same: logout, terms, beta
links, machines, What's new, patch pages, sharing, home, feedback and
user lifecycle. Their answer is unchanged; it just comes without the
wait. Readers that check the declared length themselves (`readBody`,
device login, OAuth) answer their own 413 first, as before.

With the new socket test over `capBody` without that check:

```
AssertionError: /join {"declared":4097}: expected +0 to equal 400
```

With it, the test passes.

**The caps**, each sized from the largest legitimate submission of its
form:

| Reader | Cap | Why |
| --- | --- | --- |
| `/join` (`Join.ts`) | 4 KiB | an invitation id, or a company name of
up to 200 UTF-16 units (at most 9 bytes each once percent-encoded: 1,800
bytes) and a 32-character handle |
| People › Invite (`CompanyPage.ts`) | 233,596 bytes (about 228 KiB) |
worked out from the address schema: an address is up to 254 UTF-16
units, each at most 9 bytes once percent-encoded (a three-byte UTF-8
character; a four-byte one is two units, 6 bytes each), and a separator
at most 9 (a comma or semicolon and a CRLF). The cap reads twice a full
batch of those, so a longer paste is refused by its count, and 4 KiB
more for the role and the list's filter: 2 × 50 × 2,295 + 4,096 |
| People › role and Resend, Agent access (`CompanyPage.ts`) | 1 KiB |
one hidden field each |
| Teams, all five forms (`TeamsPage.ts`) | 8 MiB | a roster form carries
up to two member ids per person (a shown member's removal and its keep
box), about 70 bytes a person. Nothing limits how many people a company
holds, so the cap sits far past any roster the page could show at once:
about 119,000 people. It was 1 MiB (about 14,000 people) until
acceptance submitted a 16,000-person roster and was refused. A team name
is 100 code points (1,200 bytes at most) |
| Every connection form (`formBody` in `ConnectionPage.ts`) | 256 KiB |
Postgres's connection string may be 16,384 characters, up to 9 bytes
each once encoded (147,456 bytes), beside a handle and a description |
| Dev server `/~dev/agent` | `mcp.body.bytes` (1,114,112) | the call as
Patchy MCP reads one: the tier 2 argument cap plus 64 KiB of envelope |
| Dev server `/api/me/shortcuts` | 4 KiB | as Patchy's own
`/api/me/shortcuts` reads it |

**How an over-cap form answers** is how that page already answers an
unreadable one:

- Join, People, Agent access and Teams: the auth pages' 400 "Invalid
form" door.
- Connection forms, Pidgeon's and GitHub's included: the form again with
400 "The form could not be read. Submit it again."
- Dev server shortcuts: 400 `Send value=on or value=off.`
- Dev server agent door: the refusal Patchy MCP's door gives a body over
its cap, `too_large` in the door's words, as the dev agent's usual
answer, so `patchy dev agent` reports a refusal and exits 2 (below). A
malformed call within the cap keeps its 400 `Bad request`.

**An over-cap `patchy dev agent` call is the door's `too_large`.** A
plain 400 would have made the CLI say the tool "may or may not have run"
and exit 3, when the call was refused before anything started. A body
over `mcp.body.bytes` is refused unread, so the dev server answers with
the door's own refusal of such a body. That refusal, `bodyTooLarge`, now
lives in `@patchy/api` beside the other shapes of a tool call's answer,
and the door's 413 reads its words from there, unchanged. `patchy dev
agent` then exits 2 with the door's words, as the README and ADR-0004
already say any refusal the door would give does; both now name this
`too_large` beside the oversized read. Answered before the body is read,
the CLI's own client (undici) still reads the refusal: a 1,114,155-byte
call gets it, in each of four runs.

**`test/socket.ts`.** `stalledUpload` reads the answer's
`content-length` and rejects when the server closed before the whole
answer arrived, so a close that cuts a refusal short no longer passes
for one. It returns the body, so tests assert which refusal came back.
Against a throwaway server, a whole answer resolves, one cut 5 bytes
short rejects with "The server closed the connection 5 bytes short of
its answer's body.", and a close with no answer rejects too. The five
suites that already used it pass unchanged.

## How it was verified

Each reader gets a body one byte past its cap over a real socket
(`NodeHttpServer.layerTest`), twice: as one chunk that never ends, and
as a declared length with nothing sent. Each must answer its whole
refusal and close within 3 seconds. Routes that share a reader share one
case.

- `AuthPages.socket.test.ts`: Join, the four People and Agent access
reads, Teams.
- `ConnectionPages.test.ts`: the connect form, through the one
`formBody` every connection form reads with.
- `devServer.test.ts`: both dev server readers, inside the existing dev
server test, so it boots once. The agent door's answer is the door's
refusal, also sent through the CLI's own client; a malformed call within
the cap is still a 400.
- `cliDevAgent.test.ts`: `patchy dev agent` given that refusal exits 2
and prints the door's words, in text and `--json`.
- `CompanyPage.test.ts`: a full batch of the longest addresses the page
accepts (50 addresses, 114,924 bytes with the longest filter) is read
and invites all 50; twice that (228,024 bytes) is refused by its count,
"That is 100 addresses". The socket case refuses one byte past 233,596.

Red, with one piece taken out at a time, then green with it back:

| Taken out | Failing assertion |
| --- | --- |
| `capBody`'s declared-length check | `/join {"declared":4097}: expected
+0 to equal 400` |
| Teams' cap (at its first value, 1 MiB) |
`/settings/company/teams/create {"chunked":1048577}: expected +0 to
equal 400` |
| The connection forms' cap | `{"chunked":262145}: expected +0 to equal
400` |
| The dev agent door's cap | `POST /~dev/agent HTTP/1.1
{"chunked":1114113}: expected +0 to equal 200` |
| The dev agent door's refusal (its plain 400 back) | `POST /~dev/agent
HTTP/1.1 {"chunked":1114113}: expected 400 to equal 200` |
| The invite cap's arithmetic (64 KiB back) | the full batch: `expected
400 to equal 303` |

Existing page tests post real forms through `HttpServerRequest.fromWeb`,
which enforces `MaxBodySize` as the socket does, so a cap below a
legitimate form would fail them. They pass, including the 51-address
invite refusal and every connection form.

Rebased onto #1426's earlier head (`b1310609`, on main at `47deb913`,
with Pidgeon's new API from #1458 and the dependency sweep from #1424),
`pnpm check` passes in full: format, lint, typecheck, synth and all
3,736 offline tests. Neither #1458 nor #1424 added a body read.
Pidgeon's connect form now posts through the shared `formBody`, so the
256 KiB cap covers it, and Postgres's connection string is still the
largest thing a connection form carries. The suites this PR and the
rebase touch pass on Node (810 tests, before the sweep landed:
`packages/integrations`, `packages/companies`, `packages/api`,
`packages/mcp`, the auth socket and company-page tests, and the CLI's
dev-agent, dev-server and `pidgeon` tests). On Bun at this head they
pass too (803; the dev-agent and dev-server files run on Node only).

`pnpm verify` ran before the rebase, at the first commit, `6e54ccd5`, on
a shared machine under heavy load (load average 40 to 60 during the test
phases). Format, lint, typecheck, synth and every acceptance suite
passed: postgres-concurrency, cli-smoke, install, tier2-smoke, browser
and browser-firefox. The offline `test` and `test (bun)` phases each
failed some tests: timeouts in files this PR doesn't touch, a different
set on each run. Rerun alone at low load, all of them passed (10 files
on Node, 6 on Bun). The socket cases ran in both phases, except
`devServer.test.ts`, which is Node-only, as the CLI is. The installer
suite needs `npm` beside the `node` it runs; with the pinned Node first
on `PATH` it passes.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required: forms people submit read as
before; only bodies past a form's largest legitimate size are refused

- **What does a revert leave behind?** Nothing: no schema, rows or
contract change.
- **Does the release before it still work with that?** Yes.

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Allison Mahmood <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 20, 2026
## What changed

`embedded-postgres` goes from 18.4.0-beta.17 to 18.6.0-beta.19, the bump
#1424 left out. The newest release is 18.6.0-beta.19, published on
2026-10-30. It and its eight platform packages ship **Postgres 18.6**,
up from 18.4, so the dev instance, the Vitest Postgres template, the
postgres-concurrency suite, the browser suites, the packed CLI e2e and
the rollback rehearsal now run on 18.6. This is dev and test
infrastructure only. People using Patchy notice nothing, and production
Postgres doesn't come from this package.

## Look at

**The shutdown hook changed library, and exit-hook needs a small patch
to behave as before.** embedded-postgres stops its clusters from a
process-exit hook. 18.4 used `async-exit-hook`, which
`patches/[email protected]` fixed so a failed Vitest run kept
its exit code. 18.6 uses `exit-hook` 5, which keeps `process.exitCode`
on its own, so that patch and its `patchedDependencies` entry are gone.
Nothing else in the tree resolves async-exit-hook, and pnpm refuses an
unused patch.

exit-hook differs from async-exit-hook in three ways that matter here. I
measured them with a small script that loads embedded-postgres, starts a
cluster and exits one way. "Cluster left" means Postgres was still
running, with its `postmaster.pid`, once the process had gone. Node 24
and Bun 1.4.4 gave the same results.

| Exit | 18.4 (async-exit-hook, patched) | 18.6 with exit-hook as
published | 18.6 with this PR's exit-hook patch |
| --- | --- | --- | --- |
| loop drains, `exitCode` unset / `= 1` | 0 / 1 | 0 / 1 | 0 / 1 |
| `process.exit(3)` with a cluster running | 3, cluster stopped, nothing
printed | 3, **cluster left**, **`SYNCHRONOUS TERMINATION NOTICE…`** on
stderr | 3, cluster stopped, nothing printed |
| `process.exit(3)` after stopping it | 3, nothing printed | 3,
**notice** | 3, nothing printed |
| SIGINT / SIGTERM | 130 / 143, cluster stopped | 130 / 143, cluster
stopped | 130 / 143, cluster stopped |
| SIGHUP | 129, cluster stopped | **killed by SIGHUP, cluster left** |
129, cluster stopped |

The notice is the visible one. It would print whenever a process that
loaded embedded-postgres ends through `process.exit()` or an uncaught
error, which includes packed-cli-e2e's failure and cancel paths and the
rollback rehearsal's cancel path. `patches/[email protected]`
restores async-exit-hook's behaviour on those paths:
- On `process.exit()`, the hook starts the asynchronous callbacks too,
unawaited. embedded-postgres's `stop()` sends Postgres SIGINT before its
first `await`, so the cluster still shuts down.
- The notice is no longer printed.
- SIGHUP (129) and SIGBREAK (149) are hooked again.

`scripts/dev/src/postgres.test.ts`, which already pinned the exit-code
fix, now covers both.

The first new case starts a cluster in a child process that calls
`process.exit(5)` with it running. It checks the code, an empty stderr,
and that the postmaster's pid is gone. The child is spawned with Node's
own `spawn`, because Effect's spawner signals a child's process group
when it exits non-zero, and that could stop Postgres in the hook's
place. Nothing in the test signals Postgres before those checks.

Its cleanup is registered as soon as the probe spawns, before anything
waits. The probe leads its own process group, which initdb and Postgres
join, and the cleanup interrupts that group, so Postgres shuts down and
frees its shared memory, then SIGKILLs whatever is left after 3 s and
waits up to 5 s more for the group to empty. It doesn't depend on
`postmaster.pid`, so it also reaches a cluster that was spawned but
hasn't written that file. It's a scope finalizer added after the
temporary directory, so it runs after the assertions, including on
failure and timeout, and before the directory is removed. A spawn error
fails the case.

The group cleanup was run outside the suite against three stalls: a
probe that never exits with its cluster running (stopped by the
interrupt in 250 ms), a timeout while the cluster is still starting (the
same), and a Postgres frozen with SIGSTOP right after spawn (SIGKILLed
at 3.3 s). Each left the group empty. A frozen Postgres can't act on the
interrupt, so that last case leaves its shared-memory segment behind, as
any SIGKILL of Postgres does.

The second case checks that a hangup exits 129.

All three cases run on live services (`excludeTestServices: true`). The
first version polled on `it.effect`'s test clock, which never advances:
whenever the first check found Postgres still shutting down, the retry
never woke. That was the 30 s timeout CI and the loaded local suite hit.

With only the patch's async-callback hunk removed, keeping notice
suppression and SIGHUP, the first case fails, and its cleanup still
leaves no cluster:

```
× stops a running cluster on process.exit, keeping its code and printing nothing 10511ms
Unknown Error: still running
      Tests  1 failed | 2 passed (3)
```

With the whole patch, all three pass, on 18.6 and on 18.4 alike. Without
the patch at all, the SIGHUP case fails too, since the process dies by
the signal instead of exiting 129.

**Who stops the dev supervisor on SIGINT and SIGTERM.** exit-hook forces
its process out five seconds after either signal, where async-exit-hook
allowed ten. The supervisor gives its server five seconds after SIGTERM
before SIGKILL, so once the server runs, the hook could end the
supervisor in the middle of its own teardown. So the two phases have
different owners:

- **While the cluster starts, embedded-postgres's handlers.** Start-up
runs inside an `acquireRelease` acquisition, which can't be interrupted,
and Postgres's release finalizer doesn't exist until it succeeds. The
library's handlers stop the starting cluster and exit within exit-hook's
bound, as on main, where it was async-exit-hook's.
- **From the moment the cluster is up, the scope.** The supervisor loads
embedded-postgres lazily, as the e2e and browser harnesses do. It
removes the library's SIGINT and SIGTERM listeners as the very next step
after acquisition, before the database is migrated or the server
launched. Two synchronous steps can't leave a gap between the owners.
`NodeRuntime.runMain` turns both signals into interruption, and the
scope stops the server and then Postgres.

The library's exit, `beforeExit` and SIGHUP hooks stay throughout.

Manual runs on the real supervisor. SIGSTOP pauses a process so it acts
on no SIGTERM, though SIGKILL still works, and it acts on a pending
signal once resumed.

| Case | First push (hook owns all) | Second push (scope owns all) |
This head (library during start-up, then scope) |
| --- | --- | --- | --- |
| Postgres paused the moment it writes `postmaster.pid` (still
starting), SIGTERM, Postgres resumed at 8 s | — | **exited only at 8.1
s**, once Postgres resumed and finished starting | exited at 5.1 s;
Postgres shut down on resume; nothing left, no `postmaster.pid` |
| the same with SIGINT | — | — | exited at 5.1 s; nothing left |
| running Postgres and the server both paused, SIGTERM, Postgres resumed
at 6 s | exited at 5.5 s, no finalizer logged; **server left running** |
exited at 6.3 s after `postgres stopped`; server SIGKILLed at its 5 s
grace; nothing left | the same: 6.3 s, `postgres stopped`, nothing left
|

A Postgres that stays paused forever during start-up would still be
left, paused with the SIGINT it was sent, as on main. Only SIGKILL ends
a stopped process, and embedded-postgres keeps its child private.

These aren't tests because they need the whole supervisor (plan, server,
cluster). SIGHUP isn't fixed by this: exit-hook's hangup handler still
exits before the finalizers, and `runMain` routes only SIGINT and
SIGTERM. So the SIGHUP row below is unchanged from main.

**The exit paths, before (main, 18.4) and after (this branch).** Each
ran on this machine, on Node 24.20.0, against throwaway instances. The
dev rows ran again on this head, and the other rows don't involve the
supervisor. "Stopped" means no postgres or server process was left and
no `postmaster.pid` remained. "Notices" counts `SYNCHRONOUS TERMINATION
NOTICE` in the full output.

| Path | Before | After |
| --- | --- | --- |
| Vitest, a failing test | exit 1, no notice | exit 1, no notice |
| Vitest, passing (`scripts/dev/src/postgres.test.ts`) | exit 0, no
notice | exit 0, no notice |
| `pnpm dev stop` (SIGTERM to the supervisor) | exit 0, "Stopped.",
stopped | exit 0, "Stopped.", stopped by the scope (`postgres stopped`
logged) |
| SIGINT to the dev supervisor | stopped in 0.25 s | stopped in 0.25 s,
by the scope |
| SIGTERM to the dev supervisor | stopped in 0.25 s | stopped in 0.25 s,
by the scope |
| SIGHUP to the dev supervisor | Postgres stopped, **server left
running** | Postgres stopped, **server left running** (unchanged; see
below) |
| `pnpm dev down` | exit 0, state removed, stopped | exit 0, state
removed, stopped |
| packed CLI e2e, success | exit 0 in 58 s, 0 notices | exit 0 in 58 s,
0 notices |
| packed CLI e2e, SIGTERM once its Postgres is up | exit 143, 0 notices,
no cluster left | exit 143, 0 notices, no cluster left |
| packed CLI e2e, its Postgres SIGKILLed mid-run | exit 1 (the step's
error), 0 notices | exit 1 (the step's error), 0 notices |
| rollback rehearsal `--live origin/main`, success | exit 0, four steps
in 123 s, 0 notices | exit 0, four steps in 116 s, 0 notices |
| rollback rehearsal, SIGTERM in step 2 | exit 143, "Stopped by SIGTERM;
…", 0 notices | exit 143, same line, 0 notices |
| rollback rehearsal, its Postgres SIGKILLed in step 2 | exit 1, "Step 2
of 4 … failed while exercising", 0 notices | exit 1, same, 0 notices |

The rehearsal ran with `--live origin/main`, so it compares main with
this branch and never reads production's health endpoint.

**IPC.** Both hook libraries add the same `process.on("message")`
listener, which acts only on the string `"shutdown"` (pm2's). Our code
opens no IPC channel to a process that loads embedded-postgres. The only
channels there are Playwright's workers and Vitest's fork pool, which
send structured messages, and the browser and test suites pass.

**What Postgres 18.4 to 18.6 changes for us** ([release
notes](https://www.postgresql.org/docs/release/18.6/); 18.5 was never
released). It needs no dump or restore within 18, so a worktree's
existing `.local/dev` cluster opens as it is. It's mostly security and
crash fixes.

Notes that touch what we use:
- Parallel GIN index builds now set `reltuples` correctly. The feedback
search tables have GIN indexes. This only affects planner statistics,
and dev and test databases are small and fresh.
- A `CREATE` now takes a shared lock on the objects it depends on, so a
concurrent `DROP` of the schema it lands in fails one side instead of
leaving a broken object.
- A missed conflict in SERIALIZABLE detection is fixed. Mutations run
SERIALIZABLE and retry `40001`.

postgres-concurrency, which exercises provisioning, reclamation and
those transactions, passes. The release's other headline changes
(logical-decoding output-plugin allowlist, pgcrypto ciphers, psql
`COPY`) touch nothing we use.

**allowBuilds.** 18.6 installs the same eight `@embedded-postgres/*`
platform packages, each with a `hydrate-symlinks` postinstall that
`allowBuilds` already permits. The new start-up `ensureSymlinks` check
passes on the installed linux-x64 build.

**Docs.** `docs/DEVELOPMENT.md` and the `patchy-dev-loop` skill don't
describe the hook workaround, so they don't change. The
`pnpm-workspace.yaml` comment and packed-cli-e2e's import comment now
name exit-hook. The other comments about embedded-postgres's
process-exiting handlers (dev `main.ts`, the rollback rehearsal, the
browser instances) stay true.

## How it was verified

- The before and after runs in the tables above, on main and on this
branch.
- `pnpm verify` on Node 24.20.0, on the first push (d144206): format,
lint, synth, postgres-concurrency, cli-smoke, install, tier2-smoke and
browser (Chromium 187 of 187 and Firefox 10 of 10) passed, with no
termination notice anywhere in the output, Playwright's workers
included. `typecheck` failed on the `JSON.stringify` the old test used.
`test` and `test (bun)` failed only on that test's frozen-clock timeout.
On this head, `pnpm test` passes 3,615 of 3,615 and `pnpm test:bun`
3,296 with 3 skipped, again with no notice. The supervisor changes touch
only `pnpm dev`, whose paths ran again above.
- `pnpm format:check`, `pnpm lint` and `pnpm typecheck` (all 25 tasks,
including `@patchy/dev`'s own check of its test files under the base
rules): clean on this head.
- Not run: the live suites and the server image, which needs Docker. CI
runs those.

**Unchanged and worth knowing, not fixed here.**
- SIGHUP to the dev supervisor stops Postgres but leaves the dev server
running, before and after: the hook exits the supervisor before Effect's
finalizers stop the server. `pnpm dev stop` and `down` send SIGTERM,
which doesn't hit this.
- A rehearsal whose Postgres died ends in `Error: kill ESRCH` from its
own cluster finalizer, before and after.

**Small differences the patch leaves**, in processes that keep
embedded-postgres's signal handlers (the Vitest global setup,
`HandlerTls.test.ts`, the server image smoke):
- exit-hook forces the exit 5 s after SIGINT or SIGTERM, where
async-exit-hook waited 10 s. Their only cleanup there is the cluster
stop, which took under 20 ms in the runs above.
- exit-hook listens for each signal once, so a second Ctrl-C during that
shutdown falls to whatever other handler the process has, or to Node's
default.
- SIGBREAK is Windows-only and wasn't exercised by anyone.

## Release impact

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

A dev and test dependency and one dependency patch. No product code,
API, schema or CLI change.

- **What does a revert leave behind?** Dev clusters that 18.6 started or
created. 18.4 opens them, since it's the same major and the same on-disk
format.
- **Does the release before it still work with that?** Yes. Production
doesn't use this package.

Made by Claude Opus 5.5 in T3 Code via Claude Code.

🤖 Generated with [Claude Code](https://claude.com/claude-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:core Touches the core area area:docs Touches the docs area area:integrations Company connections and integration implementations area:primitives Patch tables and files area:server Touches the server area area:ui Portal and first-party browser pages, shared rendering and styles size:m 100-500 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant