Treasury & Bank Transfer Management System — سامانه مدیریت خزانهداری و حوالههای بانکی
docs: define two-phase closure and phase 6 plan
Davood Mehraban committed
Oct 5, 2026 at 17:17 UTC
d00cf90bd6627e729ddf3194fc2c1e8686c06478
2 files changed
+65
docs/REMAINING_WORK_2_PHASES.md
new
+22
@@ -0,0 +1,22 @@
1
+# Remaining Work — Two-Phase Closure Plan
2
+
3
+## Phase 6 — Production Platform Foundation (execute now)
4
+1. Persistent PostgreSQL schema and tenant isolation/RLS contract.
5
+2. Production identity/session and RBAC authorization boundary.
6
+3. Server-side repository/service layer wiring core domain to persistence.
7
+4. Replace representative UI data with authenticated server-derived data.
8
+5. Fix Persian UI source encoding and add UI/accessibility regression tests.
9
+6. Make CI run on all phase/release branches and add migration/security checks.
10
+7. Add application health/readiness endpoint and deployment configuration validation.
11
+8. Full local gate: typecheck, tests, lint, build, migration/schema verification, secret scan; push and inspect remote status.
12
+
13
+## Phase 7 — Production Infrastructure & Bank Go-Live (requires external credentials/infra authorization)
14
+1. Provision production PostgreSQL and prove RLS with integration tests.
15
+2. Configure production identity provider, MFA/session policy and secret/KMS storage.
16
+3. Configure production observability/SIEM/WAF and alert delivery.
17
+4. Execute real backup/restore drill and prove RPO/RTO.
18
+5. Implement a bank-specific adapter: protocol/auth/certificate lifecycle/status polling.
19
+6. Bank sandbox/certification, E2E, performance, accessibility and security regression.
20
+7. Controlled live-bank activation, canary, rollback rehearsal and production release approval.
21
+
22
+Phase 7 does not authorize spending, infrastructure provisioning, credential changes, or live-bank transfers; those actions require explicit approval at execution time.
docs/superpowers/plans/2026-10-05-phase-6-production-platform.md
new
+43
@@ -0,0 +1,43 @@
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.