1.02 Architecture Decisions: Exit Evidence
Evidence · Step: 1.02 Architecture Decision Records and Repository Restructure
| Step | 1.02 Architecture Decision Records and Repository Restructure |
| Date | 2026-11-10 |
| Result | Passed |
Deliverables
Section titled “Deliverables”| Deliverable | Required | Delivered |
|---|---|---|
| ADRs | 0001–0010 as listed in the step | 12 ADRs in docs/adr/. 0011 (append-only history) and 0012 (stored running balances) were added so every architecture §5 question maps to an ADR. |
Remove proto/, spec §9 to REST |
Yes | proto/ deleted; spec §9 rewritten for REST (ADR-0009) |
| Crate list | core, engine, ops, offline, api, sim, cli | crates/ uses these short folder names; packages keep the mezgeb- prefix. store-pg became engine, server became api, the client SDK was replaced by cli, ops was added. |
| Scaffold types marked for replacement | Yes | account, transfer and state in crates/core are marked for replacement in steps 1.04–1.06 (ADR-0003, ADR-0004) |
Testing requirements
Section titled “Testing requirements”| Requirement | Result |
|---|---|
| The workspace builds and passes clippy after the restructure | Pass: cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace all pass; mezgeb-sim, mezgeb-api and mezgeb-cli run |
| Each ADR lists at least 2 alternatives and its consequences | Pass: every ADR lists 3–4 alternatives, and consequences with costs (review checklist) |
Acceptance criteria
Section titled “Acceptance criteria”Every question in architecture §5 maps to an ADR:
| Question | ADR |
|---|---|
| 5.1 Modular monolith | 0001 |
| 5.2 Engine vs wallet and payment logic | 0002 |
| 5.3 Every posting balances | 0003 |
| 5.4 Concurrent spending | 0007 |
| 5.5 Duplicate transactions | 0008 |
| 5.6 Reversals without modifying history | 0011 |
| 5.7 Calculating and verifying balances | 0012 |
| 5.8 Offline synchronisation | 0010 |
| 5.9 Reconciling cached balances | 0002 |
| 5.10 Crash recovery | 0008 |
Exit gate
Section titled “Exit gate”Question: for any table or crate, can you point to the ADR that justifies it? Seven questions were answered without notes, after one read-through of a plain-language summary. The answers are recorded as given, with spelling lightly corrected.
| # | Question | Answer | ADR | Result |
|---|---|---|---|---|
| 1 | Why is ops separate from engine? |
The engine only knows accounting rules, but ops knows how each business event is booked. | 0002 | Pass |
| 2 | Why is money a BIGINT, not a float? |
Whole numbers are always exact; with BIGINT we store cents (santim) easily. |
0005 | Pass |
| 3 | Why is the idempotency key saved in the same transaction as the entry? | To make a payment happen exactly once. | 0008 | Pass, with a gap |
| 4 | Why is there no proto/ folder? |
We chose REST instead of gRPC: most developers know REST, and gRPC needs extra tools without giving us a real benefit. | 0009 | Pass |
| 5 | Why does the account store debits_total and credits_total? |
Adding up millions of lines on every payment is too slow. | 0012 | Pass |
| 6 | Why reverses_entry_id instead of editing a wrong entry? |
History must never be changed. | 0011 | Pass, with a gap |
| 7 | Why does a withdrawal move money into 2020 instead of a pending flag? | Money waiting for the payout is still owed to the customer, so it must show in the books. | 0004 | Pass |
Feedback on the gaps:
- 3: the answer gives the goal, not why the same transaction is needed. Saved separately, a crash between the two writes lets a retry post the payment twice. In one transaction, both are saved or neither is.
- 6: the answer gives the goal, not the mechanism. The wrong entry stays,
and a new mirror entry cancels it, linked by
reverses_entry_id(E13).
Result: passed. Each answer names the right reason for the right decision. The two gaps are recorded here so they are covered again in steps 1.11 (idempotency) and 1.12 (reversals).