* chore: repo-wide bloat sweep, remove dead code and fold duplicate helpers
Remove 33 dead files, ~270 unreferenced exports/types, 13 dead i18n
namespaces and 4 unused dependencies; fold byte-identical helper copies
into one canonical home each (lib/utils chunk/sleep/utcDateStamp,
lib/dates/iso, lib/invariants/uuid, lib/xml/escape, lib/reports/sru/format,
lib/pdf/number-text, lib/browser/panel-request, lib/api/v1/body +
v1ValidationError rolled out to ~55 v1 routes, booking-template schemas).
No behaviour change: v1 bodies and status codes, MCP tool schemas, DB
writes and money math are untouched. Naive ore rounding was deliberately
not swapped for roundOre; see DECISIONS.md 2026-09-02 for the full list
of things left alone on purpose.
tsc, lint, 19588 unit tests and check:guards green; antipattern baseline
ratcheted (naive-ore-round 622 -> 620, hand-rolled-invariant 115 -> 113).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test(transactions): import RawTransaction from @/types after the ingest re-export removal
CI's type ratchet (check:types, full tsconfig) caught the one test file
that still imported the type through lib/transactions/ingest.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* fix(articles): article ROT/RUT prefill was dead for every dashboard-created article
Follow-up to #1634. The user re-tested and picking a RUT article still left
the line on "Ingen": the article form has always stored the bare kind
('ROT'/'RUT'), while the prefill only recognised Skatteverket work-type codes
(BYGG, STAD, ...). On prod every dashboard-created ROT/RUT article holds the
bare kind, so the fix in #1634 never fired for a real user, and worse, since
the helper returned null for those values, picking such an article CLEARED a
deduction the user had set manually on the row.
- rot-rut-rules: parseArticleHouseworkType() understands both vocabularies
(code -> kind + arbetstyp; bare ROT/RUT -> kind only), plus
normalizeHouseworkType()/HOUSEWORK_TYPE_VALUES/workTypeLabel().
- InvoiceEditor.applyArticle: kind-only articles pre-fill the deduction and
keep a same-kind arbetstyp already chosen on the row; "Spara som artikel"
round-trips the code or, lacking one, the kind.
- ArticleForm: the ROT/RUT select now offers the real Skatteverket arbetstyper
in ROT/RUT groups (its own hint always promised "förifyller arbetstyp");
legacy kind-only values stay selectable as "RUT (arbetstyp ej vald)" so an
edit never silently drops the flag. Article detail renders "RUT · Städning"
instead of the raw code.
- API + MCP commit schemas normalize housework_type (case-insensitive code or
ROT/RUT, '' clears) and reject anything else; the CSV article import
normalizes the column the same way. Prod holds 178 articles with '0'/'1'
from a boolean "Rot" column that the keyword detector mapped straight
through; those now read as no flag everywhere and can no longer be created.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(articles): review follow-ups on #1651
- InvoiceEditor: switching a row's skattereduktion ROT<->RUT clears an
arbetstyp from the other list, and Spara som artikel only round-trips a
work type that belongs to the row's kind (CodeRabbit).
- MCP update_article: null / '' / whitespace now clear housework_type
(commit drops only undefined keys, so the old undefined mapping made the
flag un-clearable); create keeps treating them as unset. Tests.
- Article CSV import warns when a non-empty ROT/RUT value is dropped as
not-an-arbetstyp instead of dropping it silently. Test.
- Hint wording: arbetstyp is pre-filled only when the article carries one.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Fixes#1168. articles.currency exists in the DB and REST API, but the
staged-operation schemas and the two MCP tools had no currency param,
so agent-created articles were always SEK and an agent asked to create
an EUR-priced article could not.
- CreateArticleParamsSchema/UpdateArticleParamsSchema accept an
optional ISO 4217 code (normalized to upper case; empty/null =
unset). The currencies-table FK stays the allow-list: a 23503 on the
currency FK maps to a clear 400 instead of a raw 500.
- commitCreateArticle inserts currency ?? 'SEK'; the sparse update
executor passes it through only when staged.
- gnubok_create_article / gnubok_update_article expose the param.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
- invoice/article posting-account overrides accept active class 1-3 accounts;
class 1-2 (balance-sheet) accounts are rejected on VAT-bearing lines so the
ruta 05 tax base always books to a 3xxx account
- shared posting-account regex across server schemas, pending-operation
re-validation, and client forms
- share-capital settings (aktiekapital/antal_aktier) feed the annual-report
note; kvotvarde derived per ABL 1 kap 6 $; all-or-nothing pair constraint
- signed per-rate VAT breakdown on credit-note PDFs; U+2212 to ASCII hyphen
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Em dashes (—) and en dashes (–) had spread across comments, docs, tests,
and a few UI strings, reading as AI-generated boilerplate rather than
house style. Replaced each with punctuation matching its context: colon
for explanatory clauses, comma for asides, plain hyphen for numeric/legal
ranges (e.g. "21-23§"), "to"/"till" for date ranges, parentheses for
paired-dash asides. messages/en.json and messages/sv.json were fixed by
hand together to keep sv/en in sync.
Left untouched where the dash is the functional subject rather than
decorative punctuation: date-range-parser.ts's separator regex,
charset-repair.ts's CP1252 byte-mapping table (and its test), the SIE
encoding mojibake docs, generic-csv.ts's minus-sign normalizer, the
agent system-prompt files that already instruct against em dashes, and
a golden iXBRL test fixture compared byte-for-byte.
Also fixes two bugs surfaced along the way: an off-by-one in
ApiKeysPanel's scope-label split (a leftover from an earlier partial
pass), and a charset-repair test that had lost the literal en-dash it
exists to verify.
Regenerated the agent atom seed migration (skills:generate) since 27
SKILL.md files changed. Added a CLAUDE.md rule against em/en dashes,
with an explicit carve-out for the functional-dash cases above.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>