Bank8:Branch - README
Branch operations as accountable positions: an office hierarchy, staff, tellers with limits, cashier sessions with server-generated shift summaries and recorded variance, cash allocation and settlement, vault position, denominational counts, and cash in transit - every cash movement posted through Bank8:Ledger.
Summary
Bank8:Branch is a Rust service owning the branch schema in the bank8
vertical database. It models the physical bank: which offices exist, who
works in them, which tellers may handle cash and up to what limit, which
shift is open, what was counted at close, and where the cash is now.
It holds no cash balance of its own. Drawer, vault, and in-transit cash are ledger positions; Branch records the movements and proves the count.
Motivation
Cash is where the physical bank and the book most visibly disagree. A terminal that keeps its own session total can be refreshed into an inconsistent state, and a variance then has no evidence behind it.
Two properties fix that:
- Expected cash is computed from recorded movements, server-side. The client supplies a count, never the expectation.
- Drawer cash is a ledger position. Every allocation, settlement, deposit, and withdrawal is a posting, so branch cash and the book of account are the same set of numbers.
Architecture & High-Level Design
Key Traits and Data Structures
Office- a hierarchy node with a dot-pathhierarchy, so a subtree is a prefix scan rather than a recursive walk.Staff- a business record bound to one office. Identity and sign-in stay with the platform; Branch never holds credentials.Teller- a cash-handling position with per-transaction and per-shift limits enforced before a posting.CashierSession- an open/closed shift with expected, counted, and variance; the summary is server-generated and immutable after close.CashTransaction- a movement with its ledger posting id and denomination breakdown.DenominationCount- a physical count by note and coin at close.VaultTransfer/CashInTransit- movements between vaults and between branches, landing only on receipt.
Rationale, Trade-offs, and Alternatives
- Expected from evidence. The alternative - letting the terminal send an expected total - makes a variance unverifiable. Computing it from recorded movements means the count is the only client input that matters, and the variance is a real number.
- Cash as a ledger position. A local cash ledger would be a second book that must be reconciled forever. Posting to the ledger makes branch cash and the GL agree by construction.
- Limits enforced at the drawer. Checking a teller's limit on a report means a breach is discovered afterwards. Enforcing it before the posting makes authority structural.
- In-transit as a first-class position. Modelling a transfer as an immediate move hides the window where cash is in a van. A suspense position makes that window visible and aged.
See DESIGN.md for the wire-level detail (including the normative
posting mapping) and BUSINESS.md for the business capabilities.
Architecture & Design: bank8:branch and its underlying concepts were designed by Hamid Jahanzad.