fix(bookkeeping): drop non-standard account 2012, book EF F-skatt on 2013 (#1409) (#1489)

Primary-source check against bas.se (BAS 2026 v2): the official kontoplan
has no account 2012; the enskild firma equity block is 2010, 2011, 2013,
2017, 2018, 2019. 2012 'Avräkning för skatter och avgifter' is a program
convention (Visma, Bokio, Björn Lundén), not standard BAS, and a
non-standard account in BAS_REFERENCE leaks via the backfill into charts,
SIE export and SRU filing.

- remove 2012 from class-2-equity-liabilities.ts, with a tombstone comment
- migration retargets 'Preliminär F-skatt (EF)' lines 2012 -> 2013
  (system row plus any clones still carrying the seeded shape)
- pin 2012's absence in bas-ef-equity-accounts.test.ts (2113 precedent)
- correct the swedish-year-end-closing references that motivated #1388,
  regenerate atom seed migration

Companies whose charts already got 2012 backfilled keep it: existing
history stays valid; only future template use books 2013.

Closes #1409

Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-08-10 14:04:08 +02:00
committed by GitHub
co-authored by Jakob Wennberg Claude Fable 5
parent 3ff12faa77
commit fe1ff8649b
11 changed files with 17631 additions and 46 deletions
+4 -4
View File
@@ -244,12 +244,12 @@
"version": 3
},
"horizontal/swedish-year-end-closing/closing-process": {
"hash": "bce8e129860dd26c04e5e406dc9312e2d42dea6aa8c0139f168de43529abf939",
"version": 2
"hash": "2d23c29bcf8a7f5d6ce72e677abe518efdf8300ed11360269377a342f51945b5",
"version": 3
},
"horizontal/swedish-year-end-closing/journal-entries": {
"hash": "acd171ade0305bcbb4142e0f9817482f845dc6e1b3620a62eb36b6e8eef6110a",
"version": 2
"hash": "b4891b88b6cf409f00c76c70b7acb9dbf20e13ac05814886f978b80b878ab0a9",
"version": 3
},
"horizontal/swedish-year-end-closing/k2-vs-k3": {
"hash": "e3fa066d0e1fe4284661df669736241daf05e08599f893b40f5a6f94722d0bce",
+5 -1
View File
@@ -127,6 +127,9 @@ export function buildMigrationSql(atoms: DiscoveredAtom[], versions: Record<stri
-- in-app agent read skill content from the DB (works on Vercel, Docker, self-hosted).
-- Idempotent: ON CONFLICT refreshes content fields but leaves is_active and
-- mcp_exposed under manual control (they take column defaults on first insert).
-- The WHERE guard skips rows whose registry version is newer than this seed's:
-- two branches can each carry a full seed, and the one that applies last can
-- no longer downgrade atoms the other already bumped.
`
const values = atoms.map((a) => buildValuesRow(a, versions[a.id])).join(',\n')
@@ -147,7 +150,8 @@ ON CONFLICT (id) DO UPDATE SET
parent_atom_id = EXCLUDED.parent_atom_id,
version = EXCLUDED.version,
schema_version = EXCLUDED.schema_version,
updated_at = now();
updated_at = now()
WHERE public.agent_atom_registry.version <= EXCLUDED.version;
`
return `${header}\n${insert}\nNOTIFY pgrst, 'reload schema';\n`