chore: repo-wide bloat sweep, remove dead code and fold duplicate helpers (#2150)

* 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>
This commit is contained in:
Jakob Wennberg
2026-09-02 11:51:16 +02:00
committed by GitHub
co-authored by Claude Fable 5.1 Jakob Wennberg
parent 18cbc4c30a
commit f266c386f3
359 changed files with 1796 additions and 11199 deletions
-78
View File
@@ -9,17 +9,13 @@ import type {
JournalEntry,
JournalEntryLine,
DocumentAttachment,
TaxCode,
Invoice,
InvoicePayment,
Customer,
Supplier,
SupplierInvoice,
CompanySettings,
InvoiceInboxItem,
CategorizationTemplate,
Company,
CompanyMember,
} from '@/types'
import type { SIEVoucher, SIETransactionLine } from '@/lib/import/types'
@@ -105,37 +101,6 @@ export function createMockSupabase() {
let _counter = 0
const nextId = () => `test-${++_counter}`
export function makeCompany(overrides: Partial<Company> = {}): Company {
const { team_id = null, ...rest } = overrides
return {
id: 'company-1',
name: 'Test Company',
org_number: null,
entity_type: 'enskild_firma',
accounting_framework: 'k2',
created_by: 'user-1',
team_id,
archived_at: null,
created_at: '2024-01-01T00:00:00Z',
updated_at: '2024-01-01T00:00:00Z',
...rest,
}
}
export function makeCompanyMember(overrides: Partial<CompanyMember> = {}): CompanyMember {
return {
id: 'member-1',
company_id: 'company-1',
user_id: 'user-1',
role: 'owner',
invited_by: null,
joined_at: '2024-01-01T00:00:00Z',
created_at: '2024-01-01T00:00:00Z',
updated_at: '2024-01-01T00:00:00Z',
...overrides,
}
}
export function makeReceipt(overrides: Partial<Receipt> = {}): Receipt {
return {
id: nextId(),
@@ -319,28 +284,6 @@ export function makeDocumentAttachment(
}
}
export function makeTaxCode(overrides: Partial<TaxCode> = {}): TaxCode {
return {
id: nextId(),
user_id: null,
code: 'MP1',
description: 'Utgående moms 25%',
rate: 25,
moms_basis_boxes: ['05'],
moms_tax_boxes: ['10'],
moms_input_boxes: [],
is_output_vat: true,
is_reverse_charge: false,
is_eu: false,
is_export: false,
is_oss: false,
is_system: true,
created_at: '2024-01-01T00:00:00Z',
updated_at: '2024-01-01T00:00:00Z',
...overrides,
}
}
export function makeInvoice(overrides: Partial<Invoice> = {}): Invoice {
return {
id: nextId(),
@@ -381,27 +324,6 @@ export function makeInvoice(overrides: Partial<Invoice> = {}): Invoice {
}
}
export function makeInvoicePayment(
overrides: Partial<InvoicePayment> = {}
): InvoicePayment {
return {
id: nextId(),
user_id: 'user-1',
company_id: 'company-1',
invoice_id: 'invoice-1',
payment_date: '2024-07-01',
amount: 12500,
currency: 'SEK',
exchange_rate: null,
exchange_rate_difference: 0,
journal_entry_id: null,
transaction_id: null,
notes: null,
created_at: '2024-07-01T00:00:00Z',
...overrides,
}
}
export function makeCustomer(overrides: Partial<Customer> = {}): Customer {
return {
id: nextId(),