@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / 81bd9bf
Fork 0

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

Mirrored from https://github.com/davoodmehraban89/Factor-easy.git

Synced Dec 3, 15:45 UTC

docs: reconcile live state and approval-gated Wave 4 drift

Update PROJECT_STATE.md with the latest owner request, inspected live repository/database evidence and NOT VERIFIED boundaries. Documentation only. PR #44 Quality 36994391586 and Security 36994391599 succeeded; real-DOM/accounting logs reviewed. Production migration remains unapplied pending explicit owner approval.

davoodmehraban89 committed Oct 2, 2026 at 13:46 UTC 81bd9bf38e0b02e5baed8a3fa32a89a2b1345572
1 file changed +21 -5
PROJECT_STATE.md
+21 -5
@@ -11,14 +11,18 @@ Verify live GitHub + Supabase before acting; implement/test/fix/retest/commit/ve
11
12 This is high-assurance accounting/ERP software. Posted financial history, tenant isolation, migration safety, traceability, reconciliation and rollback are mandatory. Do not create billable resources; development/verification must stay on zero-cost/free-tier paths. Destructive financial-history changes, unapproved external costs, public/external messaging and sensitive access changes remain safety boundaries.
13
14 +## Current session authority — 2026-10-02
15 +The latest user message is the sole source of new instructions. Read AGENTS.md then PROJECT_STATE.md in full; verify live main/head/recent commits/CI and Supabase migrations/RLS before implementation; reconcile discrepancies first. Record each request before implementation and update this file in the same commit as every durable change. Work in verified vertical slices. CI success alone is not completion: real-DOM smoke and accounting-invariant tests must pass; unrun checks are NOT VERIFIED. Every Supabase migration must be archived under supabase/migrations/. Ask the owner before schema/RLS/auth/role changes or destructive data operations; older standing approvals below do not override this requirement. Final reports: Persian, approximately 15 lines maximum, evidence SHAs/run IDs, unverified work and next step. This request authorizes verification and reconciliation; older backlog entries are context, not new implementation instructions.
16 +
17 ## Current change ledger
18 | Date | Request / decision | Status | Evidence / next action |
19 |---|---|---|---|
17 -| 2026-10-02 | Branding PR first Quality run exposed a Pages-artifact packaging gap: new icon files were present in source but `scripts/build-pages.mjs` copied only `js` and `vendor`, causing a 404 in hardened Pages smoke. | **BUILD FIX APPLIED / RETEST PENDING** | Pages builder now copies the versioned `assets` directory into `_site`; product/auth logic was not the cause. Security run `36989236713` succeeded; Quality retest required. |
18 -| 2026-10-02 | Owner requested product-wide naming change to «نرم‌افزار ERP سازمانی فینورا», a premium redesign of the login screen based on the supplied reference, and replacement of the generated letter favicon/bookmark icon with the supplied Finora F icon. | **IMPLEMENTED ON BRANCH / CI PENDING** | Browser/bookmark title, application metadata, manifest and visible legacy tagline now use «نرم‌افزار ERP سازمانی فینورا». Added supplied-logo-derived 32px favicon + 180px app/apple icon, real icon in shell branding, and a responsive premium split login with Finora Enterprise visual while preserving every auth contract ID/action. Added static + Real-DOM desktop/mobile regression gates; CI/merge/deploy pending. |
20 +| 2026-10-02 | Latest owner request: verify live main and Supabase, reconcile state before implementation, enforce explicit approval for sensitive database/auth changes and evidence-based slice acceptance. | **RECONCILIATION RECORDED / WAVE 4 PRODUCTION BLOCKER / NO PRODUCT CHANGE** | Baseline main `d70e7d02ecebe5aa75f05b71c0d9a18ad316e7e5`; previous branding merge `5d33b6ea4fb173f6b2e6514c756fc1d122fd2773`. Quality `36991861922`, Security `36991863100`, Release `36992001841`, gated Pages `36992033310` succeeded. Job `110789670982` logs confirm 49/49 real-DOM tests and accounting phases 2–6 + Golden passed; the seven accounting scripts were also rerun locally at the baseline SHA and passed. DOM tests use controlled fixtures/mocked auth and are not authenticated production E2E. Supabase Finora ACTIVE_HEALTHY, 78 migration history entries, all 18 public tables have RLS; 10 private tables have no client CRUD grants (3 RLS enabled, 7 disabled). 79 repository SQL files versus 78 production migration records; 21 same-name files have different production versions. Wave 4 operational-integrity migration is genuinely absent; details below. Full SQL equivalence of all historical migrations NOT VERIFIED. No schema/RLS/auth/role/data mutation performed. |
21 +| 2026-10-02 | Branding PR first Quality run exposed a Pages-artifact packaging gap: new icon files were present in source but `scripts/build-pages.mjs` copied only `js` and `vendor`, causing a 404 in hardened Pages smoke. | **MERGED ON MAIN / CONTROLLED DOM + ACCOUNTING VERIFIED** | Pages builder now copies the versioned `assets` directory into `_site`; product/auth logic was not the cause. Merged in `5d33b6ea4fb173f6b2e6514c756fc1d122fd2773`; baseline main Quality `36991861922` succeeded; job logs verify 49/49 controlled real-DOM tests and accounting regression gates; production two-user E2E remains NOT VERIFIED. |
22 +| 2026-10-02 | Owner requested product-wide naming change to «نرم‌افزار ERP سازمانی فینورا», a premium redesign of the login screen based on the supplied reference, and replacement of the generated letter favicon/bookmark icon with the supplied Finora F icon. | **MERGED ON MAIN / CONTROLLED DOM + ACCOUNTING VERIFIED** | Browser/bookmark title, application metadata, manifest and visible legacy tagline now use «نرم‌افزار ERP سازمانی فینورا». Added supplied-logo-derived 32px favicon + 180px app/apple icon, real icon in shell branding, and a responsive premium split login with Finora Enterprise visual while preserving every auth contract ID/action. Added static + Real-DOM desktop/mobile regression gates; merged in `5d33b6ea4fb173f6b2e6514c756fc1d122fd2773`, baseline CI/release/deploy succeeded as recorded above; runtime checks remain bounded by actual evidence. |
23 | 2026-10-02 | Owner video confirms the three-scrollbar defect is still visible after PR #35 deployment. | **HOTFIX MERGED / MAIN CI + RELEASE + DEPLOY VERIFIED** | Main `a55933c421eb1ea75a863fadd5d51f3bb29d6b8d` duplicates critical desktop ownership CSS in `index.html` and cache-busts `ui.js` as `20261002-shell-scroll-ownership-v2`. Quality `36985456403` SUCCESS, Security `36985456341` SUCCESS, Release gate `36985769059` SUCCESS and gated Pages `36985796598` SUCCESS. |
24 | 2026-10-02 | Owner reported three desktop vertical scrollbars are attached to the wrong visual edges and requested strict scroll ownership: module rail scrolls only main modules from its right edge; contextual subsystem panel scrolls only its own links from its right edge; workspace scrolls only the active work surface from its right edge. | **MERGED / MAIN CI + RELEASE + DEPLOY VERIFIED** | PR #35 merged as `4a8caf7447ddb5361fe56555a8a6bccc7a733602`. Desktop document scrolling is suppressed; module rail, subsystem links, and workspace are independent viewport-bound scroll owners with physical-right scrollbars while Persian content remains RTL; workspace navigation resets its own scroller; mobile/print retain normal flow. PR retest corrected one test-only mobile overflow expectation. Main Quality `36984349326` SUCCESS, Security `36984349300` SUCCESS, Release gate `36984494858` SUCCESS, gated Pages `36984556741` SUCCESS. |
21 -| 2026-10-02 | Wave 5c privileged full backup/restore authorization after offboarding hardening. | **IMPLEMENTED ON BRANCH / CI PENDING** | Full organization export/restore now requires both fresh server membership revalidation and existing organization-management authority (owner or `core:configure`); restore performs the check before reading the selected file. Static + Real-DOM denial-path gates added. This is an application-layer privilege boundary over data already readable under server RLS; no new schema/RLS/auth-role change was introduced. |
25 +| 2026-10-02 | Wave 5c privileged full backup/restore authorization after offboarding hardening. | **PRESENT ON MAIN / CI SUCCESS / PRODUCTION E2E NOT VERIFIED** | Full organization export/restore now requires both fresh server membership revalidation and existing organization-management authority (owner or `core:configure`); restore performs the check before reading the selected file. Static + Real-DOM denial-path gates added. This is an application-layer privilege boundary over data already readable under server RLS; no new schema/RLS/auth-role change was introduced. |
26 | 2026-10-02 | Supabase security-advisor intent review for authenticated-callable SECURITY DEFINER RPCs and three private C8 no-policy tables. | **LIVE INTENT REVIEW VERIFIED / NO DDL REQUIRED** | Production `hcsixhqbyuhpshfwqpjx` reviewed read-only. All 20 public advisor-listed SECURITY DEFINER functions use `search_path=''` and enforce caller/admin/org/capability/read-scope checks appropriate to their RPC contract; warning is retained as an intentional privileged-RPC boundary rather than weakened. The three private C8 tables have RLS enabled, zero policies, and no anon/authenticated CRUD grants, confirming deliberate deny-by-default private storage behind controlled RPCs. Evidence: `docs/SECURITY_ADVISOR_INTENT_REVIEW_2026-10-02.md`. Leaked-password protection remains an external Auth-setting gap. |
27 | 2026-10-02 | Wave 5b offboarding/revocation client fail-closed remediation from Round 29. | **MERGED / MAIN CI + RELEASE + DEPLOY VERIFIED** | PR #32 merged as `e9831e4d23fceae3a30359fe2eca8743087bb6b5`. Main Quality `36982398280` SUCCESS, Security `36982398238` SUCCESS, Release gate `36982548804` SUCCESS, gated Pages `36982584408` SUCCESS. Added 30s + visibility membership revalidation, known-revocation tenant-memory/cache purge, stale `currentUser` removal, sensitive-view lock, alternate-org recovery path, no-membership sign-out, and fresh server membership gate before bulk export. Persistent two-real-user production E2E and capability-specific privileged export authorization remain NOT VERIFIED. |
28 | 2026-10-02 | Permanent project constraint: user operates from Iran and cannot use paid infrastructure, paid APIs, international-card billing, or services that require a later paid upgrade for essential operation. Railway is excluded from Finora runtime/deployment. | **ACTIVE ARCHITECTURE CONSTRAINT** | Use only genuinely no-cost capabilities for required operation; do not create paid resources or make Finora depend on a service whose essential path later requires billing. GitHub + Supabase remain current sources of truth; any future infrastructure choice must pass this zero-cost/no-billing constraint first. |
@@ -34,7 +38,8 @@ This is high-assurance accounting/ERP software. Posted financial history, tenant
38 | 2026-10-02 | Owner supplied environment/connection handoff and directed it to be enforced while continuing work. | **LIVE RECONCILED / ACTIVE OPERATING CONTEXT** | Verified GitHub target `davoodmehraban89/Factor-easy` with admin/read-write access, canonical `main`, and Supabase target `hcsixhqbyuhpshfwqpjx` = Finora / `ACTIVE_HEALTHY`. GitHub + Supabase remain source of truth; Gmail/Notion are optional support only, and Railway/Render are not deployment truth unless a later explicit project decision makes them so. Detected concurrent branch advancement during Wave 4 and refused a non-fast-forward overwrite; re-read the newer head before continuing. |
39 | 2026-10-02 | Wave 4 remediation F-420/F-421/F-422 from canonical audit register. | **IMPLEMENTED ON BRANCH / NOT YET VERIFIED** | F-420 rejects duplicate normalized `onApproved` target/action identities; F-421 binds SLA editor values to logical step keys across reorder/remove/key-edit; F-422 adds actor-scoped delegation idempotency, explicit overlap rejection and revoke retry audit dedupe. Disposable-DB + Real-DOM gates added. CI/merge/production remain NOT VERIFIED at this checkpoint. |
40 | 2026-10-02 | Owner supplied the current remediation/audit package plus manual GitHub QA workflow and directed continuation of both roadmap execution and defect remediation. | **F-412 + WAVE 3 F-415/F-416 VERIFIED / PRODUCTION RECONCILED** | PR #23 merged as `d13498f3af03f544c05168727b440f053de1d733`. Main Quality `36973781026` SUCCESS including disposable D1 DB adversarial tests; Security `36973781055` SUCCESS (Release/QA safety + CodeQL; PR Dependency Review remains externally blocked by disabled Dependency Graph); Release gate `36973927530` SUCCESS; gated Pages `36973959986` SUCCESS. Production migrations `20261002063121 request_wave2_duplicate_code_guard` and `20261002063123 request_wave3_decision_idempotency` applied. Read-only production reconciliation: duplicate legacy code groups=0; replay actor binding, reauthorization and immutable event-outcome reconstruction are present. Next: Wave 4 F-420/F-421/F-422; D4c consumers remain disabled. |
37 -| 2026-10-02 | Owner directed immediate continuation after observing execution delay. | **D4A IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + ACCOUNTING + SECURITY VERIFIED** | PR #21 merged as `4583703396a7ddb00bdad76b52c22932d634cbef`. Main Quality `36961361891` SUCCESS (38/38 real-DOM, accounting phases 2–6 + Golden, D1/C8 DB); Security `36961361897` SUCCESS; Release gate `36961459328` SUCCESS; gated Pages `36961492170` SUCCESS. Production migration `20261002034311 request_workflow_d4a_work_queue` reconciled. Evidence: `docs/REQUEST_WORKFLOW_D4A_VERIFICATION.md`. |\n| 2026-10-02 | Owner switched GitHub Pages source to **GitHub Actions** after the gated Pages workflow was installed. | **WAVE 0 COMPLETED / POSITIVE + NEGATIVE CONTROLS VERIFIED** | Negative control: failing SHA `03561a3369130a7aaba689474d92aa3e93137404` on PR #15 failed required `static-quality`, could not merge, and produced no Release gate / gated Pages deployment. Positive control: protected-main SHA `150ff54d938a45b9a9b476f3a4a8fdabbb45d065` passed Quality `36932956964`, Security `36932956877`, exact-SHA Release gate `36933115365`, then gated Pages deploy `36933151878`; no legacy dynamic branch Pages deployment appeared. F-402/F-403/F-406/F-407/F-423/F-424 are closed at the verified GitHub/repository boundary. |
41 +| 2026-10-02 | Owner directed immediate continuation after observing execution delay. | **D4A IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + ACCOUNTING + SECURITY VERIFIED** | PR #21 merged as `4583703396a7ddb00bdad76b52c22932d634cbef`. Main Quality `36961361891` SUCCESS (38/38 real-DOM, accounting phases 2–6 + Golden, D1/C8 DB); Security `36961361897` SUCCESS; Release gate `36961459328` SUCCESS; gated Pages `36961492170` SUCCESS. Production migration `20261002034311 request_workflow_d4a_work_queue` reconciled. Evidence: `docs/REQUEST_WORKFLOW_D4A_VERIFICATION.md`. |
42 +| 2026-10-02 | Owner switched GitHub Pages source to **GitHub Actions** after the gated Pages workflow was installed. | **WAVE 0 COMPLETED / POSITIVE + NEGATIVE CONTROLS VERIFIED** | Negative control: failing SHA `03561a3369130a7aaba689474d92aa3e93137404` on PR #15 failed required `static-quality`, could not merge, and produced no Release gate / gated Pages deployment. Positive control: protected-main SHA `150ff54d938a45b9a9b476f3a4a8fdabbb45d065` passed Quality `36932956964`, Security `36932956877`, exact-SHA Release gate `36933115365`, then gated Pages deploy `36933151878`; no legacy dynamic branch Pages deployment appeared. F-402/F-403/F-406/F-407/F-423/F-424 are closed at the verified GitHub/repository boundary. |
43 | 2026-10-02 | Wave 2 request integrity remediation F-411/F-413/F-414/F-417/F-418. | **IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + ACCOUNTING + SECURITY VERIFIED** | Squash merge `7346910638b6ef9555d4adb5952dd62c8f4c130d` from PR #19. PR Quality `36937247798`: DB jobs SUCCESS and 37/37 real-DOM tests passed; accounting phases + Golden journey passed. PR Security `36937247803`: required Release/QA invariants + CodeQL SUCCESS (Dependency review remains the documented external graph boundary). Main Quality `36937448157` SUCCESS; Security `36937448101` SUCCESS; exact-SHA Release gate `36937598497` SUCCESS; gated Pages `36937616201` SUCCESS. Production migration recorded as `20261001225044 request_wave2_integrity_hardening`; live validator negative controls and function-contract checks passed. |
44 | 2026-10-02 | Live Supabase target `hcsixhqbyuhpshfwqpjx` became available to the connector; owner directed immediate continuation. | **WAVE 1 PRODUCTION RECONCILED / WAVE 2 STARTED** | Production migration history and live `request_transition_instance` definitions were inspected read-only. F-409/F-410 guard is present in production; next slice is F-411/F-413/F-414/F-417/F-418 with server validation, form-runtime fidelity, idempotency binding, active/latest-version enforcement and schema-bound conditions. |
45 | 2026-10-02 | Owner completed the GitHub `Protect main` ruleset and directed autonomous continuation to fully remediate the audited defects. | **ACTIVE — REMEDIATION CONTINUATION** | Ruleset `24334764` verified ACTIVE on default branch with deletion + non-fast-forward protection, PR-only updates, strict required checks `static-quality`, `Release and QA safety invariants`, and `CodeQL JavaScript`; bypass list empty. Continue Wave 1/2 request integrity work. |
@@ -79,9 +84,20 @@ Posted accounting history is immutable and balanced; tenant isolation is enforce
84 ## NOT VERIFIED / external boundary
85 Automatic background scheduling for SLA scans; delivery/dispatch consumers for D3c outbox intents; authenticated two-real-user production browser E2E with a persistent legitimate non-owner member; automatic external invitation email delivery; owner-approved accounting cutover; real Persian OCR accuracy/provider; qualified digital signature; physical printer; live external adapters; GitHub Dependency graph/enforceable dependency review; leaked-password protection; PostgreSQL upgrade; CodeQL v4 migration; external BPM/provider integration remain outside verified scope.
86
82 -The connected Supabase production target is `hcsixhqbyuhpshfwqpjx` (`Finora`). Live migration history now includes C8, D1–D4a, request security Waves 1–4, `request_wave4b_scheduler_outbox_delivery` version `20261002072526`, and `identity_wave5a_bootstrap` version `20261002075156`. Read-only production reconciliation after Wave 4b confirmed both scheduler evidence tables, stable destination-command/dead-letter outbox columns, and scheduler/claim/complete/fail/replay RPC contracts exist. Security advisor still reports 3 private C8 tables with RLS but no policies and 20 authenticated-callable SECURITY DEFINER functions; live intent review on 2026-10-02 verified these as deliberate deny-by-default private storage and guarded privileged RPC boundaries, respectively. Leaked-password protection remains disabled.
87 +The connected Supabase production target is `hcsixhqbyuhpshfwqpjx` (`Finora`). Live migration history includes C8, D1–D4a and request security Waves 1–3; the 2026-10-02 reconciliation found Wave 4 operational integrity missing despite later Wave 4b being present. History includes `request_wave4b_scheduler_outbox_delivery` version `20261002072526`, and `identity_wave5a_bootstrap` version `20261002075156`. Read-only production reconciliation after Wave 4b confirmed both scheduler evidence tables, stable destination-command/dead-letter outbox columns, and scheduler/claim/complete/fail/replay RPC contracts exist. Security advisor still reports 3 private C8 tables with RLS but no policies and 20 authenticated-callable SECURITY DEFINER functions; live intent review on 2026-10-02 verified these as deliberate deny-by-default private storage and guarded privileged RPC boundaries, respectively. Leaked-password protection remains disabled.
88 +
89 +## Reconciliation evidence — 2026-10-02
90 +- Request recorded before implementation in commit `cb7f4f0606207077151f5c82801842670a35d90a` on `audit/reconcile-state-20261002`. This slice changes documentation only. No feature, schema, RLS, auth, role or production data mutation was performed.
91 +- Baseline main `d70e7d02ecebe5aa75f05b71c0d9a18ad316e7e5` follows branding merge `5d33b6ea4fb173f6b2e6514c756fc1d122fd2773`. The heartbeat commit changed AGENTS.md without a same-commit PROJECT_STATE.md update; this is a historical continuity-protocol discrepancy, not retroactively corrected history.
92 +- Exact-SHA workflow evidence: Quality `36991861922` (static job `110789670982`: 49/49 real-DOM tests; accounting phases 2–6 and Golden passed); Security `36991863100`; Release gate `36992001841`; gated Pages `36992033310`: all SUCCESS. Logs were inspected, not inferred from workflow color. All seven accounting scripts also passed locally on the baseline; local DOM was NOT RUN (browser/test runtime unavailable). CI DOM fixtures mock auth/data and do not prove live tenant isolation.
93 +- Supabase `hcsixhqbyuhpshfwqpjx`: ACTIVE_HEALTHY, PostgreSQL `17.6.1.166`; 18/18 public tables RLS enabled. Ten private tables have zero effective SELECT/INSERT/UPDATE/DELETE privileges for anon/authenticated; three have RLS, seven do not. Authenticated has private-schema USAGE, anon does not. This inventory does not prove all policy predicates or RPC authorization behavior.
94 +- Advisor recheck: three private C8 no-policy INFO findings, 20 authenticated-callable SECURITY DEFINER WARN findings, leaked-password protection disabled. Previous intent review remains historical evidence; no privileged-function-wide re-audit claimed. References: https://supabase.com/docs/guides/database/database-linter?lint=0008_rls_enabled_no_policy ; https://supabase.com/docs/guides/database/database-linter?lint=0029_authenticated_security_definer_function_executable ; https://supabase.com/docs/guides/auth/password-security#password-strength-and-leaked-password-protection .
95 +- Migration inventory: 79 SQL files / 78 live records; 21 same-name repository files differ in version from production. `20260930222500_iran_enterprise_control_collections.sql` is an intentional no-op placeholder. Duplicate live entries exist for the Wave 1 guard, Wave 2 duplicate-code guard and Wave 3 replay hardening. Do not blindly replay or repair history; full statement equivalence remains NOT VERIFIED.
96 +- **CONFIRMED PRODUCTION DRIFT / APPROVAL REQUIRED:** `supabase/migrations/20261002072000_request_wave4_operational_integrity.sql` has no production history entry. Live pg_proc inventory and full function-body reads show only the six-argument delegation create RPC, no seven-argument idempotent RPC, no duplicate target/action guard in workflow validation, and revoke retries unconditionally append audit events. The archived SQL adds the delegation idempotency column/check/index, seven-argument guarded RPC, duplicate-intent rejection and revoke audit deduplication, and changes EXECUTE grants on old/new signatures. CI disposable database job `110789671195` applied this exact file and passed Wave 4 assertions, but that does not establish production deployment. **Do not apply until the owner explicitly approves these schema/function/grant changes.**
97 +- NOT VERIFIED: authenticated production browser E2E; production accounting writes/reconciliation; complete historical SQL equivalence; full RLS policy adversarial tests in production; Wave 4 production behavior. No new product slice is marked COMPLETED.
98
99 ## Exact next executable work
100 +0. Obtain explicit owner approval for the archived Wave 4 schema/function/EXECUTE-grant migration above. After approval, recheck live main/migration history/function definitions for concurrent changes, apply the reviewed SQL via migration tooling, record the returned production version and reconcile contracts. Any data-writing production tests need a separately safe authorized scope. Current schema/RLS/auth/role changes remain approval-gated.
101 1. Finish Wave 5 offboarding/session-revocation verification on protected main, then execute persistent legitimate non-owner E2E when a second durable test identity is available without weakening tenant/capability checks.
102 2. Keep D4c destination consumers disabled until a real destination adapter enforces `destination_command_key` idempotency and its authorization/audit behavior is adversarially verified; automatic scheduler invocation remains a separate operational verification.
103 3. Resolve remaining platform-security gaps: formalize the three private C8 no-policy contracts, enable leaked-password protection when supported by the connected Auth control surface, and keep Dependency Review marked unavailable until Dependency Graph is enabled.