The registry lookup was built for rows that already exist (the detail
page's "Hämta uppgifter" records facts on the row's party), so on the
create form people typed what SCB already knew. Org number now comes
first in both forms; a complete, check-digit valid number of a Swedish
legal person is looked up once and fills name, address, postal code,
city (and the VAT number where the form shows one) wherever nothing has
been typed. A typed value is never replaced; a corrected number replaces
only its own earlier fill. A personnummer never reaches the register
(client key and server gate), and an environment without SCB credentials
answers 503 once and the form stays quiet.
- GET /api/parties/registry?org_number=: read-only route over the same
SCB client, credential gate and registrySummary reader as the enrich
route; writes nothing.
- lib/parties/registry-form-fill.ts: registryLookupKey (one rule for
what may be looked up) and registryFormFill (contactFill's untouched
rule plus name and VAT number), pure and tested.
- components/parties/use-registry-autofill.ts + RegistryAutofillNote:
debounced, once per distinct number, skips the number an edit dialog
opened with, one muted line under the field.
- Adressrad 2 is now an input on both forms: the register's c/o goes on
line 1 with the street on line 2, as on the row, and both edit dialogs
already passed the column in.
Claude-Session: https://claude.ai/code/session_01LvMaHcTnwAfxzgYD1fGYX1
Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>