Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
Lägger docs/production-readiness.md och siax/production-gaps.json enligt SIAX Master Definition of Done. Underlag: git-, kod- och live-evidens 2026-11-11. Nivån är evidensbaserad, inte ett leveransgodkännande.
* 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>
* refactor(reports): restructure declaration pages around the filing pipeline
Momsdeklaration (/reports/vat-declaration) becomes the four-step flow the
user actually runs: kontrollera, granska, bokfoer, laemna in.
- NEW VatChecksCard, mounted first and ungated: the local pre-flight
checks and the RC-basis-gap worklist used to render inside
SkatteverketPanel BELOW the filing CTAs, and vanished entirely for
free-tier or not-connected users, exactly the manual filers who must
not file a declaration the checks would have blocked.
- The gap worklist scales: compact DataList rows (first 8 + visa alla),
visible shared classification selects, per-row overrides, bulk
"Korrigera alla" behind a confirm dialog with serial progress, and an
in-page declaration refetch replacing "Ladda om sidan". The list
outlives the aggregate RC_BASIS_MISSING check so remaining rows never
vanish after the first fix.
- Summary card: status Badge + font-display headline amount instead of a
Badge carrying the number; sanctioned h3 section heads; Table
primitive; NEW import block (rutor 50/60-62) and the utgaende sum now
includes 60-62 so it matches ruta 49 arithmetic; drill-downs preserved.
- SkatteverketPanel stops being an API console: three forward buttons
(Validera, Spara utkast, Laas och signera), six lookup/recovery actions
in an overflow menu with two-line descriptions, destructive confirms on
radera/koppla bort, one truthful notice slot (not-found is info, never
green), visible disabled-reasons instead of title attrs, signing link
as a real anchor plus auto re-check of inlaemning on tab refocus, and
per-period state reset so a Q1 signing link can never show Q4's
kvittens.
- VatCompositionChart deleted (decorative donut mixing in/out VAT);
export menu keeps xlsx only, XML/PDF live in the Laemna in card.
- Sibling declaration pages adopt the same grammar: PS gets shadcn
selects, auto-fetch with stale-discard, refresh button, envelope-parse
fix (message_sv never existed); NE/INK2 auto-fetch on fiscal-year
change (kills stale-year data), shared keyboard-accessible
DeclarationRutaRow (fixes the expense sign bug), whole-krona amounts
matching filed SRU values, neutral info notes instead of bg-primary/10,
Skeleton loading, accessible download errors.
UI-only: no API, schema, or dependency changes. All strings hardcoded
Swedish (statutory surface). Adversarially reviewed (19-agent pass); all
10 confirmed findings fixed in this commit.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(reports): address CodeRabbit review on #992
- formatWholeKronor truncates instead of rounds: NE/INK2 SRU generators
drop oere with Math.trunc, and the UI must show the filed figures.
- SkatteverketPanel disconnect surfaces non-ok responses instead of
silently stopping the spinner.
- VatChecksCard distinguishes a failed rc-basis-gaps fetch from a real
zero-gap result: destructive note + retry instead of the benign
'Inga verifikationer hittades'.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
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>
* feat(api): implement commit functionality for journal entries
* fix(extensions): make ExtensionSettings.clear() a real delete so disconnect flows work
The 2026-03-30 multi-tenant refactor dropped all RLS policies on extension_data
and recreated only SELECT/INSERT/UPDATE. Combined with `value jsonb NOT NULL`,
every extension that called `settings.set(key, null)` to clear stored state
(cloud-backup disconnect, skatteverket OAuth/AGI cleanup, arcim-migration
consent reset) silently failed — the upsert hit the NOT NULL constraint and
the error was swallowed, leaving users stuck with stale connection rows.
Adds an `extension_data_delete` RLS policy, a `clear(key)` method backed by a
real DELETE, switches the four affected handlers, and makes `set()` throw on
Supabase error so this class of silent failure can't recur.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(journal-entries): add draft saving functionality to journal entry form
* feat: add periodisk sammanställning report generation and CSV export
- Implemented period date helpers in `period-dates.ts` for calculating start and end dates based on period type (monthly, quarterly, yearly).
- Created `periodisk-sammanstallning.ts` to generate the periodisk sammanställning report, including data fetching, validation, and warning handling.
- Developed CSV serializer in `periodisk-sammanstallning-csv.ts` for exporting the report in SKV574008 format.
- Added new columns to `company_settings` for storing periodisk sammanställning settings and tax contact information via migration.
- Introduced a new migration to add a `paid_with_private_funds` flag to `supplier_invoices` for tracking out-of-pocket expenses.
- Updated journal entries to include the new source type for privately paid supplier invoices.
* feat(migrations): add paid_with_private_funds flag to supplier_invoices and expand journal_entries.source_type CHECK
* fix(ai_requests): drop existing policies and trigger before creating new ones
* fix(migrations): ensure extension_data has a proper DELETE policy for ExtensionSettings.clear()
* fix(supplier-invoices): update error handling for invalid input in POST request
* fix: correct capitalization in project title
* fix(migrations): resolve duplicate version 20260513120000
Two migrations shared the same timestamp prefix, causing
schema_migrations_pkey collision on Supabase preview branches.
Bump extension_data_delete_policy to 20260513120001.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>