@fin.cx/skr 3.1.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/readme.plan.md DELETED
@@ -1,219 +0,0 @@
1
- # fin.cx Accounting Program — "No External Tax Accountant"
2
-
3
- Program-level plan anchored in @fin.cx/skr. Supersedes the original build checklist
4
- (that scaffold was stale; the package is long past it — see changelog).
5
- Status source of truth for current findings: `readme.hints.md`.
6
-
7
- ## Context
8
-
9
- Run German company books end-to-end — bookkeeping, VAT filings, year-end — without an
10
- external Steuerberater for the mechanical work. skr v1.x is a solid bookkeeping core but
11
- not filing-grade: float money with 0.01-epsilon balance checks, non-atomic 3-write
12
- posting, no GoBD Festschreibung (mutable docs, non-gapless numbering, no audit trail),
13
- 6 BU keys, ~110-account chart subsets, non-importable DATEV export stub, no stateless
14
- booking API, and zero filing coverage (ELSTER/E-Bilanz/HGB statements/OPOS/
15
- Anlagenbuchhaltung/bank reconciliation).
16
-
17
- **Critical path:** skr v2 hardening → complete FiBu → UStVA via ELSTER (removes monthly
18
- StB dependency) → E-Bilanz + HGB year-end (removes annual dependency).
19
-
20
- ## Decisions (assumptions where user confirmation pending)
21
-
22
- 1. Full program roadmap; each milestone gets its own detailed plan when it starts.
23
- 2. Own company books first; APIs product-grade; multi-tenant/RBAC deferred.
24
- 3. ELSTER owned: ERiC native lib via @git.zone/tsrust + @push.rocks/smartrust →
25
- `@fin.cx/elster`.
26
- 4. Full SKR03/04 + E-Bilanz taxonomy mapping from public sources (no DATEV license);
27
- legal review before public release.
28
- 5. Payroll OUT of scope (integrate provider, import GL postings).
29
- 6. Statutory WP audit (§316 HGB) out of scope by law. Goal = "StB consulted on judgment
30
- calls only".
31
-
32
- ## Calendar anchors (from 2026-07-09, FY = calendar year)
33
-
34
- UStVA parallel-run 09–11/2026 → first live self-filed UStVA 12/2026 or 01/2027 →
35
- FY2026 Jahresabschluss self-prepared H1 2027 (one paid StB review as backstop;
36
- KSt/GewSt/UStJE deadline ~31 Jul 2027; Offenlegung 31 Dec 2027) → fully solo from FY2027.
37
-
38
- **Week-0 actions (hard external clocks, user):**
39
- 1. ELSTER developer registration (Bayerisches LfSt) → Hersteller-ID + ERiC access
40
- (days–4 wks).
41
- 2. Confirm/obtain ELSTER Organisationszertifikat for TVC GmbH (post, 1–2 wks).
42
- 3. Bundesanzeiger/Unternehmensregister publisher registration.
43
-
44
- ## Milestones
45
-
46
- ### M0 — skr v2.0.0 core hardening (foundation; blocks B, C2, D, E1)
47
-
48
- After **@fin.cx/calculation v1.1.0** (cents module — RELEASED 2026-07-09 ✓).
49
-
50
- - **Money:** ledger amounts = integer cents (`TCents`); exact `===` balance checks.
51
- Fractional math via calculation cents module (`vatFromNetCents`, `splitGrossCents`
52
- with net+vat===gross guarantee, `allocateCents` largest-remainder, `convertCents`,
53
- `centsFromFloat` with drift guard). ROUND_HALF_UP = kaufmännisches Runden.
54
- - **Stateless core `ts/core/`** (imports only @fin.cx/calculation + each other):
55
- `core.types.ts` (IJournalDraft/IJournalLineDraft with explicit per-line Gegenkonto;
56
- TBuKey as string union; TTaxScenario), `core.bukeys.ts` (full BU table from official
57
- DATEV Steuerschlüssel docs — v1 table + finance.plus logic both suspect, do not copy
58
- blind), `core.taxscenario.ts` (confidence-scored cascade), `core.accountpolicy.ts`
59
- (IAccountPolicy + SKR03/04 defaults incl. Geldtransit, FX gain/loss, rounding-diff),
60
- `core.recipes.ts` (pure builders: vendor/customer invoice incl. reverse-charge +
61
- intra-EU paired VAT, bank payment clearing with Skonto, internal transfer via
62
- Geldtransit, suspense book/resolve, FX difference lines), `core.validate.ts`,
63
- `core.datev.ts` (full Buchungsstapel row model, EXTF 700, buSchluessel on every row),
64
- `core.hash.ts` (canonical serialization + SHA-256 chain).
65
- - **Atomic posting:** smartdata 7.1.7 sessions (verified supported). Mongo MUST be a
66
- replica set; `SkrApi.initialize()` probes and fails hard. `JournalPoster`
67
- (skr.posting.ts): pre-flight → withTransaction: period-lock re-check, gapless sequence
68
- via $inc findOneAndUpdate, hash chain CAS on head. JournalEntry = single source of
69
- truth (v1 Transaction explosion removed; collection frozen as legacy read model).
70
- Balances recomputed via aggregation (skr.balances.ts); Account.updateBalance deleted
71
- from posting path.
72
- - **Festschreibung:** posted == immutable (corrections via Storno only). JournalEntry +=
73
- sequenceNumber (gapless per skrType+fiscalYear), prevHash/entryHash, finalizedAt,
74
- status posted|finalized, schemaVersion 2. beforeSave()/delete() throw on mutation of
75
- hashed docs; reversedBy derived (not stored). LedgerPeriod doc + festschreibePeriod();
76
- closePeriod() posts P&L-zero entries then festschreibt. verifyHashChain() in
77
- skr.verify.ts. SecurityManager: keep CAdES-B; RFC-3161 stub → loud NotImplementedError;
78
- fix require('crypto') ESM bug in skr.export.ts.
79
- - **Migration** (idempotent, offline, float fields kept): M001 cents backfill (abort on
80
- drift > 0.5 cent) → M002 unify legacy Transactions into synthesized JournalEntries →
81
- M003 sequence + chain assignment + operator-confirmed festschreiben. JSON report.
82
- - **Phases (status 2026-07-09):** (0) replica-set env ✓ (gitzone services ≥2.23.0),
83
- EXTF-700/v13 layout ✓ (verified vs DATEV-importable reference; official
84
- Steuerschlüssel doc 0904313 portal-gated → manual import check per RC remains) →
85
- (1) calculation v1.1.1 ✓ released → (2) stateless core ✓ → (3) persistence
86
- hardening ✓ → (4) facade/reports rewiring + security descope ✓ →
87
- (5) migrations + docs + v2.0.0 release ✓. **M0 COMPLETE** except the standing
88
- per-RC manual DATEV import validation.
89
- - **Tests:** recipe goldens (both charts, exact cents), byte-exact EXTF files, property
90
- tests (seeded PRNG), concurrency (N parallel posts → gapless, chain verifies, exact
91
- trial balance), locked-period race, immutability throws, txn-abort no-partials,
92
- migration round-trip; existing 65 tests green minus documented divergences; manual
93
- DATEV import check per RC.
94
-
95
- ### M-A — `@fin.cx/chartdata` (new pkg; parallel to M0)
96
-
97
- **Status 2026-07-09: A1 seed COMPLETE locally** (repo at
98
- `/mnt/data/foss.global/fin.cx/chartdata`, committed, 12/12 tests): year-keyed
99
- SKR03/04 2026 datasets (~125 accounts each incl. all fiscally-relevant VAT/
100
- Skonto/igE/§13b/EUSt accounts missing from skr v1), Automatik functions +
101
- allowed BU keys, account→UStVA-Kennzahl mappings, scenario Kennzahlen table
102
- (89/93, 46/47, 84/85, 41, 43, 81, 86, 60, 66/61/67/62), coverage introspection,
103
- provenance per record, reproducible seed pipeline in tools/.
104
- **RELEASED as @fin.cx/chartdata v1.1.0** (2026-07-09, verdaccio + npmjs).
105
- **A1 REBASE COMPLETE (2026-07-09):** chartdata v2.1.0 = curated oracle-verified
106
- datasets (91 SKR03 / 78 SKR04 accounts, verification-only oracle, no foreign
107
- strings); skr v3.0.0 aligned: charts GENERATED from chartdata
108
- (tools/generate-chart-data.ts), policies corrected (expense default 4900/6300,
109
- SKR04 controls 1200/3300, bank 1800/Kasse 1600), all 98 tests remapped to real
110
- DATEV numbers and green. A2 HGB §266/§275 mappings DONE
111
- (chartdata v2.2.0: every non-statistical account carries hgb266Position or
112
- hgb275Position, validated against the statute Gliederung trees in
113
- chartdata.hgb.ts and verified against the oracle's position tags — 11
114
- documented modeling exceptions where German textbook treatment differs, e.g.
115
- USt liabilities in Passiva C.8). NEXT: A3 E-Bilanz taxonomy; D1 can now build
116
- the §266/§275 Gliederung from chartdata.
117
-
118
- **A1 cross-diff done (2026-07-09):** Odoo l10n_de oracle proves the skr-v1 seed
119
- charts are an invented hybrid (~50/125 SKR03 + ~66/130 SKR04 divergences);
120
- ALL fiscal A1 additions verified clean. Rate-label fixes released (v1.1.1:
121
- 1570/1571/1770/1771). NEXT: A1 seed-base rebase (clean-room base set, remove
122
- invented blocks, align skr built-in charts + tests — coupled change), then A2
123
- (HGB mappings; Odoo tags as verification oracle), then A3. Details:
124
- chartdata/tools/a1-crossdiff-report.md.
125
-
126
- Year-versioned full SKR03/04: account master, Automatikkonto functions + allowed BU keys,
127
- UStVA-Kennzahl / HGB §266/§275 / E-Bilanz (de-gaap-ci) mappings. Pure data + lookup API;
128
- `getMappingCoverage()` fails loudly. Pipeline in unpublished tools/ (public sources,
129
- provenance per record). A1 chart+Automatik+Kennzahlen → A2 HGB → A3 E-Bilanz taxonomy
130
- (esteuer.de). Own-books account coverage first. Verify: schema checks, cross-diff vs
131
- Kivitendo/Odoo l10n_de (reviewed, not copied), SKR PDF spot checks, ERiC as E-Bilanz
132
- oracle. Legal review before public MIT release.
133
-
134
- ### M-B — Subledgers + reconciliation
135
-
136
- **B1 status 2026-07-09: package layer RELEASED** — @fin.cx/camt v1.1.0
137
- (CAMT.052/053/054, exact cents, SEPA extraction, statement-internal balance
138
- check) and @fin.cx/bankrec v1.1.0 (canonical signed-cent transactions, camt +
139
- mt940 adapters, cross-statement continuity control, confidence-scored matching
140
- engine: direction filter, Skonto window, tie-forces-review, no double
141
- settlement). @fin.cx/mt940parser v1.1.1 published for the first time
142
- (modernized: smartconfig v2, direct npm publish, pnpm pinned). Remaining B1:
143
- regression run against real TVC bank statements (user to provide), then wire
144
- auto/review/unmatched decisions to skr recipes in the consuming app.
145
-
146
- B1 `@fin.cx/camt` (CAMT.052/053/054; MT940 = legacy) + `@fin.cx/bankrec` (canonical
147
- decimal bank txn with SEPA refs, adapters, balance-chain continuity, confidence-scored
148
- matching, auto-post above threshold, review queue below). B2 OPOS inside skr (ts/opos/:
149
- masters, open items, clearItems with Skonto+VAT correction, aging, dunning states;
150
- invariant: subledger == control account). B3 `@fin.cx/assets` (AfA schedules from BMF
151
- tables, GWG/degressive as year-keyed policy, Anlagespiegel → D1). B1 before live UStVA;
152
- B2/B3 may trail.
153
-
154
- ### M-C — `@fin.cx/elster` (ERiC via Rust bridge) — first-win lane
155
-
156
- Thin transport: validate / submitTest (Testmerker) / submitLive / confirmation PDF.
157
- Rust binary dlopens ERiC from operator-supplied ERIC_HOME (ERiC never enters npm/repo;
158
- version-compat matrix + checksum gate). Kennzahl computation in `@fin.cx/tax` (VAT module
159
- ships early). C1 bridge → C2 UStVA 3-month parallel-run (3 consecutive zero/explained-diff
160
- months required) → C2' live + E1 → C3 DFV/ZM/UStJE.
161
-
162
- ### M-D — Year-end (`@fin.cx/jahresabschluss` + `@fin.cx/tax`, Q1–Q2 2027)
163
-
164
- D1 §266/§275 Gliederung + §267 size classes + Anhang skeleton + Anlagespiegel. D3 tax
165
- engine (§4(5) EStG, §8b KStG, GewSt §8/§9 add-backs, loss carryforwards, KSt 15%+Soli,
166
- GewSt Hebesatz Bremen 460%; provisions posted back to skr). D2 E-Bilanz XBRL writer
167
- (ERiC validates locally — no heavyweight XBRL lib) via elster. D4 Offenlegung generator +
168
- checklist (semi-manual upload). Verify: "re-file the past" vs StB-filed prior year +
169
- Bescheide; tie-outs; paid StB review of first Abschluss.
170
-
171
- ### M-E — Operational readiness (thin, inside skr)
172
-
173
- E1 Verfahrensdoku generator (ships WITH first live UStVA — GoBD requires from go-live).
174
- E2 GDPdU/GoBD Z3 Datenträgerüberlassung (Beschreibungsstandard index.xml + IDEA CSVs, on
175
- BagIt export). E3 retention (10y books, 8y Belege post-2025).
176
-
177
- ## Waves
178
-
179
- 1. **W0 (now):** registrations; A1 pipeline; M0 start. ✓ calculation v1.1.0 released.
180
- 2. **W1 (Jul–Sep 2026):** M0 lands; C1; tax VAT module; A1; B1 MVP; parallel-run from
181
- 09/2026.
182
- 3. **W2 (Q4 2026):** live UStVA + E1 ⇒ monthly StB dependency removed. C3 DFV. B2/B3/A2/A3.
183
- 4. **W3 (Q1–Q2 2027):** D1→D3→D2→D4 for FY2026; StB review ⇒ fully solo from FY2027.
184
- 5. **Continuous:** E2/E3; annual maintenance ~4–8 wks/yr (ERiC Nov release = hard
185
- calendar item; taxonomy bump; form-year schemas; year-keyed tax parameters).
186
-
187
- ## Top risks
188
-
189
- 1. Incorrect live filing → parallel-run gate, re-file-the-past regression, ERiC+Testmerker
190
- CI, human sign-off, StB review yr 1.
191
- 2. ERiC licensing/platform (non-redistributable; ARM64 TBD) → ERIC_HOME + compat matrix;
192
- x86_64 first.
193
- 3. DATEV database rights on chart data → multi-source, provenance, legal review.
194
- 4. Completeness failures → balance-chain continuity as monthly-close gate; OPOS
195
- invariants.
196
- 5. Regulatory churn → year-keyed data concentrated in chartdata+elster; DATEV export as
197
- permanent escape hatch.
198
-
199
- ## Open questions (user)
200
-
201
- 1. Location of `fin-accountingbackend` repo (not on this machine; finance.plus used as
202
- reference).
203
- 2. ELSTER Organisationszertifikat present? Dauerfristverlängerung in place?
204
- 3. **Ist- oder Soll-Versteuerung (§20 UStG)?** Blocks Wave-1 VAT engine design.
205
- 4. Intra-EU B2B supplies (ZM needed)?
206
- 5. elster deployment host architecture (ERiC aarch64 TBD)?
207
- 6. chartdata public MIT immediately or after legal review?
208
- 7. Beleg archival: doclake vs skr export bundles?
209
- 8. StB cooperation for parallel-run (filed Kennzahlen + prior-year working papers)?
210
- 9. Festschreibung: posted==immutable OK, or correction window until UStVA submission?
211
- 10. RFC-3161 descope in M0 OK (loud failure instead of fake stub)?
212
- 11. One company per DB confirmed (sequences keyed skrType+fiscalYear)?
213
-
214
- ## Program gates
215
-
216
- - **Gate 1 (before live UStVA):** 3 zero/explained-diff parallel months + B1 continuity
217
- green + E1 published.
218
- - **Gate 2 (before FY2026 self-filing):** re-file-the-past matches StB filings +
219
- Bescheide; ERiC-valid E-Bilanz; StB review sign-off.