Add phase B5 for the fourth review round

This commit is contained in:
ai-bot committed 2026-11-16 19:03:36 +00:00
1 parent 6b72b7ca29
commit dd6650f671
1 file changed
+45
+45
View File
@@ -268,6 +268,51 @@ The kroner balance, the refusals, the bank's two legs leaving it at zero, and th
moves. moves.
**Verify:** `python3 -m unittest discover -s tests -v` — green. **Verify:** `python3 -m unittest discover -s tests -v` — green.
## Phase B5 — corrections to the kroner model (steps B5.1-B5.6)
The owner's fourth review round. Kroner are not moved between two real accounts: they go in and
out through the bank, which is a real side of the transfer and is visible in the list. `Til` is
always required, the empty-`Til` withdrawal goes away, and a buy must have the kroner. The steps
are lettered on purpose: Phase C and Phase D keep their numbers.
### B5.1 `docs/spec.md`, `docs/TODO.md`
Fold the corrections in: §3.11 (the bank as a side of a kroner transfer, `Til` always required,
the buy refused when the kroner do not cover it), §7.3, §7.4, §8 and the decisions D33-D35, plus
this phase.
**Verify:** the spec reads consistently and Phase C still starts at 56.
### B5.2 `static/transaction.js`
Fix the regression from B4.7: the listener on the outgoing currency called `applyType()`, which
set the select back to the default of the type, so `Salg/kostnad` on Handel could never be
changed to sats. Only the parts that depend on the currency are refreshed (`syncDestination()`).
**Verify:** in the browser, Handel lets `Salg/kostnad` be switched between kr and sats and the
choice stays.
### B5.3 `validation.py`
A kroner `transfer_out` must have the bank on exactly one side: as `market_id` (a deposit) or as
`to_market_id` (a withdrawal). Kroner between two real accounts are rejected, `to_market_id` is
always required, and a sats transfer may not name the bank. `validation` learns the bank id as a
parameter.
**Verify:** six payloads, clean and rejected, each with its Nynorsk message.
### B5.4 `ledger.py`
Refuse a `trade` buy that overdraws the kroner balance, with the same message as a transfer.
**Verify:** the unit tests, plus a hand check of a buy that overdraws and one that a deposit
covers.
### B5.5 `app.py`
Allow the bank as the `market_id` or the `to_market_id` of a kroner `transfer_out` (and keep it
refused everywhere else), drop the branch that wrote no pair, and let `GET /api/markets` carry
the bank with `bank: true` and `kroner_ore`.
**Verify:** `curl` a withdrawal to the bank, a deposit from it, kroner between two real accounts
(refused), and a `Forvaltningskostnad`.
### B5.6 `static/transaction.html`, `static/transaction.js`, tests
Offer the bank in `Til` and in `Marknad` only for a kroner `Overføring ut`, drop the withdrawal
hint, and update the tests for the new rules.
**Verify:** in the browser, a withdrawal and a deposit; then
`python3 -m unittest discover -s tests -v` — green.
## Phase C — StartOS package (steps 56-71) ## Phase C — StartOS package (steps 56-71)
### 56. `package.json`, `tsconfig.json`, `.prettierrc` ### 56. `package.json`, `tsconfig.json`, `.prettierrc`