diff options
Diffstat (limited to 'docs/STATE.md')
| -rw-r--r-- | docs/STATE.md | 79 |
1 files changed, 68 insertions, 11 deletions
diff --git a/docs/STATE.md b/docs/STATE.md index b7ed645..bd38963 100644 --- a/docs/STATE.md +++ b/docs/STATE.md @@ -6,10 +6,40 @@ Read with `AGENTS.md` (rules) and `docs/TUI-GUIDELINES.md` (UI conventions). ## Status Working self-hosted bookkeeping system, not production-proven. Backend ledger -core is complete; filing/year-end/payroll are not. TUI is usable and exercised -by `make test-pty` (golden screen-text scenarios); `make test` covers the -server/protocol/ledger, the TUI widget unit tests and the docs consistency -check. +core is complete, as are invoicing, the payroll engine and the payroll TUI; +filing/year-end work remains. TUI is usable and exercised by `make test-pty` +(golden screen-text scenarios, now including the payroll run and the +lönebesked); `make test` covers the server/protocol/ledger, the TUI widget +unit tests and the docs consistency check. + +## Resume here (2026-09-21) + +- **Deployed**: `v0.1.55`, healthy on `nas` (Alpine runtime, static aarch64 + binaries cross-compiled on this machine — ~20 s, the host only assembles + the image; image 33.7 MB, no `libssl3`). It brings the payroll server + waves (schema v11: employees, tax tables, lönebesked) and the payroll + TUI with the Företag/System menu; the live database migrated v9 → v11 on + startup with the automatic pre-migration snapshot in `var/db/backup/`. + `main` and the tag `v0.1.55` are pushed to `nas`. +- **Next tasks (payroll follow-ups)**: fold `payroll.settings_get/set` into + `settings.get/set` (cmd_settings.c was busy during wave 1); settle the + over-80k % rule (SKV 433 leaves it ambiguous — currently a clear + `INVALID_ARGS`); move `invoice.send` to the shared `src/mail.c`. The TUI + has no screen for the payroll account/rate settings yet (they are + defaults and can stay server-side until the fold). +- **Done in the TUI wave**: `clients/screens_payroll.c` with Lönekörningar + (list + Ctrl+N, run screen with F5 preview, Ctrl+Enter post after + confirmation and the action rows Lönebesked, AGI-underlag, Betala skatt & + avgifter), Anställda under Företag and the Skattetabeller + fetch/import/status screen under System. A pty scenario posts a run and + fetches its lönebesked, so the payslip PDF path is exercised end to end. +- **Menu (2026-09-21)**: the dashboard has the sections Bokföring (with + Mallar), Fakturering, Lön, Rapporter & bokslut, Företag (Anställda, + Kunder, Bolaget, Momsregler) and System (Skattetabeller, Revision, + Systeminställningar). Inställningar is gone: standardserie, + fordrings-/intäktskonto, bankgiro, vår referens and SMTP now live under + Bolaget (the Fakturauppgifter and E-post sub-forms) and bilagornas mapp + under System. `--screen settings` remains an alias for Bolaget. ## Open decisions @@ -27,25 +57,42 @@ None open. Completed items that used to be listed here are archived in 7. ~~Pre-migration `VACUUM INTO` snapshot~~ done. 8. ~~Docker image + compose~~ done (no registry, no systemd unit). 9. Password change, user disable, TOTP. -10. ~~Bank import/reconciliation (CSV first)~~ phase 1 done (SEB CSV + - matching, schema v8). Next: phase 2 prefill-from-transaction and - `bank_rule.*`, then PSD2; invoicing/reskontra and AGI/payroll if - employees. +10. ~~Bank import/reconciliation (CSV first)~~ phase 1 (SEB CSV + matching, + schema v8) and phase 2 (Ctrl+N prefills the voucher and auto-matches it, + `9b1021e`) done. Phase 3 (`bank_rule.*`) **dropped by the user + 2026-09-21**; PSD2 only if it ever hurts. 11a. Imported history years with source P&L closings: decided, no importer change (see DECISIONS.md). 11. ~~SIE import only into an empty fiscal year~~ chronological multi-year import works; each year must still target an empty fiscal year. 12. TUI polish: horizontal scrolling in long text fields, bracketed paste. +13. ~~Payroll TUI (wave 3)~~ done (`clients/screens_payroll.c`); the + remaining payroll follow-ups are listed under "Resume here". No + employee is registered yet in the real orgs. +14. Invoice follow-ups when needed: credit notes (`invoice.credit`), per-row + account in the invoice form, kundreskontra view. +15. `make test-pty` speed if it ever exceeds ~60 s: parallelise the + independent scenarios (each has its own rig) and add `--only` symmetry; + measure first. +16. Test fixtures (`t_fresh_org()`) + one test file per domain + (`tests/core_<domain>.c`) so `--only` stops cascading; pilot with one + domain. Original entries for the struck items are in `docs/DECISIONS.md`. ## Environment / how to run -- **Deployed**: `scripts/deploy.sh` (latest `v0.1.48`, healthy on nas). +- **Deployed**: `scripts/deploy.sh` (latest `v0.1.55`, healthy on nas). Live daemon `tls:bokf.makandra.eu:8788`, token `~/.config/bokf/migration-token` (scopes `read,write`; owner-only actions like closing years must be done by the human in the TUI). Git remote `origin` is `nas:/mnt/data/git-repos/bokf.git` (push `main` and tags). + `sh scripts/install-hooks.sh` once per checkout points `core.hooksPath` at + `.githooks/`, so every push runs `make gate` (clean `-Werror` build in + `build-gate/`, the suite and ASan); it is installed here. + `deploy/Dockerfile.cross` + `deploy/cross-build.sh` produce static aarch64 + `bokfd`/`bokfctl` in ~20 s when the host architecture differs; the image is + assembled on the host from `.prebuilt` (see docs/DEPLOY.md). - **Local test rig** (transient, `/tmp`): daemon `./build/bokfd --db /tmp/opencode/bokf-local/t.db --socket /tmp/opencode/bokf-local/sock`, org 1, login `admin`/`testpass123`. @@ -91,10 +138,11 @@ Original entries for the struck items are in `docs/DECISIONS.md`. - Never commit unless the human asks. - SQLite files must not be backed up live with restic; use `backup.snapshot` (`VACUUM INTO`) and point restic at the snapshots. -- Schema version is 9 (v3 moms rules; v4/v6 year info; v5 org +- Schema version is 11 (v3 moms rules; v4/v6 year info; v5 org description/shares + board members; v7 attachments append-only triggers; v8 bank reconciliation; v9 invoicing + widened `vouchers.source` with a - table rebuild); forward migrations are in `db.c`. + table rebuild; v10 payroll + `payroll`/`payroll_tax` sources, same + rebuild; v11 `employees.email`); forward migrations are in `db.c`. ## Makandra driftstatus (org 2) @@ -122,3 +170,12 @@ Original entries for the struck items are in `docs/DECISIONS.md`. över "Stäng"-verifikat i flerårsöversikten); utdelning bokförs vid stämman med mallen **Utdelning** (D 2099/K 2898); pappersoriginal finns i fysisk pärm (får refereras i efterhand, även i stängda år). +- **Lön (2026-09-21)**: bara ägaren är anställd, men schema och kommandon är + fleranvändarklara. Lönemotorn (schema v11: anställda, skattetabeller, + lönekörningar, lönebesked + mejl) och TUI-sektionen Lön är klara, men + **ingen anställd är registrerad än** (personnummer, lön, skattetabell och + kolumn fylls i under Register → Anställda). Konton enligt historiken: + 7210/7510/2710/2731/1630. Skattetabellerna hämtas med en knapp från + Skatteverket (varning när året är gammalt), personnumret är krypterat i + databasen. Ingen semesteruppbokning; arbetsgivardeklarationen (AGI) görs + manuellt med underlaget från `payroll.agi`. |
