@davoodmehraban89 / Factor-easy / commits / 3970297
Fork 0

سامانه صدور فاکتور و حسابداری

Close Phase 2 accounting foundation acceptance

davoodmehraban89 committed Sep 28, 2026 at 18:16 UTC 39702975a08ded8997787858383e20dab7d9afa9
1 file changed +68
docs/PHASE_2_REDESIGN_VERIFICATION.md new
+68
@@ -0,0 +1,68 @@
1 +# Finora — Phase 2 Verification
2 +
3 +Date: 2026-09-28
4 +Status: COMPLETED
5 +
6 +## Scope
7 +Phase 2 establishes the accounting master-data foundation while preserving Finora 1.0 operational records.
8 +
9 +Implemented:
10 +- three fixed account levels: General Ledger (کل), Subsidiary (معین), Detail (تفصیلی)
11 +- account code, parent, normal balance, posting-level and active state
12 +- user-defined analytic/floating dimensions
13 +- configurable hierarchy depth from 1 to 8 for manual dimensions
14 +- strict terminal-depth/leaf-only posting semantics
15 +- hierarchy depth lock after the first value exists
16 +- depth may be changed only after all unreferenced values are removed
17 +- deletion guards for child/referenced analytic values
18 +- account-to-dimension rules: required, optional, unavailable
19 +- entity-backed dimensions for contacts, projects and branches
20 +- fiscal-year master with overlap validation and lock state
21 +- branch master
22 +- global project master with multi-counterparty links
23 +- legacy contact-owned project migration preserving IDs
24 +- company activity classification and optional accounting starter template
25 +- starter templates for trading, service, manufacturing, contracting, retail, distribution, nonprofit and professional-services companies
26 +- template choice supports recommended setup or empty chart
27 +- cloud sync, backup and Supabase records collection support for Phase 2 masters
28 +
29 +## Safety invariants
30 +1. A dimension's configured hierarchy depth cannot be changed while it contains values.
31 +2. A manual analytic value is postable only at the configured terminal depth and only when it has no active child.
32 +3. A terminal node cannot receive children beyond configured depth.
33 +4. Referenced dimension values, projects and branches cannot be destructively removed.
34 +5. Account codes and dimension/value codes are unique within the active company scope.
35 +6. Subsidiary accounts require a GL parent; detail accounts require a subsidiary parent.
36 +7. Only detail accounts are posting-enabled in the Phase 2 three-level model.
37 +8. Fiscal years cannot overlap.
38 +9. Existing Finora operational documents are not rewritten by Phase 2.
39 +10. Legacy project migration copies into the global project master while preserving historical IDs.
40 +
41 +## Production database
42 +Supabase project: hcsixhqbyuhpshfwqpjx
43 +
44 +The records collection constraint already permits:
45 +- fiscalYears
46 +- accounts
47 +- dimensionTypes
48 +- dimensionValues
49 +- accountDimensionRules
50 +- branches
51 +- projects
52 +- projectLinks
53 +
54 +RLS remains enabled on records. No destructive schema/data migration was required for existing financial records.
55 +
56 +At final verification, production contained zero Phase 2 master records, so no pre-existing Phase 2 user data required conversion.
57 +
58 +## Release gates
59 +- JavaScript syntax gate: required
60 +- repository application invariants: required
61 +- GitHub Pages deployment: required
62 +- CodeQL security workflow: required
63 +- Supabase security/performance advisors reviewed
64 +
65 +Known platform-level security notices remain the previously documented intentional SECURITY DEFINER RPC exposure to authenticated users with internal authorization checks, plus Supabase Auth leaked-password protection being disabled. Neither was introduced by Phase 2.
66 +
67 +## Boundary
68 +Phase 2 does not create journal vouchers or double-entry postings. Those belong to Phase 3. This prevents partially implemented ledger behavior from being presented as operational accounting.