Treasury & Bank Transfer Management System — سامانه مدیریت خزانهداری و حوالههای بانکی
dev/v7-production-failclosed-20261021
ci/public-windows-bridge-probe-20261017
ci/windows-dispatch-bootstrap-20261016
ci/windows-dual-app-lab-20261016
dev/v7-production-failclosed-20261021
feature/reconciliation-guard-20261013
main
phase-1-foundation
phase-1-implementation
phase-2-treasury-core
phase-3-banking-reconciliation
phase-4-operations-enterprise-ux
phase-5-hardening-release
phase-6-production-platform
phase-7-production-infrastructure-bank-golive
phase-7-sql-readonly-ux-20261015
transfer-exe-to-drive-20261006
| 1 | # Phase 3 Banking & Reconciliation Implementation Plan |
| 2 | |
| 3 | > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox syntax for tracking. |
| 4 | |
| 5 | **Goal:** Deliver bank-adapter contracts, safe dispatch semantics, statement ingestion, deterministic reconciliation, exception handling and treasury bank operations without claiming a live bank connection. |
| 6 | |
| 7 | **Architecture:** Pure TypeScript banking ports isolate external bank side effects from the treasury domain. Dispatch is idempotent and UNKNOWN-safe; statement ingestion normalizes immutable bank transactions; reconciliation uses deterministic exact matching first and explicit review queues for ambiguity. |
| 8 | |
| 9 | **Tech Stack:** TypeScript strict, Vitest, Next.js 16.3.8, React 19, GitHub Actions. |
| 10 | |
| 11 | **Spec:** docs/ROADMAP.md Phase 3 and Phase 1 invariants. |
| 12 | |
| 13 | ## Global Constraints |
| 14 | - Never automatically retry UNKNOWN bank outcomes. |
| 15 | - Never claim live bank connectivity in this phase. |
| 16 | - Every dispatch uses a stable idempotency key. |
| 17 | - Reconciliation never auto-selects among ambiguous candidates. |
| 18 | - Tenant boundaries are mandatory for accounts, transfers and statements. |
| 19 | - Imported bank transactions are immutable source records. |
| 20 | |
| 21 | ## Review Focus |
| 22 | - duplicate dispatch and timeout-after-submit; |
| 23 | - duplicate statement imports; |
| 24 | - cross-tenant/cross-account matching; |
| 25 | - ambiguous amount/date/reference matches; |
| 26 | - reversal/returned transactions and unmatched exceptions. |
| 27 | |
| 28 | ### Task 1: Bank adapter port and dispatch safety |
| 29 | TDD adapter request/result contracts, idempotency, UNKNOWN semantics and duplicate-dispatch protection. |
| 30 | |
| 31 | ### Task 2: Bank statement ingestion |
| 32 | TDD normalized statement rows, atomic validation and duplicate source-record detection. |
| 33 | |
| 34 | ### Task 3: Deterministic reconciliation engine |
| 35 | TDD exact reference/amount/account matching, ambiguity detection and unmatched handling. |
| 36 | |
| 37 | ### Task 4: Exception and reversal workflow |
| 38 | TDD review queues, manual resolution contracts, reversal/return states and audit-friendly reason codes. |
| 39 | |
| 40 | ### Task 5: Banking & reconciliation RTL UI |
| 41 | Add Persian operational views for bank dispatch, statement imports, reconciliation summary and exception queue. |
| 42 | |
| 43 | ### Task 6: Phase 3 verification gate |
| 44 | Run typecheck/tests/lint/build, update gate evidence, push branch and inspect GitHub status. |