Treasury & Bank Transfer Management System — سامانه مدیریت خزانهداری و حوالههای بانکی
phase-7-sql-readonly-ux-20261015
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 6 Production Platform Foundation 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:** Close repository-level production platform gaps: persistence contracts, tenant isolation, authenticated server boundaries, real server-derived UI data, Persian encoding/accessibility, CI coverage, and readiness validation. |
| 6 | |
| 7 | **Architecture:** Add explicit persistence and identity ports around the tested domain core, with PostgreSQL migration/RLS artifacts that remain deployable without requiring a database during repository verification. The Next.js UI consumes server-side application services rather than embedded representative data. Production infrastructure and bank-specific credentials remain Phase 7. |
| 8 | |
| 9 | **Tech Stack:** TypeScript strict, Vitest, Next.js 16.3.8, PostgreSQL SQL migrations/contracts, React 19, GitHub Actions. |
| 10 | |
| 11 | **Spec:** docs/REMAINING_WORK_2_PHASES.md plus Phase 1–5 gate invariants. |
| 12 | |
| 13 | ## Global Constraints |
| 14 | - Tenant isolation must be enforced at both application and PostgreSQL policy boundaries. |
| 15 | - Maker/checker separation and UNKNOWN no-auto-retry remain mandatory. |
| 16 | - No production credentials or live-bank calls. |
| 17 | - UI must be Persian-first RTL and must not embed fake operational numbers. |
| 18 | - CI must verify every phase/release branch and pull request to main. |
| 19 | |
| 20 | ## Review Focus |
| 21 | - missing tenant context / cross-tenant access; |
| 22 | - privilege escalation and maker self-approval; |
| 23 | - migration schema drift or missing unique constraints; |
| 24 | - fake/stale UI data represented as operational truth; |
| 25 | - broken Persian encoding and inaccessible emergency controls. |
| 26 | |
| 27 | ### Task 1: Persistence schema and RLS contracts |
| 28 | TDD schema verification helpers; add SQL migration for tenants/users/accounts/beneficiaries/payments/approvals/statements/audit with tenant RLS and idempotency uniqueness. |
| 29 | |
| 30 | ### Task 2: Identity and server authorization boundary |
| 31 | TDD trusted session claims, role checks and tenant-bound request context. |
| 32 | |
| 33 | ### Task 3: Repository/application service wiring |
| 34 | TDD tenant-scoped repositories and dashboard query service using persistence ports. |
| 35 | |
| 36 | ### Task 4: Real server-derived RTL UI |
| 37 | Remove representative hard-coded operational data; render server service result/empty state and repair Persian source encoding. |
| 38 | |
| 39 | ### Task 5: Accessibility/readiness/CI hardening |
| 40 | Add semantic UI regression tests, readiness endpoint/config checks, CI branch coverage and migration/secret checks. |
| 41 | |
| 42 | ### Task 6: Phase 6 gate |
| 43 | Run complete verification, record evidence, push branch and inspect GitHub status. |