Files
KomediruzeckiandGitHub e5931959c1 Retire the Express backend; run e2e against the Worker (#428)
* chore: retire the Express backend, run e2e against the Worker

backend/ had not shipped for a long time. ci.yml stopped testing it,
nothing deploys it, browser-only mode is IndexedDB and cloud mode is the
Worker. But it was a complete server — routes, models, repositories, its
own test suite — and it kept attracting fixes that could never reach a
user.

The one thing holding it in the tree was e2e.yml. 35 Playwright specs
drive the real built frontend, and something had to answer /api. That is
now wrangler dev against a local D1: the runtime that actually serves the
app, so the suite finally tests what ships.

playwright.config.ts starts both servers itself — wrangler on :8787 after
d1:migrate:local, then vite on :3800 with its proxy pinned at it — and
runs a setup project first. So `pnpm run test:e2e` does the whole thing
locally, which the four curl commands it replaces never did.

global.setup.ts registers the fixture account through the real API, marks
it verified, puts it on a plan without a profile cap, seeds the fixture
profile and signs in ONCE. Every context inherits that storageState.
Signing in per context was spending the per-IP login budget on machines
with enough cores to run a context per CPU. It also clears rate_limits
first: the local database survives between runs and so did the counters,
so the seventh run of an afternoon failed at sign-in with a 429.

e2e-seed.ts is the dataset, written where the tests are instead of inside
a server's seed routine. Two accounts, six categories, two years of
transactions, goals, a loan, three holdings, a paid and an unpaid bill.
Each of those exists because a page renders its empty state without it —
and the two years are because the transactions page paginates at 50 rows.

Also gone: db/, test/backend/, test/e2e/backend-api/, test/benchmark/,
Dockerfile, docker-compose.yml, .dockerignore, the nuke-* scripts, the
root start/lint:backend/test:backend scripts, and better-sqlite3, bcrypt
and sqlite3 from onlyBuiltDependencies.

* chore: finish the e2e move and update the docs for it

Full suite against the Worker: 514 passed, 1 skipped, 0 failed.

Three things the move surfaced:

api.spec.ts asserted `x-ratelimit-limit`, a header express-rate-limit
set on a server that no longer exists. The Worker's limiter counts in D1
and answers a refusal with Retry-After, so the test now drives the export
limiter until it refuses and checks that.

The retirement chart-zoom spec wheeled at boundingBox() centre without
scrolling first. boundingBox() reports document coordinates, so a chart
below the fold got a wheel event that scrolled the page instead of
zooming — and how far down it sits depends on the data.

Workers are capped at 4 rather than one per CPU. Every worker drives the
same local D1 through one wrangler process, and a machine with a lot of
cores turned that into enough contention that pages timed out on their
first fetch, which reads as "the goals list is empty".

AGENTS.md, README.md and CONTRIBUTING.md now describe a tree without
backend/ in it, and point at `pnpm test:e2e` and worker/.dev.vars.

* ci(e2e): install the worker's own dependencies

worker/ is deliberately not a pnpm workspace member, so the root
`pnpm install` never reached it. It did not matter until the suite
started needing its wrangler: `sh: 1: wrangler: not found`.

Same install deploy-worker.yml uses.

* ci(e2e): run the suite serially, so one workerd crash cannot sink it

Four Playwright workers on a 4-vCPU runner meant four headless Chromiums,
vite and wrangler's workerd at once. Twenty seconds in, wrangler dev printed
an empty error and exited; nothing restarts it, so all 17 remaining specs
failed on a 502 from the vite proxy rather than on anything they assert.

One worker on CI, one retry, and a 30-minute job bound.
2026-08-24 03:44:56 +02:00
..