Files
KomediruzeckiandGitHub b51ec63230 feat(forms): loans and retirement say what is wrong at the field (slice 4a of 6) (#609)
Slice 4a of the form-errors rollout. Loans, rate periods, extra payments, retirement goals and the
retirement plan refuse a bad value at its field, with the same 400 { error, fields } from both
runtimes and one shared set of rules (shared/loanSchema.ts, shared/retirementGoalSchema.ts,
shared/retirementPlanSchema.ts).

- Removing an extra payment or a rate period the loan does not have answers 404 in both runtimes.
  The page treats a 404 on a remove, or on a loan delete, as already done.
- total_prepaid is 0, to the cent, for a loan without extra payments. The FIRE calculator takes
  inflationRate in both runtimes.
- Local-first's unused POST /loans/:id/prepayment is gone.
- The form kit gains fields in list rows, a form's own copy of its values, and SubmitButton
  `unchanged`.
- A parity guard schedules loans typed into the dialog to the same cent in both runtimes.

The owner's open questions are in the pull request description.
2026-10-09 14:37:42 +02:00

131 lines
6.2 KiB
YAML

name: E2E Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
e2e:
name: E2E Tests (${{ matrix.shard }}/${{ strategy.job-total }})
runs-on: ubuntu-latest
# Per shard, not for the suite. Each shard is ~5 min of setup plus a few minutes of tests, so
# hitting this means something is hung rather than slow. The previous bound was 30 minutes for
# the WHOLE suite run serially in one job, which a clean run already spent 22 of; the next push
# to main went over and GitHub killed it — and a `timeout-minutes` kill reports as *cancelled*,
# which reads like a broken test suite when nothing failed.
timeout-minutes: 25
strategy:
# One shard failing should not cancel the other three. The point of splitting the suite is to
# see everything that is broken in one run, not the first thing.
fail-fast: false
matrix:
# A pull request runs the smoke subset, 99 tests in October 2026, which fits in one job in
# about five minutes of tests. A push to main runs the whole suite, 628 tests then, split
# four ways.
#
# Four JOBS, not four workers. playwright.config.ts pins `workers: 1` on CI because four
# headless Chromiums against one wrangler got workerd killed twenty seconds in. Sharding
# buys back the wall-clock without putting a second browser on any one workerd: every
# shard is its own runner with its own wrangler and its own local D1.
shard: ${{ fromJSON(github.event_name == 'pull_request' && '[1]' || '[1, 2, 3, 4]') }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: '22'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
# worker/ is deliberately NOT a pnpm workspace member (see deploy-worker.yml), so the root
# install does not reach it — and the suite needs its wrangler.
#
# --frozen-lockfile, against a worker/pnpm-lock.yaml that is now actually committed. It was
# `--no-frozen-lockfile` against an ignored lockfile, so every run resolved the toolchain
# afresh: CI never ran the wrangler anyone had tested locally, and a `wrangler dev` crash
# could not be told from a code change because the version moved underneath the suite.
- name: Install worker dependencies
working-directory: worker
run: pnpm install --frozen-lockfile --ignore-workspace
# `wrangler dev` runs the Worker locally against a local D1 and R2 under worker/.wrangler —
# no Cloudflare account, no network. It needs a signing key like any other deployment; this
# one signs sessions for a database that is deleted with the runner.
- name: Configure the local Worker
run: echo "JWT_SECRET=e2e-local-signing-key-not-a-real-secret" > worker/.dev.vars
- name: Build frontend
working-directory: ./frontend
run: pnpm run build
- name: Install Playwright Browsers
working-directory: ./frontend
run: pnpm exec playwright install --with-deps chromium
# Playwright starts both servers itself (wrangler on :8787, vite on :3800 proxied at it),
# applies the D1 migrations, then runs a setup project that registers an account, seeds the
# fixture profile and saves the signed-in state every spec starts from. See
# frontend/playwright.config.ts and frontend/tests/global.setup.ts — the whole thing runs
# locally with `pnpm run test:e2e`, which the four curl commands this replaces never did.
# `pnpm exec playwright`, not `pnpm run test:e2e -- --shard=…`: pnpm did not forward the
# flag, so every shard silently ran the WHOLE suite. Each one reported `529 passed (22.9m)`
# and then died on the 25-minute job bound — a timeout that reads as "the suite got slower"
# rather than "the split never happened". `pnpm exec playwright test --shard=1/4 --list`
# reports 133 tests; through `pnpm run` it reports an error.
- name: Run E2E tests
working-directory: ./frontend
env:
CI: true
PLAYWRIGHT_HEADLESS: true
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
pnpm run test:e2e:smoke
else
pnpm exec playwright test --shard=${{ matrix.shard }}/${{ strategy.job-total }}
fi
continue-on-error: false
# Both of these used to be wrong, and silently so. They uploaded `playwright-report/` and
# `test-results/` from the REPO ROOT, but Playwright writes them next to its config, under
# `frontend/`. Every run since they were added produced zero artifacts, so a failing spec's
# trace was never actually collected. The name has to carry the shard too — upload-artifact
# v4 rejects a second upload under a name another job already claimed.
# `always()`, not `failure()`. When a shard hits the job's `timeout-minutes`, GitHub records
# it as CANCELLED, and a `failure()` step does not run on a cancelled job — so the one run
# that most needed its traces was the one guaranteed not to upload them. `trace:
# retain-on-failure` means a green shard writes nothing here anyway, and if-no-files-found
# is already ignore, so this costs a clean run nothing.
- name: Upload failure traces
if: always()
uses: actions/upload-artifact@v7
with:
name: playwright-traces-${{ matrix.shard }}
path: frontend/test-results/
retention-days: 30
if-no-files-found: ignore
# `wrangler dev` prints an empty `✘ [ERROR]` when workerd dies and points at a log file it
# writes outside the workspace. Without this the crash that ends a shard is undiagnosable
# from the job log — which is exactly where the 2026-08-25 investigation ran out of road.
- name: Upload wrangler logs
if: always()
uses: actions/upload-artifact@v7
with:
name: wrangler-logs-${{ matrix.shard }}
path: ~/.config/.wrangler/logs/
retention-days: 30
if-no-files-found: ignore