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 | # TreasuryFlow V1 Desktop + SQL Bootstrap 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:** Ship TreasuryFlow V1.0.0 as a true Windows desktop app whose installer configures and validates the existing accounting SQL Server before first launch. |
| 6 | |
| 7 | **Architecture:** Electron owns the desktop window and embedded local Next.js server. SQL bootstrap is explicit, versioned, reversible, and defaults to least privilege; accounting/Peyvast objects are discovered before any TreasuryFlow-owned migration is applied. |
| 8 | |
| 9 | **Tech Stack:** Electron, Next.js/TypeScript, SQL Server (`mssql`), Vitest, Inno Setup 7. |
| 10 | |
| 11 | **Spec:** User-approved V1 requirements in project conversation, 2026-10-06. |
| 12 | |
| 13 | ## Global Constraints |
| 14 | - One Windows installer EXE; no manual Node.js install on destination PC. |
| 15 | - No browser UI or visible localhost address in normal use. |
| 16 | - Existing SQL Server is configured, not bundled. |
| 17 | - Preflight must validate server/database/auth/schema before writes. |
| 18 | - TreasuryFlow-owned SQL changes must be versioned and idempotent; do not mutate Peyvast core objects without an explicit verified contract. |
| 19 | - Installer must not report success if SQL bootstrap fails. |
| 20 | |
| 21 | ## Review Focus |
| 22 | - SQL server unavailable or credentials invalid: fail safely with actionable diagnostics. |
| 23 | - Wrong accounting database selected: detect schema mismatch before writes. |
| 24 | - Re-running setup: migrations remain idempotent. |
| 25 | - SQL account has read access but insufficient migration rights: report exact missing capability. |
| 26 | - Desktop close/relaunch: embedded server lifecycle leaves no orphan and app reopens normally. |
| 27 | |
| 28 | --- |
| 29 | |
| 30 | ### Task 1: SQL bootstrap contract and preflight |
| 31 | - [ ] Add failing tests for configuration validation, connection preflight, schema discovery, and no-write behavior on mismatch. |
| 32 | - [ ] Implement bootstrap service and typed result model. |
| 33 | - [ ] Verify focused tests then full suite. |
| 34 | |
| 35 | ### Task 2: Versioned TreasuryFlow SQL migrations |
| 36 | - [ ] Add failing tests for first-run migration and idempotent rerun. |
| 37 | - [ ] Implement TreasuryFlow-owned migration ledger/schema objects only. |
| 38 | - [ ] Verify rollback/error behavior and full suite. |
| 39 | |
| 40 | ### Task 3: First-run desktop setup UX |
| 41 | - [ ] Add tests for first-run state/config persistence boundaries. |
| 42 | - [ ] Implement desktop setup flow for SQL Server/instance/database/auth and preflight/bootstrap invocation. |
| 43 | - [ ] Ensure credentials are not written to logs or source-controlled files. |
| 44 | |
| 45 | ### Task 4: True desktop lifecycle |
| 46 | - [ ] Add lifecycle/security tests where practical. |
| 47 | - [ ] Harden Electron single-instance, embedded server start/stop, navigation restrictions, and error UI. |
| 48 | - [ ] Verify no external browser opens during normal launch. |
| 49 | |
| 50 | ### Task 5: V1 installer and clean-machine acceptance |
| 51 | - [ ] Build production app and Inno Setup installer as TreasuryFlow V1.0.0. |
| 52 | - [ ] Silent-install into a clean test location, launch installed app, verify readiness and desktop process lifecycle. |
| 53 | - [ ] Verify SQL bootstrap against an available test SQL Server when credentials/database are available; otherwise mark external SQL acceptance as blocked, never simulated. |
| 54 | - [ ] Record SHA-256 and final artifact path. |