Files
token-circles/docs/plans/2026-10-07-form-errors.md
KomediruzeckiandGitHub 993a4145d2 feat(forms): sign-in and support say what is wrong at the field (slice 6 of 6) (#615)
The sign-in screen and dialog, the sign-in code steps, the two-factor challenge and its enroll and
disable steps, the new-password screen and the support form move onto the form kit from #602: a
refused entry is said under the field it is about, with the cursor there, and nothing is sent. A
wrong address or password stays one message for the whole form and marks neither field.

- shared/signInSchema.ts holds the address format, a new password's 8 characters and a support
  message's length. The routes answer a refused field with 400 { error, fields }, and a code that
  does not sign in with 401 at code.
- Every field has a label and takes its look from a class, so a marked field shows the kit's
  danger border. The sign-in fields keep the ids password managers use.
- The captcha goes through one gate: a send waits for its token, and each token is used for one
  request.
- The reset page says a link is invalid only when the Worker says so. A check that failed says
  so, with Try again.
- A mail call gives up after 10 seconds.
- Migration 0032 adds a column to login_codes. A sign-in code requested before the deploy stops
  working, and the person asks for a new one.

Slice 6 of 6 in docs/plans/2026-10-07-form-errors.md.
2026-10-10 11:38:29 +02:00

89 KiB

Form errors: one answer, one schema, one kit

Status: slice 1 (categories) merged in #602; slice 2 (transactions and accounts) built on feat/forms-transactions, see Slice 2; slice 4a (loans and retirement) built on feat/forms-loans, see Slice 4a; slice 4b (profiles, Settings and import) built on feat/forms-profiles, see Slice 4b; slice 6 (sign-in and support) built on feat/forms-slice-6, see Slice 6 Date: 2026-10-07, decisions recorded 2026-10-08. Written on PR #599 (fix/dev-check-polish, 664fd0c6); rebased onto main (d92626fe) once #599 and #601 merged.

Decisions (2026-10-08)

  1. #601 merges first. Done: this branch is rebased onto main with #599 and #601 (git rebase --onto origin/main 664fd0c6), and #601's publicError and errorResponse carry fields. worker/test/category-refusals.test.ts fails if a refusal's fields stop reaching the client, and error-response.test.ts pins the answer.
  2. The refusals stay, with one rule: an edit that sends a field's stored value unchanged is never refused. Old rows can hold a 3-digit or named colour, a name over 100 characters, a type the app does not read, or two names that differ only in case, and the edit forms send every field they show on every save. So an edit checks only the fields whose value it changes, and the duplicate check runs only when the name changes, compared case-insensitively with the row's own stored name: a case-only rename of itself is allowed. Both runtimes, and the form.
  3. A parent from another profile is a 400 with fields.parent_id in both runtimes. The Worker used to answer 403.
  4. One CategoryDialog is a follow-up (Later).
  5. Placements confirmed: Retirement and RetirementPlanner in PR 4; Housing, Portfolio and Tags in PR 5; auth and support in PR 6.
  6. Success toasts quote a name in straight double quotes, the style the app's visible copy uses most: at the fork point, 19 strings use straight double quotes and 4 use curly ones, and every toast that quotes uses straight ones. #599 standardised on straight apostrophes for the same reason. Goals gaining a success toast is fine.
  7. The busy state is in the kit, so every form inherits it: while a save runs the submit button reads "Saving…" or the form's own verb ("Adding…"), the form is aria-busy, and the button stays focusable (aria-disabled, not disabled). Busy labels use the ellipsis character, as 39 of the app's 66 busy labels do.

Why

On the local-first demo, creating a category with the icon field left blank failed. The only feedback was a toast that said "Failed to save category" after a router answer of "Validation failed": no message at the field, no red border. Typing any icon made it save. The blank icon is fixed on #599. This workstream is about everything around it: a refused form says what is wrong, at the field that is wrong, in the same words in both runtimes.

What the code does today

Measured on #599's head (664fd0c6).

  • The client drops the reasons. The local-first router answers a refused body with 400 { error: 'Validation failed', details: [{ field, message }] } (frontend/src/core/validation.ts validateBody), and the messages are zod's own. The typed client's request() (core/api.ts) reads error (or message) and nothing else; the raw helpers' parseJsonResponse() reads error only. Nothing in frontend/src reads details: the only readers are core/__tests__/validation.test.ts and the console-message detectors described under Risks.
  • The Worker validates almost nothing with a schema. zod covers only the money fields of a transaction (worker/src/validation.ts), throwing HttpError(400, 'Invalid transaction: amount: must be a positive number'). Every other route hand-checks a few fields and answers { error: '<its own sentence>' }. 208 HttpError(4xx) refusals across 23 route files.
  • Four client surfaces, not two. The typed api.* goes through request(). The raw apiGet/apiPost/apiPut/apiDelete call apiFetch and parse with parseJsonResponse(). Two components (three forms) call apiFetch directly and read the body themselves (EmailCodeLogin, TwofaChallenge), and SupportContact calls fetch with no apiFetch at all. Only the first two are in scope for ApiError; the other two keep their own handling (they are auth and support forms, last in the rollout).
  • The surfaces already differ. A 401 on a write dispatches auth:required from request() and from nothing else. A non-JSON error body (a Cloudflare 502 page) becomes Error('HTTP 502') in request() and Error('Invalid response format'), with no status, in the raw helpers. A network failure surfaces as the browser's TypeError ("Failed to fetch") on both.
  • Forms barely mark errors. 21 <form> elements in 18 files. aria-invalid appears in 3 components (LoginScreen, AccountSelect, SubscriptionCatalogModal). No <label> in the category forms is tied to its control.
  • Toasts carry the failures. 75 single-line toasts start with "Failed to", "Could not" or "Couldn't" (42 showToast, 28 toast, 5 addToast) in 27 files. 20 toasts print a caught error's .message directly (err., error. or e.message), in 9 files: Tags (6), Settings (5), Loans (2), OnboardingWizard (2), and one each in RecurringSection, ResendVerification, CompoundInterestCalculator, EmergencyFundCalculator and Transactions. Transactions' save prints one more through a variable (const message = error instanceof Error ? error.message : ...).
  • HTML validation does the client-side checking, where there is any. required on the name makes the browser show its own bubble and swallow the submit, so the form never runs its own code for an empty name, and a name of three spaces passes the browser and fails the server.

Inventory: the 21 forms

Surface: raw = apiPost/apiPut helpers, typed = api.* through request(), apiFetch = direct apiFetch with a hand-read body, fetch = plain fetch.

# Form (file:line) Entity Endpoints Client-side checks today A refusal shows as Surface PR
1 features/Categories.tsx:476 category POST /api/categories, PUT /api/categories/:id required on name toast "Failed to save category" raw 1
2 features/Budgets.tsx:1346 category same as 1 required on name toast "Failed to save category" raw 1
3 features/Bills.tsx:1017 category POST /api/categories required on name toast "Failed to add category" raw 1
4 features/Goals.tsx:877 category POST /api/categories required on name toast "Failed to create category" raw 1
5 features/Transactions.tsx:1382 transaction POST /api/transactions, PUT /api/transactions/:id (+ tags, receipt) 7 JS checks, each a warning toast ("Please enter a description", ...) toast of the raw error message typed 2
6 features/Accounts.tsx:582 account POST /api/accounts, PUT /api/accounts/:id required on name; balance parse, as a toast toast "Failed to create account" / "Failed to update account" raw 2
7 features/Goals.tsx:709 savings goal POST /api/savings-goals, PUT /api/savings-goals/:id required name and target; decimal sanitiser toast "Failed to save goal" raw 3
8 features/Bills.tsx:878 bill POST /api/bills, PUT /api/bills/:id required name, amount, due date toast "Failed to save bill" raw 3
9 features/Loans.tsx:751 loan POST /api/loans, PUT /api/loans/:id required on five fields; a hand-rolled type="number" (solid-forms rule 2) toast "Failed to save loan" raw 4
10 features/Retirement.tsx:458 retirement goal POST /api/retirement-goals, PUT /api/retirement-goals/:id required on all; ages 18-100, return 0-20 toast "Failed to save retirement goal" raw 4*
11 features/RetirementPlanner.tsx:452 retirement plan PUT /api/retirement/settings none (NumberField, MonthPicker; the server normalises) toast "Failed to save your retirement assumptions" raw 4*
12 features/Housing.tsx:443 housing expense POST /api/housing required name and amount; due day 1-31 toast "Failed to save housing expense" raw 5*
13 features/Portfolio.tsx:483 holding POST /api/portfolio/holdings, PUT /api/portfolio/holdings/:id required; then a toast "Please fill all required fields" toast "Failed to save holding" raw 5*
14 features/Tags.tsx:543 tag POST /api/tags, PUT /api/tags/:id none: an empty name returns silently, with no feedback at all toast of the raw error message typed 5*
15 components/LoginScreen.tsx:302 session /api/auth/login, /register, /forgot-password email format at the field (aria-invalid); password length in the form error form-level text, the raw error message typed 6*
16 components/LoginModal.tsx:243 session /api/auth/login, /register required and length, in the form error form-level text, the raw error message typed 6*
17 components/EmailCodeLogin.tsx:125 sign-in code /api/auth/email-code/request email required form-level text, the body's error apiFetch 6*
18 components/EmailCodeLogin.tsx:194 sign-in code /api/auth/email-code/verify 6 digits form-level text, the body's error apiFetch 6*
19 components/TwofaChallenge.tsx:82 2FA code /api/auth/2fa/verify code present form-level text, the body's error apiFetch 6*
20 components/ResetPassword.tsx:142 password reset /api/auth/reset-password length, match form-level text, the raw error message typed 6*
21 components/SupportContact.tsx:192 support message /api/support/contact email and message present form-level text, the raw error message fetch 6*

* Not placed by the brief. Recommendation under Rollout.

The Transactions form has no inline category creation, and neither has the command bar or the guided entry: they pick from the active profile's list. The category flows are the four forms above, plus one-click colour swatches on the Categories and Budgets cards (PUT /api/categories/:id { color }), which have no form in front of them and keep a toast.

Editing surfaces that are not <form> elements

These write through the same endpoints and belong to the same PRs, though they have no <form>: the Budgets page's budget, allocate and rollover modals (PR 3); the Categories page's Set Budget modal (PR 3); Goals' contribute action (PR 3); Loans' rate periods and prepayments (PR 4, today a toast "Month and amount are required"); ProfileModal and the sidebar's profile create (PR 4); the Settings page (PR 4); the import flow, bank rules and connected sources (PR 4); RecurringSection, SubscriptionCatalogModal, SubscriptionScan and OnboardingWizard (recommended for PR 5).

Categories: local-first against the Worker, today

Rule Local-first (validation.ts zod + handlers/categories.ts) Worker (routes/categories.ts)
name, create required, trimmed, "Category name is required"; zod min(1) first required, trimmed, "Category name is required"
name, edit zod min(1): " " passes and is stored no check: '' is stored, null hits NOT NULL and answers 500 with D1's text
name length 100 none
duplicate name create only, case-insensitive create only, exact match ("Food" and "food" both allowed)
duplicate on rename none none
type required, income or expense optional, default expense, any string stored
color required, #RRGGBB optional, default #6b7280, any string; a non-string throws in .trim() and answers 500
icon blank becomes tag (#599) blank becomes tag (#599)
tax_deductible must be a boolean any truthy value; an edit without it clears it
parent must belong to the profile, 400 must belong to the profile, 403; an edit without it clears it
unknown keys on an edit written into the IndexedDB row as sent ignored
refusal body { error: 'Validation failed', details: [zod messages] } or { error: '<sentence>' } { error: '<sentence>' }

Where they disagree on what is valid, a person sees it:

  • Editing an imported category fails in local-first only. The read schema accepts four types (income, expense, transfer, account), because older imports wrote account-typed categories before the importer learned to make accounts of them. The local update schema accepts two, so saving any change to such a category answers "Validation failed". The Worker accepts it.
  • A body without a type or colour fails in local-first only, though the local handler has defaults for both: validateBody refuses it before the handler runs.
  • The Worker stores what the read schema then refuses. A category saved with type savings makes CategorySchema throw on every api.getCategories() for that profile.
  • An edit on the Worker silently clears tax_deductible and the parent, because the Categories form sends neither. No form sets either today, so nobody has seen it; the tax report reads tax_deductible.

Other entities: where the runtimes disagree

From validation.ts against each Worker route; each PR re-checks its own entities in detail.

  • Transactions. Local refuses type deduction (the Worker and shared/transactionInvariant.ts allow it), requires description, a YYYY-MM-DD date and a category_id key; the Worker requires none of those. The Worker checks two decimals; local does not. Settled in slice 2.
  • Accounts. Local requires type from four values; the Worker defaults it to giro. A 409 base-currency conflict carries a useful sentence that the Accounts form drops for "Failed to create account". Settled in slice 2.
  • Budgets. Local requires amount, period and start date; the Worker checks only that the category is the profile's. Settled in slice 3.
  • Bills. Local accepts an amount of 0, the Worker refuses it; local requires a frequency from five values, the Worker stores any. Settled in slice 3.
  • Savings goals. Local requires a positive target; the Worker accepts 0. Settled in slice 3.
  • Loans. Local requires every field; the Worker checks none. A loan without a name answers 500 with D1's text, and interest_rate || 5.0 turns a 0 % loan into a 5 % one. Settled in slice 4a.
  • Housing. The local schemas are registered as /api/housings, but the route is /api/housing, so they never run. (They would refuse the form: they require a purchase price the Housing form does not send.) Settled in slice 5.
  • Profiles and tags. Both runtimes refuse a duplicate name; tags compare exactly on the Worker. Profiles settled in slice 4b, tags in slice 5.

Design

1. One answer from both runtimes

A refused body answers 400 { error: string, fields?: Record<string, string> }.

  • fields maps a body field's name to one sentence that says what is wrong and how to fix it: "Give the category a name." The keys are the body's keys, so a form whose values are named like its body (all of them) maps them without a table.
  • error is a summary for a client that cannot place fields: an older frontend, an API client, a form that has no field of that name. It is every field message in order, joined with a space. A degraded client therefore still shows "Give the category a name." rather than "Validation failed".
  • Other statuses answer { error } in plain words. Unexpected 500s are generic since #601 (worker/src/error-response.ts).

On the Worker, HttpError (worker/src/http.ts) gains an optional fields, and #601's publicError and errorResponse (the app's onError) send it. A route turns a failed check into that error with one call (accept(...), below). This keeps the existing pattern, a refusal is a throw, and lets PR 2 convert validateTransactionCreate without changing its callers.

In the local-first router, validateBody answers the same body. Categories go through the shared check; every other entity keeps its zod schema until its PR, but its issues are translated into a field and a plain sentence ("Fill in the name.", "Choose a frequency from the list.") instead of zod's text. details goes: nothing reads it.

2. One schema per entity, in shared/

shared/ cannot import zod. The Worker is installed outside the pnpm workspace, the root has no zod, so a bare import 'zod' from shared/ resolves in neither bundle, and the frontend's zod must load zodConfig before any schema is defined (CSP). The existing shared validators (transactionInvariant.ts, importRowChecks.ts) are plain TypeScript for the same reason. So is this:

// shared/refusal.ts: the contract
export type FieldErrors = Record<string, string>;
export interface Refusal {
  error: string;
  fields?: FieldErrors;
}
export type Checked<T> = { ok: true; value: T } | { ok: false; fields: FieldErrors };
export function refusalOf(fields: FieldErrors): Refusal; // error = every message, joined

// shared/categorySchema.ts: the category, for the form, the local handler and the Worker route
export function checkCategoryCreate(body: unknown): Checked<CategoryInput>;
// An edit of a stored row: only the fields whose value the body changes are checked and returned.
export function checkCategoryEdit(body: unknown, stored: object): Checked<Partial<CategoryInput>>;
export function renamesCategory(storedName: unknown, name: string): boolean; // not by case alone
export function categoryNameTaken(name: string): FieldErrors; // the duplicate-name refusal
export function sameCategoryName(a: string, b: string): boolean;

Rules for every entity schema:

  • Messages are written for people, say what to do, and name no internals.
  • A blank optional field takes its default, on a create and on an edit: a blank icon is tag, a blank colour #6b7280, a blank type expense. A field left out of an edit is left alone.
  • Valid means what the store can hold and the read schema accepts. A category's type is one of the four the read schema knows, so imported categories can be edited.
  • Checks that need the database (a duplicate name, a parent in another profile) stay in the handler and the route, with their message from the schema module, so both runtimes still say the same thing.

For categories the shared rules settle every disagreement above: the name is required and at most 100 characters on a create and an edit; a duplicate is case-insensitive in both runtimes, and a rename onto an existing name is refused too; type, colour and icon have defaults; an edit that leaves out tax_deductible or the parent keeps them; unknown keys are dropped. A parent from another profile is refused at parent_id with a 400 in both runtimes; no form sends a parent yet.

An edit checks only what it changes (decision 2). A field sent back with the value the row holds is neither checked nor written, so a row saved under older rules can still be edited: a colour-only edit of a category whose name is over 100 characters saves. What the edit changes is checked like anything else. The duplicate check runs only when the name changes other than in case or surrounding space. "Unchanged" means the stored value as the field reads it: a parent sent as "771104" is the stored 771104, and a tax flag sent as false is the stored 0. A value the rules refuse is unchanged only as stored. A name is the same name without the space around it: older versions stored names as typed, and a long name with a trailing space, sent back trimmed, was refused for its length. The comparison needs the row: the Worker route and the local handler run checkCategoryEdit(body, row) after loading it, and the local router has no category PUT entry in validateBody. The form runs the same check against the values it opened with, and sends a name it did not touch back as it came.

3. One client error type

// frontend/src/core/apiError.ts
export class ApiError extends Error {
  readonly status: number; // HTTP status; 0 when no answer arrived
  readonly fields: Readonly<FieldErrors>; // {} when the answer had none
}
export function apiErrorFrom(response: Response): Promise<ApiError>;
export function plainMessage(error: unknown, fallback: string): string;
  • request() and parseJsonResponse() both throw await apiErrorFrom(response) for any non-2xx. .message is the answer's error (or message), else a plain sentence for the status, so a non-JSON 502 says "Token Circles isn't answering right now. Try again in a moment." on both surfaces. status stays where errorStatus() and the 409 handling read it.
  • apiFetch turns a failed network request to the API into ApiError(0, ...), with a sentence that depends on navigator.onLine. An abort passes through untouched. Both surfaces get it for free, and so do the direct apiFetch callers.
  • An older Worker answers without fields; fields is {} and the form shows the summary.
  • plainMessage(error, fallback) is the one way to put a failure in a toast: an ApiError's words, or the caller's fallback for anything else (a TypeError from a bug says nothing a person can act on).

4. The form kit: frontend/src/components/form/

const form = createForm({
  initial: { name: '', type: 'expense', color: DEFAULT_COLOR, icon: '' },
  check: (values) => fieldErrorsOf(checkCategoryCreate(values)), // {} when fine
  send: (values) => saveCategory(values), // throw to refuse
  saved: () => close(), // only while this is still the form that sent
  failure: "Couldn't save the category. Try again.", // when the error carries no words
})

form.values.name           // a store: read it in JSX
form.set('name', value)     // returns value; re-checks every field a submit has marked
form.reset(values?)         // open for an edit; drops the answer to a send still in flight
form.error('name')          // the field's message, or undefined
form.notice()               // the form-level message, or undefined
form.submitting()           // true while send() runs
form.submit                 // what the <form> runs on submit
form.attrs                  // spread on the <form>: noValidate, onSubmit, aria-busy while sending
<form class={styles.modalBody} {...form.attrs}>
  <FormNotice form={form} />
  <Field form={form} name="name" label="Category name" class={styles.formGroup}
         labelClass={styles.formLabel}>
    {(control) => (
      <input {...control} type="text" required class={styles.formControl}
             value={form.values.name} onInput={(e) => form.set('name', e.currentTarget.value)} />
    )}
  </Field>
  <Field form={form} name="color" label="Color" group ...>
    {(control) => <div {...control} class={styles.colorPicker}>...swatches...</div>}
  </Field>
  <SubmitButton class={styles.btnPrimary} busy={form.submitting()} busyLabel="Adding…">
    Add Category
  </SubmitButton>
</form>
  • Field renders the label (for the control, or aria-labelledby for a group such as the swatches), the control, the error and the hint. The control gets id, name, aria-invalid and aria-describedby (error first, then hint).
  • [aria-invalid="true"] inside a field gets a border in --danger. The message uses a new --danger-text token, set in both themes for 4.5:1 on the modal surface; --danger itself is 4.4:1 on the light theme's white.
  • FormNotice is a role="alert" region for what belongs to no field: offline, a 500, a field the server named that this form does not show.
  • On submit the kit runs check. Errors mark their fields and focus moves to the first invalid control in DOM order; nothing is sent. Otherwise send runs; an ApiError with fields marks the fields this form has (registered by its Fields) and puts the rest in the notice; one without fields puts its message in the notice; anything else puts failure there.
  • A marked field is re-checked as it changes, so its message goes as soon as it is fixed. An unmarked field is never checked while typing. A server mark (a duplicate name) goes on the first change, because the client check cannot know it still holds.
  • novalidate on the form (from form.attrs), required kept on the control: the browser stops swallowing the submit, and assistive technology still hears "required".
  • While send runs, form.attrs sets aria-busy="true" on the form and a second submit does nothing. SubmitButton reads busyLabel ("Saving…" by default) and is aria-disabled, not disabled: a disabled button loses focus, which drops a keyboard user at the top of the page. A click on it while busy submits nothing. The kit's stylesheet gives it the look a page's own :disabled rule would have.
  • Closing the dialog after a save goes in saved, which gets what send returned. The kit runs it only while the form is still the one that sent, as it drops a late refusal: a dialog cancelled and opened again while its save was out has been reset, and the late save used to close it, with what was being typed in it. The category dialogs' close is their saved. Their success toast is in send, after the write: a save that lands after a cancel still happened, and says so.
  • It follows solid-forms rules 1 to 4; it renders no list of editable rows and no number field.

The category's form logic lives once, in features/categoryForm.ts (the values, the shared check, the create or update call, the success toast): createCategoryForm({ color, editing, onSaved }) returns the form plus open(category?), which fills it for a new category or an edit. Each of the four places keeps its own markup and look, built from Field, FormNotice and SubmitButton. A create or an edit sends only the four fields the dialogs show, so an edit cannot clear a parent or a tax flag. An edit is checked with checkCategoryEdit against the values open filled in, so a row saved under older rules can be edited without its name or colour being refused.

5. Toast policy

A form's errors stay in the form: no failure toast from a converted form. Toasts are for success, undo, and work with no form in front of the person (a swatch click, a delete, a background reload). Those failure toasts go through plainMessage. A success toast that names what was saved quotes it in straight double quotes: Added "Coffee" to your categories. (decision 6).

6. Guards

  • frontend/src/__tests__/toastErrorMessages.test.ts scans src for a toast that prints a caught error's .message, directly or through a variable assigned from one a few lines above. It allows today's 20 by file and count (21 at the fork point; #599 fixed one in Transactions), fails when a file goes over its count (a new one), and fails when a file goes under (shrink the list). A converted file is not on the list, so it is held at zero. The scanner is tested on samples it must and must not flag.
  • Unit tests for the kit, ApiError on both surfaces and in both modes, and the shared schema.
  • Worker tests for the categories routes' refusals and the fields passing through errorResponse.
  • Per-form tests on the real local-first router: a bad submission marks the field and sends nothing; a server refusal marks the field; no failure toast.
  • E2E per converted form, cloud and local-first: a bad submission marks the field.
  • Rule 5 in .claude/skills/solid-forms/SKILL.md.

Slice 2: transactions and accounts (2026-10-08)

On feat/forms-transactions, from main at 60408c6e (#602 and #603 in).

  • One set of rules each, in shared/. shared/transactionSchema.ts and shared/accountSchema.ts hold the rules and their words. The Worker routes (worker/src/routes/transactions.ts, accounts.ts), the local-first handlers (frontend/src/core/storage/handlers/transactions.ts, accounts.ts) and the two forms run them, and both runtimes answer a refusal with 400 { error, fields }. validation.ts keeps POST:/api/transactions and POST:/api/accounts as calls into the shared checks; their zod schemas are gone, and an edit is checked in the handler against the stored row.
  • An edit checks and writes only what it changes (decision 2), in both runtimes and both forms: a row an import stored with three decimals can still have its description changed.
  • The Transactions form is on the kit (frontend/src/features/transactionForm.ts). The seven warning toasts are field errors; a refusal from either runtime lands under its field; a Cash account that could not be created says why under the account field (form.mark). Tags, receipts, transfers, copy and household view work as before. Enter in a field now saves, as Save does: the old form had no submit button.
  • The Accounts dialog is on the kit (frontend/src/features/accountForm.ts): name and balances under their fields, and the 409's sentence in the dialog's notice.
  • The kit gained form.mark(name, message) and Field's tip, which keeps an InfoTip's explanation out of the control's name.

What the runtimes now agree on:

Question Before Now, in both
Type deduction Local refused it; the Worker took it Taken: it is one of TRANSACTION_TYPES
Description Local required it Optional, blank is empty; the form still asks for one
Date Local required YYYY-MM-DD; the Worker took any text Blank is today on the person's calendar; a given date must be a real one
category_id key Local required the key Optional; none is uncategorized
Decimals The Worker allowed two; local any At most two, and below one trillion
Another profile's account or category The Worker 403, local-first 400, each in its own words A 400 at its field: account_id, transfer_account_id or category_id
Local-first stored The body as sent The checked row only
Account type Local required one of four; the Worker made any giro Blank is giro, the old names map (LEGACY_ACCOUNT_TYPES), anything else is refused
Account name Local: 1 to 100 characters; the Worker: any, and an edit ignored a blank one Required, at most 100 characters, on a create and on an edit that changes it
Account balance and currency Local checked both; the Worker neither Numbers, and a three-letter currency; a new account's balance is its starting balance

Fixed on the way, each with a test that failed before: an edit updates the goals of both categories it moves between (Worker); a new amount moves the local amount at the row's own rate; the edit form opens with the row's own exchange rate instead of 1; an edit saves notes, a beneficiary or a payor someone cleared; the Worker answers "No changes" to an account edit that changes nothing.

Open for the owner: whether the form keeps asking for a description, a category and an account that the runtimes do not require (an edit of an imported row without them is asked for them); the category list's blank option reads "Uncategorized" while the form refuses it for income and expenses (as before); the Worker's default currency for a body without one is USD where local-first's is the browser's; Add Account takes the starting balance and ignores Current Balance when both are filled.

Slice 3: budgets, goals and bills (2026-10-08)

On feat/forms-budgets, from #605 and moved onto main at 5b4a4d91 (#606 in).

  • One set of rules each, in shared/. shared/budgetSchema.ts, shared/goalSchema.ts and shared/billSchema.ts hold the rules and their words, and read values through shared/fieldReaders.ts. The Worker routes (budgets.ts, savings-goals.ts, bills.ts), the local-first handlers and the forms run them; both runtimes answer a refusal with 400 { error, fields }, and an edit checks and writes only what it changes. The three zod schemas are gone from validation.ts.
  • The forms are on the kit. The goal dialog and Add Funds (features/goalForm.ts), the Bills dialog (features/billForm.ts), and Allocate and both Set Budget dialogs (features/budgetForm.ts, one save between them). A refusal lands under its field, a category deleted in another tab is marked at the category, and a save says what it did.
  • Set Budget goes through Allocate, so it changes the month's budget instead of adding a second one, and Allocate sets the month on screen.
  • One rule for when a bill falls due next (shared/billSchedule.ts). The Bills list, its calendar, GET /api/bills/upcoming, the Dashboard and mark-paid use it in both runtimes, and the pages say the next due date rather than the first one a bill was saved with (features/billDue.ts).
  • Money to the cent (shared/money.ts). Budget summaries and a bill's payment answer 739.65, not 739.6500000000001, in both runtimes. worker/test/money-parity.test.ts and its local-first twin make every row through POST, as the forms do.

What the runtimes now agree on:

Question Before Now, in both
Budget without a start date A 500 from D1 on the Worker It starts on the first of the person's month
Budget amount Local required one; the Worker took anything Zero or more, to the cent
Goal target The Worker took 0, or text More than zero, to the cent
Goal contribution The Worker added nothing for an unreadable amount; local added text as text More than zero, to the cent, added in one write
Goal saved without a monthly amount Local stored null and no tracking date 0, counted from today
Bill amount and frequency Local took 0 and daily; the Worker stored any frequency More than zero; weekly, biweekly, monthly or yearly
Bill without a day of the month Local stored 1 None: the due date's day is the bill's
Another profile's category or account The Worker 403, local-first 400 A 400 at category_id or account_id
Deleting a bill the profile does not have 200 on the Worker 404
A category with spending and no budget Local gave it its spending as its budget, 100% used An amount of 0, nothing used
Budget trend and forecast history Local counted every expense of the month What the budgeted categories spent
"Over budget by" "$-10.00" on the Worker, "$0.00" at exactly 100% in local-first What was spent past the allocation, from past 100%
The budget flow (sankey) The Worker left uncategorised spending out It is shown as Uncategorized, budgeted at what was spent
Upcoming bills The first due date on the Worker; none, or the stored rows, in local-first The next due date, by one rule

Fixed on the way, each with a test that failed before: setting a month from last month's spending replaced the month's budgets (it now fills only the categories without one, as Copy last month does); the bill calendar left out a bill due on the 31st in a shorter month; budget alerts measured every month's budget against this month's spending; the Bills dialog saved no category, ever; Allocate set this month whatever month was on screen; Set Budget added a budget on every save; New Goal opened as Edit Goal after a backdrop close; the Dashboard said "Due in Due in 12 days"; a weekly bill could not be paid on the day it fell due again; and a field marked in a closed section of a form was said twice.

After review (#607), each with a test that failed before:

  • A budget stored with a float error (0.6000000000000001) opened in Allocate and Set Budget as that text, which the cents rule refused, so it could not be saved untouched. The dialogs open on the amount to the cent, and Backfill from Spending stores each month's sum to the cent in both runtimes.
  • A weekly or biweekly bill falls due on its own weekday, its first due date plus whole weeks, whenever it is paid: paid two days late, a Monday bill is still due next Monday. A payment up to one step before the first due date pays that date. A bill stored as daily falls due every day.
  • Allocate, in both runtimes, and the MCP tool upsert_budget change the month's budget whatever day it starts, instead of adding a second one, and upsert_budget runs the budget checks.
  • The reminder emails and the MCP read tools use the same rules: the bills reminder lists what the Bills page calls overdue or due within a week, on the dates they fall due; the budget alert and get_budgets_and_goals read the month's budgets only; get_overview lists the Dashboard's Upcoming Bills. GET /api/bills/notifications has no caller and is left for the PR that removes dead routes.
  • Local-first checks a bill's account before its category, as the Worker does; the subscription scan and catalog say which entry was refused and why; deleting a bill another tab deleted drops it instead of failing.

Two contributions to a goal sent at once both count, in both runtimes. The code already added in one write; the new tests fail when it reads the goal and writes the sum back.

Open for the owner: whether an unpaid bill stays overdue until it is paid (each occurrence tracked) or, as coded, until its period ends, when it falls due again with nothing said about the missed one; whether a payment should cover the earliest unpaid occurrence, accepted up to one period early (it needs a stored "paid through" date); whether to merge, with a one-off migration, the second budgets main's Set Budget wrote for a category and month; whether Backfill from Spending should fill only the months and categories without a budget, as from-expenses and Copy last month now do, rather than replace its range; the Dashboard's Upcoming Bills leaves overdue and paused bills out; a bill's frequency is one of four, so a stored daily bill opens with a blank frequency; a budget of zero is allowed where a goal target must be more than zero; "Over budget by $" names dollars whatever the currency; the Bills dialog has no account field, so a payment moves no balance unless an API client set one; there is no way to remove a budget on the page. Follow-up: the bill calendar draws every bill once a month, whatever its frequency.

Slice 4a: loans and retirement (2026-10-08)

On feat/forms-loans, from 149a41e8 and moved onto main at 39808e0b (#607 in).

  • One set of rules each, in shared/. shared/loanSchema.ts (a loan, a rate period and an extra payment), shared/retirementGoalSchema.ts and shared/retirementPlanSchema.ts hold the rules and their words. The Worker routes (loans.ts, retirement-goals.ts), the local-first handlers and the forms run them. Both runtimes answer a refusal with 400 { error, fields }, a row's field named <list>.<index>.<field> (rate_periods.0.rate, lifestyles.1.monthlySpendToday), and an edit of a loan, a rate period, an extra payment or a goal checks and writes only what it changes. The plan is saved whole: its ranges are the ones normalizeSettings reads a stored plan into, so a plan read back and sent unchanged always saves.
  • The forms are on the kit. The Loans dialog, its rate periods as rows (features/loans/loanForm.ts); adding and changing an extra payment (features/loans/extraPaymentForm.ts); the Retirement page's goal dialog (features/retirementGoalForm.ts); and the planner's assumptions (RetirementPlanner.tsx).
  • The kit takes a list of rows, whose marks follow a row when one before it is removed. It keeps its own copy of the values it starts from and is reset to, and SubmitButton takes unchanged for a form whose values are already saved: the planner's "Saved", aria-disabled so it keeps focus. NumberField and MonthPicker carry a field's marks.

What the runtimes now agree on:

Question Before Now, in both
A loan without a name A 500 from D1 on the Worker Refused at name
A loan without a rate Saved at 5 % on the Worker Refused at interest_rate; 0 % stays 0 %
A rate period's rate and payments Stored as sent on the Worker 0 to 100 %, inside the loan's term, refused at a row
An extra payment with three decimals Rounded Refused at amount
Removing a rate period or extra payment 200 on the Worker for one the loan does not have 404
A loan the profile does not have "Not found" on the Worker "Loan not found"
The loan list's extra payment total null for none on the Worker; float sums in both 0 for none, to the cent
A retirement goal without ages or a return Saved as 30, 65 and 7 % Refused at each field
A retirement goal at 0 % Saved as 7 % 0 %
A goal edit that sends only a name A 500 on the Worker The name changes
A goal the profile does not have "Not found" on the Worker "Retirement goal not found"
A plan value outside its range Moved into range, or dropped, without a word Refused at the field
The FIRE calculator with an inflation rate Ignored on the Worker Deflates the projection

The contract's loan-total-prepaid-none and fire-inflation are settled and their pins removed.

Fixed on the way, each with a test that failed before: a goal saved at 0 % showed, and opened, at 7 %, and one without a date said "Invalid Date"; local-first restored a backup's 0 % goal at 7 %; local-first served a POST /loans/:id/prepayment that nothing called; removing an extra payment another tab had removed was an error toast and left the row listed (local-first, and cloud once the Worker answers 404), and now says "That extra payment was already removed." and reads the loan again; deleting a loan another tab had deleted said "The loan was not deleted. Check your connection and try again." and left it listed, and now says "That loan was already deleted.", with any other failure in the runtime's words; and a change open on an extra payment lost the caret when the list was read again, as on coming back to the page after a minute away. The parity guard (shared/fixtures/loanFormParity.ts) gained a loan with two extra payments in one month and one after payoff, so each runtime's schedule and its list's total_prepaid are held to figures worked out by hand.

Not a fix to anything shipped: main's dialog never gave a new loan the rate periods of a loan edited before it. It replaced the draft's list on every change rather than changing it (LoanForm.tsx on main, lines 55, 64-66, 326-328 and 353-356). Moving the dialog onto the kit exposed the kit's shallow copy: a reset changed in place the lists of the values the form was given, so the first edit of a loan wrote its rate periods into the blank loan's list. The kit's own copy of its values (c3849fe2) fixed that before merge, with a test that fails without it.

Open for the owner, each a change no decision covers: a new loan must give a rate and an edit cannot empty one, where the Worker saved 5 % and kept the stored rate; a third decimal on an extra payment is refused where it was rounded; a new goal must give both ages and a return, where the API filled in 30, 65 and 7 %; the goal dialog's date is optional, as both runtimes always took it, where the dialog had made it required; the ranges (ages 18 to 100, a goal's return 0 to 20 %, a loan's rate 0 to 100 % and its term 1 to 1200 months); a plan saved through the API is refused where it was clamped; a loan's extra payment total of 0 for none, and the FIRE calculator taking inflationRate in both runtimes, as local-first did; an extra payment's month and amount read from text; the wording of the new messages and toasts; the planner's "Saved" button, the kit's unchanged state; a name over 100 characters, refused for a loan on the Worker and for a goal in both, where only local-first capped a loan's; two decimals on a loan's amount and a goal's three amounts; a goal's target above zero and its saved amount and contribution zero or more, where both runtimes stored text or a negative target; real dates for a loan's first payment and a goal's target date, where the Worker stored any text for both and local-first checked only a loan's shape, so 2026-02-30 saved; a rate period's rate from 0 to 100 and payments inside the term; the goal dialog's Current Amount, no longer required, a blank one saved as 0; the goal card's "Not set" and "No target date"; and a second Remove of an extra payment, a 404 the page now says was already done.

Slice 4b: profiles, Settings and import (2026-10-09)

On feat/forms-profiles, from f368caa7 (slice 4a's tip, merged into main as b51ec632).

  • One set of rules each, in shared/. shared/profileSchema.ts (a profile's name, created and renamed), shared/settingsSchema.ts (what PUT /api/settings stores, and the keys it leaves to the routes that own them), shared/importSourceSchema.ts (a connected source and a Google Sheet link), shared/categoryMappingSchema.ts (a learned category mapping, applying mappings and auto-map), shared/autoCategorize.ts (the suggestions both runtimes make), shared/exportColumns.ts (the file each kind exports) and shared/importUpload.ts (an uploaded file, read alike). The Worker routes, the local-first handlers and the forms run them, and both runtimes answer a refusal with 400 { error, fields }.
  • The forms are on the kit. The Create Profile dialog and the sidebar's create (components/ProfileModal.tsx), Settings' profile rename (features/profileForm.ts), base currency (features/baseCurrencyForm.ts) and email reminders (features/notificationsForm.ts, the waiting change from #608 kept), Connected Sources' "Add a sheet" (features/import/sheetSourceForm.ts), the Import page's Google Sheets link (sheetLinkForm.ts), Paste CSV (pasteForm.ts) and File Upload (uploadForm.ts), and the Bank Imports rules editor, its rules as rows (BankRulesEditor.tsx, with core/bankImport/rulesCheck.ts, since the rules live in the browser only). Settings leaves the toast guard's known list: its four toasts of a caught error go through plainMessage.

What the runtimes now agree on:

Question Before Now, in both
A profile name blank, over 100 characters, or another profile's in other case Stored on the Worker, or refused at no field Refused at name; re-casing a profile's own name is allowed
A profile created 200 on the Worker 201
Deleting a profile Local-first refused one not in use and deleted the last one Any profile but the last; the last is refused
Clearing a profile, or all data The Worker kept its connected sources Deleted with the rest
A backup Carried no connected sources; local-first's file for one profile carried another's plan and badges Carries each profile's sources and only its own settings; a restore answers what it put back
POST /api/profiles/reseed-demo Cleared and reseeded on the Worker, a demo reseed in local-first 410 on the Worker; local-first keeps its demo reseed
A setting another route owns (retirement_settings, email_*, a backup's extensions, a cache) Stored through PUT /api/settings Refused at that key, and nothing in the request stored
A base currency '', EURO or 12; usd Stored on the Worker; usd refused there (422) Refused at currency; usd saved as USD
A base currency once a profile has data 409 with no field 409 at currency, in words that say why
The storage mode The Worker answered type: sqlite; local-first's POST switched the browser { mode }, and a POST that switches nothing
An uploaded file's cells Numbers and Excel date serials on the Worker; a session answer in local-first Every cell as text, a date as its day; a broken file refused at file
A category mapping for another profile's category 403 on the Worker; 400 at no field in local-first 400 at category_id
Mappings listed, saved again, applied, auto-mapped Local-first listed every selected profile's, added a twin, filed nothing The profile's own; saved again updates it; applying files the listed transactions and learns
A kind exported on its own Local-first's own columns and JSON, any backup kind, every profile The Worker's columns, a header for no rows, the list as JSON, the request's profiles; another kind refused
A connected source's kind, schedule, name, settings or account "Invalid kind"; a long name cut; text or settings stored empty; another profile's account taken; a sheet saved with no link Refused at each field; an edit checks only what it sends
A Google Sheet link that is not a sheet's "Invalid Google Sheets URL or ID", or "URL is required", at no field Refused at url

The contract's profile-answers, profile-delete-selection, profile-delete-last, profile-clear-import-sources, backup-restore-answer, profile-reseed-demo, storage-mode-answers, import-upload-answer, category-apply-mappings, category-mapping-upsert, category-auto-map and export-by-type are settled and their pins removed. settings-scope stays pinned for the owner to decide.

Fixed on the way, each with a test that failed before: Settings' rename reloaded the page and now changes the name in place; the base currency select had no label and said every failure was the lock; an uploaded file went to the mapping step with no columns detected, and a sheet chosen after an upload read the first sheet again; local-first named a detected investment account by a key of its own rather than as the sheet spells it; a failed checkout, portal or test email toasted a caught error's words; a backup that was not restored said "Backup restore failed:" and the check's own words; a refused email address was a toast with nothing marked; a sheet that could not be read, or saved, was a toast with nothing marked; a bank rule half filled in was dropped beside "Rules saved."; a paste of one line was a banner at the top of the page; and a file that could not be read was a banner too, from a file input no keyboard could reach.

Open for the owner, each a change no decision covers: settings kept per profile on the Worker and once per browser in local-first (settings-scope); reseed-demo retired on the Worker; a learned mapping list now the current profile's only in local-first; a confidence of 0 refused; local-first's export columns, JSON shape and unknown-kind refusal, and the Worker's header for an empty export; a connected source's name refused over 200 characters where it was cut, its settings and account refused where they were stored; a base currency in lower case accepted; the wording of the new messages and toasts; and the mapping step, which still lets a person continue with the date or the amount column unmapped, where the page says they are required.

Slice 5: housing, portfolio, tags, recurring and subscriptions (2026-10-10)

On feat/forms-slice-5, from ceb43bb3 (slice 4b, #611), with main merged in at 29d85467 (#612 and #613).

  • One set of rules each, in shared/. shared/tagSchema.ts (a tag, and the tags put on a transaction), shared/housingSchema.ts, shared/holdingSchema.ts and shared/recurringSchema.ts hold the rules and their words; shared/palette.ts the app's palette, whose next colour a tag created without one gets, and shared/recurringUpcoming.ts the upcoming list both runtimes answer. The Worker routes (tags.ts, housing.ts, portfolio.ts, recurring.ts), the local-first handlers and the forms run them. Both runtimes answer a refusal with 400 { error, fields }, and an edit of a tag, a housing expense, a holding or a recurring rule checks and writes only what it changes. In validation.ts the shared checks take the place of local-first's zod schemas for housing (registered at /api/housings, a path nothing calls), holdings and recurring rules. No entity is checked by zod there now: the counterparty schema, the last, checked writes local-first does not serve, and went in the fix round.
  • The forms are on the kit. The Tags page's tag form (features/tagForm.ts), the Housing dialog (features/housingForm.ts), the Portfolio dialog with its merge of a buy into a holding (features/holdingForm.ts), the Recurring section's dialog (features/recurringForm.ts), the subscription catalog and the subscription scan, each chosen price a field, and the setup wizard's "Name your space" and "Create your first account" (components/onboarding/onboardingForms.ts). A refusal no price can fix (a category deleted elsewhere, being offline) is said in the catalog's or the scan's notice, naming the subscription. Tags, RecurringSection and OnboardingWizard leave the toast guard's known list.

What the runtimes now agree on:

Question Before Now, in both
A tag name blank, over 50 characters, or another tag's in other case "Tag name is required" or "Tag already exists" at no field on the Worker, which compared case; a rename onto another tag's name stored in local-first Refused at name; re-casing a tag's own name is allowed
A tag's colour Any text on the Worker; #6e9bff in local-first for none #RRGGBB, refused at color; none is the palette's next colour
A tag edit without a colour Reset to grey on the Worker Kept
Another profile's tag on a transaction, category or account on a rule 403 on the Worker, 400 in local-first 400 at the field it names (tagIds, category_id, account_id)
Transactions by tag Every tagged row in key order, unfiltered, in local-first Newest first, with the Worker's filters and paging
A housing expense's name, type, amount, due month and day A name and an amount above zero, in one sentence at no field; the rest stored as sent (local-first's own check never ran) Refused at the field: a name up to 100 characters, six types, an amount to the cent, a real due month and a day it has (29 February taken)
A housing expense without a due month January on the Worker, this month in local-first This month
A housing edit that sends no name A 500 from D1 on the Worker, and the type could not change The fields it sends change
Housing's answers 200 on the Worker, autopay 0 or 1; local-first's rows carried the form's own fields 201, autopay true or false, the Worker's columns
A new tag's and a new recurring rule's answers 200 on the Worker; a rule's { id, profile_id } in local-first 201: a rule { id }, a tag { id, name, color }
A holding without its ticker, shares, price or date One sentence at no field on the Worker; zod's words in local-first Refused at each field
A holding's ticker, shares, price and date Stored on the Worker (a price below zero, a date of "soon", shares as text a 500); a ticker over 10 refused in local-first A ticker up to 20, in capitals; shares and price above zero, below one trillion; a real date
A holding edit Every field written on the Worker; checked as a whole new holding in local-first Checks and writes only what it changes
A recurring rule's description, amount, type, frequency, day and next date The amount refused in the transaction rules' sentence and the rest stored as sent on the Worker; zod's words in local-first Refused at each field
A recurring rule saved without a day of the month Day 1 in local-first No day
Deleting a recurring rule the profile does not have 200 on the Worker 404
Pausing a recurring rule active on the Worker, is_active in local-first, each blind to the other's active, is_active read as it; a paused rule leaves the list
Adding a rule's period to the transactions { ok } in local-first, where two at once each added the period { ok, transactionId, next_date }; a period is added once, and a second add of it is a 409 that says so
The upcoming list The active rules themselves in local-first Every occurrence in the next 30 days, totals to the cent

The contract's foreign-link-status, transactions-by-tag, tag-default-colour, tag-edit-without-colour, tag-rename-duplicate, housing-due-month-default, housing-answer-shape, day-of-month-default, delete-missing, recurring-populate-answer, recurring-upcoming and recurring-pause are settled and their pins removed. portfolio-prices stays pinned: live quotes come from a quote service the Worker can reach and the browser cannot.

Fixed on the way, each with a test that failed before: an empty tag name was ignored without a word, and a taken one was a toast; a due day that was not a number became the 1st, and a housing row with no due date said "undefined / undefined"; the holding dialog's shares and price dropped letters as they were typed, and a merged position kept a sum's float error, as did an edit that opened on it; the Recurring dialog's number fields dropped letters, and a delete or "Add to transactions" that failed said nothing (a rule another tab had deleted now says it already was, and leaves the list); the catalog closed on a refusal and said so in a toast; the scan's price dropped letters and read "1.234,56" as 1.234; and the wizard put the chosen base currency back as a name was typed, and moved on from "Add 2 subscriptions & continue" whether or not they were added. The Tags, Housing, Portfolio and Recurring failures toasted a caught error's own words; they go through plainMessage.

The fix round after the review (2026-10-10), each with a test that failed before: a holding edit rounded shares and a price stored past eight decimals and wrote them back on any save; a buy was offered as a merge into another profile's holding the household view lists; a due day the month does not have, 31 April, was stored; two overlapping "Add to transactions" each added the period in local-first, and a second press sent a second populate; a new tag and a new recurring rule answered 200 on the Worker; MCP's upsert_tag_rule made a padded twin of a tag (" travel " beside "Travel") a new tag, and created one with a name up to 100 characters; a rule stored as a deduction or biweekly opened with blank selects; a tag the Transactions form could not create said "Failed to create tag"; the scan disabled its fields while it added, which dropped the focus to the page; and deleting a housing expense, a holding or a tag another tab had deleted said the runtime's "not found" as an error.

Open for the owner, each a change no decision covers: a tag name capped at 50 characters and compared without case on the Worker; a tag's colour checked as #RRGGBB there too; another profile's tag, category or account a 400 where the Worker answered 403; a housing expense's six types, its name capped at 100 characters, its amount to the cent, and a create answered 201; the due month of an expense posted without one, this month where the Worker used January; a holding's ticker up to 20 characters where local-first stopped at 10, its date required to be real; a recurring rule's description and next date required on the Worker, its day left blank in local-first, a paused rule left out of local-first's list; a deleted rule's second delete a 404; the words of a period already added (409); the upcoming list in local-first; the Recurring dialog's selects opening blank on a category or account no longer listed; the catalog staying open with what was refused still chosen; the scan refusing a price it cannot read where it dropped letters; the wizard's Continue and Create no longer disabled for a blank name; the subscriptions step staying put while a subscription is refused; and the wording of the new messages and toasts. From the review: a recurring rule's three types and four frequencies, where the Worker's transactions take a deduction and its populate steps a biweekly rule; a recurring amount refused past two decimal places, where the Worker stored any; a transaction's tag list refused as a whole for one bad entry, where the Worker dropped it; local-first's transactions by tag read with the Worker's dates, filters and paging; a merged holding rounded to eight decimal places; and a rule with no next date opening on today, which any save of it then stores.

Slice 6: sign-in and support (2026-10-09)

On feat/forms-slice-6, from main ceb43bb3, with main merged in at 29d85467 (#612, #613) and at 08ad6413 (#614, slice 5).

The owner's rule for this slice: the sign-in system cannot break, so it changes how a refusal is shown, never what the Worker accepts.

  • One set of rules, in shared/signInSchema.ts. The address format, the 8 characters a new password needs and the length of a message to support are the rules the routes already ran, moved so the forms run them too. Registering, asking for a reset link or a sign-in code, trading the code, setting a new password and writing to support answer a refused field with 400 { error, fields }; a code that does not sign in (by email, an authenticator or a recovery code, and turning two-factor on or off) with 401 { error, fields: { code } }. Signing in with a password tests only that both fields are there, as before.
  • The forms are on the kit. The sign-in screen (sign in, create an account, ask for a reset link) and the sign-in dialog share one form (components/signInForm.ts). EmailCodeLogin (both steps), TwofaChallenge, ResetPassword, SupportContact and the two code steps of TwofaSettings are kit forms too. EmailCodeLogin and TwofaChallenge moved from bodies read by hand onto the typed client (api.requestEmailCode, api.verifyEmailCode, api.verifySecondFactor); SupportContact keeps its own fetch, so it works in any storage mode, and reads a refusal with apiErrorFrom. Every field has a label, and takes its look from a class with no border set on the element, so a marked field shows the kit's danger border; the sign-in fields keep their ids (login-email, login-password), which a kit Field now takes.
  • The reset page checks its link when it opens. It says the link is invalid or has expired only when the Worker answers valid: false; a check that failed (an error, no answer, or an answer that does not say) says so, in the kit's words, and Try again checks the link again.
  • The same status and words for an address with an account and one without. A wrong address or password is one message for the whole form and marks neither field, whatever the answer carries (forTheWholeForm). The Worker's answers to signing in with a wrong password, asking for a reset link, asking for a sign-in code and creating an account are the same status, headers (every one but Date, the sign-in code's cookie without its value) and body for both, and so is each route's answer once its limit on one address is reached, the wait it names aside (worker/test/sign-in-same-answer.test.ts); through the form, signing in and asking for a reset link give the same status, body and words on the screen (frontend/tests/sign-in-form-errors.spec.ts).
  • A limit and the captcha have their own words, and mark no field. A 429 shows the Worker's sentence, which says when to try again. The captcha goes through one gate (components/captchaGate.ts): the send waits for a token instead of the button waiting disabled; a widget that cannot run says what to fix before anything is sent; no token in 20 seconds, or a token the Worker refused, says "Verification didn't go through. Try again, and complete the check if one appears."; each token is used for one request.
  • A mail call gives up after 10 seconds (worker/src/email.ts), as a failed network call does, so a mail that fails after the answer is logged by its route.

Not moved, and why: the passkey step that asks for the password again in Settings (PasskeySettings) reads its refusal from registerPasskey's result, which also drives the browser's passkey ceremony, so moving it means reshaping core/webauthn.ts; the recovery codes view, ResendVerification and SignedInDevices have no field.

The contract's two slice 6 entries stay, as differences on purpose: auth-local-user (local-first has no account to answer and no session to end) and health-answer (the Worker reports its own environment and captcha setup).

Fixed on the way, each with a test that fails without the fix: the new-password and support fields had only placeholders, no labels; EmailCodeLogin's "Back to sign in" and "Send another" were anchors with no href, out of the keyboard's reach; and the send after a refused one, on the support form, carried the captcha token the first had used (a token is good for one check).

Open for the owner, each a change no decision covers: the sign-in dialog now checks the address format before it signs in, as the sign-in screen did, where the Worker's sign-in tests none; the dialog and the code request no longer disable their button until the visible captcha has a token; the new words for every refusal, the Worker's included; the hint the sign-in screen showed on leaving a malformed address, gone; the dialog saying "Signing you in…" after an account is created; a reset link that stopped working showing its own screen; the reset page's words for a link check that failed, and its Try again; and the two-factor enroll and disable steps as forms, so Enter in the code field sends the code.

Rollout, one PR each

  1. Contract, ApiError, kit, categories. Forms 1-4, the swatch toasts, the shared category schema in the form, the local handler and the Worker route; the generic local translation for every other entity.
  2. Transactions and accounts. Forms 5 and 6, the inline Cash account in the Transactions form. Shared schemas for both; validateTransactionCreate/Update move onto the transaction schema; the seven warning toasts become field errors. Decide deduction and the required description.
  3. Budgets, goals, bills. Forms 7 and 8, the budget, allocate, rollover and Set Budget modals, goal contributions.
  4. Loans, profiles, settings, import. Form 9, the rate period and prepayment forms, ProfileModal and the sidebar create, Settings, the import flow and its rules, and forms 10 and 11 (Retirement, RetirementPlanner): the retirement settings next to the loans and settings work. Confirmed 2026-10-08.

Added to the plan, and confirmed on 2026-10-08:

  1. Housing, portfolio, tags, recurring and subscriptions. Forms 12-14, RecurringSection, SubscriptionCatalogModal, SubscriptionScan, OnboardingWizard. Fix the dead housing schema keys here.
  2. Auth and support. Forms 15-21. They already show errors in the form, so the change is field placement, aria-invalid, and moving EmailCodeLogin, TwofaChallenge and SupportContact onto ApiError. Rate-limit and captcha answers need their own wording.

Risks

  • Deploy skew. The frontend and the Worker deploy separately (a push to main deploys both to dev; a tag deploys both to prod, one workflow each). A new frontend on an old Worker gets { error } with no fields: the client check has already caught the empty name, and anything else shows the Worker's sentence in the notice. An old frontend on a new Worker reads error and shows the summary, which is now a plain sentence. Local-first ships inside the frontend, so its router and client cannot skew.
  • The new Worker refuses what the old one stored: a type outside the four, a colour that is not #RRGGBB, a name over 100 characters, a case-insensitive duplicate, a rename onto an existing name. Only the app writes categories (no MCP or v1 tool does; the importer inserts its own rows), and the app's forms cannot produce any of them except the two duplicates. It refuses them when a create or an edit sets them, never when an edit sends a row's own value back.
  • Old rows. Local-first rows written before #599 can have icon: null, no tax_deductible, or the importer's account type; cloud rows can have names over 100 characters, an off-palette or 3-digit colour, or a twin that differs only in case. An edit sends the form's whole body, so each runtime compares it with the stored row and checks only what changed (decision 2): an old row saves with its old values, and a case-only rename of one twin is allowed. Reads are unchanged: normalizeCategory and CategorySchema still accept every stored shape.
  • The two client surfaces. Anything wired into only one of them drifts (#574 was exactly that). ApiError is built by one function, apiErrorFrom, which both call, and the network case is converted in apiFetch, which both pass through. The tests run each case through both surfaces.
  • Console detectors. The release suite (tests/release/release-fixtures.ts) and quick-entry-phone.spec.ts treat a console line containing Validation failed in local-first as a bug: a write the local schemas refused. The local router keeps logging [routeApiRequest] Validation failed for every schema refusal, categories included, so those detectors still see one. A category edit is checked in its handler, against the stored row, so the handler logs [categoriesUpdate] Validation failed for the edits it refuses. A form's own client check now stops most bad submissions before they reach the router at all.
  • #601. It replaced app.onError with errorResponse (error-response.ts). It merged first, and the rebase carried fields through publicError and errorResponse. A Worker test fails if a refusal's fields stop reaching the client, so a later change cannot drop them quietly. Its two D1-leak tests had sent the category edit a null color, which the edit now stores as the default; they send it to a stand-in route that writes the column unchecked.

Test strategy

  • Shared schema (frontend/src/core/__tests__/categorySchema.test.ts): every rule and default, create and edit, every message, the summary.
  • Worker (worker/test/category-refusals.test.ts): each refusal's status, error and fields; the duplicate rules; an edit keeping tax_deductible and the parent; defaults stored; a parent from another profile at parent_id; and edits of rows seeded in D1 under older rules (3-digit and named colours, a name over 100 characters, an unreadable type, case twins, a foreign parent), each sending its own values back and saving, while a changed bad value is still refused. Each was run against the old route first and fails there.
  • Local-first router (core/storage/__tests__/categoryRefusals.test.ts): the same cases through routeApiRequest, with the old rows seeded in IndexedDB, the generic translation for one other entity, no details, the console line kept.
  • ApiError (core/__tests__/apiError.test.ts): both surfaces, both modes, 400 with and without fields, a non-JSON 502, a network failure offline and online, an abort.
  • Kit (components/form/__tests__/): no message while typing first time, marking and focus on submit, re-checking a marked field, server fields and the notice, aria-* wiring, groups, and the busy state: the label, aria-disabled without disabled, focus kept, aria-busy, one send.
  • Forms (features/__tests__/categoryForms.test.tsx): each of the four forms against the real local-first router: an empty name marks the field and stores nothing; a duplicate marks the name with the server's sentence; a blank icon stores tag; no failure toast; the success toast's words. Categories and Budgets also edit a row saved under older rules.
  • E2E (frontend/tests/category-form-errors.spec.ts), cloud and local-first: an empty name marks the field with its message; a duplicate is marked with the server's message; a blank icon saves as tag. The Bills, Goals and Budgets dialogs: an empty name marks the field. Signed in, a held save shows the busy button, keeps focus on it, and marks the form aria-busy.
  • Guard: the toast scan and its sample tests.
  • Every fix of behaviour has a test that fails on the old code; the report lists which.

Later

  • Fifteen pages reload through refetchOnActive with no newest-answer guard. Two overlapping reloads can land out of order and show the older answer. Moving the guard into the shared helper (core/pageVisibility.ts) is a data-layer change for its own PR.
  • One CategoryDialog instead of four (decision 4). Bills and Goals use a native colour input and have no icon field; Budgets has no icon gallery. Merging them is a design decision, so this PR keeps each look and shares only the logic (categoryForm.ts).
  • request()'s response-schema failure throws "API Response Validation failed for /x", which the toasts that print .message show as is.
  • A 401 on a write fires auth:required from request() only; the raw helpers do not.
  • The local router answers an unexpected handler error with the raw err.message and status 500, as the Worker did before #601.
  • The housing schema keys (/api/housings) in validation.ts never match the route.
  • The bulk update route on the Worker still answers 403 for another profile's category, where local-first and the single-row routes answer 400.
  • Local-first does not resolve means_of_payment or a category given by name, as the Worker does.
  • In the Transactions form, a tag that could not be created, a receipt over 5 MB and a receipt that could not be deleted still toast; a receipt that could not be uploaded says nothing.
  • The MCP create_account tool stores any type and currency.
  • CommandBar and GuidedOrbit add transactions outside the form, with their own toasts.
  • The account delete confirmation says it "also removes all of its transactions", but a delete is refused while transactions use the account.
  • A retirement goal's card reads its date with new Date('YYYY-MM-DD'), midnight in UTC, so west of UTC it shows the day before.
  • The Loans dialog's first payment date is a type="date" input (solid-forms rule 4), for a date that can be years back.
  • The Worker's loan CSV export totals extra payments in SQL (exports.ts), so a loan without any exports an empty total and a sum can carry a float error, where the loan list now says 0, to the cent.