Skip to content

chore(dev): faster checks agents can trust, and a pnpm dev that needs no accounts - #475

Merged
allisonmahmood merged 31 commits into
mainfrom
dx/fast-trustworthy-checks
Oct 2, 2026
Merged

allisonmahmood merged 31 commits into
mainfrom
dx/fast-trustworthy-checks

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Building Patchy Cloud was slower and less trustworthy than it should be, for us and for agents. pnpm test took 8 minutes locally and 12.6 in CI, almost all of it one file. Tests were never typechecked, and 256 errors were hiding there. main went red twice this week from a flaky fleet test. A fresh clone couldn't start pnpm dev without Clerk keys. And an agent had to read a 1,585-line DEVELOPMENT.md before starting anything.

This makes the checks fast enough to run constantly and honest enough to believe, puts them behind one command, and lets anyone run the whole loop with no accounts.

Faster

  • cli.test.ts (732 of the 759 seconds in CI's test job) is split into eight files along its describe blocks, so vitest runs them in parallel.
  • Every vitest run and dev start rebuilt the packed CLI release (~16 s). It is now reused when nothing it reads has changed: every module-graph file, the workspace manifests and the lockfile, plus a check that every output it made is still there.
  • pnpm typecheck compiles each package once, through its build, instead of building and then checking again.

Honest

  • tsconfig.test.json typechecks every test and harness file, keeping Effect's correctness rules and dropping its style rules. Fixing the 256 errors turned up three real test bugs: the dev-resources handlers ran with admin undefined, a RuntimeApi test never sent the header it claimed to check, and an ESLint test hook did nothing. test(runtime): typed file-route tests never send the file name #474 tracks a fourth: typed file-route tests never send the file name.
  • The fleet flake's cause: the test's clock barrier counted the replenish loop's 5 s sleep as a lease renewal, so under load fake time outran the renewal loop until the lease expired. The barrier now waits for the renewal loop only. Instrumenting it showed two fibers handing out tokens before the fix and one after.
  • Cold PGlite operation tests and packed patchy dev starts get budgets that survive a loaded run.
  • pnpm 11.28 links skipped optional platform packages (e.g. lightningcss-darwin-x64) to the workspace root, and the CLI suites' offline registry was tarring the whole checkout because of it. That failed whenever another suite wrote into the repo mid-archive. The registry now accepts a package only when its name matches.
  • Migrations come from one record, apps/server/src/migrations.ts, for the server, the dev runner and the test template, with a test that ids are unique and gap-free. New tests fail when docs/API.md or the global skill's lock hash goes stale. The API.md test already caught chore(deps): move to stable Effect 4.0.0 #473 leaving it unrendered (same content, new order), so it is re-rendered here.
  • A flaky label, and DEVELOPMENT says to check it before treating a red check as yours.

One command

  • pnpm check runs format, lint, typecheck and the offline tests. pnpm verify adds every acceptance suite CI runs except live Clerk, and --changed skips them for docs-only or runner-only changes. These replace test:all.
  • CI now runs the tier 1/2 browser suite as a browser job, everything except the one native-print test, which needs a display. The suite had never run in CI, and five problems surfaced, all fixed:
    • one test had drifted since feat(runtime): enforce server handler lifetimes #429 (Runtime refuses tier 1 server.call with access_denied);
    • an online-retry test raced the shell's up-to-30-second backoff. Pinning Math.random to the worst case reproduces CI's failure exactly; the test now steps the page clock;
    • the harness proxy piped streams with pipe, so a host that died mid-stream left the browser's stream open and silent forever. A SIGKILL restart reproduces CI's failure. The proxy now uses pipeline, which resets the stream as real ingress would;
    • the harness lost a bind race when another process took its reserved port. It now relaunches on a fresh port;
    • native printing shared a test with unrelated sandbox and download checks. It has its own @print test now, so the rest runs in CI.
  • The ruleset is unchanged, so browser is not a required check.

Local loop

  • pnpm dev signs people in as dev personas, and --clerk opts into Clerk. Existing instances keep Clerk. Plain instances now listen on loopback only.
  • pnpm dev shot <person> <path> writes a full-page PNG of what that person sees, patch frames included, and prints the status and any browser errors.
  • pnpm dev up adopts a running plain instance instead of refusing.

Docs and skills

  • DEVELOPMENT.md goes from 99 KB to an 18 KB runbook. Running the server by hand, the execution fleet and the spike deploy move to OPERATIONS.md. The dev-loop skill goes from 18 KB to 3 KB, and README's "Try it" needs no Clerk.
  • Removed the vendored Clerk skills (billing, orgs, webhooks, custom UI, setup, router) and the general Neon skill. The repo doesn't use what they cover, and their descriptions triggered on common words.
Before After
pnpm test, 16-core machine 498 s, failed on a timeout ~185 s, passing
pnpm test step in CI 758 s 580–611 s (a 4-core runner is now CPU-bound, not waiting on one file)
One small test file 19 s ~4 s
pnpm typecheck in CI 122 s, tests unchecked 101 s, tests included
pnpm typecheck, warm, local — 4 s
pnpm dev, cold needed Clerk keys 6 s

How it was verified

  • On the final head:
    • CI is green on every job.
    • Locally, pnpm check passes and pnpm test:browser passes 53/53. Two more 53/53 runs were just before the rebase onto Effect 4.0.0.
    • Earlier on the branch, pnpm verify ran every suite.
  • Fleet: 19/19 tests, plus 15 of 15 runs of the flaky case under parallel load.
  • Each browser flake was reproduced on the old code before its fix: worst-case jitter, a SIGKILL restart, a blocked port.
  • By hand:
    • pnpm dev with personas, then pnpm patchy publish, with curl showing 401 anonymous and 200 as [email protected].
    • pnpm dev --clerk refuses on a personas instance.
    • pnpm dev up adopts the plain instance and keeps its data.
    • pnpm dev shot jordan /brightline/new-business captures the tier 2 board with no errors.

Release impact

  • Breaking
  • Not breaking: development tooling, tests and docs. The server only moves its migration record into a module; product behaviour is unchanged.

Follow-ups: making browser a required check is a ruleset change for you.

Review

GPT 6.1 Sol (codex) reviewed three times.

  • First pass: five real issues, all fixed:
    • the release cache ignored workspace manifests;
    • a cache hit accepted missing outputs;
    • the test tsconfig dropped the base config's Effect correctness rules;
    • verify --changed skipped suites that share the runner's Postgres settings;
    • the @print tag hid unrelated browser checks.
  • Second pass: confirmed all five fixes.
  • Third pass: reviewed the CI-driven fixes and the rebase onto Effect 4.0.0 and found nothing.

Made by Claude Opus 5.5 via Claude Code; reviewed by GPT 6.1 Sol via codex.

@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:xl Over 1,000 changed lines; review in multiple passes labels Oct 2, 2026
@allisonmahmood
allisonmahmood force-pushed the dx/fast-trustworthy-checks branch from c976f33 to 230469a Compare October 2, 2026 14:46
allisonmahmood and others added 20 commits October 2, 2026 17:17
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ng and browser suites

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…e browser suite

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
allisonmahmood and others added 11 commits October 2, 2026 17:18
…Postgres settings

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…test runs in CI

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… to the root

pnpm 11.28 links a skipped optional platform package, such as lightningcss-darwin-x64,
to the workspace root. The CLI suites' offline registry followed that link and tarred
the whole checkout, which fails when another suite writes into it mid-archive.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ingress does

`pipe` left the browser's stream open and silent when the server died mid-stream, so
the host-restart test waited for a reconnect that could never start.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`Fixtures.ownRouter` (from #473) inferred its requirements as `unknown`, which the
test typecheck reports in every suite that uses it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Same content; Effect 4.0.0 orders the OpenAPI components differently. The new drift
test caught it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the dx/fast-trustworthy-checks branch from 24e60e5 to 53c062e Compare October 2, 2026 15:31
@allisonmahmood
allisonmahmood merged commit 7e5ab8f into main Oct 2, 2026
12 checks passed
@allisonmahmood
allisonmahmood deleted the dx/fast-trustworthy-checks branch October 2, 2026 15:58
allisonmahmood added a commit that referenced this pull request Oct 2, 2026
`main` went red right after #475: the newly required `browser` job's
"host restart reconnects the loaded document" test timed out waiting for
the page to reconnect.

The cause is a startup race in the test harness. `@effect/platform-node`
binds a server's port while its layer builds and attaches the request
handler only later, in `serve`. During `instance.restart()`, the harness
proxy forwarded the page's next stream request as soon as the new
process accepted connections. The request landed in that gap, got no
handler, and hung forever, so the page never reconnected. Under parallel
load this reproduced 2 to 4 times in 24 runs.

The proxy now answers 502 while a restart is between stopping the old
host and the new one announcing it is listening, which happens after
`serve` attaches the handler. That is what an ingress routing only to
healthy targets does. The page's normal backoff then retries against a
ready host.

Verified: 0 failures in 48 loaded runs of the test, and the full `pnpm
test:browser` passes 53/53.

Production is barely exposed to this race, because a load balancer only
routes to targets that pass a health check, and that check needs the
handler.

Made by Claude Opus 5.5 via Claude Code; reviewed by GPT 6.1 Sol via
codex.

Co-authored-by: Claude Opus 5.5 (1M context) <[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:xl Over 1,000 changed lines; review in multiple passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant