سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 20:45 UTC
Record current gap-closure evidence and blockers
davoodmehraban89 committed
Sep 30, 2026 at 07:49 UTC
ab1104ff185295928f366dfad78de61032994be8
1 file changed
+11
-10
PROJECT_STATE.md
+11
-10
@@ -12,22 +12,23 @@ Verify live GitHub+Supabase before acting; record material requests before imple
12
## Current change ledger
13
| Date | Request / decision | Status | Evidence / next action |
14
|---|---|---|---|
15
-| 2026-09-30 | Audit Gmail GitHub `Run failed` notifications, verify/fix any still-live CI defects, and produce a severity-ranked list of remaining gaps needed to make the current Finora stage complete. | **AUDITED / HISTORICAL FAILURES TRIAGED / CI MAINTENANCE APPLIED / GAP REGISTERED** | Gmail failures mapped to intermediate commits: old Real-DOM/request-builder failures were fixed by later browser hardening; Slice-B migration-count invariant was fixed by later archived migrations; Security failures were Dependency Review failing because GitHub Dependency graph is disabled while CodeQL passed. During this audit a CodeQL v4 modernization attempt exposed a repository invariant still pinned to v3 and generated transient main failure emails (`31ef607`, `42d2476`, `7e8e43e`); rather than weaken the gate, CodeQL was restored to supported v3 at `0279c3d`. Quality remains modernized on `checkout@v7` + `setup-node@v7`; security uses `checkout@v7` and CodeQL v3 until the invariant and action are migrated together. On follow-up run `36666564985`, syntax + application + Phase2–6 + Golden + platform + Slice-B invariants all passed before browser-runtime installation; full post-maintenance Quality/CodeQL/Pages completion remains to be observed. Prioritized remaining register: `docs/CURRENT_STAGE_GAP_REGISTER_2026-09-30.md`. |
15
+| 2026-09-30 | Continue closing the current-stage gap register autonomously, prioritizing production safety and real evidence. | **IN PROGRESS — SECURITY HARDENING APPLIED / CUTOVER RECONCILED / REAL-USER E2E BLOCKED BY TEST PRINCIPALS** | Live Supabase rechecked `ACTIVE_HEALTHY`. Migration `20260930041735_harden_public_security_definer_rpc_grants_search_path` applied and archived: all 7 public SECURITY DEFINER helpers now use empty `search_path`; `PUBLIC`/`anon` execute revoked; `authenticated`/`service_role` explicit. Transactional impersonation of a real non-admin principal proved all 5 admin mutators reject with SQLSTATE `42501`; advisor still reports 7 exposure warnings by design because authenticated RPC access remains intentional. Evidence: `docs/SECURITY_DEFINER_HARDENING_2026-09-30.md`. Production accounting source population re-read without mutation: 7 invoices = 4 formal + 1 non-formal eligible total `3,371,160,000`, plus 2 `pre_invoice` total `3,570,000,000`; both invoice-holding orgs have fiscal-year records but zero account masters and unset company sector, so automatic historical posting remains prohibited until owner mapping/chart approval. Evidence: `docs/PRODUCTION_ACCOUNTING_CUTOVER_READINESS_2026-09-30.md`; Phase-6 manifest wording corrected. Two-real-user E2E cannot yet be truthfully executed because all 4 organizations currently have only their owner member and zero active non-owner members; do not fabricate a second production user or grant cross-org access silently. |
16
+| 2026-09-30 | Audit Gmail GitHub `Run failed` notifications, verify/fix any still-live CI defects, and produce a severity-ranked list of remaining gaps needed to make the current Finora stage complete. | **AUDITED / HISTORICAL FAILURES TRIAGED / CI MAINTENANCE VERIFIED / GAP REGISTERED** | Gmail failures mapped to intermediate commits: old Real-DOM/request-builder failures were fixed by later browser hardening; Slice-B migration-count invariant was fixed by later archived migrations; Security failures were Dependency Review failing because GitHub Dependency graph is disabled while CodeQL passed. During this audit a CodeQL v4 modernization attempt exposed a repository invariant still pinned to v3 and generated transient main failure emails (`31ef607`, `42d2476`, `7e8e43e`); rather than weaken the gate, CodeQL was restored to supported v3. Final audit-closeout commit `5182b786dc7488146eaaa68d87dcc2f1d2c9a725` passed Quality run `36666677736`, Security run `36666677677`, and Pages run `36666676797`. Quality uses `checkout@v7` + `setup-node@v7`; security uses `checkout@v7` and CodeQL v3 until invariant+action migrate together. Prioritized register: `docs/CURRENT_STAGE_GAP_REGISTER_2026-09-30.md`. |
17
| 2026-09-30 | Continue from verified Slice A into Slice B: organization tenant, multi-user memberships, module roles/capabilities, row scopes, confidentiality, shared office access/referral foundation and immutable permission/referral audit. | **IMPLEMENTED / MERGED / VERIFIED** | PR #7 merged as `d212c6aeef5b49f33351166771a0899f307a9067`. PR Quality `36664844247` PASS and Security `36664844234` CodeQL PASS. Final main checkpoint `99a23edcaddf542f9080bbe70bb0b450af14913f` also passed Quality `36664994360`, Security/CodeQL `36664994384`, and Pages `36664994039`. Production migrations `20260930031853`, `20260930031942`, `20260930032615`, `20260930032654`, `20260930033010` applied+archived. Production transactional tests PASS for own/org scope, confidentiality, read-only capability, member core read-only context, expired-license read-only, referral/audit immutability and member Storage-path isolation. GitHub Dependency graph remains disabled, so dependency review is not claimed. Evidence: `docs/SLICE_B_TENANT_RBAC_VERIFICATION.md`. |
18
| 2026-09-30 | Modular organization-wide ERP: office automation/scanned correspondence/secretariat, configurable requests, module managers/permissions, module-select entry, module-by-module/full-suite licensing, future transport/operations; research Barid/ParGar, Chargoon/Didgah, Faragostar. | **SLICE A IMPLEMENTED / VERIFIED** | Request `0b622439`; implementation `d3934690`; read-only expiry hardening `906d78d7`; browser integration hardening `df82067ecb1fda9007eb11a30d0a9d7cc1b113cd`. Production migrations `20260930025546`, `20260930025647`, `20260930030314` applied+archived. Final product-head Quality `36662911587` PASS including syntax, accounting/Phase2–6/Golden, modular-office invariants and Chromium Real-DOM tests; Security `36662911572` PASS; Pages `36662911432` PASS. |
19
| 2026-09-30 | Iran-first high-assurance ERP expansion. | IN PROGRESS — broader roadmap | `docs/IRAN_COMPLIANCE_MATRIX_V1.md`; do not claim statutory consolidation/full tax submission/full HR/CRM until complete lifecycle/accounting/permissions/tests exist. |
20
21
## Current production state — 2026-09-30
21
-- Verified Slice B release checkpoint on canonical main: `99a23edcaddf542f9080bbe70bb0b450af14913f`; subsequent commits are continuity/CI-maintenance/gap-documentation changes and require their own green main gates before being called release-verified.
22
-- Supabase `hcsixhqbyuhpshfwqpjx`: `ACTIVE_HEALTHY`, PostgreSQL `17.6.1.166`, 29 migrations through `20260930033010`.
23
-- 4 existing licenses remain `full_suite`; each license belongs to a backfilled organization whose original account is owner. Production check: 4 organizations, 4 active owners, 0 licenses without organization, 0 records without organization.
22
+- Last fully green CI checkpoint explicitly verified across Quality/Security/Pages: `5182b786dc7488146eaaa68d87dcc2f1d2c9a725`; subsequent documentation/migration archive commits require their normal applicable gates before being called a new release checkpoint.
23
+- Supabase `hcsixhqbyuhpshfwqpjx`: `ACTIVE_HEALTHY`, PostgreSQL `17.6.1.166`, 30 migrations through `20260930041735`.
24
+- 4 existing licenses remain `full_suite`; each license belongs to a backfilled organization whose original account is owner. Current membership check: each of the 4 organizations has exactly 1 active owner and 0 active non-owner members.
25
- `records` primary identity is `(organization_id, collection, id)`; RLS enforces membership/entitlement/capability/scope/confidentiality. Writes require active organization license; expired/cancelled organizations retain authorized historical reads.
26
- Active non-owner members receive read-only `core` context for workspace initialization; core writes remain owner-only in Slice B.
27
- Organization security metadata: `organizations`, `organization_units`, `organization_members`, `member_module_permissions`, immutable `organization_audit`.
28
- Office registration is organization-aware; referral is server-validated and immutable; new Storage path is organization/uploader/correspondence/file and resolves access through correspondence authorization. Legacy attachment writes are owner-only.
28
-- Live security advisor still reports 7 reviewed authenticated-callable public SECURITY DEFINER helpers and leaked-password protection disabled; these are tracked in the gap register and are not silently called resolved.
29
+- Security hardening migration `20260930041735`: all 7 reviewed public SECURITY DEFINER helpers have empty `search_path`, no `anon` execute, and explicit authenticated/service-role execute. Non-admin mutation negative tests pass. Supabase advisor still reports the 7 authenticated-callable warnings because the RPC exposure is intentional; zero-warning architecture would require moving privileged mutation behind a non-exposed/server boundary. Leaked-password protection remains disabled.
30
- Live performance advisor reports 5 newly-created unused-index informational notices; no unindexed-FK finding is present. Do not remove new indexes before representative workload evidence.
30
-- Production currently has 7 invoice records and no account-master/journal collections; controlled accounting cutover remains a P0 completion gap rather than being auto-posted destructively.
31
+- Production invoice history is 7 records: 4 formal + 1 non-formal eligible for controlled accounting cutover (`3,371,160,000` total), plus 2 `pre_invoice` (`3,570,000,000`) excluded from posting. Invoice-holding organizations have fiscal-year records but no account masters; company sector is unset. Controlled accounting cutover remains P0 and must not be auto-posted.
32
33
## Implemented Slice A
34
- Architecture/research: `docs/FINORA_MODULAR_ERP_OFFICE_AUTOMATION_V1.md`.
@@ -49,14 +50,14 @@ Verify live GitHub+Supabase before acting; record material requests before imple
50
Posted accounting history is immutable and balanced; tenant isolation is data-boundary enforced; commercial module entitlement and member authorization are independent; UI hiding is never security; expired licenses are read-only; office numbers are server-atomic; binary scans stay in private Storage; roadmap-only modules are not presented as operational.
51
52
## Required evidence
52
-`docs/PHASE_1_REDESIGN_VERIFICATION.md` · `docs/PHASE_2_REDESIGN_VERIFICATION.md` · `docs/PHASE_3_REDESIGN_VERIFICATION.md` · `docs/PHASE_4_REDESIGN_VERIFICATION.md` · `docs/PHASE_5_VERIFICATION.md` · `docs/PHASE_6_VERIFICATION.md` · `docs/IRAN_COMPLIANCE_MATRIX_V1.md` · `docs/FINORA_ERP_EXPANSION_ROADMAP_V4.md` · `docs/FINORA_UX_ACCOUNTING_BENCHMARK_V3.md` · `docs/FINORA_MODULAR_ERP_OFFICE_AUTOMATION_V1.md` · `docs/SLICE_B_TENANT_RBAC_VERIFICATION.md` · `docs/CURRENT_STAGE_GAP_REGISTER_2026-09-30.md` · `docs/PRODUCTION_RUNBOOK.md` · `supabase/migrations/`.
53
+`docs/PHASE_1_REDESIGN_VERIFICATION.md` · `docs/PHASE_2_REDESIGN_VERIFICATION.md` · `docs/PHASE_3_REDESIGN_VERIFICATION.md` · `docs/PHASE_4_REDESIGN_VERIFICATION.md` · `docs/PHASE_5_VERIFICATION.md` · `docs/PHASE_6_VERIFICATION.md` · `docs/PHASE_6_CUTOVER_MANIFEST.md` · `docs/PRODUCTION_ACCOUNTING_CUTOVER_READINESS_2026-09-30.md` · `docs/IRAN_COMPLIANCE_MATRIX_V1.md` · `docs/FINORA_ERP_EXPANSION_ROADMAP_V4.md` · `docs/FINORA_UX_ACCOUNTING_BENCHMARK_V3.md` · `docs/FINORA_MODULAR_ERP_OFFICE_AUTOMATION_V1.md` · `docs/SLICE_B_TENANT_RBAC_VERIFICATION.md` · `docs/SECURITY_DEFINER_HARDENING_2026-09-30.md` · `docs/CURRENT_STAGE_GAP_REGISTER_2026-09-30.md` · `docs/PRODUCTION_RUNBOOK.md` · `supabase/migrations/`.
54
55
## NOT VERIFIED / external boundary
55
-Authenticated two-real-user production browser E2E; member invitation without a pre-existing account; controlled posting/reconciliation of existing production invoices into initialized accounting masters; real Persian OCR accuracy; qualified digital signature; physical printer; third-party webhook/ECE/email gateways; GitHub Dependency graph/dependency-review availability; Supabase leaked-password protection; formal closure/hardening disposition for 7 public SECURITY DEFINER advisor warnings; PostgreSQL 17.11 platform upgrade; complete post-maintenance Quality/CodeQL/Pages result after the CI runtime changes.
56
+Authenticated two-real-user production browser E2E (no active non-owner member exists yet); member invitation without a pre-existing account; owner-approved chart/mapping and controlled posting/reconciliation of existing production invoices; real Persian OCR accuracy; qualified digital signature; physical printer; third-party webhook/ECE/email gateways; GitHub Dependency graph/dependency-review availability; Supabase leaked-password protection; zero-warning architectural replacement for public authenticated SECURITY DEFINER RPC exposure; PostgreSQL 17.11 platform upgrade; CodeQL v4 migration.
57
58
## Exact next executable work
58
-1. Close current-stage P0/P1 register in `docs/CURRENT_STAGE_GAP_REGISTER_2026-09-30.md`, starting with two-real-user authenticated E2E and a non-destructive controlled accounting cutover plan/evidence.
59
-2. Finish CI maintenance cleanly: migrate the CodeQL version invariant and action together to v4 in a tested change; enable GitHub Dependency graph so dependency review becomes real rather than skipped.
59
+1. Do not fabricate P0 closure: two-real-user browser E2E needs a legitimate second test/member principal; accounting cutover needs owner chart/company-type approval because sector is unset and account masters are absent.
60
+2. Continue independent P1/P2 hardening that does not require those decisions: member invitation foundation, leaked-password platform configuration when the platform exposes a controllable setting, dependency graph when repository administration is available, and CodeQL v4 invariant+action migration as one tested PR.
61
3. Slice C: mature office lifecycle — templates/editor, signatures/approval, referral chains/read receipts, SLA/reminders, reply/related-letter graph, archive classification, OCR/full-text and integration adapters.
62
4. Slice D: versioned workflow engine for configurable requests — steps, conditions, parallel/sequential approval, delegation/substitution, SLA/escalation and immutable action history.
63
5. Slice E: transport/procurement/service/CRM/manufacturing/maintenance only as complete tested vertical modules with accounting/permissions/reporting integration.