سامانه صدور فاکتور و حسابداری
qa/wave0-negative-gate-proof
Finora / Factor-easy — Durable Handoff
Date: 2026-09-29 Repository: davoodmehraban89/Factor-easy Canonical branch: main Verified head at handoff: 8761d21189d9c4058c3019ea6e42d4103fc83556 Working product name: Finora Current public release identity: Finora 1.0
Source-of-truth rule
A successor must verify GitHub and Supabase before changing anything. This file is a recovery map, not a substitute for remote evidence.
Master six-phase roadmap
- UX/product architecture redesign and scalable navigation shell.
- Master Data + Accounting Core foundation: chart, fiscal years, branches, global projects, generic hierarchical analytic dimensions, templates.
- Double-entry operational accounting: journal engine, automatic postings, ledgers/trial balance, source immutability.
- Projects, contracts, deductions, guarantees and contractor accounting.
- Complementary ERP + integrations: inventory, costing, fixed assets, multi-currency/cost centers, import/backup/permissions/settings redesign.
- Reports, control, migration and final release: professional accounting statements/reports, reconciliation/cutover of Finora 1.0 history, QA/security/performance/audit/backup/rollback/release.
The older docs/ACCOUNTING_CORE_ROADMAP_V1.md contains historical labels “Phase 5..8”. Do not treat those numbers as the current master phase numbering. Preserve its accounting decisions, but follow the six-phase roadmap above.
Verified completion state
Phase 1 — COMPLETED
Verification: docs/PHASE_1_REDESIGN_VERIFICATION.md Acceptance commit: c51e49a3f7863886e8a997858d6f2c44165eb5de
Delivered: - compact RTL module rail - contextual second-level panel - collapsible desktop navigation with persisted preference - command/menu search and Ctrl/Cmd+K - topbar company/fiscal context and quick action - canonical view-to-module mapping - responsive/mobile compatibility - print isolation - existing operational capabilities retained
Phase 2 — COMPLETED
Verification: docs/PHASE_2_REDESIGN_VERIFICATION.md Acceptance commit: 39702975a08ded8997787858383e20dab7d9afa9 Acceptance CI: Quality success 36438531727; Security success 36438531722; Pages success 36438530674.
Delivered: - three fixed account levels: GL/کل, Subsidiary/معین, Detail/تفصیلی - generic user-defined analytic dimensions - configurable hierarchy depth 1..8 - leaf/terminal-only posting semantics - depth locked after values exist - safe delete/reference guards - account-dimension required/optional/unavailable rules - entity-backed contacts/projects/branches - fiscal years and locks - branch master - global projects and legacy contact-project migration - company activity types and optional starter templates - sync/backup/Supabase collection support
Critical dimension invariant: A dimension’s hierarchy depth is explicitly configured. Once values exist, depth cannot be changed directly. Used financial identities are not destructively deleted; they are deactivated/versioned/migrated. Group nodes are non-postable when leaf-only is enabled. Storage is normalized and not limited to floating1..floating4.
Phase 3 — COMPLETED
Verification: docs/PHASE_3_REDESIGN_VERIFICATION.md Final evidence commit: 8761d21189d9c4058c3019ea6e42d4103fc83556 Final head CI: Quality success 36443016075; Security success 36443016203; Pages success 36443015338. Implementation head documented in Phase 3 verification: b0f3e2587c6cc04beaf579505cb975a939459d6e.
Delivered: - journal vouchers/lines and normalized line dimensions - draft -> posted -> reversed lifecycle - balanced debit/credit validation - posting-account and analytic-dimension validation - fiscal-year resolution/lock - sequential voucher numbering - source event/version uniqueness - immutable posted vouchers; reversal instead of destructive edit - manual journal UI with dynamic dimensions - journal register and trial balance - automatic posting profiles for sale, purchase, receipt, payment, expense and other income - cash/credit aware sales/purchases - VAT split behavior - source-to-voucher adapter - sync/backup persistence - source-document immutability when linked to posted vouchers - protection of used accounting masters/rules from destructive mutation
Important correction: Earlier chat messages said Phase 3 was incomplete while execution was still catching up. GitHub remote evidence later closed and verified Phase 3. Current verified truth is Phase 3 COMPLETED.
Production Supabase
Project ref: hcsixhqbyuhpshfwqpjx Public tables: profiles, licenses, records; RLS enabled. At handoff: profiles 4 rows, licenses 4 rows, records 84 rows.
Relevant migrations: - 20260928141512 allow_accounting_foundation_collections - 20260928145306 allow_phase3_double_entry_collections
Phase 3 allowed collections: - postingProfiles - journalVouchers - journalLines - journalLineDimensions
At final Phase 3 verification there were no Phase 3 journal rows requiring conversion/backfill. Historical Finora 1.0 accounting cutover was intentionally deferred.
Security advisor at handoff: - five WARN findings for authenticated-callable SECURITY DEFINER functions: admin_cancel_license, admin_extend_license, admin_set_license, has_active_license, is_admin. These are known and were previously reviewed as intentional with internal authorization/RLS dependencies; do not blindly revoke authenticated execute. - leaked password protection disabled in Supabase Auth; still an external/manual hardening item. Performance advisor: no findings.
Existing operational capabilities that must not regress
Sales invoices, purchase invoices, contacts/counterparties, products/services, receipts/payments with partial settlement, cheques, expenses/income, companies, global projects, reporting, formal/nonformal printing, Excel import, backup/cloud sync, admin/license controls, dashboard/drilldowns.
Phase 4 — NEXT WORK
Phase 4 is the next master phase. Scope: - first-class contracts - contract amendments/status/lifecycle - employer/contractor/subcontractor relationships - contract/project links - deduction masters and schedules: retention, insurance, withholding tax, advance recovery, penalties, configurable other deductions - guarantees: type, issuer/beneficiary, bank/institution, number, amount, issue/expiry, collateral, extension/release history - optional memorandum/off-balance posting profiles for guarantees - project/contract profitability and deduction/guarantee reporting - source-to-voucher traceability for all new operations - permissions, audit, reversal, sync/backup, migration, tests
Phase 4 acceptance must require master data + transaction lifecycle + posting + reversal + permissions + audit + reports + migration + tests + reconciliation. Forms alone do not complete a module.
Phase 5 — AFTER PHASE 4
Complementary ERP/integration: - inventory/warehouse and costing - standard item/service master refinement - fixed assets - multi-currency - cost centers/advanced analytics - Excel/import center - backup/restore - company settings/permissions redesign - integration/API architecture
Phase 6 — FINAL
- journal/GL/subsidiary/detail/analytic ledgers
- trial balance variants
- P&L, financial position, cash flow
- AR/AP aging
- project/contract reports
- historical Finora 1.0 reconciliation and controlled cutover
- QA/security/performance
- audit/backup/rollback
- production release
Accounting architecture decisions that are not to be casually reversed
- posted journal lines become accounting truth; operational documents remain source documents
- posted vouchers are immutable; corrections use reversal/amendment
- counterparties/projects/branches/contracts are global masters, not cloned into account trees
- do not create one ledger account per customer/supplier
- analytic dimensions are generic normalized assignments, not fixed four columns
- account determines which dimensions are required/optional/unavailable
- group/non-leaf analytic nodes are not postable when leaf-only rules apply
- historical identity/meaning must survive structural changes
- templates are optional/editable setup accelerators, not hard-coded accounting rules
- bank design supports stable ledger account + Bank Account master/dimension as scalable default
- no destructive historical migration without preview/reconciliation/rollback
Known verification boundary
The execution environment used for these phases did not provide an authenticated interactive browser/device walkthrough. Do not claim browser E2E or physical-printer validation unless actually performed. CI, source verification, Supabase checks and Pages deployment were used as release evidence.
Successor startup procedure
- Connect official GitHub and Supabase tools.
- Verify repository main head and read this file.
- Read docs/PHASE_1_REDESIGN_VERIFICATION.md, docs/PHASE_2_REDESIGN_VERIFICATION.md, docs/PHASE_3_REDESIGN_VERIFICATION.md, docs/ACCOUNTING_CORE_ROADMAP_V1.md, docs/RD_IRAN_ACCOUNTING_ERP_2026-09-28.md.
- Verify latest Quality/Security/Pages results.
- Verify Supabase migrations/RLS/advisors.
- Do not redo Phases 1–3 unless a regression is found.
- Start Phase 4 from the current remote state.
- Work continuously: inspect -> implement -> test -> fix -> retest -> commit/push -> verify -> continue.
- Never report a phase complete until its acceptance criteria and release gates are actually verified.