Skip to content

refactor(cli): parse patch sources without the TypeScript API - #994

Merged
allisonmahmood merged 7 commits into
mainfrom
refactor/cli-parse-without-typescript
Oct 29, 2026
Merged

allisonmahmood merged 7 commits into
mainfrom
refactor/cli-parse-without-typescript

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

What changed

The patchy CLI no longer bundles TypeScript to read patch repos, which makes it a third smaller. TypeScript 7 ships no JavaScript API, so this is the next step of the move (#985). @babel/parser reads patch sources instead, and the repo's own compiler answers what only it knows.

Part of #985 (step 2 of 5). Stacked on #989.

Look at

  • patchy add / patchy remove (editUses.ts) splice one entry into uses instead of reprinting the whole object through TypeScript's printer, which reflowed indentation and dropped or moved comments. The new entry goes after everything that follows the last entry, on a line of its own when the object ends on one. Every comment stays with the entry it follows, and removal keeps every comment not on the removed entry's own lines. Adding then removing an alias gives back the file byte for byte, LF or CRLF, with one exception: a one-line object of spaces, { }, comes back as {}, as it does on main. The existing one-line output is unchanged: uses: { "analytics": { kind: "posthog", handle: "product" } }. A config that doesn't parse is refused at the line Babel stopped on. editUses.test.ts covers each layout, a sweep of commented layouts, the refusals and the lines they name. Acceptance's runs drove most of this: see the verdicts and replies below.
  • The agent/ typecheck warning (serverModules.ts) asks the repo's own compiler for its file list with tsc --showConfig. That gives include, exclude and extends the meaning they have for pnpm typecheck, on TypeScript 6 or 7, instead of re-implementing them.
  • The import check (pageImports.ts) reads each file as Vite would. TypeScript with decorators parses with JSX outside .ts. Inline HTML scripts parse as plain JavaScript, classic or module, and data blocks such as JSON and import maps are skipped. Every existing form keeps its test: type-only imports and exports, import-equals, require, require?.() and import.defer. One deliberate tightening: the server graph refuses import.defer() as it already refused import(), because both load a module at run time.
CLI release main this PR
Tarball 35.1 MB 22.4 MB
dist/index.js 13.9 MB 3.7 MB
dist/dev.js 16.8 MB 6.6 MB

How it was verified

  • editUses.test.ts, pageImports.test.ts, serverModules.test.ts (the warning now runs the linked compiler), packagePin.test.ts and ManagedProject.test.ts pass: 151 tests. A local generator over 1,057 uses layouts, with LF and CRLF, checks the editor's invariants: comments stay with their entries through add and remove, output parses, and add then remove gives back the original bytes except { }. It finds no failures.
  • tsc on the CLI and pnpm typecheck:tests pass, and pnpm lint is clean.
  • The full packages/patchy suite passed 595 of 618 locally. The rest failed on a loaded shared machine (load average about 17), where a stray GET / reached the tests' localhost stub servers. The same files fail identically on build: lint with Oxlint #989's head without this change, and build: lint with Oxlint #989's CI ran them green. CI on this head is the oracle.

Release impact

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

patchy add and remove write the same declarations into the same place, and now leave the rest of the file alone. A server bundle with import.defer() was already outside the contract ("closed modules without dynamic imports").

  • What does a revert leave behind? Nothing. Configs edited in between are ordinary TypeScript.
  • Does the release before it still work with that? Yes.

Made by Claude Opus 5.5 (Claude Code in T3 Code); reviewed by GPT 6.1 Sol.

@github-actions github-actions Bot added area:cli Touches the cli area area:docs Touches the docs area size:l 501-1,000 changed lines labels Oct 28, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review (GPT 6.1 Sol, xhigh) and what changed. All fixed in 94e4520; each new test is red on dc39476 and green now:

  1. require?.("x") skipped the import check. Babel reads it as OptionalCallExpression. It's now checked like require(). Test row: if (false) require?.("lodash") with lodash aliased is refused.
  2. Inline HTML data scripts failed builds. type="application/json", import maps and other data blocks are skipped, since browsers never run them. Classic inline scripts parse as scripts, so a leading <!-- builds.
  3. TypeScript decorators failed to parse. Decorators parse now, including legacy parameter decorators under experimentalDecorators. One new build test covers 2 and 3 together.
  4. TypeScript 6's no-inputs refusal hid the agent/ warning. TS18003 now counts as an empty file list, matching what TypeScript 7 prints. The warning test gained an include: ["lib"] case.
  5. A comment before the trailing comma moved onto the new entry. patchy add now looks for the comma past comments. New editUses case.

pnpm lint is clean, and the five parser suites pass (89 tests).

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Answering the FAIL verdict above: fixed in 5a2df1d.

  • patchy remove now keeps neighbouring comments. An entry on lines of its own goes with exactly those lines, including a comment that ends them; every other line stays. A last entry without a trailing comma also takes the previous entry's comma, so the object keeps its style. The verdict's case now leaves // Keep member access: … above members.
  • The empty commented block from the notes. Adding into a uses that holds only comments keeps them and puts the entry after.
  • New tests. Adding then removing an alias gives back the file byte for byte, for each of the 7 layouts with LF and with CRLF. The verdict's case and the comment-only block each have their own test. The five parser suites pass (105 tests) and pnpm lint is clean.

A fresh acceptance run on 5a2df1d is next.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Answering the second FAIL verdict: fixed in 678338d.

  • A last entry's multi-line trailing comment. An entry's trailing comment is now one comment, on any number of lines, with nothing after it on its last line. Removing analytics keeps members' // Keep this note.
  • A comment between entries on a one-line object. A last or only entry takes only the space before it, so /* Keep this note. */ stays.
  • The stray space. Removing what was added to { /* Keep this note. */ } gives back the original bytes. An object left empty closes up to {}.
  • A sweep test. Over commented layouts, with LF and CRLF, removing any entry must keep every other entry's comments and undo an add byte for byte. It fails 5 cases on 5a2df1d and passes all 52 now. A local sweep of 15 more layouts, removing each entry in turn, also kept every other comment and parsed.

The five parser suites pass (113 tests) and pnpm lint is clean. A fresh acceptance run on 678338d is next.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Answering the third FAIL verdict: fixed in bd11f86.

  • Several comments trailing one entry. A trailing run is now any number of comments: block comments, which may run onto more lines, then one line comment last. members: { … }, /* first */ // second keeps both notes through add and remove, and so does /* first */ /* second */ without a comma.
  • Where patchy add puts the new entry. It goes after everything that follows the last entry. On a one-line object that means after its trailing block comments. On a multi-line object it means on the closing brace's line, so comments on their own lines after the last entry stay above it.
  • The sweep test. It now also checks adds: each comment must still follow the entry it followed before the add. With the new layouts, 14 of its cases fail on 678338d and all 64 pass now. A local sweep over 21 layouts, with LF and CRLF, checks every add and every removal of each entry: comments keep their entries, the output parses, and add then remove gives back the original bytes. No failures.

The five parser suites pass (137 tests), and pnpm lint and the CLI typecheck are clean.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Answering the fourth FAIL verdict: fixed in 8e055ce. Instead of another special case, insertion now follows one rule.

  • The rule. Everything between the last entry and the closing brace is that entry's separator and comments. patchy add puts the new entry after all of it: on a line of its own when the object ends on one, else on the same line. It no longer looks at the gap before the first entry, which is what broke uses: { members: …, // note with } on a later line.
  • Both of your layouts. With } beside the last entry's comments, /* KEEP_analytics_1 */ /* KEEP_analytics_2 */ stay after analytics, with or without a trailing comma, and through a multi-line block comment. Add then remove gives back the original bytes.
  • Empty objects. Their comments get the same rule, so adding into { // note with } on the next line no longer puts the entry inside the comment. My sweep caught that one, not your matrix.
  • Tests. The sweep test gains the mixed-brace layouts: 6 of its cases fail on bd11f86, and all 70 pass now. A local sweep over 32 layouts, with LF and CRLF, checks that each comment still follows its entry after an add, that removing any entry keeps the others' comments, that every result parses, and that add then remove gives back the original bytes. No failures.

The five parser suites pass (143 tests) and pnpm lint is clean.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

One more check on 8e055ce: a generator crossed brace placement (opening and closing each on their own line or beside an entry) × trailing comma or not × trailing comments (none, line, block, two blocks, block then line, multi-line block) × an own-line footer comment × 0–3 entries. That's 195 layouts, each with LF and CRLF. All four invariants held in every case: comments stay with their entries on add, removal keeps the other entries' comments, add then remove gives back the original bytes, and the output parses with its line endings intact.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Answering the fifth verdict: fixed in dc83ce9.

  • Line-ending spaces. The new entry now goes in after the spaces ending the line it follows, so // KEEP_members_3 \t keeps its \t, and add then remove gives back those bytes. That covers G935, G777 and G2259.
  • Empty objects spread over lines. These take the entry on a line of its own and keep their shape after removal, so {\n } round-trips too.
  • The one exception. A one-line object of spaces, { } (your G00), still comes back as {}, as on the base. The PR body now states that exception instead of claiming every byte.

The sweep test gains your whitespace and tab cases: 4 fail on 8e055ce, and all 78 pass now. My own generator now crosses your dimensions: 1,057 layouts × LF/CRLF, tabs and trailing whitespace included. It finds no failures on any invariant apart from { }. The five parser suites pass (151 tests), and pnpm lint and the CLI typecheck are clean.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked dc83ce9fa135fc7b4f9ba53bf2e1cda43a2852ba (base 03e94e9a8d2888c43b5e4cf35d812ec70a388276, origin/build/oxlint) on disposable packed-CLI repos with synthetic integration metadata, by GPT 6.1 Sol in the Codex harness through T3 Code.

Done means

This checks #994's current parser-replacement and source-preservation claims, not #985's later whole-stack TypeScript 7 criteria. The documented one-line whitespace-only empty-object normalization is allowed; every other roundtrip is checked byte for byte.

  • Full Cartesian source-level head/base comparison: passed. All 2,304 option combinations × LF/CRLF, representing 3,040 distinct source/line-ending cases, ran through both actual editors. All four head invariants hold: comments retain their preceding entry on add; removal keeps comments off the removed entry's lines; add→remove returns the original bytes except the documented inline-empty normalization; every output parses and retains its line endings. No invariant regressed against the base.
  • Original packed matrix: passed, 94/94 probes. The same 47 layouts × LF/CRLF, including the earlier comment-placement failures.
  • Pairwise packed matrix: passed, 50/50 probes. The same 25 deterministic layouts × LF/CRLF, covering every pair of values across all eight dimensions (224 pairs): both brace positions, trailing comma, six trailing-comment forms, three own-line-comment forms, 0–3 entries, spaces/tabs and trailing whitespace. G935, G777 and G2259 now roundtrip exactly with both line endings. G00 returns {} from { }, exactly the exception the body now states.
  • Focused suites on this head: passed, 151/151 tests in editUses, pageImports, serverModules, packagePin and ManagedProject.
  • Earlier passing evidence reused as requested. git diff 8e055ce..dc83ce9 changes only editUses.ts and its test; the same is true relative to 94e4520, where the unaffected behavior was checked. I read the earlier tier 1/tier 2 packed, import-guard, compiler-warning and size logs. This head was built afresh and its digest-addressed tarball installed offline into fresh prefixes with empty npm caches. CLI execution and config/client imports use that installation; compiler/Vite tools are linked from this checkout.

Golden journeys

  • Add/remove → refresh → generated types: passed, 392 edits and 556 refresh/typecheck checks. Every edit checks exit 0 and ok: true, then runs installed patchy refresh --json and pnpm typecheck. Direct-removal baselines also refresh and typecheck.
  • Reused, not rerun: packed tier 1 init/dev/publish and local/hosted isolation; tier 2 init, both dev mounts, publish, two-viewer sync, query/mutation/action, keyed retry, shared resources, files, members, CSV and tier changes; clean-HOME install, machine login/logout, sharing and lifecycle. Dev/publish import refusals and compiler-owned include/exclude/extends warning behavior likewise reuse the earlier passing evidence.

Rollback answers: Compatibility matches the diff. Configs edited in between remain ordinary TypeScript readable by the prior release. Reverting code leaves those source edits in place, but no incompatible schema, API, infrastructure or persisted-config shape. No one-way label is needed. CI rollback rehearsal passed.

Notes

  • The fifth run's remaining whitespace findings are resolved against the body's current claims. Multiline whitespace-only objects keep their shape; trailing spaces stay on their original line. The sole allowed roundtrip difference is a one-line whitespace-only object collapsing to {}, as on the base.
  • CI passes on Node 22/24/26, lint, browser, Clerk live, Attio live, both packed CLI smoke jobs, tier 2 smoke, Linux/macOS/Windows installation, release tarball, image, Postgres concurrency and rollback rehearsal. Pidgeon suite is still pending in the snapshot. This is a behavioral verdict, not a merge-readiness claim.
Evidence and invariant comparison

Source-level failures among the 3,040 distinct cases, applying the documented exception equally to both commits:

Invariant Head failures Base failures
Comment retains its predecessor after add 0 1,756
Remove preserves comments off the removed entry's lines 0 2,368
Roundtrip bytes, allowing only the documented inline-empty exception 0 3,014
Output parses and retains LF/CRLF 0 0

Counts overlap across invariants. Each commit executes all 4,608 combinations, not only the selected packed cases. Comment identity for predecessor checks ignores trailing whitespace; exact roundtrip bytes are checked separately. Inline-empty exception: 16 option executions / 4 distinct source-and-line-ending cases. Their only raw differences are the one-line horizontal-whitespace interiors { } and { \t } becoming {}, under LF and CRLF. No multiline empty-object or trailing-line whitespace difference remains.

Original packed matrix: 94/94 passed
Generated packed matrix: 50/50 passed
Original matrix: 214 edits + 86 baselines = 300 refresh/typecheck checks
Generated matrix: 178 edits + 78 baselines = 256 refresh/typecheck checks
Combined: 392 edits; 556 successful refresh/typecheck checks
Focused suites: 5 files, 151 tests passed
Full Cartesian: 4,608 executions per commit / 3,040 distinct cases
Head invariant failures, with the documented exception: 0
Base-to-head invariant regressions: 0

Each packed cycle runs:

patchy add posthog/product --as extra --json
patchy refresh --json
pnpm typecheck
patchy remove extra --json
patchy refresh --json
pnpm typecheck

The previous fixture matrix uses analytics for its original cycle aliases and removes every existing alias separately in its adversarial cases. The generated matrix also removes every existing alias separately and parses the resulting source. Each removal has its own refresh and compiler check.

The Cartesian comparison explicitly uses --base origin/build/oxlint, extracts that commit's editor and calls it and the head editor on identical sources. No main-branch comparison or production data is involved.

Commands ran one at a time. Test hooks removed disposable fixtures, loopback servers, installed prefixes and test Postgres; pnpm dev down confirmed this checkout has no remaining instance. The supplied checkout remains detached at the checked head with a clean tracked-file status. No production resources or live connections were touched locally.

Not run

  • Full local pnpm verify, live Clerk or live third-party integrations. The requested reruns use synthetic metadata and disposable loopback servers.
  • Earlier end-to-end, import-guard, compiler-warning and size checks were reused as described above.

Surface audit: CLI --json, config editing, refresh/generation and add/remove reverse operations apply and were exercised. Mirrored CLI docs remain consistent. Other import, pin and generated-module checks have fresh focused suites plus reused end-to-end evidence. No wire schema, migration, served UI, company-resource ownership, vocabulary or package-layout change applies. No PR code, branch, body or labels were edited.

Base automatically changed from build/oxlint to main October 29, 2026 09:45
allisonmahmood and others added 7 commits October 29, 2026 10:45
TypeScript 7 ships no JavaScript API, and the CLI used TypeScript 6's to
read patch repos. It now uses @babel/parser, pure JavaScript like the
rest of the offline tarball, and leaves the compiler to the repo:

- `patchy add`/`remove` splice one entry into `uses` instead of
  reprinting the object, so the author's comments and layout survive,
  CRLF included. A config that doesn't parse is refused at its line.
- Package pins, the page and server import checks, and the generated
  server module list read Babel's AST. The server graph refuses
  import.defer() as it refuses import(); both load at run time.
- The agent/ typecheck warning asks the repo's own compiler for its file
  list (`tsc --showConfig`), so include, exclude and extends mean what
  they mean to `pnpm typecheck`, on TypeScript 6 or 7.

The CLI bundle no longer carries TypeScript: the tarball drops from
35.1 MB to 22.4 MB and index.js from 13.9 MB to 3.7 MB.

Part of #985.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review of the Babel port found it stricter than TypeScript's parser in
three places and looser in one:

- `require?.("x")` is an OptionalCallExpression, which the check skipped,
  so an aliased package could hide behind it. It is checked like require().
- Inline HTML scripts with a data type, such as JSON or an import map,
  are never run by browsers and are no longer parsed. Classic inline
  scripts parse as scripts, so an opening HTML comment builds again.
- TypeScript decorators parse, including legacy parameter decorators.
- TypeScript 6's --showConfig refuses an include that matches no file
  (TS18003); the agent/ warning now treats that as an empty file list,
  as TypeScript 7 already prints it.
- `patchy add` finds a trailing comma behind a comment, so the comment
  stays with its property.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Acceptance found `patchy remove` deleting through the next entry's start,
taking that entry's own comment with it, and back to the previous entry's
end, taking its trailing comment. An entry on lines of its own now goes
with exactly those lines, a comment ending them included; other lines
stay. A last entry without a trailing comma also takes the previous
entry's comma, so the object keeps its style. Adding into an empty uses
that holds only comments keeps them too.

Adding then removing an alias now gives back the file byte for byte, in
every layout the tests cover, with LF or CRLF.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Acceptance found three more layouts where `patchy remove` or a round trip
lost bytes: a last entry whose block comment runs onto further lines
took the previous entry's comment, a comment between entries on a
one-line object went with the entry after it, and removing what was
added to `{ /* note */ }` left a stray space.

An entry's trailing comment is now one comment, on any number of lines,
with nothing after it on its last line. A last or only entry takes the
space before it, never what sits between it and its neighbour; an
object left empty closes up to `{}`. A sweep over commented layouts,
with LF and CRLF, checks that removing any entry keeps every other
entry's comments and undoes an add byte for byte.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Acceptance found comments moving onto a new entry: several comments
trailing one entry (`/* a */ // b`), block comments trailing a
one-line object's last entry, and comments on lines of their own after
the last entry. A trailing run is now any number of comments, block
comments on more lines and a line comment last. A new entry goes after
everything that follows the last one: on a one-line object after its
trailing comments, in a multi-line object on the closing brace's line.

The sweep test now also checks that adding leaves each comment after the
entry it followed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Acceptance found layouts where the opening and closing braces sit on
different kinds of lines (the first entry beside `{`, or `}` beside the
last entry's comments). The editor chose one-line or multi-line style
from the gap before the first entry, and so put the new entry between
the last one and its trailing comments.

Now one rule: everything between the last entry and the closing brace
is its separator and comments, and the new entry goes after all of it,
on a line of its own when the object ends on one, else on the same line.
An empty object's comments get the same rule, so `{ // note` no longer
swallows the new entry into its comment.

The sweep test gains the mixed-brace layouts; a local sweep over 32
layouts, LF and CRLF, keeps every comment with its entry through add and
remove and gives back the original bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Acceptance's systematic sweep found the last remaining byte change: a new
entry went in before the spaces ending the line it follows, so they
moved onto its line and left with it on removal. The entry now goes in
after them. An empty object spread over lines takes the entry on a line
of its own and keeps its shape after removal; only a one-line object of
spaces, `{  }`, still comes back as `{}`, as it did before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the refactor/cli-parse-without-typescript branch from dc83ce9 to 3df1a74 Compare October 29, 2026 09:45
@allisonmahmood
allisonmahmood merged commit b800aed into main Oct 29, 2026
23 checks passed
@allisonmahmood
allisonmahmood deleted the refactor/cli-parse-without-typescript branch October 29, 2026 10:00
allisonmahmood added a commit that referenced this pull request Oct 29, 2026
## What changed

TypeScript 7's Effect checker (`@effect/tsgo`) flags `node:crypto`
imports that the TypeScript 6 language service let through. Effect 4 has
a `Crypto` service, so code that already runs inside Effect now takes it
from its environment instead of importing Node's. Nothing anyone sees
changes: every id, token, digest and stored fingerprint keeps its
format.

Part of #985 (step 3 of 5). Stacked on #994.

## Look at

- **Moved to `Crypto`, formats unchanged:**
  - Fleet task ids and wake origins: UUIDv4.
- Each company database's file-handle secret: still 32 random bytes in
hex. Both company database constructors take `Crypto` and hand it to
`Inventory.initialize`.
- Table row ids: UUIDv7 on the Effect clock, the same layout the
hand-rolled ones had.
- File tokens and SHA-256 digests: Effect's `Hex` and `Base64Url` encode
exactly as Node's `hex` and `base64url`. Checked on 32 random bytes.
- The deployment config's `revision`, stored with every limit change in
`deployment_revision`: still the SHA-256 hex of the values. `main` and
this branch both print `af2b298c…2724e` for
`PATCHY_LIMITS_JSON='{"company.connections":9}'`.
- **`DeploymentConfig.load` keeps its ripple small.** `revision` is now
an Effect, so only `OperatingLimits` and the `exec` entrypoint, the two
that record it, need `Crypto`. The services that only read values don't.
The server gets `Crypto` from `NodeHttpServer`, `exec` provides
`NodeCrypto`, and so do the test layers that build fleets, table writers
or operating limits.
- **Kept on `node:crypto`, each with its reason:**
- What Effect has no equivalent for: AES-256-GCM in `CredentialKeys`,
and HMAC with a constant-time compare in `Files`.
- Synchronous helpers callers outside Effect use: core `sha256`, tokens
and ids, which the CLI uses too; table index names; and the look
preview's CSP hash, a module constant.

## How it was verified

- `pnpm build`, `pnpm typecheck` and `pnpm typecheck:tests` (exit 0),
`pnpm lint` and `pnpm format:check` pass. The TypeScript 7 Effect
checker reports nothing in the touched packages.
- Suites that build what moved pass: limits (deployment config and
operating limits), table operations, files and the files API, wakes over
Postgres, the fleet controller, client documents and OAuth endpoints
(163 tests); company databases on Postgres and PGlite, and tables (89
tests).
- The deployment revision matches between `main` and this branch, as
above.

## Release impact

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

An internal refactor: every id, token, digest and stored revision keeps
its format.

- **What does a revert leave behind?** Nothing new. Rows written in
between carry the same id, token, digest and revision formats as before.
- **Does the release before it still work with that?** Yes.

Made by Claude Opus 5.5 (Claude Code in T3 Code); reviewed by GPT 6.1
Sol.

---------

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

Patches now publish on TypeScript 7. Publishing a patch repo still on
TypeScript 6 stops before anything runs, with the exact steps for the
builder's agent: upgrade TypeScript, and move lint from ESLint to
Oxlint, because typescript-eslint can't run beside TypeScript 7.
Published patches keep running untouched, and `patchy dev` and `patchy
refresh` only warn. Each repo moves the next time someone publishes it.

Closes #985 (step 5 of 5). Stacked on #1009.

## Look at

- **The gate (`toolchainProcess.ts`, `repoBuild.ts`).** Publish reads
the version in the repo's `node_modules/typescript`, the compiler it
actually runs, rather than the declared range. It checks that against
the release's `typescript.accepted` (`^7.0.2`, served by `GET
/api/release`) right after the release check, before it syncs the
description or runs config, Vite or the typecheck. The refusal reuses
`toolchain_unsupported`, exit 1 and the existing `--json` failure shape:

> This repo has TypeScript 6.0.3; this release publishes only TypeScript
^7.0.2 (tested against 7.0.2). Run: pnpm add --save-dev
'typescript@^7.0.2'. typescript-eslint doesn't run beside TypeScript 7:
if the lint script runs ESLint, move it to Oxlint as
.agents/skills/patchy-preact/SKILL.md says.

- **The lint move (`patchy-preact` skill).** The skill now carries the
scaffold's `.oxlintrc.json` and what to remove. A test fails if the
documented config drifts from what `patchy init` writes.
- **Docs.** ADR-0004 now treats TypeScript as a publish gate, and the
CLI README and `docs/product.md` follow. `docs/product.md` also drops a
stale "by TypeScript AST" left from #994.

## How it was verified

- The new `cliRepoBuild` case runs against a release that requires
`typescript@^99`:
  - `refresh` exits 0 with the warning.
- `publish --json` exits 1 with `toolchain_unsupported` and the upgrade
line.
- The only API calls during publish are `/api/me` and `/api/release`,
and `patchy.config.ts` is unchanged.
- `cliRepoBuild` (13), `initProject` (15) and `packages/sdk` (34) pass.
`pnpm lint`, `pnpm typecheck:tests` and the CLI's `effect-tsgo`
typecheck exit 0.
- The upgrade path is real: three of the company's own patch repos (52,
40 and 25 files) type-check under `[email protected]`, and lint clean
under the scaffold's Oxlint config, with no code changes (see #985).
- Not covered by a test: `patchy dev`'s warning. It rides the same
`typescriptRefusal` check and the warnings list dev already prints.

## Release impact

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

A patch repo on TypeScript 6 can't publish until it moves: `pnpm add
--save-dev 'typescript@^7.0.2'`, then, if its lint runs ESLint, the
Oxlint config from the `patchy-preact` skill. The refusal says exactly
that, so a builder's agent can do it unaided. Running patches, local dev
and refresh are unaffected. Deploying this needs a What's new line
telling builders their next publish asks for the move.

- **What does a revert leave behind?** Patch repos moved to TypeScript 7
and Oxlint, which the release before publishes fine: it never gated
TypeScript.
- **Does the release before it still work with that?** Yes.

Made by Claude Opus 5.5 (Claude Code in T3 Code); reviewed by GPT 6.1
Sol.

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Oct 29, 2026
… 7 (#1046)

## What changed

This adds release 22's What's new entry, written from `a2d1331`. It
covers everything merged since release 21's `through` (`f30d8fe`), and
sets the `patchy` release to `0.22.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`. With this release, patch repos move to TypeScript
7 and Oxlint, and Patchy's crypto runs through one Effect service.

| Change | PRs |
| --- | --- |
| Improved: Your agent checks patches several times faster. New repos
use TypeScript 7 and Oxlint, the patchy download is a third smaller, and
an existing repo's next publish asks it to move over | #989, #994,
#1009, #1010 |
| Behind the scenes: Patchy itself builds with TypeScript 7 and Oxlint |
#989, #1009 |
| Behind the scenes: Encryption, signing and ids go through one place,
with tests proving stored values still open | #1000, #1041, #1042 |

One merged PR gets no line: #971 is release 21's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`. It tells builders that their next
publish of an existing repo will ask them to move to TypeScript 7, and
that live patches keep working. That's the one behaviour change people
will meet.
- **Rollback safety, from the live commit `2f9f7c1` (release 21) to
`a2d1331`:**
- No PR in the range is labelled `one-way`, and none has a migration or
an infrastructure change.
- Every stored format is unchanged: ids, tokens, digests, sealed
credentials, file handles and index names. The crypto PRs prove this
with known-answer tests.
- #1010 is Breaking for builders: publishing a TypeScript 6 repo is
refused, with the command to fix it. A rollback lifts that refusal, and
doesn't strand anyone.
  - `rollback-rehearsal` passed on every landed head.

**Rollback line:** If this release misbehaves, roll back to `2f9f7c1`
(release 21).

## 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 stack.** All seven PRs were Sol-reviewed with every finding
fixed, and each got an acceptance PASS or PASS with notes. Each landed
after a rebase onto `main` that left it unchanged (range-diff `=`), with
all 12 required checks passing. #1000's one red run was the known Fleet
flake #1012, and it passed on rerun.
- **Deploy state.** The live commit, pinned from `/healthz/deep`, is
`2f9f7c1` (release 21). The Deploy run updated last succeeded, and none
is unfinished.

## Release impact

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

Text and version numbers only. The `0.22.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.

Made by Claude Opus 5.5 (Claude Code in T3 Code).

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

Labels

area:cli Touches the cli area area:docs Touches the docs area size:l 501-1,000 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant