diff --git a/CHANGELOG.md b/CHANGELOG.md index 65d8bd8..12d5c51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog +## 0.14.0 + +Lists and reports get their column widths back, the first screen of the desktop app is filled in, and a line with no item posts to a named account. + +### Fixed +- **Column widths on every list and report** were being refused by the app's own security rule and never applied, so columns spread evenly. They apply now. The same fault in the payment allocation table is fixed. +- **Home in the desktop app** showed its three cards with no figures and two blank panels until the account was claimed. It now shows 0.00 and a plain sentence in each panel on an empty ledger. +- **A document started from a template lost its supplier or customer and its tax rate,** so the totals left out tax. Both are kept now. +- **A line with no item on a purchase document was refused** because nothing said which account it posts to. It now posts to the purchases account (5100, or the `purchase.expense_account` setting), and a sales line with no item posts to 4100 (or `sales.income_account`). The line shows that account, for example "5100 Purchases and cost of sales", before you save. +- **Delivery notes** failed to load its customer names; it asked the server for more rows than it allows. + +### Improved +- When the server refuses one line of a document, the reason shows on that line. +- Numbers in a document's lines and totals no longer nudge as you type. + +### Known issues +- A desktop ledger that has no chart of accounts yet does not point you to Setup from Home. +- An empty ledger shows 0.00 with no currency code. +- The account shown on a line with no item is 5100 or 4100 even if the setting names another account. +- Reading the snapshot from FormCel's window was not checked. + +### Under the hood +- Every browser check for this version ran with the app's content security policy enforced; earlier checks had bypassed it. Printing through FormTxt was run with posted, numbered documents in Letter and A4 and a statement with rows. Not run: the packaged app, and anything on macOS or Windows. + ## 0.13.9 Every printable document has a FormTxt template, document lines are tighter and add up as you type, and the window tells the owner to back up the key. diff --git a/Makefile b/Makefile index abf72f1..c18605c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION := v0.13.9 +VERSION := v0.14.0 GO_BUILD := CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" .PHONY: build web server check clean diff --git a/README.md b/README.md index 3badee2..a24a397 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@
-
+
diff --git a/cmd/HASHOUT_LOG.md b/cmd/HASHOUT_LOG.md
index 26cf313..391feee 100644
--- a/cmd/HASHOUT_LOG.md
+++ b/cmd/HASHOUT_LOG.md
@@ -2,7 +2,7 @@
Living log of all comment content, explainers, rationale, TODOs, & removed (hashed-out) code for the entry point, `embed.go`, `internal/server`, `internal/static` and `internal/startup`. Source files stay comment-free per dev-rules `sub-skills/hashout-log/SUB-SKILL.md`; everything they would have said lives here, indexed. Read it first, then edit code surgically.
-Current build version: v0.13.9
+Current build version: v0.14.0
Last updated: 2026-11-26 (US Eastern) · skeleton port from form.md
---
diff --git a/docs/PRINT.md b/docs/PRINT.md
index c0c56a2..b35290c 100644
--- a/docs/PRINT.md
+++ b/docs/PRINT.md
@@ -64,6 +64,8 @@ FormTxt's `/api/reports/run` takes no page size (its fields are `template`, `dat
**Run on 2026-11-27 against FormTxt 0.38.0** (a copy on port 8901 with its own data folder, window in headless Chrome; FormLedger 0.13.9 work on 8801, seeded with `fl_exit.py --seed`, no `FORMLEDGER_FORMTXT_TEMPLATE_*` set). One draft of each kind was made through the API (quote, sales order, invoice for ACME; purchase order, purchase invoice and goods receipt for a supplier NORD with supplier ref NP-4471; an invoice in EUR for a EUR customer) and printed by id with `cli print`. Before the templates were in FormTxt each printed plain with the missing-template note (the EUR invoice's note named the `(A4)` title). After the 14 files from `--all` were opened through File > Open or import file and Always allow was clicked once, all eight prints (the seven kinds plus the EUR invoice) were drawn by FormTxt in 0.28 to 0.88 seconds. Page sizes: every USD document and the statement 612 by 792 points (Letter), the EUR invoice 595.28 by 841.89 points (A4), the same as the plain renderer gave for each. The statement had no rows because nothing was posted.
+**Run on 2026-11-27 with posted documents, against FormTxt 0.38.0** (a copy on port 8951 with its own data folder and its window served from its own build in headless Chrome; FormLedger 0.14.0 work on 8933, seeded with `fl_exit.py --seed`, no `FORMLEDGER_FORMTXT_TEMPLATE_*` set). Through the API: quote SQ-2026-000001 and sales order SO-2026-000001 confirmed, invoices SI-2026-000001 and SI-2026-000002 posted for ACME, payment PR-2026-000001 of 50.00 posted and allocated to the first; purchase order PO-2026-000001 confirmed, goods receipt GR-2026-000001 and purchase invoice PI-2026-000001 posted for NORD; for the EUR customer EURO (receivable account 12001 in EUR) quote SQ-2026-000002 and order SO-2026-000002 confirmed, and invoice SI-2026-000003 posted on three EUR items whose income account 41001 is in EUR (an EUR invoice on the USD items is refused at posting with `currency_mismatch`, account 4100 is in USD). All 14 files from `--all` were opened through File > Open or import file, Always allow all outside agents was clicked once, and ten prints were drawn by FormTxt in 0.27 to 0.69 seconds: every kind from the Letter files, each heading carrying its number (for example `Invoice SI-2026-000001`, `Goods receipt GR-2026-000001`), 612 by 792 points, one page each; the EUR invoice, quote and order from the A4 files, 595.28 by 841.89 points, one page each, totals EUR 68.13, EUR 73.58 and EUR 73.58; the statement for ACME to 2026-11-27 with three rows (invoice 73.58, invoice 73.58, payment 50.00 credit) running to a closing balance of USD 97.16. Page one of each was rendered to PNG and looked at; no field was empty or misplaced and no template was changed.
+
### How the template is used
FormLedger carries an invoice template as its own data, written in FormTxt's `.ftxt` document format (`internal/printout/formtxt_invoice.json`, embedded in the binary). It is titled `FormLedger invoice template` and holds the company name, the document title and number, date, due date, currency and status, the bill-to customer name and code, a line table whose header row repeats on every page and whose second row is marked to repeat once per line (`item`, `description`, `quantity`, `unitPrice` as Rate, `taxRate`, `lineSubtotal` as Amount), then subtotal, tax, total with the currency, the notes, and "Page N of M" in the footer. A statement template ships the same way (`internal/printout/formtxt_statement.json`, titled `FormLedger statement template`, written by `./formledger formtxt-template statement`): company, period, customer name and code, currency, opening balance, one repeating row per event (`lineDate`, `event`, `reference`, `debit`, `credit`, `balance`) and the closing balance. With no `from` the heading reads "Statement to" and the end date. The two lookups are separate, so each kind uses its template once it is in FormTxt.
diff --git a/internal/HASHOUT_LOG.md b/internal/HASHOUT_LOG.md
index 668e73a..cd3d9dd 100644
--- a/internal/HASHOUT_LOG.md
+++ b/internal/HASHOUT_LOG.md
@@ -2,7 +2,7 @@
Living log of comment content, rationale and removed code for the core skeleton packages under `internal/`. Source files stay comment-free; what they would have said lives here, indexed. Read it first, then edit code surgically. Covers the packages ported in the core slice only; `internal/server`, `internal/static` and `internal/startup` are logged by their own slice.
-Current build version: v0.13.9
+Current build version: v0.14.0
Last updated: 2026-11-27 (US Eastern) · profit and loss and the balance sheet
---
@@ -1896,3 +1896,17 @@ FormTxt 0.38.0's `/api/reports/run` has no page size field, so the size lives in
- logged: v0.13.9 · 2026-11-27
The lost-key warning was only in the log. `/api/me` now carries `key` for the owner role only: encrypted, `madeHere` (the key is the one `EnsureHome` made in `FORMLEDGER_KEY_HOME` and no `FORMLEDGER_KEY_FILE` or credential overrides it), the path, and `backedUp`. The key itself never leaves the server. The confirmation is a file beside the key, `formledger.key.backed-up`, not a row in the database: it belongs to that key on that computer, survives a fresh data folder that reuses the key, and is gone if the key folder is replaced. `keyState` reads `config.Load` rather than threading the config through `Service`, because `server.go` builds the service and is not this slice's file; in desktop mode that also mints an unused window key per call, which is harmless. The route `POST /api/me/key-backed-up` (Session, owner checked in the handler) needs one line in `internal/auth/module.go`, with its owner. Run in a private copy with that line, started as the desktop shell does (`FORMLEDGER_DESKTOP=1 FORMLEDGER_KEY_HOME=/tmp/P3/appdata`, signed in through `/desktop/enter`): `key` read encrypted, madeHere, the path, not backed up; the confirm answered 200 and wrote the marker; a reload read backed up. With no key home, `key` read not encrypted and no path.
+
+### internal/printout/formtxt.go, internal/printout/template.go · proven with posted documents
+- refers-to: internal/printout/formtxt.go :: formtxt.Render; internal/printout/template.go :: TemplateCommand, sized, findShipped
+- kind: rationale
+- logged: v0.14.0 · 2026-11-27
+
+The earlier proof printed drafts, so no heading had a number and the statement had no rows. On 2026-11-27 against FormTxt 0.38.0 on 8951 (its own data folder, window from its own build), with all 14 files from `--all` opened and Always allow clicked once, ten posted documents were drawn by FormTxt in 0.27 to 0.69 seconds: the seven kinds from the Letter files at 612 by 792 with numbered headings (SQ, SO, SI, PO, PI, GR), and an EUR invoice, quote and order from the A4 files at 595.28 by 841.89; the ACME statement showed two invoices of 73.58 and a payment of 50.00, closing 97.16. No template or code needed a change. An EUR invoice on the seeded USD items is refused at posting (`currency_mismatch`, income account 4100 is USD), so the EUR invoice used EUR items on an EUR income account.
+
+### internal/purchase/resolve.go, internal/sales/resolve.go · a free line posts to the default account
+- refers-to: internal/purchase/resolve.go :: expenseSetting, defaultExpenseCode; internal/sales/resolve.go :: incomeSetting, defaultIncomeCode
+- kind: rationale
+- logged: v0.14.0 · 2026-11-27
+
+A line with no item and no account was refused (`no_expense_account`, `no_income_account`), and the form had no way to name one. The chart marks no default account, so the rule is the smallest honest one already used for item lines on buying: the setting `purchase.expense_account`, else 5100; selling gets the same shape, `sales.income_account`, else 4100. When that account is missing, inactive or a group, the refusal keeps its code and says in words to add the account to the chart or pick an item. Against a seeded copy, a free line "Courier fee" at 42.50 posted PI-2026-000001 as 5100 debit, 2110 credit, and SI-2026-000001 as 1200 debit, 4100 credit.
diff --git a/internal/app/version.go b/internal/app/version.go
index eca3e1c..e0de571 100644
--- a/internal/app/version.go
+++ b/internal/app/version.go
@@ -1,5 +1,5 @@
package app
-var Version = "v0.13.9"
+var Version = "v0.14.0"
const Product = "FormLedger"
diff --git a/internal/purchase/resolve.go b/internal/purchase/resolve.go
index 5ef588b..95b4e12 100644
--- a/internal/purchase/resolve.go
+++ b/internal/purchase/resolve.go
@@ -182,7 +182,11 @@ func resolveLines(ctx context.Context, q store.Querier, in []LineInput, currency
return nil, bad("no_price", n+"has no item, so it needs a unitPrice")
}
if strings.TrimSpace(li.ExpenseAccount) == "" {
- return nil, bad("no_expense_account", n+"has no item, so it needs an expenseAccount code")
+ code := expenseSetting(ctx, q)
+ if l.ExpenseAccountID, err = findAccount(ctx, q, code, n); err != nil {
+ return nil, refuse("no_expense_account", n+"has no item and the chart has no usable purchases account "+code+"; add account "+code+" to the chart or pick an item for this line")
+ }
+ l.ExpenseAccount = code
}
}
if li.Description != nil {
diff --git a/internal/sales/resolve.go b/internal/sales/resolve.go
index 8b0454f..b07a4f3 100644
--- a/internal/sales/resolve.go
+++ b/internal/sales/resolve.go
@@ -11,6 +11,17 @@ import (
"github.com/nodemode-ai/formledger/internal/store"
)
+const defaultIncomeCode = "4100"
+
+func incomeSetting(ctx context.Context, q store.Querier) string {
+ var code string
+ err := q.QueryRowContext(ctx, `SELECT value FROM settings WHERE key = 'sales.income_account'`).Scan(&code)
+ if err != nil || strings.TrimSpace(code) == "" {
+ return defaultIncomeCode
+ }
+ return strings.TrimSpace(code)
+}
+
type customer struct {
id string
code string
@@ -124,7 +135,11 @@ func resolveLines(ctx context.Context, q store.Querier, in []LineInput, currency
return nil, bad("no_price", n+"has no item, so it needs a unitPrice")
}
if strings.TrimSpace(li.IncomeAccount) == "" {
- return nil, bad("no_income_account", n+"has no item, so it needs an incomeAccount code")
+ code := incomeSetting(ctx, q)
+ if l.IncomeAccountID, err = findAccount(ctx, q, code, n); err != nil {
+ return nil, refuse("no_income_account", n+"has no item and the chart has no usable sales account "+code+"; add account "+code+" to the chart or pick an item for this line")
+ }
+ l.IncomeAccount = code
}
}
if li.Description != nil {
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 6bf7f54..48a8323 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -1106,7 +1106,7 @@ dependencies = [
[[package]]
name = "formledger-desktop"
-version = "0.13.9"
+version = "0.14.0"
dependencies = [
"objc2",
"objc2-app-kit",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index ddd09c3..9a166e0 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "formledger-desktop"
-version = "0.13.9"
+version = "0.14.0"
description = "FormLedger desktop app"
authors = ["NodeAgentc, Inc."]
license = "Apache-2.0"
diff --git a/src-tauri/HASHOUT_LOG.md b/src-tauri/HASHOUT_LOG.md
index cdad10f..969efb4 100644
--- a/src-tauri/HASHOUT_LOG.md
+++ b/src-tauri/HASHOUT_LOG.md
@@ -2,7 +2,7 @@
Living log of all comment content, explainers, rationale, TODOs, & removed (hashed-out) code for the Tauri 2 desktop shell (`src-tauri`). Source files stay comment-free per dev-rules `sub-skills/hashout-log/SUB-SKILL.md`; everything they would have said lives here, indexed. This file is also the compressed contextual map of the shell: read it first, then edit code surgically.
-Current build version: v0.13.9
+Current build version: v0.14.0
Last updated: 2026-11-26 (US Eastern) · the shell ported from form.md's src-tauri and renamed for FormLedger
---
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 6740eeb..ef6bae5 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -2,7 +2,7 @@
"$schema": "https://schema.tauri.app/config/2",
"productName": "FormLedger",
"mainBinaryName": "formledger-desktop",
- "version": "0.13.9",
+ "version": "0.14.0",
"identifier": "ai.nodemode.formledger",
"build": { "frontendDist": "splash" },
"app": {
diff --git a/web/HASHOUT_LOG.md b/web/HASHOUT_LOG.md
index 9475e18..c6eaf9f 100644
--- a/web/HASHOUT_LOG.md
+++ b/web/HASHOUT_LOG.md
@@ -2,7 +2,7 @@
Living log of all comment content, explainers, rationale, TODOs, & removed (hashed-out) code for the web client. Source files stay comment-free per dev-rules `sub-skills/hashout-log/SUB-SKILL.md`; everything they would have said lives here, indexed. This file is also the compressed contextual map of the web side: read it first, then edit code surgically.
-Current build version: v0.13.9
+Current build version: v0.14.0
Last updated: 2026-11-26 (US Eastern) · account screens, and the fixes from the throttled browser check
---
@@ -754,3 +754,24 @@ Pre-write statement. 1: most sessions never see the notice, so no space is reser
- logged: v0.13.9 · 2026-11-27
Each `.grid__line` was 47 px: a second grid track of `--grid-err` (16 px) held the per-line error text ("Needs an item", server line errors) under every row, plus a 1 px border. The line is now one track at `block-size: var(--row)` (30 px, border inside), and `.grid__err` is an absolutely placed tag over the row's lower edge at `--z-raised`, hidden while empty, so an error appears without moving anything. The scroll box's minimum is five rows plus one error tag. Totals: the form's `onChange` is a no-op and the document totals came only from the server's answer after a save, while `setLines` never totaled at all, so a template's lines showed no Amount and 0.00 totals. `recompute` now works out each line the way `sales.LineAmounts` does (subtotal half-up from milli quantity, tax half-up from the rate's basis points read from the tax picker's record) and writes only changed text into the existing cells and sums; it runs on every edit, at the end of `setLines`, and again when a line's tax rate resolves. The server's figures still overwrite them after save, and they agree. Removing a line used to pull every row below it up; `dropRow` now copies the following lines' values up one row and drops the last node. The account hint box is a fixed 45 percent wide so its text changing never resizes it. Checked under 4x CPU and the slowed network at 1400 by 900: the twenty-line exit run read 0 at every step; the service-hours template read 1,200.00, 180.00, 0.00 and 1,380.00 at load, 0 shift dark and light; a hand-typed free line 3 at 25.50 read 76.50; removing line 2 and the last line read 0 with and without input; a posted template invoice read subtotal 120000 and total 120000 from the API, as the form showed.
+
+### src/ui/views/payments.ts, src/styles/views/payments.css · allocation column widths under the content policy
+- refers-to: src/ui/views/payments.ts :: allocation table colgroup; src/styles/views/payments.css :: .pay__col--number, .pay__col--date, .pay__col--money, .pay__col--input
+- kind: rationale
+- logged: v0.14.0 · 2026-11-27
+
+The server sends `style-src 'self'`, which blocks every `style` attribute, so the six `col` widths the allocation table wrote as `style="inline-size:var(--pay-col-...)"` never applied in the desktop app; checks that passed `bypass_csp` hid it. They are classes now, reading the same `--pay-col-*` tokens. Setting one property through the CSSOM (`el.style.left`, `style.setProperty`) is not an attribute and the policy allows it, which is why the picker and menu placement stay as they are. Swept with the policy enforced and no bypass, seeded ledger with one posted invoice, 1400 by 900, dark and light: Home, Dashboards, Reports, Setup, Templates, the five document forms, both payment forms and the palette read zero violations; every list and report built by `ui/parts/table.ts` still reads 3 to 10, because its `colgroup` writes `style` per column. Empty desktop Home: the five calls answer 200 with zeros and empty lists while the owner is unclaimed, and nothing is written only because `mountHome`'s load returns early on `claimRequired`.
+
+### src/ui/views/docform.ts · a template's codes become ids before the form is filled
+- refers-to: src/ui/views/docform.ts :: fromTemplate, idOf; src/ui/parts/linegrid.ts :: setLines, recompute, flagMissing; src/styles/views/grid.css :: .grid__err
+- kind: rationale
+- logged: v0.14.0 · 2026-11-27
+
+`POST /api/templates/{id}/use` names the party, items and tax rates by code (`NORD`, `K001`, `ST8`), while the pickers and `setLines` take ids, so a template-started document showed an empty supplier and an empty tax cell and totaled with no tax. `fromTemplate` now resolves each code through `lookup` (matching code first, then id) before `setLines` and `setById`, and drops the answer if another load started meanwhile. Run with the content policy enforced (no bypass), 4x CPU, 400 ms and 50000 B/s, cache off, hard reload at 1400 by 900, 0 policy violations. `#/purchase-doc`: load 0 shift without input and 0 with, every line 30 px; sixteen lines typed 0 and 0, totals live (298.50); select-all and typing 12.75 in a unit price 0 without input and 0.00005 with, in four entries whose only source is a node already gone from the page (the replaced amount text) with previous and current rectangles both 968, 291.77, 86 by 17, so nothing a person sees moves; Save draft with lines 8 and 16 holding a quantity and no item showed "Needs an item" on both, 0 and 0 as the tags appeared and went; with the box scrolled to its end the tag on the last row ran from 657.77 to 673.77 inside a box ending at 675.06, readable, so it was left below the row; removing line 3 of 16 read 0 and 0. A template with one ST8 line on account 5200 for NORD: load 0 and 0, the account hint read "5200 Freight in", totals 120.00, 9.60, 129.60 (before the fix 120.00, 0.00, 120.00 and no supplier); a typed second line "Freight in", 3 at 25.50 with ST8 picked read 196.50, 15.72, 212.22, typing 0 and 0.00001, and after Save draft and posting, PI-2026-000002 read subtotal 19650, tax 1572, total 21222 from the API. A typed free line with any other description is refused by the server (`no_expense_account`), since the form only gets an account from a template description.
+
+### src/ui/views/docform.ts · a free line shows its default account; numbers keep their right edge
+- refers-to: src/ui/views/docform.ts :: defaultCode, defaultAccount, run; src/ui/parts/linegrid.ts :: put, refreshHints; src/styles/views/grid.css :: .grid__c-num, .grid__num, .grid__sum-value
+- kind: rationale
+- logged: v0.14.0 · 2026-11-27
+
+A line with no item now shows the account the server will use, "5100 Purchases and cost of sales" on buying and "4100 Sales" on selling, read from the account lookup once and written by `refreshHints`; the codes mirror the server defaults, so if the owner changes `purchase.expense_account` or `sales.income_account` the hint still names 5100 or 4100. A refusal that starts "line N" also lands on that line's error tag. `put` writes the data of the cell's one text node instead of replacing it; that alone left 0.00007 with input, because right-aligned text that grows a digit moves its start point, and the price input's inner text is replaced by the browser on select-all. Numeric cells, inputs and totals are `direction: rtl` with `unicode-bidi: plaintext`, which keeps the anchor at the right edge and leaves the reading order of the number as typed. Policy enforced, no bypass, 4x CPU, 400 ms, 50000 B/s, cache off, hard reload, 1400 by 900, blank purchase and sales invoices: load 0 and 0, typing "Courier fee", 1, then 42.50 after select-all 0 and 0, Post 0 and 0, 0 violations; PI-2026-000001 posted 5100 debit 42.50 against 2110, SI-2026-000001 posted 1200 against 4100 credit 42.50. The exit script's twenty-line invoice posted with 0 and 0 on every step.
diff --git a/web/package-lock.json b/web/package-lock.json
index 632e74d..7f81953 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "formledger",
- "version": "0.13.9",
+ "version": "0.14.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "formledger",
- "version": "0.13.9",
+ "version": "0.14.0",
"license": "Apache-2.0",
"devDependencies": {
"@types/node": "^22.20.5",
diff --git a/web/package.json b/web/package.json
index 2e5c9e8..1e8d13f 100644
--- a/web/package.json
+++ b/web/package.json
@@ -1,7 +1,7 @@
{
"name": "formledger",
"private": true,
- "version": "0.13.9",
+ "version": "0.14.0",
"license": "Apache-2.0",
"type": "module",
"scripts": {
diff --git a/web/src/engine/doclists.ts b/web/src/engine/doclists.ts
index 87e7567..5d5139a 100644
--- a/web/src/engine/doclists.ts
+++ b/web/src/engine/doclists.ts
@@ -70,7 +70,7 @@ let customerNames: Promise