سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 4, 00:30 UTC
Make PROJECT_STATE the single canonical continuity source
davoodmehraban89 committed
Sep 29, 2026 at 09:39 UTC
9c8b0d59e467749886b9defae118ca4d38c48547
1 file changed
+9
-341
docs/PROJECT_CONTINUITY.md
+9
-341
@@ -1,349 +1,17 @@
1
-# FINORA — PROJECT CONTINUITY & AUTONOMOUS EXECUTION CONTROL FILE
1
+# PROJECT CONTINUITY POINTER
2
3
-> **Canonical continuity file. Read this before doing any work on this repository.**
4
->
5
-> Repository: `davoodmehraban89/Factor-easy`
6
->
7
-> Product working name: **Finora**
8
->
9
-> Production data: existing Supabase production project/data must be preserved. Never create a replacement production database merely for redesign/rebranding.
10
->
11
-> This file is the single handoff/checkpoint source for ChatGPT, Codex, Claude Code, Gemini, Grok, or any other capable implementation agent.
3
+The canonical, mandatory, continuously updated project state for Finora is:
4
13
-## 1. Operating mandate
5
+**`/PROJECT_STATE.md`**
6
15
-Act as the **implementation owner and coordinating project manager**, not as a passive adviser. Inspect the real repository state before making claims. Make ordinary, reversible, in-scope engineering decisions autonomously. Continue implementation in dependency order until the requested phase is genuinely complete or a real external blocker is reached.
7
+All agents/chats/developers must read `PROJECT_STATE.md` first and treat it as the single source of continuity truth. Do not maintain a competing roadmap/status in this file.
8
17
-This is financial/accounting software. Treat correctness like safety-critical business software: a silent wrong balance, duplicated posting, destructive history edit, broken migration, unauthorized access, or false reconciliation is a release-blocking defect. Prefer rejection of an invalid financial state over silently accepting it.
9
+Canonical approved UI reference:
10
19
-Never claim a test, deployment, database migration, browser check, integration, commit, push, or multi-agent execution happened unless it actually happened.
11
+**`/docs/reference/finora-ui-target-v1.jpg`**
12
21
-Do not stop at planning, explanation, one task, one file, or one milestone. Normal loop:
13
+Repository:
14
23
-`INSPECT → IMPLEMENT → VERIFY → FIX → RE-VERIFY → COMMIT → UPDATE THIS FILE → CONTINUE`
15
+**`davoodmehraban89/Factor-easy`**, branch **`main`**
16
25
-When a user introduces a new requirement, **first update the Current Requirements / Roadmap / Decision Log in this file**, then implement it. At every stable checkpoint and before ending a work session, update this file with the exact current state so another agent can resume without chat history.
26
-
27
-## 2. Coordinated specialist workstreams
28
-
29
-The coordinating manager owns final integration. Use these five specialist workstreams when the runtime supports real delegation; otherwise execute them as disciplined internal workstreams and **do not falsely claim independent agents**.
30
-
31
-1. **Architecture & Accounting Requirements** — accounting model, invariants, data contracts, migration design, scope control.
32
-2. **Implementation & Integration** — frontend, data layer, Supabase integration, accounting engine, source-document integration.
33
-3. **UX/UI & Product Design** — information architecture, RTL usability, responsive shell, forms, discoverability, accessibility.
34
-4. **QA & Financial Verification** — independent regression checks, accounting invariants, reconciliation, migration fixtures, failure reproduction.
35
-5. **Security, Data Integrity & Release** — RLS/authorization, auditability, locks, backup/rollback, CI/security/deployment evidence.
36
-
37
-Every task has one primary owner. Cross-workstream findings are handed to the owning workstream and re-verified after correction.
38
-
39
-## 3. User communication rule
40
-
41
-The user frequently requests autonomous execution with no progress chatter. When that instruction is active, do not send interim prose. Execute, verify, and only report after the requested scope is complete or a genuine blocker requires user action.
42
-
43
-## 4. Product baseline and verified history
44
-
45
-### Finora 1.0 legacy baseline
46
-Before the current ERP redesign, the repository already contained working financial-management capabilities including sales, purchases, contacts, products/services, cheques, expenses/income, receipts/payments, companies, projects/subprojects, reports, printing, cloud sync/backup, authentication/admin and production Supabase integration.
47
-
48
-Earlier four-phase stabilization/release work was completed before the new six-phase ERP redesign began. Do not confuse that old phase numbering with the **current six-phase master roadmap** below.
49
-
50
-### Current redesign Phase 1 — COMPLETED
51
-Verification file: `docs/PHASE_1_REDESIGN_VERIFICATION.md`
52
-
53
-Implemented and accepted:
54
-- compact RTL primary module rail
55
-- contextual second-level panel
56
-- collapsible desktop navigation
57
-- global command/menu search
58
-- top bar context
59
-- responsive/mobile preservation
60
-- existing operational views mapped into the new shell without fake future modules
61
-- print isolation and quality-gate coverage
62
-
63
-Acceptance commit recorded in repository history: `c51e49a3f7863886e8a997858d6f2c44165eb5de`.
64
-
65
-### Current redesign Phase 2 — STATUS MUST BE RE-VERIFIED
66
-Chat execution was interrupted and later phase requests overlapped. Do **not** infer completion from conversation. Inspect repository commits, schema, docs and tests. If Phase 2 is incomplete, resume it before Phase 3 unless the current repository proves its acceptance criteria are satisfied.
67
-
68
-### Current redesign Phase 3 — NOT VERIFIED COMPLETE
69
-The prior chat explicitly determined Phase 3 had **not** reached the full implementation → test → fix → retest → final acceptance cycle. Resume from repository reality, not from optimistic chat claims.
70
-
71
-## 5. Current six-phase master roadmap
72
-
73
-This roadmap supersedes earlier “Phase 5–8” numbering in old planning documents. Existing useful work must be absorbed into this unified product; do not create a disconnected legacy/new product split.
74
-
75
-### Phase 1 — Product shell, UX and information architecture
76
-Status: **COMPLETED / verified**.
77
-
78
-Goal: scalable Finora shell, dashboard/navigation hierarchy, top bar/search/responsiveness, and migration of existing operational features into one coherent IA without losing functionality.
79
-
80
-### Phase 2 — Master Data + Accounting Core foundation
81
-Status: **RE-VERIFY AND COMPLETE IF NEEDED**.
82
-
83
-Required scope:
84
-- three fixed account levels: General Ledger / کل, Subsidiary / معین, Detail / تفصیلی
85
-- fiscal years/period concepts
86
-- branches
87
-- counterparties as reusable master identities
88
-- global projects (not contact-owned project trees)
89
-- generic analytic/floating dimensions
90
-- account ↔ dimension applicability rules
91
-- company-type setup templates
92
-- safe migration/mapping from legacy structures
93
-- sync/backup/Supabase support and RLS/integrity controls
94
-
95
-### Phase 3 — Double-entry financial operations
96
-Status: **INCOMPLETE UNTIL VERIFIED**.
97
-
98
-Redesign existing source documents onto a real double-entry accounting engine:
99
-- journal vouchers + journal lines
100
-- balanced debit/credit validation
101
-- voucher lifecycle: draft → validated → posted → reversed
102
-- immutable posted vouchers; corrections via reversal/amendment
103
-- posting profiles
104
-- automatic posting for sales, purchases, expense/income, receipt/payment and relevant cheque/treasury events
105
-- treasury masters for bank/cash/POS/petty cash as needed
106
-- AR/AP settlement and source ↔ voucher traceability
107
-- fiscal/period locks
108
-- manual journal entry
109
-- source-to-ledger and ledger-to-source drill-through
110
-- reconciliation proving legacy operational balances and accounting balances agree
111
-
112
-A form alone is not completion. Posting, reversal, permissions, audit, reports/reconciliation, migration and tests must all work.
113
-
114
-### Phase 4 — Projects, contracts, deductions and guarantees
115
-- global projects
116
-- contracts/pacts and amendments
117
-- statements/progress billing where applicable
118
-- subcontractors
119
-- retention, insurance, withholding tax, advances, penalties
120
-- guarantees lifecycle
121
-- appropriate memo/off-balance posting profiles
122
-- project/contract profitability and traceability
123
-
124
-### Phase 5 — Complementary ERP and integrations
125
-- standard product/service master
126
-- inventory and costing
127
-- fixed assets
128
-- multi-currency
129
-- cost centers
130
-- Excel/import migration center
131
-- backup/restore
132
-- professional printing
133
-- company settings and permissions redesign
134
-- integrations/API boundaries
135
-- Iran compliance adapters kept versioned/separate from the generic ledger
136
-
137
-### Phase 6 — Reports, control, migration and final Finora release
138
-- journal/general/subsidiary/detail/analytic ledgers
139
-- trial balance
140
-- profit & loss
141
-- financial position
142
-- cash flow
143
-- AR/AP aging
144
-- project/contract reporting
145
-- close/lock/opening controls
146
-- full Finora 1.0 reconciliation/migration
147
-- QA, security, performance, audit, backup, rollback and production release
148
-- all automated quality/security/deployment gates passing
149
-
150
-Possible later ERP expansion after the six phases: payroll, production/BOM, industrial costing, budgeting, CRM, procurement, distribution, BI/intelligent assistants.
151
-
152
-## 6. Non-negotiable accounting architecture
153
-
154
-### Account structure
155
-Three fixed account levels:
156
-1. کل
157
-2. معین
158
-3. تفصیلی
159
-
160
-Posting is only to valid posting accounts. Parent/group accounts never receive direct postings.
161
-
162
-### Generic analytic dimensions — NOT four hard-coded columns
163
-Do **not** implement storage as `floating1..floating4`. The system may offer four convenient UI slots initially, but storage must be normalized, conceptually:
164
-
165
-`journalLineDimension(lineId, dimensionId, dimensionValueId)`
166
-
167
-A posting account may require zero, one, or many dimensions.
168
-
169
-### Hierarchy depth
170
-Each dimension definition has an explicit **Hierarchy Depth / عمق ساختار**.
171
-
172
-Example depth 1:
173
-`کارکنان ← علی رضایی`
174
-
175
-Example depth 2:
176
-`کارکنان ← واحد مالی ← علی رضایی`
177
-
178
-Intermediate/group nodes are non-postable. Posting selects terminal leaf nodes when leaf-only posting is enabled.
179
-
180
-Hard rules:
181
-- after values/children exist, depth cannot be casually changed
182
-- changing structural depth requires removal/migration of lower values first
183
-- physical deletion is forbidden if any journal, mapping, rule, master, source document or history references a value
184
-- referenced values become inactive/closed instead
185
-- after posted activity, structural changes are versioned/effective-dated or handled through controlled migration
186
-- historical posted lines retain their original identity/meaning
187
-- required dimensions must exist and be valid before posting
188
-
189
-### Entity-backed dimensions
190
-Do not duplicate business identities merely to satisfy accounting:
191
-- Counterparty ← Contacts
192
-- Project ← Projects
193
-- Branch ← Branches
194
-- Employee ← Employees
195
-- Bank Account ← Bank Account master
196
-- Contract ← Contracts
197
-
198
-### Account-dimension rule
199
-For each account + dimension:
200
-- required
201
-- optional
202
-- unavailable
203
-
204
-Only relevant dimensions appear when posting to that account.
205
-
206
-### Company templates
207
-Optional onboarding templates, editable after installation:
208
-- Trading / بازرگانی
209
-- Service / خدماتی
210
-- Manufacturing / تولیدی
211
-- Contracting / پیمانکاری
212
-- Retail / فروشگاهی
213
-- Distribution / پخش
214
-- Nonprofit / غیرانتفاعی
215
-- Professional services / خدمات حرفهای
216
-- Holding/multi-company later
217
-
218
-User may choose recommended template or start empty. Templates seed configuration; they are not hard-coded business logic.
219
-
220
-### Bank design
221
-Support traditional chart-based bank detail when desired, but scalable default is a stable ledger account plus a Bank Account master/dimension used consistently by treasury, reconciliation, payments and accounting.
222
-
223
-## 7. Financial safety invariants
224
-
225
-At minimum:
226
-- every posted voucher is balanced
227
-- no negative/zero-invalid posting semantics are silently normalized
228
-- no posting to inactive/non-posting account
229
-- required analytic assignments enforced
230
-- dimension values valid for company/account/effective period
231
-- posted vouchers immutable
232
-- reversal/amendment preserves audit history
233
-- locked fiscal periods reject mutation
234
-- source posting is idempotent: retry cannot duplicate the accounting event
235
-- each source posting event has at most one active posted voucher
236
-- migrations are atomic where possible and produce reconciliation evidence
237
-- production changes require backup/rollback strategy
238
-- ownership/company scope and RLS/authorization enforced server-side
239
-- never rely on UI-only validation for critical financial integrity
240
-- no destructive deletion of referenced financial masters/history
241
-
242
-## 8. Current production/integration facts
243
-
244
-Repository: `davoodmehraban89/Factor-easy`, default branch `main`.
245
-
246
-Production Supabase project previously used by this product: `hcsixhqbyuhpshfwqpjx`. Before any database change, verify this is still the connected production project.
247
-
248
-Current custom domain in repository baseline: `factoreasy.ir`.
249
-
250
-Working product name remains **Finora**. A later rebrand is allowed, but do not rename repository/domain/Supabase or create a replacement database merely to change branding. Rebranding must be a controlled migration preserving production data and integrations.
251
-
252
-Known operational/security residuals from the prior release that must not be falsely reported as fixed:
253
-- Supabase Leaked Password Protection required dashboard-level attention unless subsequently verified
254
-- intentional SECURITY DEFINER helper/RPC warnings must be reviewed by behavior, not blindly “fixed”
255
-- no claim of physical printer validation without actually testing it
256
-- no claim of authenticated browser E2E unless actually performed
257
-- Taxpayer System API was not live in the 1.0 baseline
258
-- PWA offline support was not part of 1.0 baseline
259
-
260
-## 9. Approved UX visual target
261
-
262
-The canonical visual reference for the redesign is stored at:
263
-
264
-**`docs/reference/finora-approved-accounting-dashboard-16x9.jpg`**
265
-
266
-This image is a **design target/reference**, not proof that every displayed future accounting feature is already implemented.
267
-
268
-When asked “what should the Finora environment look like?” or when implementing the shell/dashboard, inspect this exact image first. Do not substitute a random ERP screenshot or invent a conflicting navigation system.
269
-
270
-Visual principles encoded by the reference:
271
-- RTL enterprise accounting workspace
272
-- narrow primary module rail on the far right
273
-- contextual second-level navigation beside it
274
-- top bar with global search, fiscal year, active company and quick action
275
-- dense but calm financial dashboard
276
-- compact professional icons, not oversized decorative UI
277
-- white/light neutral surfaces, restrained accent colors
278
-- high information density without visual clutter
279
-- clear drill-down paths and quick access
280
-- desktop-first accounting efficiency with responsive behavior
281
-
282
-## 10. Existing project research/docs to read
283
-
284
-Before architectural/accounting changes, inspect:
285
-- `docs/ACCOUNTING_CORE_ROADMAP_V1.md`
286
-- `docs/RD_IRAN_ACCOUNTING_ERP_2026-09-28.md`
287
-- `docs/PHASE_1_REDESIGN_VERIFICATION.md`
288
-- this file
289
-
290
-Important: older roadmap docs contain superseded numbering and an early “four floating details” formulation. **This continuity file contains the latest decisions**: normalized unlimited analytic dimensions and the six-phase master roadmap.
291
-
292
-## 11. Required checkpoint protocol
293
-
294
-At the beginning of every session:
295
-1. Read this file completely.
296
-2. Inspect current `main`, recent commits, relevant source, migrations and CI state.
297
-3. Reconcile repository reality with the status recorded here.
298
-4. If reality differs, update this file before continuing.
299
-
300
-Whenever the user changes scope:
301
-1. Add/update the requirement here.
302
-2. Record any architecture decision affected.
303
-3. Implement.
304
-4. Test.
305
-5. Update Current Execution Checkpoint below.
306
-
307
-At every stable checkpoint/end:
308
-- exact phase/status
309
-- work completed
310
-- files/schema changed
311
-- migrations applied
312
-- tests/checks run and their actual result
313
-- latest relevant commit SHA
314
-- unresolved defects/blockers
315
-- next executable task
316
-- any user decision still required
317
-
318
-Never mark a phase COMPLETE merely because code was written. Completion requires its acceptance criteria and verification evidence.
319
-
320
-## 12. Current execution checkpoint
321
-
322
-**Checkpoint date:** 2026-09-29
323
-
324
-**Last trusted redesign milestone:** Phase 1 accepted and verified.
325
-
326
-**Phase 2:** must be re-audited against the six-phase scope before claiming completion.
327
-
328
-**Phase 3:** not verified complete. Previous chat execution was interrupted while attempting to inspect/continue the double-entry redesign. Resume only after confirming Phase 2 prerequisites.
329
-
330
-**Immediate next action for a new agent:**
331
-- inspect current `main` and recent commits after the Phase 1 acceptance commit
332
-- inspect Supabase migrations/schema
333
-- map actual implemented Phase 2 artifacts against Section 5 acceptance scope
334
-- complete/verify Phase 2 if necessary
335
-- then execute Phase 3 continuously through implementation, tests, fixes, reconciliation, security/deployment gates
336
-- update this file after each stable checkpoint
337
-
338
-## 13. Decision log
339
-
340
-- Finora remains the working name; Nivaro was rejected due to naming collision concerns.
341
-- The product is evolving from simple invoice/financial management into a true accounting/ERP system.
342
-- Current features are to be redesigned/absorbed into one unified architecture, not kept as a separate legacy generation.
343
-- Global projects replace per-contact project ownership.
344
-- Counterparties are one identity reused across AR/AP through dimensions/posting profiles.
345
-- Analytic dimensions are generic, hierarchical, configurable and normalized; not limited to four storage slots.
346
-- Dimension hierarchy depth is explicit and structurally protected after use.
347
-- Posted accounting history is immutable; corrections are reversal/amendment.
348
-- The approved dashboard image in `docs/reference/` is the canonical visual reference.
349
-- This file is the canonical cross-chat/cross-agent continuity mechanism and must stay current.
17
+If this pointer conflicts with `PROJECT_STATE.md`, `PROJECT_STATE.md` wins after verification against live GitHub/Supabase evidence.