سامانه صدور فاکتور و حسابداری
Consolidate continuity on root project state
davoodmehraban89 committed
Sep 29, 2026 at 10:04 UTC
897b7ad581455328d49020628e38232b368fbe9b
1 file changed
+7
-247
docs/FINORA_MASTER_CONTINUITY.md
+7
-247
@@ -1,250 +1,10 @@
1
-# FINORA — MASTER CONTINUITY & AUTONOMOUS EXECUTION FILE
2
-Version: 1.0-continuity
3
-Repository: davoodmehraban89/Factor-easy
4
-Default branch: main
5
-Production domain: factoreasy.ir
6
-Working product name: Finora
7
-Current public release identity: Finora 1.0
8
-Supabase production project ref: hcsixhqbyuhpshfwqpjx
1
+# Finora continuity pointer
2
10
-> THIS FILE IS THE SINGLE SOURCE OF TRUTH FOR CONTINUING THE PROJECT ACROSS CHATS, MODELS AND CODING AGENTS.
11
-> Every agent MUST read this file before making project decisions and MUST update it after every confirmed work batch, changed requirement, completed milestone, migration, release, blocker, or architectural decision.
3
+This historical filename is retained so older references still find the project state.
4
13
-## 0. Mandatory startup protocol
5
+Canonical current state: `/PROJECT_STATE.md`
6
+Repository guidance: `/AGENTS.md`
7
+Portable entry prompt: `/AI_BOOTSTRAP.md`
8
+Approved UI reference: `/docs/reference/finora-ui-target-v1.jpg`
9
15
-When given the bootstrap instruction for this repository:
16
-
17
-1. Open this repository and read this file completely.
18
-2. Inspect the ACTUAL current repository state, latest commits, workflows, migrations and relevant production configuration. Never trust this file over contradictory live evidence; reconcile and update this file if drift exists.
19
-3. Read the roadmap and verification documents referenced below.
20
-4. Resume from the latest VERIFIED checkpoint. Do not redo completed work.
21
-5. Before implementing a new user-requested change, record the new requirement in this file under Change Log / Current Queue so it survives interruption.
22
-6. Execute continuously: INSPECT → IMPLEMENT → TEST → FIX → RETEST → VERIFY → COMMIT/PUSH → UPDATE THIS FILE → CONTINUE.
23
-7. Never mark a phase complete until its acceptance criteria and automated gates are verified.
24
-8. After every confirmed work batch, update this file with exact status, important decisions, commit SHA(s), migrations, test results, unresolved risks and next executable item.
25
-
26
-## 1. Authority and operating mode
27
-
28
-Act as the autonomous implementation owner and coordinated project manager for Finora within the authority delegated by the repository owner.
29
-
30
-You are NOT merely an adviser. For reversible, in-scope repository work, make normal engineering decisions and execute them without repeatedly asking for approval. Do not impersonate the human owner in legal, financial, public, contractual, destructive or access-sensitive actions. Those require explicit authorization when needed.
31
-
32
-This is financial/accounting software. Treat correctness as safety-critical business logic: a silent wrong balance, journal, settlement, migration or report is worse than rejecting an operation. Prefer fail-safe behavior, atomic transactions, explicit invariants, immutable posted history, auditability, controlled migration and reconciliation.
33
-
34
-Engineering quality target: mission-critical professional software. Do not optimize for demos. Do not expose fake future screens as completed features. Do not fabricate tests, browser verification, production state, integrations or agent execution.
35
-
36
-## 2. Coordinated specialist workstreams
37
-
38
-The coordinating manager owns integration, dependencies and final acceptance. Use five specialist workstreams when the environment supports them; otherwise execute these roles sequentially and DO NOT claim independent agents existed.
39
-
40
-1. Architecture & Requirements — product boundaries, accounting invariants, data contracts, migration design, acceptance criteria.
41
-2. Implementation — frontend, domain logic, persistence, integrations and migrations.
42
-3. UX/UI — RTL information architecture, interaction design, responsive behavior, accessibility, visual consistency.
43
-4. QA & Verification — independent regression, financial invariants, migration/reconciliation tests, failure reproduction, release gates.
44
-5. Security & Release — RLS/auth, permissions, audit, dependency/code scanning, production deployment, rollback and operational documentation.
45
-
46
-Each task has exactly one primary owner. Workstreams may review each other but must not make conflicting concurrent edits to shared files.
47
-
48
-## 3. Product direction
49
-
50
-Finora is evolving from invoice/financial-management software into a unified accounting/ERP platform. Existing features are not a separate legacy product. Every current capability must be reviewed, redesigned where necessary, aligned to the accounting core, migrated without data loss and retested.
51
-
52
-Working name remains Finora until a later controlled rebrand. Do not rename repository, production domain, Supabase project or integrations merely for branding without an approved rebrand migration.
53
-
54
-## 4. Approved UX reference — DO NOT DRIFT
55
-
56
-The approved target is the RTL enterprise shell shown by the owner in the Phase-1 reference screenshot:
57
-- compact fixed module rail on the far right;
58
-- contextual second-level menu panel beside it;
59
-- top bar for global search, active company, fiscal year, quick action, notification/user context;
60
-- accounting dashboard with clean white cards, restrained teal/blue accents, compact icons, generous content area;
61
-- submenu can collapse so forms/reports gain width;
62
-- desktop uses compact iconography and strong first-glance findability;
63
-- mobile preserves practical navigation rather than reproducing desktop panels.
64
-
65
-Canonical screenshot target path:
66
-`docs/reference/FINORA_PHASE1_APPROVED_UI.webp`
67
-
68
-If that binary asset is unavailable in the execution environment, DO NOT invent a different design. Use this section plus the Phase-1 implementation as the design source and flag the missing binary asset in this file. The screenshot supplied by the owner is 1536×864 (16:9). Its visual content is the exact approved Finora accounting-dashboard reference.
69
-
70
-## 5. Master six-phase roadmap
71
-
72
-### Phase 1 — Product/UX architecture redesign
73
-Approved shell, dashboard/navigation architecture, two-layer navigation, top bar, global command search, responsive behavior; migrate current working features into the new information architecture without loss.
74
-
75
-STATUS: COMPLETED and verified.
76
-Acceptance commit: c51e49a3f7863886e8a997858d6f2c44165eb5de
77
-Evidence: docs/PHASE_1_REDESIGN_VERIFICATION.md
78
-Verified gates on acceptance commit: Quality SUCCESS; GitHub Pages SUCCESS; Security/CodeQL SUCCESS.
79
-Important boundary: no authenticated interactive browser/device walkthrough was available in that execution environment, so it was not claimed.
80
-
81
-### Phase 2 — Master Data + Accounting Core redesign
82
-Build real accounting foundations: GL / Subsidiary / Detail chart, fiscal years, branches, counterparties, products/services, global projects and normalized analytical dimensions. Migrate contact-owned legacy project concepts safely.
83
-
84
-STATUS: NOT VERIFIED COMPLETE.
85
-Do not skip this phase because later phase requests were issued. Inspect current repository and finish all acceptance criteria before declaring complete.
86
-
87
-### Phase 3 — Double-entry financial operations
88
-Redesign sales/formal/nonformal invoices, purchases, expenses/income, receipts/payments and cheques onto the posting engine; journals, ledger lines, treasury, bank/cash/POS/petty cash, reconciliation and AR/AP.
89
-
90
-STATUS: NOT COMPLETE / NOT VERIFIED.
91
-Prior attempts to start/continue Phase 3 were interrupted before a complete implement→test→fix→retest→verify cycle. Never report Phase 3 complete without repository and production evidence.
92
-
93
-### Phase 4 — Projects, contracts, deductions, guarantees
94
-Global projects, contracts/pacts, statements, subcontractors, retention, insurance, tax, advances, penalties, guarantees and appropriate memo/off-balance treatment.
95
-
96
-STATUS: PLANNED.
97
-
98
-### Phase 5 — Complementary ERP + integration
99
-Standard item/service master, inventory, costing, fixed assets, multi-currency, cost centers; redesign Excel import, backup, print, company settings and permissions around the unified core.
100
-
101
-STATUS: PLANNED.
102
-
103
-### Phase 6 — Reports, control, migration, final release
104
-Journal/GL/subsidiary/detail/analytic ledgers, trial balance, P&L, financial position, cash flow, aging, project/contract reporting; reconcile/migrate Finora 1.0; QA/security/performance/audit/backup/rollback/release.
105
-
106
-STATUS: PLANNED.
107
-
108
-Future expansion after these six phases may include payroll, production/BOM, industrial costing, budget, CRM, procurement, distribution, BI and intelligent capabilities.
109
-
110
-## 6. Accounting-core non-negotiable rules
111
-
112
-Chart of Accounts has three fixed accounting levels: General Ledger (کل), Subsidiary (معین), Detail (تفصیلی).
113
-
114
-Analytical/floating dimensions MUST NOT be stored as fixed floating1..floating4 fields. Use normalized line assignments such as journalLineDimension(lineId, dimensionId, dimensionValueId), allowing zero/one/many dimensions per line.
115
-
116
-A dimension has explicit Hierarchy Depth. Example depth 1: کارکنان ← علی رضایی. Example depth 2: کارکنان ← واحد مالی ← علی رضایی. Intermediate/group nodes are non-postable; valid terminal leaf nodes are postable.
117
-
118
-Once child/value data exists, hierarchy depth cannot be directly changed. Structural reduction/change requires first proving dependent values are unused. If any journal, posting, mapping, rule, master data or history references a value, physical deletion is forbidden; deactivate/close or controlled versioned migration only.
119
-
120
-After posted financial activity, structural meaning is immutable historically. Use effective dating/versioning or explicit controlled migration; never silently rewrite posted meaning.
121
-
122
-Each account+dimension relation declares required / optional / unavailable. Selecting an account in journal entry exposes only applicable dimensions and blocks posting when required dimensions are missing.
123
-
124
-Entity-backed dimensions should reuse master identities instead of duplicate data: Contact, Project, Branch, Employee, Bank Account, Contract, etc.
125
-
126
-Counterparty roles map naturally to AR/AP. Projects are global, not owned by a contact.
127
-
128
-Optional company-type onboarding templates may seed recommended chart, posting profiles, dimensions and mappings, but users may start empty and templates are not hard-coded accounting law.
129
-
130
-Initial template families: Trading, Service, Manufacturing, Contracting, Retail, Distribution, Nonprofit, Professional Services; multi-company/holding later.
131
-
132
-Recommended scalable bank model: stable ledger account + Bank Account master/dimension for treasury/reconciliation, while still supporting traditional chart-oriented structures when needed.
133
-
134
-Financial posting controls belong at database/API/transaction boundaries, not only UI. Posted vouchers require immutable history with reversal/amendment, period locks, audit trail and reconciliation.
135
-
136
-## 7. Existing production architecture and verified legacy capabilities
137
-
138
-Repository: davoodmehraban89/Factor-easy
139
-Production Supabase: hcsixhqbyuhpshfwqpjx
140
-Public records table uses owner_id, collection, id, data jsonb, updated_at with RLS.
141
-Known collections include companies, contacts, products, invoices, cheques, expenses, settings, purchases, payments.
142
-
143
-Existing v1.0 capabilities include sales/purchases, contacts/products, expenses/income, cheque lifecycle, payment allocations, companies, projects/subprojects, financial reporting, print, cloud sync/backup and admin/license flows.
144
-
145
-Payment allocation is the current source of receivable/payable settlement. Cheques are lifecycle/status records and must not independently reduce balances without an explicit accounting design, to avoid double counting.
146
-
147
-Known residual/operational items from v1.0:
148
-- Supabase Leaked Password Protection was previously observed disabled.
149
-- SECURITY DEFINER advisor warnings exist for admin/license/helper functions; do not blindly revoke authenticated execution because current RLS/admin flows depend on them. Inspect current definitions before changing.
150
-- PWA offline support not implemented.
151
-- Taxpayer System API not live.
152
-- CSP still contains unsafe-inline because of current architecture.
153
-- SMTP production provider remains an operational requirement.
154
-- no previously verified live physical printer test.
155
-- legacy project storage exists inside contacts and must be migrated to global projects.
156
-- current accounting.js is derived accounting/project/inventory logic, not the final double-entry core.
157
-
158
-## 8. Key historical verified milestones
159
-
160
-Original pre-redesign four-phase v1.0 program was completed and released before the new six-phase transformation.
161
-Important v1.0 final/audit/version work included:
162
-- Phase 1/2 acceptance: f31401d3aec77a8fa365f9c2b85c878030618e8e
163
-- Phase 3 verification line: 32a5a76b...
164
-- Phase 4 verification line: 967cb8b...
165
-- Full project audit: 441f32003881aac0b5520412d117a39981efa544
166
-- Final v1.0 cache/version line: 08be8c441fa6cb26c59aec99d2286e60bd76d721
167
-These refer to the OLD v1.0 delivery program, not completion of the NEW six-phase ERP transformation.
168
-
169
-New transformation:
170
-- R&D market research: docs/RD_IRAN_ACCOUNTING_ERP_2026-09-28.md
171
-- Accounting roadmap: docs/ACCOUNTING_CORE_ROADMAP_V1.md
172
-- New Phase 1 redesign acceptance: c51e49a3f7863886e8a997858d6f2c44165eb5de
173
-
174
-## 9. Required documents to read
175
-
176
-Read these when present:
177
-- docs/ACCOUNTING_CORE_ROADMAP_V1.md
178
-- docs/RD_IRAN_ACCOUNTING_ERP_2026-09-28.md
179
-- docs/PHASE_1_REDESIGN_VERIFICATION.md
180
-- docs/FULL_PROJECT_AUDIT_2026-09-28.md
181
-- docs/PRODUCTION_RUNBOOK.md
182
-- docs/COMPLETION_PHASES.md
183
-
184
-Do not assume documents are current without comparing them to live code and migrations.
185
-
186
-## 10. Definition of Done for any phase
187
-
188
-A phase is COMPLETE only when:
189
-- scoped implementation exists in the real repository;
190
-- migrations are applied safely where required;
191
-- old data is preserved/reconciled;
192
-- automated syntax/quality/regression checks pass;
193
-- security implications are reviewed;
194
-- failure cases and accounting invariants are tested;
195
-- relevant deployment succeeds;
196
-- acceptance evidence is written;
197
-- THIS FILE is updated with exact commit/migration/test status;
198
-- no critical unresolved defect in phase scope remains.
199
-
200
-A form or menu alone never completes an accounting module.
201
-
202
-## 11. Continuity/change-control protocol
203
-
204
-This file must remain current.
205
-
206
-When the owner asks for a new feature/change:
207
-1. Record it first in Current Queue / Change Log with date and intended phase.
208
-2. Resolve dependencies and architecture impact.
209
-3. Implement.
210
-4. Verify.
211
-5. Replace the queue item status with VERIFIED or BLOCKED and record evidence.
212
-6. Update roadmap status if scope changed.
213
-
214
-When interrupted, the next agent starts from this file plus actual repo state. Never depend on chat memory as the only project record.
215
-
216
-## 12. Current Queue / next executable work
217
-
218
-Priority 1: reconcile actual repository state after Phase-1 acceptance and any commits made afterward.
219
-Priority 2: complete NEW Phase 2 before Phase 3 can be truthfully closed:
220
-- normalized accounting master-data schema;
221
-- three fixed account levels;
222
-- fiscal-year/period model;
223
-- global projects migration design;
224
-- generic hierarchical analytic dimensions and depth invariants;
225
-- account-dimension applicability;
226
-- company templates;
227
-- migration/reconciliation and regression gates.
228
-Priority 3: then execute NEW Phase 3 posting engine and migrate all financial operations to double entry.
229
-
230
-Do not declare Phase 2 or Phase 3 complete merely because a chat previously requested completion.
231
-
232
-## 13. Change Log
233
-
234
-2026-09-28 — New six-phase ERP transformation roadmap established.
235
-2026-09-28 — Finora retained as working name; Nivaro rejected due brand collision concern. Rebrand deferred.
236
-2026-09-28 — Hybrid RTL shell approved: compact right module rail + contextual submenu + top global bar/search.
237
-2026-09-28 — New Phase 1 redesign completed and accepted at c51e49a3f7863886e8a997858d6f2c44165eb5de with Quality, Pages and Security/CodeQL success.
238
-2026-09-28/29 — Requests to complete new Phase 2/3 were interrupted; no verified completion evidence recorded. Status remains incomplete until proven from repository.
239
-2026-09-29 — Continuity protocol established: this file becomes mandatory cross-chat source of truth and must be updated after every confirmed work batch or requirement change.
240
-2026-09-29 — Owner re-supplied the approved 1536×864 Phase-1 UI reference and required it to remain the canonical visual target.
241
-
242
-## 14. Absolute prohibitions
243
-
244
-- Never fabricate completion, tests, deployments, production state or agent activity.
245
-- Never silently alter posted financial history.
246
-- Never delete referenced financial/master records merely to simplify migration.
247
-- Never create parallel “old” and “new” products as the final architecture.
248
-- Never let UI-only validation substitute for accounting/database invariants.
249
-- Never drift from the approved UX reference without an explicit newer owner decision.
250
-- Never leave this file stale after a confirmed project change.
10
+Do not maintain a second independent roadmap here. If an older document differs from PROJECT_STATE.md, reconcile it against verified GitHub/Supabase evidence and update the canonical state.