@davoodmehraban89 / Factor-easy / commits / 67be4fb
Fork 0

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

Docs/QA: complete Finora master financial audit Phase 0 (#160)

* docs: preserve exact pre-audit project continuity history * docs: audit current financial event posting and manual voucher paths * docs: classify all existing tests and record executed CI evidence * docs: publish one-page phase-zero audit and prioritized risks * docs: compact project continuity after lossless history archive * docs: reconcile phase-zero findings against read-only Supabase catalog * docs: reconcile phase-zero findings against read-only Supabase catalog * docs: reconcile phase-zero findings against read-only Supabase catalog * test: execute previously omitted standalone public Pages QA regression * docs: scope phase-zero change to audit and extended CI-only test coverage * docs: scope phase-zero change to audit and extended CI-only test coverage * docs: scope phase-zero change to audit and extended CI-only test coverage

davoodmehraban89 committed Oct 16, 2026 at 11:06 UTC 67be4fbfa6161156b10ce6279445266c989e97d3
6 files changed +971 -808
.github/workflows/quality.yml
+2
@@ -20,6 +20,8 @@ jobs:
20 package-manager-cache: false
21 - name: JavaScript syntax
22 run: node scripts/syntax-check.mjs
23 + - name: Generated Pages public regression (standalone suite)
24 + run: node scripts/public-qa-regression-check.mjs
25 - name: Offline encrypted backup safety contracts
26 run: python3 scripts/finora_local_backup_test.py -v
27 - name: Application invariants
PROJECT_STATE.md
+36 -808
@@ -1,808 +1,36 @@
1 -# PROJECT STATE — FINORA / FACTOR-EASY
2 -
3 -> **MANDATORY CONTINUITY FILE — READ THIS FIRST**
4 ->
5 -> Repository: `davoodmehraban89/Factor-easy` · Canonical branch: `main` · Product: **Finora 1.0**
6 -
7 -Read `AGENTS.md` first, then this file. Latest user chat is the only source of new instructions; repo files are continuity/context. Detailed older history remains available in Git history and the verification documents listed below.
8 -
9 -## Protocol / authority
10 -Verify live GitHub + Supabase before acting; implement/test/fix/retest/commit/verify in bounded vertical slices; archive exact production SQL; never call unrun work verified. The owner has repeatedly directed autonomous roadmap execution without routine confirmation pauses and has authorized normal in-scope GitHub/Supabase work. Keep five specialist workstreams under one coordinator: Architecture & Requirements, Implementation, UX/UI, QA & Verification, Security & Release. Use real subagents only when the environment provides them; otherwise execute those responsibilities directly without claiming parallel agents.
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 -## 2026-10-12 owner live-repository/Supabase operating request — VERIFIED READ-ONLY RECONCILIATION / PHASE 0 OPEN
18 -- **Latest chat instruction (sole new authority):** open `davoodmehraban89/Factor-easy` on `main`; read `AGENTS.md` then all of `PROJECT_STATE.md`; verify head, recent commits, CI, live Supabase migrations and RLS before implementation; correct state discrepancies first, record request before functional changes and maintain same-commit continuity for each durable change; require actual real-DOM and accounting-invariant evidence before any COMPLETED claim; list unexecuted gates as NOT VERIFIED. Every future Supabase migration must be archived under `supabase/migrations/`. **Prior approval does not waive explicit owner confirmation for any schema/RLS/Auth/role or destructive-data change.** No separate product feature was requested in this chat; scope is bounded read-only reconciliation and this documentation-only change.
19 -- **GitHub readback:** authenticated repository metadata confirms default branch `main` (push access), with latest returned commit `cc1c2cfddcff3a1f27302c027b9467fafa8b29f8` (documentation-only `PROJECT_STATE.md` change); preceding runtime merge `a67c07a717bffc2a8ee90c7e3cc9db55c2d05881` (startup optimization), before that `61cbcf3113c598022d6877e447bf8c97b4788a19`. Do not confuse the current documentation HEAD with the previous deployed runtime SHA.
20 -- **Independently fetched previous exact-runtime-SHA GitHub jobs:** Quality run `38230349289` (static job `114748008377`, database jobs `114748008669`, `114748008801`, `114748008884`) all SUCCESS; job log explicitly records **89/89 Chromium Playwright**, Golden sale/receipt/purchase/payment/expense/reversal/trial balance/financial statements, phases 2–6, financial draft/posted safety, and accounting P0 PASS. Security run `38230349290` CodeQL `114748007614` and release safety `114748008097` SUCCESS; dependency review `114748009940` SKIPPED, not passed. Exact-SHA release gate `38230688599` and Pages `38230726054` jobs SUCCESS. **Current documentation-only HEAD `cc1c2cf...` individual Actions/check-run result was not obtainable from the available commit-check endpoint (empty statuses and PR-only run lookup): NOT VERIFIED; earlier a67 runs do not certify cc1.**
21 -- **Independently read live Supabase `hcsixhqbyuhpshfwqpjx`:** `ACTIVE_HEALTHY`, PostgreSQL `17.6.1.166`, **82 recorded migrations**, latest `20261012075507 fix_identity_bootstrap_license_before_membership`; `20261007165208 phone_identity_profile`, `20261011174445 posted_source_idempotency_index`, and Wave 4/4b are present. Live records are not proof of exact SQL text parity with repository migration archives. The historical missing phone-identity archive/PR #58 issue remains unresolved; sampled `supabase/migrations/20261007165208_phone_identity_profile.sql` is 404 on `main`, while current bootstrap correction `supabase/migrations/20261012080000_fix_identity_bootstrap_license_before_membership.sql` exists. **Complete 82-to-repo migration SQL parity: NOT VERIFIED**; do not invent/reapply or replace historical migration SQL.
22 -- **Direct PostgreSQL permission audit, read-only:** **18/18 `public` tables have RLS enabled**. In `private`, **3/10 RLS enabled**, **7/10 disabled**. Despite generic Supabase RLS-warning wording alleging client exposure, actual `has_table_privilege` checks show **zero direct SELECT/INSERT/UPDATE/DELETE grants for both `anon` and `authenticated` on all ten private tables**; anon also lacks private-schema USAGE. Treat seven disabled-RLS tables as a recorded defense-in-depth/security review item **not verified as publicly accessible**, not a reason to enable RLS or modify grants without approval. This does **not** prove every SECURITY DEFINER RPC authorization path safe. Security Advisor: three private RLS-no-policy INFO, 21 authenticated-callable SECURITY DEFINER WARN and one leaked-password-protection-disabled WARN; performance advisor identified two unindexed private scheduler FKs (review only). Public RLS predicate adversarial tests, authenticated production two-user isolation, and end-user browser tests remain NOT VERIFIED.
23 -- **Reconciliation outcome:** updated the dated 2026-10-02 continuity snapshot with verified October 12 evidence while preserving historical entries, and distinguished current doc HEAD from released runtime. **Phase 0 remains OPEN, not owner accepted.** No product feature, finance data, accounts, Auth/RLS/role/schema, Supabase migration or deployment changed in this slice. Documentation branch only, rollback by reverting this entry. **Next safe step:** review/merge this documentation-only PR after exact-PR-head Quality/Security evidence; separately audit PR #58 archive parity read-only and obtain owner-session F0 acceptance evidence without credentials or financial writes.
24 -
25 -### 2026-10-12 live-state reconciliation — PR #102 merged, source and tests read back
26 -- The immediately preceding entry's `documentation branch only / pending merge` was the pre-merge checkpoint. Documentation-only PR [#102](https://github.com/davoodmehraban89/Factor-easy/pull/102), head `a053d2e3627105566c09d82475ff916fcd5e804e`, has now **MERGED** to protected `main` as `4be48f74a4add63d3f1dc8791ade6ce7c1e4c651`. Independent GitHub commit inspection confirms **only `PROJECT_STATE.md` changed**; main-branch content and new live-Supabase reconciliation entry read back intact.
27 -- **Exact PR-head verification:** Quality `38263379525` SUCCESS, static job `114859322898` logs **89/89 actual Chromium DOM PASS**, Accounting P0, double-entry, Golden and posted-history invariant PASS; disposable DB jobs `114859322415`, `114859323040`, `114859323233` SUCCESS. Security `38263379761` SUCCESS, CodeQL job `114859321621` and release safety job `114859321310` SUCCESS; Dependency Review `114859324783` SKIPPED. The post-merge main exact-SHA workflows for `4be48f74...` remain **NOT VERIFIED**, as do any owner-authenticated production F0-01/F0-02/F0-03/F0-04/F0-07, complete migration SQL parity and true adversarial RLS checks; these must not be inferred from CI or documented as COMPLETED.
28 -- **Outcome and rollback:** state reconciliation recorded and merged, **PHASE 0 STILL OPEN**; no application runtime, production ledger, Supabase schema/RLS/Auth/roles/migrations, or destructive data changed. Documentation-only rollback is a targeted revert; next independent safe task is read-only PR #58 archive-parity assessment, then owner-authorized browser acceptance against legitimate existing data with no confidential credentials in chat.
29 -
30 -## 2026-10-12 Phase 0 owner escalation — login screen looks ready but ignores interaction (PLANNED / NOT FIXED)
31 -- **User symptom and P0 priority:** the email/password form becomes visible while login resources/session initialization are still loading; entering credentials and clicking login can appear to do nothing, sometimes never reaching the application. This is distinct from the previously shipped 14-extension download optimization PR #100 and must not be declared resolved by its CI.
32 -- **Baseline:** protected main `3445a87592341512dea56745e291c10e5225d8b4`; no Auth/DB/account changes authorized. Source investigation found 40+ synchronous parser-blocking local JS tags, auth init delayed until the 14 extension scripts settle, and `handleLogin()` silently returns when `authBusy` while `enterApp()` awaits full account-record download with no visible per-step status.
33 -- **Narrow intended correction:** preserve ordered script dependencies while fetching parser-blocking app JS in parallel; initialize the login form before non-auth extensions finish; keep authenticated app transition gated on complete scripts and tenant-scoped data loading; make login-in-progress/busy/error state visible rather than leaving an apparently inert form. Add Chromium network-throttled before/after regression and preserve all accounting/Golden/Security/DB gates. No mutation of real accounts, RLS, schema, roles, financial data or Auth server settings.
34 -- **Acceptance:** fresh login form becomes actionable before intentionally delayed optional app module, mocked/unauthenticated negative tests show no credential disclosure or duplicate sign-in, restored session never renders partial app, app status never silently ignores a second click. Gate release on same-SHA Quality/Security/Release/Deploy; owner affected-network authenticated acceptance remains separately OPEN. Rollback: revert single scoped PR and gated redeploy.
35 -
36 -### 2026-10-12 Phase 0 login interactivity repair — PR #104 CONTROLLED QA PASS / MERGE PENDING
37 -- **Verified baseline and root cause:** pre-fix email/password controls painted before the application finished downloading numerous parser-blocking scripts. Core login initialization also previously waited for all 14 extension scripts to settle. Once clicked, `authBusy` silently ignored repeat clicks while authenticated `enterApp()` awaited account + `pullAll()` with no inline stage status. This matches a plausible mechanism for the owner's reported unresponsive/spinning login; **affected ISP production session not reproduced**.
38 -- **Patch in [PR #104](https://github.com/davoodmehraban89/Factor-easy/pull/104):** priority preload of versioned `js/core.js` and `js/login-connectivity.js` in HTML; explicit disabled-until-handler-ready auth controls; immediate `initAuthSystem()` after core runs and the auth DOM exists, without waiting for 14 optional ordered extension requests. Restored and newly authenticated sessions wait `FinoraAppAssetsReady` before tenant-scoped hydration; the original 41 classic ERP script execution order remains unchanged (trial `defer` was rolled back after browser regressions). Login now reports ready / authenticating / waiting for modules / loading company records / slow network / error, and duplicate clicks never trigger duplicate Auth calls. Auth HTTP requests have a bounded 12s abort using the Supabase client fetch adapter; record/ledger writes and reads are unchanged.
39 -- **Actual Chromium regressions added:** optional extension held 3.5 seconds while password form was enabled at **379ms** in one controlled runner sample; mocked incomplete hydration retains progress and suppresses duplicate sign-in; synthetic hung Auth transport aborts without modifying records endpoint behavior; optional CDN outage and ordered extensions still covered. Synthetic times are **not** owner workstation benchmarks.
40 -- **Exact tested feature-head SHA `872d26e144aab81dc6c04a5eae536f02e15ec1b3`:** [Quality `38277314941`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38277314941) SUCCESS; static quality job **92/92 actual Chromium Playwright PASS (53.7s)**, 55 JS / 52 MJS syntax PASS, Golden accounting + immutable posted-history PASS; disposable PostgreSQL C8/D1/identity jobs all SUCCESS. [Security `38277315134`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38277315134) SUCCESS. Earlier full-defer attempt failed regression (16/92), rolled back; next failure 91/92 arose from duplicate role=status and was corrected without weakening the test. **This documentation follow-up commit has not yet received same-head CI.**
41 -- **Acceptance boundaries:** coded fix and controlled QA verified; protected-main merge, exact-SHA Release/Deploy and live domain readback are **PENDING**. Owner-authenticated sign-in on affected ISP, latency after tenant `pullAll()`, real user/password and device-specific stability remain **NOT VERIFIED / F0-01 OPEN**. Phase 0 remains OPEN. No accounts, Auth server config, schema, RLS, permissions, production data or financial history modified. Rollback: revert #104 and gated Pages redeploy.
42 -
43 -### 2026-10-12 Owner-critical login responsiveness #104 — RELEASED / CONTROLLED QA PASS / REAL OWNER ISP OPEN
44 -- [PR #104](https://github.com/davoodmehraban89/Factor-easy/pull/104) reviewed and squash-merged to protected `main` as exact runtime SHA **`8217f7ebb3cb66f4be471cadd62e70a9991524cf`**. The earlier PR checkpoint above is historical, not an outstanding merge.
45 -- **Final PR tested head `b8e2529bdbda00a1c2825e892854f0aa5977eb75`:** Quality [`38277769229`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38277769229) SUCCESS, actual Chromium **92/92 PASS**, three disposable Postgres jobs PASS, Golden accounting, syntax and posting safety PASS; Security [`38277769217`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38277769217) SUCCESS.
46 -- **Exact protected-main runtime verification:** Quality [`38278039076`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38278039076) SUCCESS, Security [`38278039045`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38278039045) SUCCESS, Release Gate [`38278232706`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38278232706) SUCCESS, and gated Pages Deploy [`38278322395`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38278322395) SUCCESS. Duplicate Release `38278217834` CANCELLED / earlier Pages `38278301298` SKIPPED are not counted as success.
47 -- **Live deployed asset readback on authorized remote Windows device:** unauthenticated read-only GET of `https://factoreasy.ir/?phase0_login_release=20261012` returned HTML containing `js/core.js?v=20261012-login-ready-v2`, `js/bootstrap.js?v=20261012-login-ready-v2`, and `auth-login-status`. Independent GET of live versioned `js/core.js` contained `finoraBoundedAuthFetch` and `FinoraAppAssetsReady` strings. No password, local cookie, login session, customer records or financial writes accessed.
48 -- **Acceptance:** FIX_RELEASED + CI_CONTROLLED_QA_PASSED. Owner's affected ISP/device real sign-in/response timing, two-user RLS, full post-login `pullAll()` latency, live company/accounting and physical printer are **NOT VERIFIED**. F0-01 and Phase 0 remain **OPEN**. No Auth server/RLS/role/schema or stored finance data mutated. Next safest step is authenticated owner-device F0-01 test (without sharing any credential) and targeted read-only timings for login to workspace; only if latency persists consider a separately tested data-hydration change. Rollback: revert merged #104 and gated redeploy, no DB rollback.
49 -
50 -### 2026-10-12 P0 owner photo: inert login connectivity button / lingering session hydration (OPEN FIX)
51 -- **User evidence:** Owner's photographed latest production login shows `در حال آماده‌سازی محیط کار...` although no fresh credentials are visible, and clicking `بررسی اتصال به سرور ورود` reportedly has no visible response. This is **owner-reported real UI failure**, not evidence of an actual failed Auth HTTP request. Related [issue #106](https://github.com/davoodmehraban89/Factor-easy/issues/106).
52 -- **Confirmed source-level root cause for inert buttons under production CSP:** the Pages builder externalizes static `onclick` handlers into `js/generated-event-handlers.js` and appends that script only at the bottom of the HTML **after dozens of parser-blocking ERP scripts**, whereas `js/core.js` enables all login buttons and declares them ready early. Thus the user can click apparently enabled controls before their production event listeners are installed. Local (unbuilt) Chromium tests retain raw inline handlers, so existing coverage did not detect the gap.
53 -- **Separate suspected hang:** restored Supabase session calls `enterApp()` before a manual login and awaits `FinoraAppAssetsReady`, profile and sequential `pullAll()` without a bounded read timeout. The screenshot matches a pending restore but does not identify the precise stalled request.
54 -- **Implementation authority and safety:** change only Pages event-binding ordering and bounded READ-ONLY hydration with visible retry/error; ensure diagnostic handler is loaded before buttons enable; add realistic built Pages Chromium test with artificially stalled unrelated JS and a synthetic restored-session read. Preserve the legacy ERP script execution order and tenant-safe, atomic datastore replacement; no modification to Supabase Auth/RLS/roles/schema, stored financial records or real customer users.
55 -- **Acceptance:** demonstrate diagnostic click starts changing UI before intentionally delayed ERP script completes in built CSP artifact; synthetic stuck read must time out and return operable login without prematurely entering app; complete Golden/92+ Chromium/3 DB/Security checks and gated release; actual affected owner ISP acceptance still OPEN. Rollback narrow PR; no DB rollback.
56 -
57 -### 2026-10-12 P0 owner photo: nonresponsive login diagnostics / session restore — PR #107 RELEASED / OWNER ACCEPTANCE PENDING
58 -- **Owner field evidence:** latest photographed production login displayed `در حال آماده‌سازی محیط کار...` without an observed fresh password attempt; the button `بررسی اتصال به سرور ورود` was reported non-responsive. Photo alone does not establish that live GoTrue/Auth or any specific Supabase SQL endpoint failed. Related [issue #106](https://github.com/davoodmehraban89/Factor-easy/issues/106) remains OPEN for actual affected-ISP acceptance.
59 -- **Proven root cause #1 (inert action):** strict-CSP Pages builder replaced `onclick` attributes with handlers registered in `js/generated-event-handlers.js`, but only appended this script after 40+ blocking application JS modules. Core declared `authFormReady` and enabled controls before listeners were bound. [PR #107](https://github.com/davoodmehraban89/Factor-easy/pull/107) moves generated static handlers ahead of core in the built artifact and loads the credential-free connectivity helper before core; only marks controls ready when built handlers exist. Unbuilt legacy ERP script ordering and CSP/SRI enforcement remain intact.
60 -- **Proven root cause #2 (uncancellable hydration wrappers):** `js/organization-rbac.js` overrides both `fetchCurrentUser` (membership/licenses/roles/permissions across multiple queries) and `pullAll` (organization-filtered records), previously discarding the new bounded-read AbortSignal. Fixed by forwarding the same signal to every read-only PostgREST query, retaining strict `organization_id` filter, checking abort/org context before atomic datastore replacement and preserving server RLS as authority; unaffected reads use the existing behavior. Restored-session hydration now has a 25s upper bound, inline error and enabled diagnostics rather than indefinite apparent loading. Versioned cache URLs updated for core/sync/organization module. No financial writes or server Auth policy change.
61 -- **Controlled browser/QA evidence:** final PR head `0911c25cd039785a853b52f0189737c01cdfbe57`: [Quality `38283874464`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38283874464) SUCCESS, **96/96 Chromium Playwright PASS**, including actual built strict-CSP site click on diagnosis and login validation while a later ERP module was artificially delayed, client session timeout and atomic/cross-tenant aborted-read assertions; Golden accounting, full syntax, three isolated Postgres DB jobs passed. [Security `38283874574`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38283874574) SUCCESS. Earlier red CI exposed that organization wrappers dropped AbortSignal, a real bug which was fixed rather than weakening the test; a separate dark/light luminance intermittent failure was not treated as success.
62 -- **Exact runtime release:** #107 squash merged to protected `main` as **`23c5f5426bc2f8ad48c6323f1d43b7cf5b556875`**. Exact-SHA Quality [`38284275379`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38284275379) SUCCESS, Security [`38284275367`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38284275367) SUCCESS, Release Gate [`38284524466`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38284524466) SUCCESS, gated Pages deployment [`38284609169`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38284609169) SUCCESS. Duplicate Release `38284453656` cancelled and Pages `38284586024` skipped, **not** successes.
63 -- **Direct live-domain parity, authorized remote Windows read-only GET:** `https://factoreasy.ir/?loginCspProof=20261012` HTML includes `js/generated-event-handlers.js`, `js/core.js?v=20261012-login-wiring-v3` and `js/sync.js?v=20261012-login-read-cancel-v1`; versioned `js/bootstrap.js` points to `organization-rbac.js?v=20261012-login-scoped-read-v1`, and direct retrieved module contains `finoraOrganizationRead`, `FINORA_LOGIN_READ_TIMEOUT` and scoped read references. No owner credentials, session data, backend mutations, accounts or financial history were accessed.
64 -- **Acceptance boundary / next step:** CODE_RELEASED / SYNTHETIC_E2E_PASSED / LIVE_ASSET_PARITY_VERIFIED; owner actual affected-ISP behavior remains **NOT VERIFIED**, F0-01 and overall Phase 0 remain **OPEN**. Owner should fully refresh `factoreasy.ir`, click `بررسی اتصال به سرور ورود` with no password and report only code (AUTH_OK/AUTH_TIMEOUT/AUTH_UNREACHABLE/SITE_UNREACHABLE), then test permitted existing account login privately. Distinguish slow restored-session permissions/records from Auth service network. Rollback #107 via guarded Pages, no DB rollback.
65 -
66 -### 2026-10-12 Kavenegar OTP preparation — OWNER APPROVED OFFLINE PREPARATION ONLY / PENDING
67 -- **Owner intent:** move future Finora primary sign-in from email toward mobile OTP using previously created Kavenegar verification template `FinoraLogin`; correct owner clarification: the owner approved **preparing the technical infrastructure**, not Kavenegar's template. Most recent visible provider status was **UNDER REVIEW**, and provider template approval and SMS delivery are **NOT VERIFIED**. Preserve existing password/email/Google sign-in and all existing Supabase Auth user IDs/organizations. No automatic new accounts or reassignment of an existing identity.
68 -- **Scope/owner:** code preparation on isolated branch only; design server-side Supabase Auth Send SMS Hook -> verified webhook -> Kavenegar `verify/lookup` using template `FinoraLogin`, feature disabled/fail-closed by default, no API key in public GitHub/browser. Add a provider adapter with synthetic offline tests and setup/runbook. No Auth settings, hook, live Edge Function, environment secrets, phone mappings, database or production site modifications under this slice.
69 -- **Verified baseline:** main `833b795b7b0320260b91dcbe621bbce04b23f0c3`; live Supabase `hcsixhqbyuhpshfwqpjx` HEALTHY; `public.profiles.phone` and unique partial index existing, live `phone_identity_profile` migration recorded; no Kavenegar sender Edge Function deployed; historical PR #58 remains open, must not blindly merge/duplicate migration. Windows Desktop Commander `DESKTOP-71SJ63M` ONLINE. Its working copy `C:\Temp\Factor-easy` was observed on stale `main` SHA `b1a35fdc...`, with **0 tracked modifications / 2189 untracked files**, and is read-only for this operation; GitHub branch is canonical source.
70 -- **Acceptance:** offline contract tests cover signed hook body/gate, phone formatting, token/template injection protection, provider status/errors/timeouts and no sensitive logging; source/docs checked on feature-head CI. Activation requires independently verified **approved provider template**, securely configured API/hook secrets, admin owner confirmation before Auth provider setting changes and actual SMS send/test costs, safe linking/verification for existing user phone identities, staged user test without creating duplicate accounts, owner affected-network sign-in acceptance. RLS/tenant isolation and ledger remain unchanged. **Phase 0 F0-01 still OPEN.**
71 -
72 -### 2026-10-12 Kavenegar OTP server-only preparation — PR #110 OFFLINE QA PASS / NOT ACTIVATED
73 -- **Owner clarification upheld:** `FinoraLogin` template **NOT verified approved by Kavenegar**, only owner-approved infrastructure preparation. Provider SDK API documented; **no provider key received**, no live outbound SMS or Auth hook configuration. Keep existing email/password/Google functioning unchanged. Historical phone PR #58 remains pending and was not merged.
74 -- **PR [#110](https://github.com/davoodmehraban89/Factor-easy/pull/110):** isolated `supabase/functions/finora-kavenegar-send-sms/{handler.mjs,index.ts}` stage, `scripts/kavenegar-otp-preflight-test.mjs`, Quality workflow step and detailed `docs/FINORA_KAVENEGAR_OTP_PREPARATION_2026-10-12.md`. Feature disabled unless explicit `FINORA_KAVENEGAR_OTP_ENABLED=true` plus Edge-only `KAVENEGAR_API_KEY` and `SEND_SMS_HOOK_SECRET`. Checks Standard Webhooks HMAC and 5-minute timestamp before parsing, validates `+989...` and 6–10-digit token, uses provider's fixed template `FinoraLogin` and 3.5s timeout. Responds non-200 on disabled/invalid/provider failure; synthetic tests never contact Kavenegar. No account management, DB migrations, RLS, Auth configuration, website login UI, edge deployment, secret creation or cost.
75 -- **Observed Quality head `b6e72973a45bd48f3b2ad28f31a4da54c8094633`:** GitHub [Quality run `38296251394`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38296251394), **attempt 2 SUCCESS**, 96/96 Chromium PASS, Golden accounting PASS, OTP synthetic signed-hook/provider regression PASS, three isolated PostgreSQL suites PASS; [Security `38296251305`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38296251305) SUCCESS. First attempt had 95/96 Chromium with old F0-06 light-theme luminance assertion failing (reported 0.456 < 0.5), but no OTP regression; reran exact code job without weakening or changing the visual assertion and passed 96/96. This *documentation follow-up* commit still requires a new exact-head validation before merge.
76 -- **Acceptance still OPEN:** Kavenegar template approval/real delivery/cost, staging Edge deploy with signature verification and `verify_jwt=false`, protected server secrets, Supabase Auth phone provider & SMS hook configuration and real-account mobile binding must receive separate explicit owner approval and testing. NO automatic signup or newly created unrelated Auth user is allowed during legacy identity migration. Phase 0 F0-01 owner-real-ISP sign-in and Phase 0 as a whole remain OPEN.
77 -
78 -### 2026-10-12 Kavenegar OTP Stage 0 — SERVER SOURCE + OFFLINE QA MERGED / SMS NOT ENABLED
79 -- Owner confirmed **approve preparation, not Kavenegar template approval**. Kavenegar `FinoraLogin` approval, live credit, delivery and message cost remain **NOT VERIFIED**. Do not silently progress to live SMS.
80 -- [PR #110](https://github.com/davoodmehraban89/Factor-easy/pull/110) squash-merged to `main` commit **`6d0882810ca66e105f2c80c745daf6bc4dcfb88b`**. Committed a **disabled** server-only Supabase Auth Send SMS Hook and Kavenegar sender, signed/raw-body/expiry/phone/token guards, 3.5s external provider deadline, synthetic offline tests under Quality, and staged operational instructions. `FINORA_KAVENEGAR_OTP_ENABLED` is deliberately unset; no key in repo.
81 -- **Exact runtime main CI:** [Quality `38297230687`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38297230687) SUCCESS, `96/96` actual Chromium, Golden accounting PASS, synthetic Kavenegar OTP PASS, disposable C8/D1/identity PostgreSQL jobs PASS. [Security `38297230690`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38297230690) SUCCESS; [Release Gate `38297468930`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38297468930) SUCCESS; [gated Pages `38297514635`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38297514635) SUCCESS. Duplicate Release `38297363249` CANCELLED and Pages `38297498599` SKIPPED are not successes.
82 -- **Independent Supabase deployment inspection:** `list_edge_functions` still returned only `admin-user-management` and `finora-stripe-qa-read`, neither the new SMS hook nor phone Auth settings activated or modified. No SMS sent, no new Auth users created, no financial DB writes/RLS/schema changes. Existing email/password/Google login remains untouched. User's Desktop Commander device available; checkout `C:\Temp\Factor-easy` is stale with 2189 untracked files and was not edited.
83 -- **Remaining independent activation authorization:** vendor approval, secure server secrets, hook deployment + verify_jwt=false, enabling Supabase phone Auth and signed Send SMS hook, validated existing-user phone linking (never duplicate `auth.users.id`), SMS delivery costs/test number, CAPTCHA/rate limiting/replay dedupe plan, staged mobile UI and affected owner ISP acceptance. **No next step may infer any of these authorized. F0-01 and Phase 0 OPEN.**
84 -
85 -### 2026-10-12 Phase 0 F0-01 affected network: screenshot SITE_UNREACHABLE and account timeout — DIAGNOSIS OPEN
86 -- **Owner evidence:** real Chrome screenshot of Finora email/password login shows `دریافت اطلاعات حساب بیش از حد طول کشید...` and `SITE_UNREACHABLE` from the built-in connectivity diagnostic. The screenshot contains private login address: NEVER copy user email/credential into tickets, public logs or code. It does not prove password invalid, that all ERP assets are inaccessible or which tenant/network fetch failed. Earlier owner video/photo documented blank/inert handlers, separately addressed in PR #107; this observation is AFTER that deployment.
87 -- **Confirmed code-level limitation:** `js/login-connectivity.js` currently runs two probes: same-origin `manifest.json` and Supabase GoTrue `/auth/v1/health`, then **returns SITE_UNREACHABLE whenever ONLY manifest fetch fails**, masking the Auth outcome and without testing any executable JS. The `manifest.json` exists in GitHub and is copied by `scripts/build-pages.mjs`, but owner ISP actual asset HTTP result remains unknown. `enterApp()` read-only account bootstrap/profile/org membership/paginated records has a 25s timeout and shows the independent account timeout message. These two strings do not prove one shared cause.
88 -- **Diagnostic remediation scope:** test one same-origin critical local JS file **and** manifest independently alongside Supabase Auth health, preserve truthful independent codes and avoid false blanket unreachable from manifest alone. Add deterministic Chromium tests for manifest-only HTTP failure, actual script failure, Auth failure and combined failures. Do not log personal identifiers, passwords, JWTs, API keys or HTTP response bodies. No Supabase/Auth/RLS/roles/schema, financial posting or real account modifications. Preserve exact legacy login behavior pending actual owner ISP result. Rollback narrow UI-only PR.
89 -- **Availability limitation:** Desktop Commander device `DESKTOP-71SJ63M` reports ONLINE, but **monthly tool quota is exhausted** (explicit tool error); do not retry/reconnect/circumvent. Public external fetch of owner domain was also inaccessible in current external inspection context. Therefore real owner-ISP CDN/site/GoTrue HTTP status and precise 25s timeout stage are **NOT VERIFIED**; F0-01 and overall Phase 0 OPEN. Next owner validation: same browser and alternate network comparing independent probe codes without sharing login secrets.
90 -
91 -### 2026-10-12 F0-01 login SITE_UNREACHABLE screenshot — DIAGNOSTIC FIX RELEASED / OWNER NETWORK OPEN
92 -- **Evidence:** user Chrome screenshot showed two independent observations: `دریافت اطلاعات حساب بیش از حد طول کشید` after 25s read-only session/organization hydration; connectivity probe reported `SITE_UNREACHABLE`. Review of old `js/login-connectivity.js` proved that code was derived **solely from unsuccessful `manifest.json` fetch**, masking GoTrue health and never probing critical JS. The photo is not proof of invalid credentials or general loss of every app asset.
93 -- **Scoped remedy** [PR #112](https://github.com/davoodmehraban89/Factor-easy/pull/112), merged on protected `main` runtime SHA **`86913c74a1abc88a2912f5ba393ef3fb01dcde49`**. New credential-free diagnostic independently tests executable local `js/login-connectivity.js`, PWA `manifest.json` and `/auth/v1/health`; preserves separate `SITE_JS_*`, `MANIFEST_*`, `AUTH_*` statuses when any other probe fails. Warns that only a missing manifest does not establish sign-in failure. Cache-busts diagnostic JS. It does **not** change Auth/session/data hydration/login policy, user profile, accounting, Supabase server or posted invoices.
94 -- **PR head `b13b7273efac47961404a7196e7ced5217e0bfdf`:** [Quality run `38299516328`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38299516328) SUCCESS, **99/99 actual Chromium Playwright**, including three synthetic network failure regressions, Golden accounting, offline OTP and three PostgreSQL suites PASS. [Security run `38299516301`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38299516301) SUCCESS.
95 -- **Exact main runtime:** [Quality `38299894628`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38299894628) SUCCESS, [Security `38299894494`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38299894494) SUCCESS, [Release Gate `38300110596`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38300110596) SUCCESS, gated [Pages Deploy `38300160000`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38300160000) SUCCESS. Duplicate Release `38300060543` CANCELLED and Pages `38300138479` SKIPPED are excluded.
96 -- **Operational blocker:** authorized Windows Desktop Commander is paired/ONLINE but tool explicitly said MONTHLY USAGE EXCEEDED and instructed not to retry or reconnect; no tool quota bypass attempted. Independent external `factoreasy.ir` HTTP fetch also inaccessible through web tool. Thus live same-ISP critical-JS/manifest/Auth HTTP outcomes, browser load latency, and authenticated company data read are **NOT VERIFIED**. The CI-gated deploy is proof of publishing but not a user-network acceptance. Owner should hard-refresh Chrome, click built-in diagnostic without entering credentials, report `SITE_JS_*`, `MANIFEST_*`, `AUTH_*` code; compare once using independent mobile hotspot if available. No username/password/private email/tokens. [Issue #106](https://github.com/davoodmehraban89/Factor-easy/issues/106) and F0-01 / Phase 0 remain OPEN.
97 -- **Rollback:** revert #112 through protected gated Pages release; no financial DB rollback necessary.
98 -
99 -### 2026-10-12 Owner confirmed post-authentication login still times out — F0-01 P0 ACTIVE
100 -- **New real user result:** on the affected Chrome/ISP, initial diagnostic `SITE_JS_OK | MANIFEST_OK | AUTH_OK` but password sign-in **does not reach the workspace** and ends with `دریافت اطلاعات حساب بیش از حد طول کشید`. This is a **25-second `enterApp()` bootstrap timeout**, not evidence of incorrect credentials; `AUTH_OK` only probes public GoTrue health. Avoid sharing/storing the owner's screenshot email/password; no live credentials collected.
101 -- **Inspected source:** `enterApp()` concurrently waits `fetchCurrentUser()` (profile + membership + 7 authorization/license organization reads) and `FinoraAppAssetsReady`; it then performs paginated, tenant-scoped `pullAll()` with full atomic snapshot. All are under one 25s cancel signal, but the existing UI gives the same timeout message regardless of which step stalled. Supabase project is ACTIVE_HEALTHY, and read-only pg_indexes shows scoped `records` indexes and membership indexes; database service health does **not** demonstrate reliable owner-ISP PostgREST connectivity.
102 -- **This bounded step:** instrument stages with **strictly fixed, privacy-safe identifiers** for account/profile, organization membership, access/license, optional startup assets, and company record hydration; show exact pending stages on timeout and add a *separate read-only PostgREST reachability check* to existing site/manifest/Auth diagnostic. Add synthetic Chromium network-failure tests, keep tenant-scoped atomic data and RLS/auth paths entirely unchanged. No user DB read, schema/RLS/Auth changes, no credential/URL logging. Rollback this UI-only PR.
103 -- **Acceptance:** full Chromium/Golden/three disposable PostgreSQL/Security checks, gated main Publish and affected-browser retest showing `REST_*` + safe `BOOT_*` stage code; actual root cause cannot be claimed fixed before owner network trace. Keep [Issue #106](https://github.com/davoodmehraban89/Factor-easy/issues/106) / F0-01 / Phase 0 OPEN. Desktop Commander reported monthly usage quota exhausted; no attempts to bypass limitation or modify stale 2189 untracked files in `C:\Temp\Factor-easy`.
104 -
105 -### 2026-10-12 F0-01 actual owner login timeout after AUTH_OK — FIXED BOUNDED WAIT / STAGED DIAGNOSTIC RELEASED / ACCEPTANCE OPEN
106 -- **Owner-verified issue:** on affected Chrome ISP, owner reports password login **still did not enter** and returned `دریافت اطلاعات حساب بیش از حد طول کشید` even though earlier login diagnostic had `SITE_JS_OK | MANIFEST_OK | AUTH_OK`. Auth health does NOT validate authenticated organization/profile/tenant-record reads. Screenshots contain identifying account information; do not publish that email or collect credentials in any QA artifacts.
107 -- **Root-cause class and limited fix:** `enterApp()` awaited a top-level `fetchCurrentUser()` promise inside `Promise.all` with a 25s AbortController, but did NOT wrap that whole outer promise in `finoraAbortableRead` if its helper ignored cancellation; a synthetic permanently pending account-context operation **survived its timeout**. [PR #114](https://github.com/davoodmehraban89/Factor-easy/pull/114) fixes the outer cancellation and adds allow-listed no-PII `BOOT_*` timeout labels for `ACCOUNT_CONTEXT`, `PROFILE`, `ORG_MEMBERSHIP`, `ORG_ACCESS`, `APP_ASSETS`, and `TENANT_RECORDS`. Also adds a separate **public, read-only** Supabase PostgREST root reachability check (`REST_*`) to existing site/manifest/GoTrue connectivity without reading any company records, credentials or session. All legacy tenant-scoped authorization and atomic financial datastore synchronization remains unchanged.
108 -- **PR-head correction/reverification:** First Quality run `38302258531` FAILED **1/103 Chromium** (a synthetic never-settling account-context fixture exposed the unbounded outer wait) while 102/103 passed; fixed without weakening any test. Corrected PR exact head `c7d46a8633fc01519e044bd1bc380796ca2c777c`: [Quality `38302642079`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38302642079) SUCCESS **103/103 Chromium Playwright**, Golden core PASS, 3 disposable PostgreSQL jobs PASS; [Security `38302641996`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38302641996) SUCCESS.
109 -- **Protected-main release:** merged runtime **`bead02fbc48f04e12de8b1565d99d2a3c4af761d`**, exact SHA [Quality `38303068200`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38303068200) SUCCESS (103/103), [Security `38303068209`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38303068209) SUCCESS, [Release Gate `38303361728`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38303361728) SUCCESS and [Deploy gated Pages `38303407938`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38303407938) SUCCESS; duplicate `38303255014` Release CANCELLED and `38303388240` Pages SKIPPED excluded.
110 -- **Acceptance still NOT verified:** no direct live `factoreasy.ir` GET or owner-ISP runtime trace after this release; Desktop Commander was ONLINE but latest remote command attempt returned MONTHLY QUOTA EXCEEDED; no bypass/reconnect attempted. No actual authenticated owner sign-in, company data loading or delay root cause yet. User to hard-refresh, run built-in diagnostic, report only `REST_*` code, then attempt sign-in privately, report `BOOT_*` code on a repeated timeout; compare a different ISP if useful. The fixed outer wait prevents indefinite hanging but is **not proof full login latency has been cured**. [Issue #106](https://github.com/davoodmehraban89/Factor-easy/issues/106), F0-01 and Phase 0 remain OPEN. No server Auth/RLS/schema/roles, user identity, financial data or customer payload modifications. Rollback via #114 revert and gated redeploy, no database rollback.
111 -
112 -### 2026-10-13 Owner affected-ISP evidence pinpoints BOOT_APP_ASSETS / slow local files — REMEDIATION IN PROGRESS
113 -- **Actual photographed owner browser after #114:** `BOOT_APP_ASSETS` when attempting authenticated workspace entry; connectivity check `SITE_JS_TIMEOUT | MANIFEST_TIMEOUT | AUTH_OK | REST_HTTP_401`. The later screenshot shows cleared email/password fields, but earlier supplied login contains private email: **never reproduce identifiers**. `AUTH_OK` means GoTrue health only; `REST_HTTP_401` for unauthenticated REST root is not proof PostgREST is offline and must not be treated as the login root cause. Two same-origin no-store diagnostics timed out under owner ISP, a strong signal of unstable own-domain asset delivery, not definitive server infrastructure fault.
114 -- **Code-proven wait:** `js/bootstrap.js` currently dispatches 14 separate extension script downloads, `Promise.allSettled` has no per-resource deadline and sets `FinoraAppAssetsReady` only after **all 14** finish/fail; `enterApp()` refuses full app until that promise resolves. This exactly matches `BOOT_APP_ASSETS`, whereas the owner code did not name a specific file. The existing flow even resolves this readiness promise if any extension fails, risking partially usable financial software.
115 -- **Safe fix scope:** build a same-origin, deterministic **single production extension JS bundle** from the exact 14 source modules in dependency order (all IIFEs, preserve CSP and source); retain existing unbundled source/dev loader; bound the extension load (including missing network) and on any failure explicitly reject workspace readiness, leave login responsive and show actionable asset-failure status, NEVER render incomplete ERP. Cache-bust built script. Add real Playwright built Pages/browser tests for one-request delivery, missing bundle fail-closed, and original parallel development behavior. No network-unapproved external CDNs, no Auth/RLS/schema/users/posting/tenant data modifications. Rollback #PR via protected Pages; no DB rollback.
116 -- **Required acceptance:** full 103+ Chromium/Golden/disposable 3 PostgreSQL/Security and exact SHA Pages gate; actual affected-ISP sign-in **remains OPEN** until owner real network retest. Desktop Commander quota previously explicitly exhausted; no retry/bypass. Keep F0-01 and Phase 0 OPEN.
117 -
118 -### 2026-10-13 Owner F0-01 BOOT_APP_ASSETS — bounded production bundle RELEASED / owner sign-in OPEN
119 -- Owner's affected Chrome screenshots show `BOOT_APP_ASSETS`, `SITE_JS_TIMEOUT`, `MANIFEST_TIMEOUT`, `AUTH_OK` and `REST_HTTP_401`; these are no-store local-file delays plus GoTrue health, **not proof of incorrect credentials or PostgREST outage**. Public notes exclude account identifying information.
120 -- Source root cause class: startup waited on 14 individual extension script downloads without individual deadlines and previously marked the full ERP ready even on script errors. [PR #116](https://github.com/davoodmehraban89/Factor-easy/pull/116) merged to runtime SHA `c72a83981860ca38a68b6f4a7b9900dd664c64f7`. Pages builds one hashed, same-origin, syntax-checked bundle of the same 14 dependency-ordered IIFEs; source/dev remains independent. Extension wait bounded at 18s and failed assets reject readiness with `BOOT_APP_ASSETS_FAILED`; no partial accounting workspace is displayed.
121 -- PR-head Quality run `38311574244` SUCCESS **105/105 Chromium** (bundled production + blocked-bundle negative), Golden and 3 PostgreSQL PASS; Security `38311574218` SUCCESS. Exact merged main Quality `38311972925` SUCCESS, Security `38311972939` SUCCESS, Release Gate `38312280586` SUCCESS and Pages `38312349416` SUCCESS. Cancelled/skipped duplicate checks excluded.
122 -- No Auth/RLS/schema/users/financial data/posting, no SMS/provider or remote desktop modifications. Remote Desktop Commander previously exhausted monthly quota; no bypass. **Owner affected-ISP full sign-in and performance not yet verified**; issue #106, F0-01, Phase 0 OPEN. Next: affected Chrome hard refresh and one actual sign-in, report result, elapsed and any BOOT code; if still failing compare an independent Internet connection. Rollback: revert #116 and gated deploy.
123 -
124 -### 2026-10-13 F0-01 owner photo STILL BOOT_APP_ASSETS after #116 — bounded critical-pages optimization
125 -- Actual owner photograph shows password login reverting to `BOOT_APP_ASSETS` rather than later `BOOT_APP_ASSETS_FAILED`; therefore user success after #116 NOT VERIFIED. This does not distinguish stale HTML from slow parser-blocking scripts or an unchanged owner network. No credentials or personal email copied from photo. Browser's first JS/manifest tests previously timed out, while public Auth health worked; PostgREST root 401 is not proof of database outage.
126 -- Source review at runtime `main=9b8d4cd7fa3bcb3b8175019525eaca0ffa97fb59`: production bundle optimization #116 only consolidated 14 **dynamically loaded extension modules**; `index.html` still has **38 other, parser-blocking, same-origin local JS tags** (12 before bootstrap and 26 after it). `DOMContentLoaded` waits for these, and `js/bootstrap.js` only starts its 18s deadline at DOMContentLoaded, so the account's 25s deadline can fire first, yielding `BOOT_APP_ASSETS` despite newer #116 code.
127 -- Safe implementation scope: build three content-hashed source-order-preserving **Pages-only blocking script bundles** corresponding to exact contiguous script ranges (admin..words, patches..accounting, accounting-foundation..ux-hardening). Preserve standalone `vendor/supabase.js`, `js/login-connectivity.js`, `js/core.js`, `js/bootstrap.js`, generated CSP event listeners and extension bundle. Preserve original source/dev `index.html`; only rewrite built `_site/index.html` in `scripts/build-pages.mjs`. Static dependency and VM parse checks, real Chromium Pages runtime DOM/CSP test, withheld-late-bundle responsive login test and exactly three bundle-request assertion required. No production tenant/auth/finance changes.
128 -- Genuine remedy acceptance: full Quality Chromium, Golden accounting, three disposable PostgreSQL, Security, exact SHA protected-main Release/Pages and owner actual affected-ISP login. Do not claim owner network repaired on CI pass. Existing issue #106 / F0-01 / Phase 0 OPEN. No remote-desktop quota circumvention.
129 -
130 -### 2026-10-13 F0-01 owner BOOT_APP_ASSETS repeated after #116 — 38 parser-blocking scripts bundled / PAGES RELEASED / OWNER LOGIN OPEN
131 -- **Owner evidence:** affected Chrome still showed `BOOT_APP_ASSETS` after earlier 14-extension bundling #116. The screenshot does not prove whether the latest HTML executed or rule out ISP/cache faults. Separate earlier `SITE_JS_TIMEOUT`/`MANIFEST_TIMEOUT` were own-domain no-store fetch failures; `AUTH_OK` public GoTrue health and `REST_HTTP_401` unauthenticated REST-root reply are not proofs of credential/account faults.
132 -- **New source-proven bottleneck:** original source `index.html` had **38 other synchronous same-origin JS loads**, blocking `DOMContentLoaded`. Extension load's 18s deadline started only at `DOMContentLoaded`; the account's 25s timeout could therefore expire while APP_ASSETS was still pending even with PR #116 in the repository. The issue was diagnosed from GitHub source, not a live Chrome network timeline.
133 -- **Runtime fix** [PR #118](https://github.com/davoodmehraban89/Factor-easy/pull/118) merged on protected main SHA **`192c04a7e4c6324131f5c1b50a45bfa091c46a7a`**: Pages builder creates three SHA-hashed local classic JS bundles in strict original source execution order (12 foundation + 10 business + 16 accounting), VM syntax validates, preserves CSS boundaries, early auth handlers and existing CSP; source/dev remains unchanged. A failing required script bundle rejects workspace readiness instead of exposing partially loaded financial ERP. Together with #116 (14 extension files -> one bundle), production now downloads four bundled files instead of 52 separate foundation/enterprise extension files; vendor Supabase, CSP handler, core, bootstrap and diagnostic resources remain independent.
134 -- **Verified controls:** PR corrected head `84e840dd8fb99a83ccda109a81c48428a3cf79e1`: [Quality 38314360631](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38314360631) SUCCESS **107/107 Chromium**, including Pages grouped-bundle and blocked-group fail-closed, Golden accounting PASS and 3 disposable PostgreSQL PASS; [Security 38314360655](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38314360655) SUCCESS. Initial test run was superseded after fixing a test-only `_site` path assertion; no weakened tests.
135 -- **Exact protected-main release:** [Quality 38314813962](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38314813962) SUCCESS, [Security 38314813972](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38314813972) SUCCESS, [Release gate 38315115231](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38315115231) SUCCESS, [gated Pages 38315149869](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38315149869) SUCCESS. Duplicate Release 38314958511 CANCELLED and Pages 38315138483 SKIPPED are excluded.
136 -- **Critical boundary:** cannot assert the actual owner's ISP login is repaired; no owner device authenticated success, real waterfall or affected-ISP asset HTTP readback. Desktop Commander monthly quota previously exhausted, not bypassed. No changes to Supabase Auth/RLS/schema/roles/accounts, finance/posted invoices, SMS or production customer data. Owner to hard-refresh affected Chrome, try real sign-in once and report only success/time/`BOOT_*` code; compare independent hotspot if it still fails. Issue #106 / F0-01 / overall Phase 0 **OPEN**. Rollback: revert #118 via Quality/Security/Release/Pages; no DB rollback.
137 -
138 -### 2026-10-13 F0-01 owner actual Chrome sign-in after #118 — FIRST AFFECTED-ISP SUCCESS / REPEATABILITY OPEN
139 -- **Latest owner test (direct statement in chat):** In the same Windows Chrome, owner pressed `Ctrl+Shift+R` at `https://factoreasy.ir/`, signed in with the existing account privately, and **the primary Finora workspace opened successfully**. Owner-reported wait was approximately **20 seconds**. This is the **first positive owner-reported authenticated, affected-browser sign-in result following bundled Pages release #118**; unlike synthetic CI, it exercises the real owner network/browser. The assistant did not remotely witness the session, collect credentials, independently time navigation, or inspect the loaded asset hashes.
140 -- **Interpretation:** Earlier blanket "real login not verified" is superseded for **one manually tested login**. Record status as **OWNER_REPORTED_AUTHENTICATED_LOGIN_PASS (one run, ~20s)**, **NOT** proven reliable cold/warm start, logout/relogin, tab/browser reopen, repeat refresh, acceptable latency SLA, financial workspace hydration correctness, F0-02/03/04 or two-user RLS. A 20s total wait is a measured concern for usability, but it does not alone localize network or code delay. Do **not** assert F0-01 fully OWNER-ACCEPTED or close issue #106 until repeatability/expectations are established. Do not infer `BOOT_APP_ASSETS` can never recur.
141 -- **Verified code/release baseline re-read:** protected `main` = `47b2aa7a70f4fc4a01ce5e39dd3578b1d3563e9b`; same SHA Quality `38315777620`, Security `38315777523`, Release Gate `38316074399`, gated Pages `38316127506` all SUCCESS (cancelled/skipped counterparts excluded). PR #118 runtime merge `192c04a7e4c6324131f5c1b50a45bfa091c46a7a` uses three ordered critical bundles and one extension bundle. Live Supabase `hcsixhqbyuhpshfwqpjx` `ACTIVE_HEALTHY`, 82 migrations, latest `20261012075507`; `public` RLS 18/18, `private` RLS 3/10, with no permissions altered in this review. These independently verified repository/backend controls are not proof of user-side latency.
142 -- **Next minimal owner acceptance check:** without sharing identifiers or network captures, try one ordinary logout→login **or** a browser close/reopen followed by login on the same ISP; report workspace yes/no and approximate elapsed time. Once stable, user may verify the original company's visible data and a safe page refresh (no posting/writing). If only a 20s delay remains, investigate an explicitly defined acceptable target with browser timing evidence; do not optimize financially sensitive `pullAll()` based on guesswork.
143 -- **Change boundary:** documentation-only evidence ledger and F0-01 acceptance register; no application JS, deployment, production account/Auth, server role/RLS/schema, financial records, OTP/SMS or credentials touched. Keep [issue #106](https://github.com/davoodmehraban89/Factor-easy/issues/106) open with updated owner-positive result and follow-up. **Phase 0 OPEN**; remaining F0-02/03/04/05/06/07 owner-context gates unaffected. Rollback: revert docs-only PR.
144 -
145 -### 2026-10-13 F0-01 second-device owner login FAILED (~40s) after first-device success — CROSS-DEVICE STABILITY OPEN
146 -- **New direct owner report in chat:** A second computer was available; owner attempted Finora F0-01 sign-in, reports **login failed after approximately 40 seconds**, and then attached a screenshot. The precise on-screen error code is **NOT INDEPENDENTLY TRANSCRIBED/VERIFIED** from the attachment in this session; **do not invent or attribute** a `BOOT_*`, credentials or network error. The second computer's browser, ISP, refresh state and exact loading stage are unspecified, and may differ from the first computer. Any private identities visible in the screenshot must not be copied into repository issues.
147 -- **Paired acceptance evidence:** First owner device showed one successful authenticated main-workspace entry after Chrome `Ctrl+Shift+R` (~20s), as recorded above. Second device now failed (~40s). Mark **F0-01 CROSS_DEVICE_INCONSISTENT / OWNER_ACCEPTANCE_OPEN / P0**. One successful login is not a reliable rollout, and one failed login does not prove an outage for all users. Overall Phase 0 **OPEN**; none of F0-02/F0-03/F0-04/F0-07 can be inferred from this result.
148 -- **Independent read-only reconciliation:** latest protected main `6ac8d68ae669cbe1e914c71064a3c1fa45d6fe5c`, same-SHA Quality `38345404409`, Security `38345404529`, Release Gate `38345621057`, gated Pages `38345647098` all SUCCESS; Production Supabase `hcsixhqbyuhpshfwqpjx` `ACTIVE_HEALTHY`, 82 migrations (newest `20261012075507`). Existing authorized remote desktop remains OFFLINE. These facts certify GitHub release/backend metadata, not remote owner-browser performance.
149 -- **Source-based diagnosis boundary:** `js/core.js` shows a 9s slow-login notice for the Auth request and a **separate 25s timeout after Auth in `enterApp`**. Thus ~40s overall is consistent with multiple possible delays, but it does **not** identify a particular `BOOT_*` stage, asset failure, rejected password or tenant fetch. Login connectivity button performs four *credential-free* read-only checks with a 12s deadline (`SITE_JS`, `MANIFEST`, `AUTH`, `REST`); `REST_HTTP_401` at the unauthenticated root is not itself proof of an outage. Avoid guess-based bypasses, 25s extension, disabling readiness checks or auth/RLS changes.
150 -- **Next evidence:** ask owner for the *exact, privacy-safe* short error/status code shown under the login form (if visible) and the four connectivity codes from clicking `بررسی اتصال به سرور ورود` on that same second computer. Do not request credentials, email addresses, token/cookies, network HAR or private tenant records. Compare one normal retry or independent connection **only after** code classification. If `SITE_JS` or `MANIFEST` timeout, inspect same-origin resource timing; if `BOOT_ACCOUNT_CONTEXT` / `BOOT_TENANT_RECORDS`, inspect latency with safe browser timing, no data exfiltration. A source fix requires reproducible evidence, controlled Chromium/Golden/3DB/Security, isolated PR and exact-SHA release.
151 -- **Change boundary:** this is a **documentation + open issue evidence update only**. No runtime/login, Supabase schema/Auth/RLS/roles, identity credentials, ledger, invoices, payments, OTP, production traffic or account settings modified. Rollback: revert this docs-only PR. Issue #106 **OPEN**.
152 -
153 -### 2026-10-13 F0-01 second-device diagnostic screenshot — SECOND-DEVICE DIAGNOSTIC CONFIRMED: SITE_JS_OK / MANIFEST_OK / AUTH_TIMEOUT / REST_TIMEOUT
154 -- **Actual visible evidence from owner-provided photo (privacy-safe codes only):** after the owner reported second-device login failure at ~40 seconds, they clicked the built-in `بررسی اتصال به سرور ورود` control on that device. The on-screen diagnostic reports **`SITE_JS_OK | MANIFEST_OK | AUTH_TIMEOUT | REST_TIMEOUT`** and says the main site file is accessible but the Auth server check was unsuccessful. Unlike the prior screenshot with a generic login alert, this photo *does* resolve the four connectivity codes. It does **not** show a `BOOT_*` code from the login attempt or timing of the actual Auth request, and the second device's ISP/browser/network route are not known. No account identifiers or private content are copied.
155 -- **Verified implementation semantics:** `js/login-connectivity.js` fires four parallel, credential-free `fetch` requests (own-origin `js/login-connectivity.js`, own-origin `manifest.json`, cross-origin Supabase `/auth/v1/health`, cross-origin Supabase `/rest/v1/`) with **one shared `AbortController` and a 12-second deadline**. Hence two `*_TIMEOUT` statuses indicate that both Supabase endpoint requests had no successful fetch completion before the shared abort; they are **not evidence of two sequential 12s delays**, a Supabase outage for everyone, invalid credentials or RLS failure. The two checked same-origin resources were reachable (`*_OK`). `AUTH_TIMEOUT` here is a health-probe code, not the password API response.
156 -- **Independent read-only reconciliation:** protected `main` before this documentation change `167fbcb1e5bb198d1025121a4ce0d97e01929519`; exact SHA Quality `38348991795`, Security `38348991712`, Release `38349249193`, Pages `38349291823` all SUCCESS. Live Supabase `hcsixhqbyuhpshfwqpjx` `ACTIVE_HEALTHY`, 82 migrations (last `20261012075507`). Neither GitHub CI nor Supabase project metadata proves the owner computer's cross-origin connectivity.
157 -- **Assessment:** first computer one login PASS ~20s; second computer login FAIL ~40s, with static website reachable but Supabase Auth/REST credential-free probes timing out at 12s. **F0-01 = P0 / CROSS_DEVICE_INCONSISTENT / NETWORK_PATH_SUSPECTED, NOT ROOT_CAUSE_PROVEN / NOT OWNER_ACCEPTED**. Phase 0 remains OPEN; do not weaken fail-closed financial workspace checks or blame/change passwords.
158 -- **Next discriminator:** owner keeps **same computer and browser** and temporarily changes only Internet access to a phone mobile hotspot; clicks the same built-in connectivity test once more, returns only four status codes and optional login success/time. If Auth and REST respond on hotspot, investigate current ISP/DNS/routing/firewall/proxy. If both still time out, assess local device/browser/proxy or service edge via privacy-safe diagnostics before any code change. Do not request email/password/tokens/cookies/HAR. No Auth/RLS/schema/roles, financial history, invoice or OTP modifications. A bounded runtime fix, if proven necessary, needs independent Chromium/Golden/DB/Security gates and owner retest. Issue #106 OPEN.
159 -- **Change boundary:** evidence-only documentation update and Issue #106 comment; rollback revert docs-only PR. No runtime change or customer production mutation.
160 -
161 -### 2026-10-13 Owner: pause Phase 0 login performance; progress independent Phase 1 security — EXECUTION STARTED
162 -- **Latest owner instruction:** defer sign-in/startup slowness, continue approved Finora execution phases. **Explicit boundary:** leave F0-01 / #106 OPEN; do not optimize login or claim Phase 0 complete. Per approved eight-phase roadmap, perform a **Phase 1 read-only security/data-integrity audit** in parallel with blocked owner-authenticated Phase 0 gates. No production Auth/RLS/schema/role, data, permissions, billing, or finance cutover changes authorized by this instruction.
163 -- **Verified beginning main:** `1fa5cf99be9eb790d1192b7597d2dbf65cc9d3fa`. Live Supabase `hcsixhqbyuhpshfwqpjx` ACTIVE_HEALTHY; **82 migrations** last `20261012075507`; existing open PR #58 contains a migration archive under a **different timestamp** (`20261007163500`) from the production-recorded `20261007165208`, and mixes old auth/frontend features; do **not** merge, rename blindly, reapply, or issue replacement SQL. Outstanding PR #6/#39/#40 also not accepted.
164 -- **Initial independently executed read-only catalog findings:** public tables **18/18 RLS**, private tables **3/10 RLS**, **zero anon/authenticated SELECT grants to all 10 private tables**; SECURITY DEFINER routines: public **27** (of which **21 authenticated EXECUTE**, **0 anon EXECUTE**, **27 configured search_path**); private **66** (of which **43 authenticated EXECUTE**, **0 anon EXECUTE**, **66 configured search_path**). Authenticated has USAGE on private schema, whereas anon does not; this requires reviewing actual API exposure and callable routine guards, **not** assuming no possible access or an exploitable vulnerability. The 21 public authenticated-callable warnings are review inputs. Six sampled public admin-license mutators explicitly call `public.is_admin()`; sampled organization invitation/workflow functions use `auth.uid()` and capability checks, but this is **source review, not authenticated adversarial execution proof**.
165 -- **This isolated slice:** deliver an executable **read-only permissions/assertion SQL audit** and a Phase 1 evidence memo with repeat procedure, expected invariants, unresolved negative tests and risk priority. Verify against live metadata with SELECT only, plus repo presence/readback; no DB or service changes, no test identities. Record exact output, SHA and outcome after the fact. This is a **Phase 1 verification slice**, not Phase 1 acceptance; additional two-user revocation, adversarial grants, backup/restore, advisor reviews and sign-off remain OPEN. Rollback revert docs/test-file PR.
166 -
167 -### 2026-10-13 Phase 1 permissions audit — LIVE SQL 4 PASS / 2 REVIEW / NO DATABASE MUTATION / PR CI PENDING
168 -- **Executable deliverables on isolated branch:** `supabase/tests/phase1_permissions_readonly.sql` (catalog-only SELECT audit) and `docs/FINORA_PHASE1_SECURITY_READONLY_AUDIT_2026-10-13.md` (repeat procedure, 21-function risk roster, historic migration discrepancy). SQL was **fetched back from GitHub** and executed read-only via production Supabase metadata access. Exact results: `PUBLIC_ALL_RLS` PASS **18/18**, `PRIVATE_NO_CLIENT_DIRECT_READ` PASS **0 of 10 exposed**, `PUBLIC_DEFINER_NO_ANON_EXEC` PASS **0 of 27**, `DEFINER_EXPLICIT_SEARCH_PATH` PASS **93/93**; `PUBLIC_AUTHENTICATED_DEFINER_REVIEW` REVIEW **21**, `PRIVATE_RLS_COVERAGE_REVIEW` REVIEW **3/10**. **4 PASS / 2 REVIEW / 0 FAIL**. The 21 live advisor warnings match exactly the 21 `public` authenticated-callable SECURITY DEFINER routines.
169 -- **Concrete regression hazard from independent production function review:** stale open PR #58 `20261007163500_phone_identity_profile.sql` defines `public.handle_new_user` with `organization_members` inserted **before** `licenses`. Current live function, after Oct-12 safeguard, deliberately inserts `licenses` **before** `organization_members` so the seat guard can evaluate capacity. **Do not reapply the stale old function or merge PR #58 as-is.** Mismatched old archive filename `20261007163500` vs live migration ledger `20261007165208` remains unresolved; exact executed SQL-body parity NOT VERIFIED.
170 -- **Source review of all 21 public authenticated-callable SECURITY DEFINER routines** completed using `pg_get_functiondef`, grouped into six admin license mutators (explicit `is_admin`), two read predicates, seven office, five organizational/invitation, one own-profile RPC. Static guard presence does **not** prove correct tenant isolation or absence of privilege escalation. Authenticated two-user revocation/adversarial parameter checks, private RPC exposure, leaked-password protection, backup/restore and migration parity remain OPEN and require appropriate approval/test identities.
171 -- **Boundaries:** Owner-directed deferral of F0-01 slowness persists; F0-01/Phase 0 OPEN. Phase 1 audit slice metadata verification PASS only; **Phase 1 owner acceptance NOT CLAIMED**. No JS runtime, production SQL DDL/DML, Auth/RLS/grant change, new identities, financial records, subscription payments or secrets touched. PR Quality/Security and any post-merge exact-SHA gates **PENDING at this checkpoint**; do not claim release until verified. Rollback revert documentation+read-only SQL check.
172 -
173 -### 2026-10-14 Owner pilot request — allow correction and cancellation of finalized accounting documents — IMPLEMENTATION GATED
174 -- **New explicit owner request:** while Finora is an incomplete pilot, expose in document management an action described as «برگشت سند قطعی به حالت موقت» so previously finalized records can be amended and re-finalized, and provide deletion/cancellation of documents. Owner requests this even for older finalized documents. This is separate from earlier OTP and slow startup scope.
175 -- **Accounting contract verified before implementation:** `js/journal-engine.js` has distinct draft/posted/reversed states and `jeReverse`, `jeCopyVoucherToDraft`, `jeDeleteDraft`; `js/invoices.js` finalizes new sale invoices explicitly with idempotent source-linked journal posting, and blocks edits to posted sources. Existing `public.finora_guard_posted_journal` and child triggers reject direct changes/deletes of posted or reversed vouchers and lines; only posted→reversed with linked reversal ID is allowed. Current docs require immutable posted history and balanced reversals. **Never** grant direct editing/physical deletion of historical posted rows.
176 -- **Safe product interpretation and first slice:** Provide understandable UX for **post→linked reversal→new editable draft→edit→post** preserving original source/voucher and explicit previous-ID provenance; for 'delete' of posted records expose **audited cancellation/reversal**, not physical erase. For never-posted drafts, permit deletion with confirmation and block any linked references. Use explicit confirmation, authorization `requireWrite`, owner/company/fiscal-period checks, and no retroactive mutation of old finance entries. Start with manual journal and sales invoices under «مدیریت اسناد» in an isolated PR; other document types (purchases, receipts, payments, expenses, tax submissions, linked documents, legacy chartless records) require separate type-specific QA/approval; do not present them as implemented. If atomic data persistence cannot be guaranteed, do not enable live controls prematurely.
177 -- **Authority boundary:** user authorizes the **feature design/development** and ordinary reversible PR, but production posted-data bulk conversion, schema/RLS/Auth/role changes, real ledger correction/deletion, closed-period reversal, offboarding, or migration are **not** authorized by a feature request alone. Test isolated synthetic ledger only, preserve tenant isolation and accounting Golden. No existing production 'final' record is automatically modified. Verify exact SHA Quality/Security/Chromium/three disposable PostgreSQL and independent posting invariants before release; keep owner live acceptance OPEN.
178 -- **Baseline before changes:** protected `main=9d40b70be90172772d12eb9fa33915fe9c055c67`, prior Phase 1 security audit PR #123 merged with Quality, Security, Release Gate, Pages successful. Live Supabase state to be checked read-only before merge. Rollback targeted PR revert; correction/cancellation must retain audit history.
179 -
180 -### 2026-10-14 Pilot correction MVP — CODE + SYNTHETIC E2E TESTS IMPLEMENTED ON BRANCH / CI NOT YET RUN
181 -- **Implemented (isolated GitHub branch only):** `js/journal-engine.js` now has `jeReturnPostedToDraft`, `jeUpdateDraft`, `jeCancelPostedManual`. `js/journal-ui.js` exposes editable saved manual drafts and buttons «برگشت به موقت» and «ابطال» for posted **manual** vouchers, preserving old voucher/lines and creating a balanced posted reversal plus a new linked draft. `js/invoices.js` adds `reopenPostedInvoiceAsDraft`, `cancelPostedInvoicePilot`, `deleteInvoicePilotDraft` for **sale invoices** only. `js/document-management.js` shows confirmed corrective return, auditable cancellation and draft-only delete; old original invoice/number/posted voucher remain linked and unchanged, correction gets a new unique number/ID, `correctsInvoiceId` and `correctionReversalId`, and can be edited and re-finalized through the existing path. It checks owner, active company, open fiscal year, current source posting, an electronic-document exclusion and visible payment references. The server's immutable posted journal triggers are not disabled or changed.
182 -- **Tests:** added two isolated authenticated-mock Chromium journeys in `scripts/accounting-document-workflow.spec.js`: sale save→post→return-to-draft→edit→repost and manual journal post→return→edit→repost→cancel with old ledger history/amount immutability, no duplicate replay, reconciliation and reload. Authoring-side JS syntax parsed **5/5 PASS** via V8 on actual GitHub branch blobs; Chromium E2E, Golden, 3 disposable PostgreSQL, CodeQL, CI and owner real authenticated acceptance **PENDING/NOT VERIFIED** until exact PR-head workflows complete. Do not merge/release on syntax alone.
183 -- **Explicit coverage caveat:** this **is not an 'all financial documents' implementation yet**: purchase source, receipts, payment settlements, expenses, tax-submitted/legal documents, closed fiscal periods, and historical records without valid source-voucher linkage are intentionally not converted automatically. Individual record deletion of a posted voucher is never performed; the visible 'delete/cancel' action records reversal, which is legally and technically distinct. Draft sale deletion is allowed only if not linked to journal/tax doc/payments. No automatic bulk unposting of previously posted records.
184 -- **Risk and follow-up:** `jeReverse` stages multiple saves on the existing debounced sync path; invoice correction requires a server acknowledgment before showing success, whereas manual journal correction relies on existing sync badge. Validate server-side immutable triggers and race/partial write scenarios in independent controlled tests before accepting production correction. If these safeguards fail CI, do not merge. No schema, RLS, Auth, user roles, SMS or live financial documents touched in this branch. Rollback by reverting exact scoped code PR; actual user reversals after future rollout remain immutable historical business events and cannot be erased by code rollback.
185 -
186 -### 2026-10-14 Pilot posted-document correction — PR #124 MERGED / EXACT-SHA QA, SECURITY, PAGES SUCCESS / OWNER ACCEPTANCE OPEN
187 -- Owner request: in pilot show «برگشت سند قطعی به موقت», edit/re-finalize and delete/cancel. This first release handles **manual journal vouchers** and **formal/nonformal sales invoices** through a linked compensating posted reversal and a NEW editable draft. Old posted vouchers and source history remain immutable.
188 -- Delivery: PR [#124](https://github.com/davoodmehraban89/Factor-easy/pull/124) squash merged as protected main **e66cbfe4e2a59519af0095f0187a4d1e7aab16d7**. Updated js/journal-engine.js, js/journal-ui.js, js/invoices.js, js/document-management.js, scripts/accounting-document-workflow.spec.js. Added manual journal draft edit/return/cancel; sales invoice correction with unique replacement ID/number and correctsInvoiceId lineage, server-acknowledged correction sync and guarded draft deletion. Confirmations, reason capture, company/identity/fiscal safeguards; electronic-tax/recognized payment-linked sources held for separate workflow.
189 -- Final PR test head **ddaeac6bcb86d1a96024c70d953a3d773b62e5af**: Quality **38514364453 SUCCESS**; Chromium **110/110 actual Playwright PASS**, Golden accounting PASS, three disposable PostgreSQL jobs PASS. Security **38514364423 SUCCESS** (CodeQL and release-safety; dependency review SKIPPED). Previously tested interim head 109/109 superseded.
190 -- Exact protected-main **e66cbfe4e2a59519af0095f0187a4d1e7aab16d7**: Quality **38514715350 SUCCESS**, Security **38514715371 SUCCESS**, Release Gate **38514995868 SUCCESS**, gated Pages **38515017469 SUCCESS**. Duplicate release **38514854574 CANCELLED** and Pages **38515005679 SKIPPED**, explicitly not counted. Gated Pages is not a live owner authenticated document acceptance claim.
191 -- **Explicitly not implemented / not accepted:** purchase invoices, receipts/payments, expenses/income, electronic submitted tax documents, legacy records without valid source-voucher linkage, locked fiscal years, adversarial second-user/tenant tests, real production owner corrective edit/repost. Source-specific inventory/settlement contracts require separate verified slices. No automatic unposting or physical deletion of posted records. Rollback of software cannot delete future legitimate compensating financial entries.
192 -- Boundary: no Supabase DDL/DML/permissions/Auth/RLS/roles, paid resource, SMS, real financial-history rewrite or live posted user record mutation occurred in this engineering delivery. Owner pilot acceptance and F0-01 slowness remain OPEN. Next: separately controlled purchase-correction workflow and authorized non-financial/synthetic owner smoke.
193 -
194 -### 2026-10-14 Owner approves in-system pilot correction rollout and continuation — PURCHASE SLICE STARTED
195 -- **New owner instruction:** «تاییده انجام بده من می خوام داخل سیستم ببینم» following PR #124 sale/manual document correction. Live protected `main=3f596568ccbfb8a63e980e672dbb45aa49bd25ef` has Quality `38515487117`, Security `38515487169`, Release `38515771924`, Pages `38515796836` all SUCCESS on this same commit. Existing sale/manual controls should be visible at `factoreasy.ir` under حسابداری ← مدیریت اسناد / فهرست اسناد حسابداری after fresh load; real user login/browser proof still open.
196 -- **Scope now:** extend the same traceable posted→compensating reversal→editable corrective draft→repost/cancel UX to **purchase invoices**, including purchase list and central document manager, with server-acknowledged sync and correct warehouse/project reporting that excludes reversed originals and unposted corrective drafts. Retain legacy purchases outside automatic conversion unless source/voucher mapping is proven. Cover posted settlement references, ownership/company and locked fiscal year fail-closed. For already posted purchase rows keep existing source and ledger history unchanged. Normal new purchase posting behavior should not silently change unless explicitly tested.
197 -- **Next dependencies and constraints:** first verify current source and live Supabase read-only, use isolated synthetic read/write fixture for tests and same-commit state notes, PR-head and protected-main Quality/Security/Chromium/Golden/three disposable PostgreSQL plus gated Pages. Do not mutate real production financial records or Auth/RLS/schema. Receipts/payments and expenses/income remain distinct follow-up types and are not implemented by a purchase-only slice.
198 -- **Rollback:** revert specific JS/document manager/QA PR. A real user financial reversal is immutable historical evidence and cannot be erased by code rollback. Owner acceptance on actual app is separate from CI.
199 -
200 -### 2026-10-14 Purchase pilot correction implementation checkpoint — SIX PARSE PASSES, E2E PENDING
201 -- `js/purchases.js`: new posted purchase eligibility on authenticated owner/active company, source-linked posted purchase voucher, current and source open fiscal years, no linked purchase payments, product catalog matches, and nonnegative available stock if the purchase is compensated. `returnPostedPurchaseAsDraft` records linked **posted balancing reversal** and adds a distinct user-owned corrective purchase draft with new unique supplier number/ID and source lineage; `finalizePurchasePilotDraft` posts an explicitly edited replacement through existing purchase journal and waits for `finora_sync_records` server sync acknowledgment; `cancelPostedPurchasePilot` creates compensating posting instead of physical delete; `deletePurchasePilotDraft` is draft-only. Normal new purchase creation remains auto-posted by existing code; editing a correction draft does not auto-post or reset supplier default prices.
202 -- `js/document-management.js` plus `js/journal-ui.js`: purchase register in **same حسابداری ← مدیریت اسناد** area and purchase actions; `js/purchases.js` own list now shows posted/draft/reversed/legacy states and corresponding actions. `js/accounting.js` excludes reversed/correction-draft purchases from derived stock and project costs while retaining historical unlinked purchase treatment. `js/payments.js` disallows allocating payment to unposted/reversed purchase.
203 -- Two synthetic authenticated Chromium journeys appended to `scripts/accounting-document-workflow.spec.js`: posted purchase→UI return→manual edit→draft save→explicit repost with old lines unchanged and balanced, linked history and reload; payment-allocation block, stock-consumption block, cancel with original retained. Fixture adds isolated supplier and purchase accounts. **Six changed JS/Playwright files parsed PASS in V8**, actual DOM, Golden, 3 disposable PostgreSQL, CodeQL and protected release gates **NOT YET RUN** at this checkpoint.
204 -- **Known boundary:** Other document classes (receipts/payments as sources, expenses/income, taxpayer submissions, standalone legacy unlinked) are not touched. Production financial rows and SQL/Auth/RLS/schema remain unchanged. The no-negative-inventory guard is a bounded catalog/derived-stock check, not evidence of fully reconciled warehouse reservations. User authenticated on-site correction acceptance OPEN. Do not merge without tests.
205 -
206 -### 2026-10-14 Owner-approved purchase correction — PR #126 MERGED / EXACT-SHA QA + PAGES VERIFIED
207 -- **Owner-approved execution:** requested in-system view after sale/manual pilot correction, and continuation toward more editable finalized documents. Latest shipped **purchase invoice** corrective workflow merges [PR #126](https://github.com/davoodmehraban89/Factor-easy/pull/126) to protected `main=07de4f974916180399d40b0064322a9480748cdf`. New purchase rows appear under **حسابداری ← مدیریت اسناد** and in purchase register; posted→reversed with posted compensating journal and a separate uniquely numbered/linked editable draft→edit→explicit repost. Original voucher/lines and original purchase record are kept immutable. Cancel posted purchase by balancing reversal; physical delete only for never-posted drafts. No existing production financial records were converted on release.
208 -- **Scope verification:** `js/purchases.js` source/voucher matching, owner+company, open fiscal year, payment-linked and stock availability guards; `js/accounting.js` removes reversed/correction-draft purchases from derived stock and project cost calculations but maintains legacy unlinked accounting semantics; `js/payments.js` allocates only to posted purchase invoices; `js/journal-ui.js` and `js/document-management.js` central purchase UX. Original new purchase creation remains auto-posted, while corrective drafts require explicit repost.
209 -- **Verified PR head `dfdb8221404b440e1bc9d8a148786f3a386801e9`:** Quality `38517172479` SUCCESS, static job `115698467172` **112/112 actual Chromium PASS (2.3m)** including two new purchase correction, inventory/payment-denial/cancellation scenarios, accounting Golden PASS, all three disposable PostgreSQL jobs SUCCESS; Security `38517172309` SUCCESS. Initial QA for prior commit failed **one unrelated transient CSS transition**: light-mode button background luminance sampled mid-animation (0.456 below >0.5), whereas purchase scenarios PASSED; fix made test await steady-state target luminance while preserving existing contrast/luminance assertions; full retest PASS.
210 -- **Protected-main exact-runtime-SHA `07de4f974916180399d40b0064322a9480748cdf`:** Quality **`38517528253` SUCCESS**, Security **`38517528297` SUCCESS**, Release Gate **`38517811727` SUCCESS**, gated Pages **`38517838093` SUCCESS**. Duplicate release `38517673640` CANCELLED, Pages `38517826545` SKIPPED; not counted as successful gates. Browser session on owner's affected ISP **NOT VERIFIED**; workflow success ≠ authenticated owner acceptance.
211 -- **Still OPEN:** receipts/payments and expense/income source corrections, taxpayer-submitted documents, linked bank/warehouse allocations beyond bounded guards, legacy chartless records and closed fiscal years; two-user adversarial permission tests, production correction atomicity/reload and owner confirmation. Global 'all documents' request is partially implemented only; no bulk unposting or physical deletion of posted evidence. F0-01 slow startup remains separately OPEN.
212 -- **Security/cost:** no production SQL DDL/DML, Auth/RLS/grant/role changes, external messaging, paid resource, existing posted ledger rewrite or live financial test transaction. Version rollback by reverting the targeted PR; real user reversal history, once created in future, is immutable and cannot be erased by reverting UI.
213 -
214 -### 2026-10-14 Owner UX correction — SAME visible document during pilot amendment — STARTED
215 -- **Exact latest owner instruction:** an employee clicks «اصلاح» on an existing finalized sales or purchase document and immediately edits **that same visible document, number, form and print view**. Employee must NOT see a "new invoice", correction suffix/ID or special bookkeeping messages; internal journal history remains with compensating reversal and properly posted amended transaction, never physical rewrite of historical accounting lines. Browser cancellation/no-op must NOT create a compensating entry. Save should complete amendment and maintain a single current visible document. Scope follows owner-approved sale/purchase and manual journal workflows where safe; no automatically unposting all existing documents.
216 -- **Starting verified live main** `d4d9e6df34f67c5f80b51daa4bb6e5512be31a8a`, protected main Quality `38518349856`, Security `38518349912`, Release Gate `38518625874`, Pages `38518677412` all SUCCESS. Current visible sale/purchase correction engines create separate physical source rows with `correctsInvoiceId` / `correctsPurchaseId` and internal numbered suffix; existing UI currently exposes these technical source versions. New user-directed correction supersedes that UX.
217 -- **Intended implementation:** change posted edit entry to in-place form prefill with deferred mutation until SAVE, use existing reversal/source-version safeguards behind the interface and invisible public history folding (one current visible version with original displayed number). Old source row and financial posting stay queryable in accounting audit. Receipt/payment allocations, external tax documents, locked periods and legacy unlinked sources remain hold cases. When full server transaction atomicity cannot be proven, fail closed and never present success before server acknowledgment; tests include open-and-cancel zero write, save+reopen, print same number, old history retained, balanced ledger, no duplicate visible rows after reload.
218 -- **No production user financial rows or Auth/RLS/SQL/schema touched; no new paid resources.** Build on isolated branch, PR-head Chromium/Golden/3 disposable PG/CodeQL, exact-main gated Pages; user acceptance remains distinct from CI.
219 -
220 -### 2026-10-14 Same-document correction UX implementation checkpoint — PR QA PENDING
221 -- **Implemented on isolated branch:** `js/invoices.js` uses `invoiceVisibleRecords` / `invoiceVisibleNumber` to fold internal version chain and show one active business invoice under the original number; `beginInvoiceAmendment` opens the existing posted invoice's **same edit form** with zero accounting mutations until Save. Save privately creates linked compensating posting and corrected source, persists edited data, re-posts and confirms server sync. `js/purchases.js` implements same in-form deferred purchase correction, one logical purchase record and original supplier number, while preserving payment/stock/period restrictions. `js/document-management.js` renders one sale and purchase row per logical invoice, and `js/print.js` prints corrected sale content with original number; purchase print follows current active revision and original supplier number. Existing journal audit displays original/reversal/new source-linked postings.
222 -- **No user-visible correction suffix, new invoice message or internal journal prompt** on normal posted→edit form workflow; editing can be cancelled without reversal. Original source data and posted voucher/lines remain physically unchanged. This design still stores internal technical source revisions, distinct from a user-visible business document ID; genuine single-row storage requires a separately approved schema redesign.
223 -- **Automated test coverage added:** 2 browser journeys for posted sale and purchase: click same document→cancel=no write→reopen→edit→single Save→internal reversal/repost→single visible item, same printed number, original transaction unchanged, reload consistency. **5/5 V8 syntax PASS**. Full Chromium/Golden/3 DB/CodeQL and exact-main Pages: PENDING; do not merge if any gate fails.
224 -- **Caveats:** source amendment is currently a multi-step application sync (not a server transaction) and waits for acknowledged stages; fail closed on sync trouble and do not retry blindly. Do not edit production historical customer records for testing; owner sign-in & UI acceptance remain OPEN. Payment/expense/tax source families remain unimplemented.
225 -
226 -### 2026-10-14 Same-document sales/purchase amendments — RELEASED PR #128 / EXACT SHA VERIFIED / OWNER ACCEPTANCE OPEN
227 -- **Owner UX contract:** Click «اصلاح فاکتور» on an already-posted sale/purchase to open the same invoice form, with its original business number. No technical correction-number, separate new invoice or reversal confirmation is shown to employees; cancelling does not post/reverse anything. Saving internally preserves the initial immutable voucher and source, records a linked compensating reversal and amended voucher/source, waits for server synchronization, and presents one current logical business invoice in manager/list/print. The technical source revisions remain visible for authorized accounting audit. Historical legacy user-issued correction drafts are still editable with their internal IDs preserved.
228 -- **Merged source:** [PR #128](https://github.com/davoodmehraban89/Factor-easy/pull/128) squash-merged protected main **635db7de4e71143fd167539780731f9277e20da0**. Updated js/invoices.js, js/purchases.js, js/document-management.js, js/print.js, scripts/accounting-document-workflow.spec.js. Pre-implementation scope + checkpoint committed to this file on isolated PR branch.
229 -- **Feature PR head:** **faeae40835631c08da12c6145913419549f1c6ed**. Quality **38522695691 SUCCESS**, static job **114/114 actual Chromium PASS**, Golden accounting PASS, three disposable PostgreSQL jobs SUCCESS. Security **38522695697 SUCCESS**. Earlier intermediate test runs at prior heads failed regression checks and were corrected/retested; do not count earlier failure as acceptance.
230 -- **Exact released main SHA:** Quality **38523130482 SUCCESS**, Security **38523130453 SUCCESS**, Release Gate **38523454291 SUCCESS**, gated Pages **38523518579 SUCCESS**. Duplicate Release **38523282456 CANCELLED** and Pages **38523502557 SKIPPED**, not counted as passes. Gated Pages attests workflow publishing; owner-authenticated real ISP/login/finance browser test not yet verified.
231 -- **Financial/operational limits:** Existing live customer financial records, permissions, RLS, roles, schema, Stripe, SMS and production DB rows were not modified by this source release. Sale/purchase historical accounting remains immutable. This is an application-level linked revision workflow using multiple sync stages, not independently verified as one server-side atomic amendment transaction; if a stage loses server confirmation, recovery must inspect state before retry. Closed periods, settled allocations, submitted tax invoices and historical unlinked vouchers still fail closed. Manual journal, payment/receipt, expense/income, taxpayer and multi-tenant concurrent correction acceptance remain separate tasks. F0-01 slow real owner sign-in still open.
232 -- **User-visible acceptance next:** In browser, refresh site, open posted purchase/sale, select اصلاح فاکتور, verify original number and edit form; cancel = zero posting, then authorized disposable test edit/save/print yields one visible record and same number after reload, while auditing all linked vouchers. Never use actual production business financial records solely as test fixtures.
233 -
234 -### 2026-10-14 Owner: continue Finora development — P0 treasury receipt/payment amendment slice OPEN
235 -- **Owner latest instruction:** «ادامه کار توسعه پیش ببر». Same-document sale/purchase UX PR #128 has been released; prior auth startup F0-01 still OPEN/deferred, no owner-authenticated acceptance claimed. Work on next independent Phase 3 treasury source corrections, preserving original document in employee view, without adding technical revision rows or changing posted accounting.
236 -- **Read-only baseline:** protected `main=b4d5da725a68af6c2a534422d3de85c13bf17b4d`; exact-main Quality `38524072782`, Security `38524072853`, Release `38524404953` and Pages `38524466785` all SUCCESS. Supabase `hcsixhqbyuhpshfwqpjx` ACTIVE_HEALTHY. This status is CI/provider metadata, not a customer login or genuine bank transfer test.
237 -- **Confirmed source problem:** `js/payments.js` posts new receipt/payment entries via `jePostSourceRecord`, but `editPayment` on a linked posted source reaches `jeGuardSourceMutation` and blocks saving. `deletePayment` likewise guards immutable journal; project cash totals and invoice outstanding currently aggregate raw payment rows, which would double count additive revisions unless filtered. `js/journal-engine.js` only allows posted historical correction through balanced compensating reversal; old source and voucher must remain immutable.
238 -- **First narrow authorized slice:** One **current visible** payment/receipt with same reference/date/form, backend correction version chain; only `cash`, `bank`, `card` postings **without** invoice allocation, cheque instrument or external reconciliation link. Preserve original direction, counterparty/company/project; allow changing amount/method/reference/note, creating no financial event on Open/Cancel. On Save, validate open fiscal year, current posted source, operator company/permission, source linkage and correction lineage; only then create linked balanced reversal and new posted source/ledger. Fold past revisions in `renderPayments`, derived cash/project totals and any allocated payment aggregates; visible delete of posted record must mean auditable reversal, not physical deletion. Deny or hold linked invoice/cheque and legacy unlinked records until separate reconciliation tests. No third-party banking action or external SMS.
239 -- **Required tests:** isolated browser mock with synthetic user/company and payment: open+cancel zero ledger writes; revise→reversal→new balanced posted voucher→same visible row after reload; original posted lines/metadata untouched; treasury totals count current revision once; reject allocated or cheque; fiscal-year lock; double-click/idempotency; aborted sync fail-closed and no duplicate blind retry. Existing Chromium Golden accounting and 3 disposable PostgreSQL, Security/CodeQL, exact main Release+Pages gates. No production financial data writes, schema/RLS/role/Auth changes, new paid costs. If tests reveal unsatisfied integrity, do not merge.
240 -- **Owner acceptance:** native browser authenticated test still OPEN. Rollback targeted code PR; legitimate future financial reversals remain historical and cannot be destroyed by reverting code.
241 -
242 -### 2026-10-14 Treasury correction implementation — 5/5 syntax PASS, Chromium+Golden+DB+Security PENDING
243 -- **Delivered on isolated branch:** `js/payments.js` adds `paymentPostingStatus`, `paymentCurrentVisible`, `paymentVisibleRecords`, `paymentEffectiveRecords` and `paymentAmendPosted` / `paymentCancelPosted`. A posted unallocated non-cheque cash/card/bank receipt/payment opens in **its original form** with unchanged reference/date/contact/direction and no journal write on open/cancel. On Save, it validates permissions, active company, open fiscal year, source-voucher posting and immutable contact/direction/invoice allocation, then **synchronously stages** balanced original-voucher reversal and corrected posted source with a new internal revision before the first async boundary. Debounced `finora_sync_records` sends the resulting diff as one batch and a server ack is required before employee success. A synchronous exception restores local journal/source/profile staging before sync. Cancel only reverses the internal accounting, clearly warning it **does not** undo actual bank/card movement.
244 -- **Employee UX:** central `حسابداری ← مدیریت اسناد` treasury table in `js/journal-ui.js` and `js/document-management.js` lists one current visible receipt/payment and routes «اصلاح» directly to `view-payments` existing form; earlier source versions remain in accounting audit. `js/payments.js` treasury list also folds technical rows; `invoiceOutstanding` / `purchaseOutstanding` count effective current settled records only; `js/accounting.js` project cash totals exclude reversed/historical versions and retain legacy unlinked treatment.
245 -- **Safety boundary:** only **unallocated cash/card/bank** receipt/payment documents with currently posted canonical vouchers. Cheques, invoice-linked settlement, historical unlinked, locked fiscal years, cross-company and different-party/direction edits fail closed. Do not allow actual banking cancellation from local accounting UI; real bank/cheque movements require external reconciliation. No production financial rows altered, and no schema/RLS/Auth/role or paid service change.
246 -- **Tests authored:** four new `scripts/accounting-document-workflow.spec.js` isolated real-DOM scenarios: employee central-manager → same form → cancel=no writes; amendment → original journal reversed + balancing compensator + new posting in **one server diff** with one visible row, same reference, old lines unchanged, reload; denial for cheque, invoice-linked and fiscal lock; cancellation keeps original history; simulated one-RPC network failure produces no partial server commit and no false UI success. Syntax 5/5 PASS on actual branch files; **real browser/Golden/three disposable PostgreSQL/Security PR-head and exact-main release NOT VERIFIED at this checkpoint**. Fail CI → fix/retest, never release red.
247 -- **Remaining risk:** client-side multi-record staging uses existing shared sync RPC and auto-retry; single-call SQL atomicity, lost-ack retry behavior and concurrency cannot be considered owner-accepted solely from synthetic browser tests. Full integrated receipt→invoice settlement/cheque/bank reconciliation and independent authorized two-user tests remain Phase 3/Phase 5 dependencies. Owner live acceptance open; original Phase 0 startup F0-01 open.
248 -
249 -### 2026-10-14 Phase 3 treasury source correction — PR #131 RELEASED / EXACT-SHA GATES PASS / OWNER ACCEPTANCE OPEN
250 -- **Delivered and shipped:** PR [#131](https://github.com/davoodmehraban89/Factor-easy/pull/131) merged to protected **main=e32a540b863d7931afefc140ed3417065b9a3d01**. New owner-approved bounded UX under `حسابداری ← مدیریت اسناد` and native `دریافت و پرداخت` form: employee sees one effective posted receipt/payment, opens existing form for amount/method (cash, card, bank), reference and note editing, with no reversal on open/cancel. On Save, original source and posted accounting lines stay immutable; one compensating journal and one new balanced posting with linked internal source revision are staged synchronously and sent in one RPC diff. Posted cancellation creates only an auditable accounting reversal; **does not reverse an actual bank/card transfer**. Invoice outstanding and project cash summaries skip reversed prior physical revisions; legacy unlinked history retains separate review handling.
251 -- **Mandatory limitations:** corrections only for **unallocated non-cheque** posted canonical receipts/payments within operator's company and open fiscal year. Invoice-linked settlements, cheques, bank reconciliation, noncurrent/legacy vouchers, cross-party/direction changes fail closed. Correction does not authorize real bank operations, automatic historical ledger bulk changes or financial DDL; the broader Phase 3 and fully authenticated owner acceptance remain open. F0-01 login startup slowness remains open/deferred.
252 -- **Exact PR head=68d9c99368f17cbd81ae77dc3f98971e07e4123b:** GitHub Quality **38528960651 SUCCESS**, static job **115735923478** **117/117 Playwright Chromium PASS** (including three newly authored treasury test cases; fourth item cancellation included in guarded case), accounting Golden sale→receipt→purchase→payment→expense/income→reversal→statements PASS, three disposable PostgreSQL jobs `115735923279`, `115735923290`, `115735923452` SUCCESS; Security **38528960665 SUCCESS** with CodeQL/release-safety and dependency review SKIPPED (not passed).
253 -- **Exact protected main=e32a540b863d7931afefc140ed3417065b9a3d01:** Quality **38529415899 SUCCESS**, Security **38529415779 SUCCESS**, Release Gate **38529791374 SUCCESS**, gated Pages **38529861751 SUCCESS**. Superseded Release `38529592570` CANCELLED and Pages `38529842842` SKIPPED, not classified as success. This proves release workflow, **not** user ISP login/customer-document UI acceptance.
254 -- **Independent live backend review:** `pg_get_functiondef(public.finora_sync_records)` shows both 2-param and 3-param overloads are PostgreSQL `plpgsql` routines without `EXCEPTION WHEN` partial-success handling, using transaction-scoped upsert/deletes. The browser test confirmed one RPC call for combined reversal+new posted source and no partial server writes on a simulated failed RPC. **Lost-response retries, concurrency, true bank statement reconciliation and offboarding two-user access remain unverified**; no promise of real-world exactly-once payment transfer semantics. Supabase `hcsixhqbyuhpshfwqpjx` ACTIVE_HEALTHY; no production financial rows, grants, roles, Auth/RLS/schema, vendor/SMS or paid resources changed by PR.
255 -- **Next verified work:** owner authenticated disposable receipt/payment test (do not use actual bank entries) then controlled separate slices for **expense/income** source correction and **allocated receipts/cheques** after complete settlement/treasury reconciliation. Maintain immutable original accounting and single visible employee-facing document. No owner acceptance claimed yet.
256 -
257 -### 2026-10-14 Owner regression — invoice/purchase listings must obey active Settings company — STARTED
258 -- **New owner request:** a user belonging to multiple companies must see **only invoices for the company currently selected under Settings**, not combined documents from other companies. Do not delete/migrate historical data. Changing default company must immediately update displayed register. This applies to invoice archive, purchase register, central document management, and must not be bypassed by a stale 'show all companies' dropdown. Existing financial entries and source correction chains must remain intact.
259 -- **Verified starting baseline:** protected main `c5a1a93dc13f1cf39dc55d0a47a75a35d7ef50c5`, `AGENTS.md` plus full `PROJECT_STATE.md` read, live existing invoices code: `renderInvoices` chooses `#filter-invoice-company` and defaults to ALL; `renderCompanies` reinstalls **نمایش همه شرکت‌ها** on each render; `purchaseVisibleRecords` returns all owners' purchases without company scoping. Central manager already filters by `afCompanyId`, but must be tested with both companies. `setDefaultCompany` calls `refreshAllSurfaces` and renders immediately.
260 -- **Fix contract:** derive active company only from owned Settings `default_company_id` or owned first company fallback `afCompanyId` (do not trust unowned arbitrary ID), and **fail closed** when none selected. Remove the cross-company selection from invoice archive, synchronize invoicing seller header to active setting, restrict visible invoice/purchase logical leaf records and direct edit/print entry where necessary, maintain separate original/revision chain per company. Reset any in-progress edited document on company switch to prevent accidental cross-company writes. No RLS/schema/Auth grants/data changes.
261 -- **Acceptance:** isolated two-company authenticated browser fixture showing same user, different sales and purchases; settings switch company A→B→A refreshes company-specific invoice archive and central manager and purchase list immediately, no 'ALL' escape; switching during edit does not permit cross-company invoice writes; legacy missing-company record held for reconciliation. Full Playwright Chromium/Golden/3 disposable DB and CodeQL release on exact SHA; owner authenticated browser acceptance remains independent/open.
262 -- **Rollback:** revert isolated UI/data-filter PR. No live production accounting records mutated.
263 -
264 -### 2026-10-14 Active Settings company for invoice visibility — IMPLEMENTED ON PR BRANCH / QA PENDING
265 -- **Regression reproduced from main:** `renderCompanies` installed `نمایش همه شرکت‌ها` and `renderInvoices` obeyed that selector, leaking all user-owned companies into the same invoice archive; `purchaseVisibleRecords` returned the owner's whole purchase store without company filtering. No evidence of cross-account RLS bypass: this is a **same-user, multi-company UI scope regression**.
266 -- **Code changed (isolated only):** `js/companies.js` now restricts both invoice seller/header and archive-company selectors to the **sole active company chosen in Settings** (disabled selectors, no ALL), validates company ownership on `setDefaultCompany`, closes any in-flight sales/purchase edits before switching, refreshes document manager and topbar. `js/invoices.js` and `js/purchases.js` fold original/correction versions and **only expose records with companyId === active owned company**, never unassigned records when another company is active; direct stale ID edit/save and print are guarded by active company; `js/print.js` denies stale off-company sale print. Other tenant/company business rows remain unchanged in cloud storage and accounting history. No DB/Auth/RLS/grant migrations.
267 -- **Real-DOM regression authored:** an isolated two-company one-user fixture has separate sale and purchase draft rows plus an unassigned legacy invoice. Check selected Settings company A restricts sale archive, purchase register, central manager, seller header; NO `ALL` selection; Settings B switches all three lists immediately with no reload and excludes A/legacy; off-company direct edit stays denied; switching company during an edit clears the draft context; switching back and app reload preserve separation and both companies' source rows.
268 -- **Verification at checkpoint:** each changed JavaScript file V8-parse and browser test compile are to be checked before PR; exact PR-head Quality, Chromium, Golden accounting, three PostgreSQL databases and Security are PENDING. Do not merge until green. Phase 0 owner affected-ISP login and real authenticated user multi-company acceptance remain OPEN. Rollback by revert scoped code PR.
269 -
270 -## Current change ledger
271 -| 2026-10-07 | Owner requested accounting/product usability refinement from live screenshots: automatic non-user-entered floating-detail codes, contextual in-product guides (especially accounting/chart/dimensions), remove duplicate product internal tax ID and use product code as internal item ID, strengthen in-control product/person search, introduce hierarchical product group/subgroup coding with deterministic 6-digit product codes, and keep sale/purchase commercial-document workspace layout stable while only semantic fields change. | **IMPLEMENTED / LOCAL VERIFICATION PASSED / CI PENDING** | Baseline main = `7e58c75f7d754f378d94ca3f356c1ae580aa7ee3`. Automatic dimension type/value codes, contextual guides, product-code-as-internal-ID, normalized multi-token search, and additive six-digit product coding implemented. Existing historical codes preserved. Commercial sale/purchase workspaces now share a stable `صدور سند تجاری` header/actions layout; duplicate purchase sidebar injection removed; the public selector is the single document-type selector and the legacy internal invoice-kind control is hidden. Local syntax/static/commerce/UX/accounting phases 2–6/Golden checks passed; protected-branch CI remains pending. |
272 -
273 -| Date | Request / decision | Status | Evidence / next action |
274 -| 2026-10-11 | Owner supplied live invoice screenshots: contact/seller combobox correctly shows choices, but invoice product/service combobox shows no known products and typed `ها` does not find existing `هارد`. Requested remote-desktop verified repair and screenshot with `بلوک`/`سیمان` suggestions. | **MERGED / GATED PAGES DEPLOYED / REMOTE DOM VERIFIED / OWNER-AUTHENTICATED SESSION PENDING** | Baseline `b1a35fdc1df71c46c287bec47be54fa6e8641428`. Scope `js/ux-hardening-r2.js`, `index.html` cache version, regression browser tests; investigate stale initial invoice row product options created before Supabase sync, preserve selected invoice product/quantity/price/history, ensure complete suggestions and Persian normalization. Negative tests for absent data, no cross-tenant exposure, selection and price/unit update; remote Playwright screenshot; gated CI. No Supabase schema/auth/RLS/roles, no financial data edits. Rollback: revert product-search PR. |
275 -|---|---|---|---|
276 -| 2026-10-07 | Owner requested an audit of all changes since the last shared verified baseline, assessment of the supplied accounting/product/search/invoice-layout issues, and a remediation plan before implementation. Owner offered a remote PC if useful; use the current environment for repository/database review because no direct remote-desktop control is exposed. | **AUDIT IN PROGRESS / NO PRODUCT OR DATABASE MUTATION** | Pinned main `7e58c75f7d754f378d94ca3f356c1ae580aa7ee3`, seven commits after `dfaa4d65918ea3bca14be2c4737af734c9328083`. Quality `37646679015` static job `112879152160` logs show 60/60 controlled real-DOM tests and accounting/Golden PASS; Security `37646679026`, Release `37646878995`, exact-SHA Pages `37646973160` succeeded. Live Supabase: 80 migrations, newest `20261007165208 phone_identity_profile`; public RLS 18/18, private RLS 3/10 with zero anon/authenticated CRUD on all ten private tables. Production identity SQL is archived on open PR #58, absent from main; do not reapply it. PR #59 contains unmerged accounting/product/guidance work and must be reviewed separately from deployed behavior. Audit findings and test boundaries follow in the audit report; no old unfinished arithmetic patch is being published. |
277 -| 2026-10-07 | Owner supplied live screenshots and requested immediate invoice-workspace cleanup: remove redundant top workflow buttons (sale/purchase/pre-invoice) and redundant sale/purchase shortcut buttons beside the document heading; keep Excel import + sample download; keep only the commercial-document type selector with sale, purchase, sales pre-invoice, sales progress statement; replace the separate search-above-select UX with a single in-control searchable product selector that matches product code/name/specification and numeric fragments. | **COMPLETED / MERGED / RELEASE VERIFIED** | Merged to `main` as `6e7fa6e861ebdd89e5712ed7d64bb5fe3128f307`. PR #54 Quality `37644940991` and Security `37644940960` SUCCESS; inspected static logs confirm commercial + UX-R2 + Golden PASS and **60/60 Real-DOM tests**. Main Quality `37645195629`, Security `37645195698`, Release gate `37645411897`, exact gated Pages `37645464262` all SUCCESS. Live `factoreasy.ir` no longer contains the sale/purchase heading shortcuts; live UX bundle contains `finora-combobox-input` and no `finora-select-search`. Four-value document selector and Excel import/sample controls retained. No schema/RLS/auth/role/data mutation. |
278 -| 2026-10-07 | Owner requested the next integrated UX/commerce/settings hardening slice: reuse global projects from counterparty screens instead of per-contact duplicate project records; searchable large selectors across product/contact/project/account lists; refresh sale/purchase default prices after master-data edits and latest transactions; purchase-invoice UI parity with sales while preserving purchase semantics; modal/close/Escape/Enter/button real behavior QA; active-company factory reset for authorized company admin with multi-step destructive warnings; richer settings (hotkeys, quick-zero shortcuts, light/dark/auto theme, data statistics, backup/restore); configurable Excel sample/import/export field selection; and consistent Persian-digit rendering in invoice UI/print. | **MERGED / CONTROLLED DOM + ACCOUNTING VERIFIED** | Baseline `main` = `b88f0f35902cc99ebd09c9fffcd5700ce759ac69`. Implemented global project reuse/attach from counterparties, large-list search, product price-default refresh from latest posted sale/purchase, purchase project/accounting separation and commerce-switch parity, Escape/modal + configurable Ctrl+S, Ctrl+Enter, Enter-save and quick-zero hotkeys, light/dark/auto theme, active-company stats, configurable Excel templates/exports, authorized-manager active-company factory reset that skips ambiguous multi-company legacy rows, and Persian-digit normalization in isolated invoice print. Local syntax, quality, commercial, UX-R2, accounting phases 2-6 and Golden PASS; `git diff --check` PASS. Merged as `6dae96fac9bd5c513209932ae777f12bd8bd95a6`. Current descendant main Quality `37646679015`, inspected job `112879152160`, passes 60/60 controlled DOM and accounting/Golden. These tests do not establish production reset safety; production reset not executed. Settings reference image still not supplied, so exact visual parity to that future image is NOT VERIFIED. |
279 -| 2026-10-07 | Owner directed autonomous continuation to finish the remaining Finora development backlog, starting with the agreed P0 accounting core: extensible analytical/floating dimensions, journal UX, context-driven posting rules and end-to-end accounting integration, then continue through remaining verified blockers without routine pauses. | **MERGED / CONTROLLED DOM + ACCOUNTING VERIFIED** | P0 adds independent COST_CENTER analytics, role-driven dimension compatibility without rewriting posted history, strict per-fiscal-year journal numbers, voucher type/reference, generic dimension-to-legacy compatibility fields, independent project vs cost-center posting, copy-to-draft, account search, row copy, and live debit/credit/difference totals. Implementation head `de2c58a52cb36bfe54eeb3c90985cd6c94cae812`; PR #52 Quality `37539607474` SUCCESS including Accounting P0 invariant step and Real DOM smoke, Security `37539607498` SUCCESS. Local quality + phases 2-6 + Golden PASS. No schema/RLS/auth/role/destructive production data change. Merged as `b88f0f35902cc99ebd09c9fffcd5700ce759ac69`; descendant main `7e58c75` passed inspected 60-test DOM + accounting/Golden and exact-SHA release/deploy. This supersedes the old merge-pending checkpoint. |
280 -| 2026-10-07 | Owner authorized implementation to completion of the researched commerce/accounting redesign: one invoice workspace in Commerce, context-driven reusable floating counterparties, purchase parity (quick supplier + Excel template), and selected-company factory reset that preserves the company. | **COMPLETED / MERGED / RELEASE VERIFIED** | Merged to `main` as `5ae9117c776a33a3cc39775c68ad0c10e13b9c44`. Push Quality run `37529032595` = success; Security `37529032630` = success; Release gate `37529230156` = success; exact gated Pages deployment `37529272934` = success and deployed the same SHA to `http://factoreasy.ir/`. Live HTML loads `js/commercial-rnd.js?v=20261007-commerce-r1`; live bundle contains factory-reset guard, quick supplier, and Excel-template code. PR Real-DOM/accounting gates were green. No production reset and no schema/RLS/auth/role mutation. |
281 -| 2026-10-04 | Continue the recorded chart and taxpayer-reference correction after interrupted sessions. | **MERGED / CONTROLLED DOM + ACCOUNTING VERIFIED / GATED PAGES DEPLOYED** | 62 additive chart rows across all eight templates, including non-current assets and contra accounts; explicit preview/apply for compatible existing templates preserves old accounts and posted history. Actual supplied tax logo and reference-aligned totals/settlement layout; image-ready printing. Local chart invariants and 3 chart DOM tests passed; 2 print DOM tests plus single-page landscape PDF passed; accounting phases 2–6 and Golden passed. Full local DOM: 52/53 passed, Pages artifact failed on external ERR_CERT_AUTHORITY_INVALID; no gate weakened. PR #47 implementation SHA `db9e7f2375e914bfa9e78932e63222af68c4c9d3`: Quality `37170173739` and Security `37170173740` passed; inspected static job `111341365938` confirms 53/53 real-DOM tests, chart invariants, phases 2–6 and Golden passed, including Pages artifact. All three disposable DB jobs passed. Production recheck on 2026-10-04: 79 migrations, latest `20261003033540`; public RLS 18/18, private 3/10. See docs/CHART_OF_ACCOUNTS_RESEARCH_2026-10-03.md and docs/CHART_TAXPAYER_VERIFICATION_2026-10-03.md. No schema/RLS/auth/role or production record mutation. |
282 -| 2026-10-03 | Owner requested continuation of unfinished work, deep Iranian chart-of-accounts research/completion (especially missing non-current assets), and exact taxpayer invoice layout matching the first supplied reference with the supplied official logo. | **REQUEST RECORDED / IMPLEMENTATION NOT VERIFIED** | PR #46 merged as `3085dce9d8f457e61aca6676f872737418116e7a`; Quality `37094979694`, Security `37094979835`; inspected job `111122956074`: 49 DOM tests and accounting gates passed. Live Supabase has 79 migrations including `20261003033540`; public RLS 18/18, private 3/10. Existing print exactness claim is superseded by owner-reported/reference-visible differences. Preserve historical account IDs/codes/postings; no schema/RLS/auth/role changes authorized by this request. |
283 -| 2026-10-03 | Owner directed continuation after Wave 4 deployment; inspect post-merge verification and two-user/concurrency readiness. | **SAME-SHA RETRY PASSED / TIMEOUT ROOT CAUSE OPEN / TWO-USER PRODUCTION E2E BLOCKED** | Main `62da4cf24b5505d9dfe41b43acafa04af74c06c9`; Quality `37094021032` failed with 48/49 DOM passing and 30s timeout in `scripts/enterprise-org-ux.spec.js`; accounting and all disposable DB jobs passed. Security `37094021045` passed. Live Wave 4 version `20261003033540` remains present, public tables without RLS=0, organizations with two distinct active users=0. No test users or access changes authorized/performed. Same-SHA retry `37094021032` attempt 2 succeeded: job `111122578331` logs confirm 49/49 DOM and accounting phases 2–6 + Golden passed. No assertion, timeout or product-code changes. Timeout did not reproduce on retry; root cause remains NOT VERIFIED. |
284 -| 2026-10-03 | Owner explicitly approved applying archived Wave 4 migration (`بله تاییده`) and directed continuation after reconnecting GitHub. | **PRODUCTION APPLIED / READ-ONLY CONTRACTS VERIFIED / PRODUCTION E2E NOT VERIFIED** | Scope: only `20261002072000_request_wave4_operational_integrity.sql` on `hcsixhqbyuhpshfwqpjx`, including column/index/functions/EXECUTE grants. Baseline main `81bd9bf38e0b02e5baed8a3fa32a89a2b1345572`; SQL blob `7e644afd2387d328056356314ebfdeed272963ab`. Live preflight: migration absent, idempotency column absent, delegation rows=0, six-argument RPC present and seven-argument RPC absent. Exact SQL applied as `20261003033540 request_wave4_operational_integrity`; approval recorded before apply in `ed90934f057e85bfd6bd0286bdf309d9c2ded9f7`. Other sensitive changes remain approval-gated. |
285 -| 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. |
286 -| 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. |
287 -| 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. |
288 -| 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. |
289 -| 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. |
290 -| 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. |
291 -| 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. |
292 -| 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. |
293 -| 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. |
294 -| 2026-10-02 | Gmail/GitHub failure review: latest Wave 5a Quality run failed only because the disposable PostgreSQL harness lacked Supabase roles `anon`/`authenticated`; Security latest run is green. | **TEST HARNESS VERIFIED** | Added the two no-login Supabase compatibility roles to the disposable identity DB bootstrap. Wave 5a identity DB gate passed on PR head and main Quality `36980655736`; the earlier failure was harness-only. |
295 -| 2026-10-02 | Second CI retest showed the safety-check regex itself was over-escaped. | **REGEX FIX VERIFIED** | Normalized regex literals to match the workflow labels/variable gate exactly; main Security `36980655725` passed Release/QA safety + CodeQL. |
296 -| 2026-10-02 | CI retest exposed a literal `\\n` introduced while editing the release-safety checker. | **TEST SYNTAX FIX VERIFIED** | Replaced the escaped text with a real newline; subsequent PR and main security checks passed. |
297 -| 2026-10-02 | Release-safety invariant initially rejected the explicit Dependency Graph availability gate. | **TEST CONTRACT VERIFIED** | Safety checker requires both properties: Dependency Review is conditional on `DEPENDENCY_GRAPH_ENABLED=true`, and remains fail-closed whenever enabled; main Security `36980655725` succeeded. |
298 -| 2026-10-02 | Wave 5a identity/signup/invitation bootstrap remediation (WS-01, F-121/F-122 and OTP bootstrap boundary). | **MERGED / PRODUCTION + CI VERIFIED** | PR #30 merged as `cfd15dcf51cf8b9085a5512ded497fe0363ae322`. Main Quality `36980655736` SUCCESS including identity disposable-DB + static/Real-DOM gates; Security `36980655725` SUCCESS. Production migration `20261002075156 identity_wave5a_bootstrap` applied to `hcsixhqbyuhpshfwqpjx`; live reconciliation confirms `search_path=''`, organization-bound trial creation, trigger present, `licenses_without_org=0`, duplicate organization licenses=0 and orphan memberships=0. Persistent two-real-user production E2E and offboarding cache/session purge remain NOT VERIFIED. |
299 -| 2026-10-02 | PR #29 exposed that Dependency Review now fails hard when GitHub Dependency Graph is disabled. | **CI BOUNDARY VERIFIED** | Security workflow runs Dependency Review only when repository variable `DEPENDENCY_GRAPH_ENABLED=true`; when enabled the action remains fail-closed. Main Security `36980655725` passed Release/QA safety + CodeQL; Dependency Review was skipped because the graph remains unavailable. |
300 -| 2026-10-02 | Owner granted standing approval to continue in-scope project work without repeated confirmation. | **WAVE 4B PRODUCTION APPLIED + VERIFIED** | Supabase production `hcsixhqbyuhpshfwqpjx` recorded `request_wave4b_scheduler_outbox_delivery` as migration version `20261002072526`. Read-only reconciliation confirmed scheduler tables, outbox delivery columns, and all five Wave 4b RPC contracts exist. GitHub main `41aff95d11a66c67e2c64df3eac11a122f94dfd7`: Quality `36975968198`, Security `36975968108`, Release Gate `36976087514`, Deploy `36976115600` succeeded. Automatic external scheduling and D4c destination consumers remain NOT VERIFIED. |
301 -| 2026-10-02 | Wave 4b first disposable-DB run exposed an ambiguous PL/pgSQL test variable in the final replay assertion. | **TEST FIX APPLIED / RETEST PENDING** | Product migration executed through all scheduler/outbox assertions; failure was confined to the final test query where local variable `k` shadowed temp-table column `k`. Renamed/qualified the assertion; no production permission or state-machine rollback. |
302 -| 2026-10-02 | Owner said «ادامه بده» after Wave 4 F-420/F-421/F-422 merge. | **IMPLEMENTED ON BRANCH / CI PENDING** | Added server-clock five-minute scheduler slots, durable run/claim evidence, replay binding, skip-locked overdue claims, stable outbox destination command identity, lease claims, retry/backoff, dead-letter and idempotent authorized replay. D4c destination consumers remain disabled. Production migration is NOT APPLIED pending the schema-change gate. |
303 -| 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. |
304 -| 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. |
305 -| 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. |
306 -| 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`. |
307 -| 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. |
308 -| 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. |
309 -| 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. |
310 -| 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. |
311 -| 2026-10-01 | Owner authorized starting the canonical remediation pack after external full-system audit. | **WAVE 0 CLOSED** | Release/QA fail-open paths, exact-SHA promotion and Pages deployment ordering are now verified by positive and negative controls above. |
312 -| 2026-10-01 | Owner said «ادامه بده» after D3a handoff. | **D3B + D3C VERIFIED** | D3b visual editor/conditions/timeline and D3c SLA/delegation/outbox are production + disposable-DB + real-DOM verified. Remediation audit supersedes roadmap ordering. |
313 -| 2026-10-01 | Slice D3c — SLA/escalation, delegation/substitution, transactional outbox. | **IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + CI VERIFIED** | `js/request-workflow-d3c.js`; migrations `20261001235500`, `20261002000500`, `20261002001000`; Quality run `36917772952` all three jobs SUCCESS. Evidence: `docs/REQUEST_WORKFLOW_D3C_VERIFICATION.md`. |
314 -| 2026-10-01 | Slice D3b — visual workflow editor + conditions + timeline. | **IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + CI VERIFIED** | `js/request-workflow-d3b.js`; migration `20261001233000`; bounded predicate DSL, skipped-step evidence and authorized timeline RPC. Quality run `36915696611` all three jobs SUCCESS. Evidence: `docs/REQUEST_WORKFLOW_D3B_VERIFICATION.md`. |
315 -| 2026-10-01 | Slice D3a — sequential/parallel request workflow runtime. | **IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + CI VERIFIED** | Migrations `20261001230000`, `20261001230500`; private step/vote runtime, quorum semantics, capability checks, idempotent decisions and immutable evidence. Quality run `36913565943` all three jobs SUCCESS. |
316 -| 2026-10-01 | Slice D2 — request UI/read-model + legacy cutover. | **IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + CI VERIFIED** | `js/request-workflow-d2.js`; migrations `20261001223500`, `20261001224500`; Quality run `36912668369` all three jobs SUCCESS. Legacy source records remain preserved and imported rows traceable. |
317 -| 2026-10-01 | Slice D1 — requests/BPMS-lite server foundation. | **IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + CI VERIFIED** | Migrations `20261001204500`, `20261001205500`, `20261001210500`, `20261001211500`; Quality run `36910187257` all three jobs SUCCESS. |
318 -| 2026-10-01 | Office Slice C8 workflow policy/runtime. | **IMPLEMENTED / PRODUCTION + ADVERSARIAL + CONCURRENCY + REAL-DOM + SECURITY VERIFIED** | Immutable workflow evidence, pinned policy versions, capability-gated transitions, optimistic revision checks, idempotency, private runtime tables and SECURITY INVOKER public wrappers. |
319 -| 2026-10-01 | Owner reconfirmed autonomous GitHub + Supabase execution and free-tier-only development. | **ACTIVE OPERATING DIRECTIVE** | No repeated routine approval requests; no paid development resource. Preserve safety/cost boundaries. |
320 -| 2026-10-01 | Live QA: commerce/tax IDs/request builder/personnel/license/floating-detail coding. | **PARTIALLY IMPLEMENTED / FOLLOW-UPS OPEN** | Kardex/tax-ID/request/profile/license/floating-code work landed. Exact Taxpayer-System print layout owner reference is now available and has regression coverage. |
321 -| 2026-09-30—2026-10-01 | Office C1–C7, ELI-1–ELI-4, Slice A/B and accounting phases 1–6. | **VERIFIED WITH DOCUMENTED BOUNDARIES** | See required evidence; do not redo completed phases without verified regression evidence. |
322 -| 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 lifecycle/accounting/permissions/tests exist. |
323 -
324 -## Wave 0 checkpoint — CLOSED 2026-10-02
325 -- Manual QA no longer uses `continue-on-error`; live/all require credentials; live credential-bearing runs reject non-allowlisted origins before secrets are injected into the test step; authenticated browser origin is rechecked before/after login/navigation; menu click errors are no longer swallowed and each navigated item must change observable UI state.
326 -- QA evidence retention reduced to 3 days and screenshots changed to failure-only.
327 -- Security dependency review no longer uses `continue-on-error`. Security runs `scripts/release-safety-check.mjs` to prevent regression of Wave 0 code contracts.
328 -- Exact-SHA `Release gate` requires successful Quality + Security for the same SHA and explicitly checks `static-quality`, `c8-policy-database`, and `d1-request-database` before promotion.
329 -- Historical reproduction: Pages run `36922017645` for SHA `6b529647...` completed before Quality/Security, proving the old branch-deploy path was unsafe.
330 -- Negative control after `Protect main` + Pages source change: failing SHA `03561a33...` on PR #15 failed `static-quality`; merge was rejected; no Release gate or gated Pages deployment existed for that SHA.
331 -- Positive control on protected main SHA `150ff54d938a45b9a9b476f3a4a8fdabbb45d065`: Quality `36932956964` SUCCESS; Security `36932956877` SUCCESS; Release gate `36933115365` SUCCESS; `Deploy gated Pages` `36933151878` SUCCESS. The earlier Pages trigger `36933134567` was skipped, as designed, and no legacy dynamic branch deployment ran.
332 -- Wave 0 findings F-402/F-403/F-406/F-407/F-423/F-424 are closed at the verified GitHub/repository boundary.
333 -
334 -## Implemented foundations
335 -- Accounting phases 1–6: accepted high-assurance accounting foundation; posted history remains immutable and balanced.
336 -- Slice A/B + ELI-1–4: modular entitlements, tenant/RBAC, seats, delegated admin, reusable roles, secure invitations and organization UX.
337 -- Office C1–C8: registration/read evidence, referrals, archive/classification, numbering/templates, approvals/SLA, OCR provenance boundary and versioned correspondence workflow runtime.
338 -- Requests D1/D2: independent versioned request definitions/forms/workflows, pinned versions, idempotent create/transition, immutable evidence, server authorization, server-backed UI/read model and non-destructive legacy cutover.
339 -- Requests D3a: ordered sequential/parallel approval steps, quorum voting, per-step capability authorization and private runtime state.
340 -- Requests D3b: visual ordered-step editor, bounded server condition predicates, skipped-step evidence and authorized runtime timeline.
341 -- Requests D3c: step SLA/deadline/escalation evidence, explicit time-bounded delegation with provenance, and transactional approved-request outbox intents.
342 -
343 -## Invariants
344 -Posted accounting history is immutable and balanced; tenant isolation is enforced at the data boundary; commercial entitlement and member authorization are independent; UI hiding is never security; expired licenses are read-only; office numbering is server-atomic; private scans remain private; seat/company limits are server-enforced; delegated customer admins cannot mutate commercial license entitlements; invitation acceptance is authenticated/email-bound/seat-safe; raw invitation tokens are never persisted or audited; organization-unit parents cannot cross tenants or form cycles. Request type/workflow versions are immutable snapshots; request instances pin both versions; runtime mutation is server-authorized, idempotency/revision guarded and append-only evidence is retained. D2 legacy import is non-destructive/idempotent/traceable. D3a votes require distinct actors for parallel quorum. D3b conditions are bounded server-validated predicates and skipped results remain evidence. D3c delegation never impersonates the source actor, source capability is revalidated, SLA escalation appends evidence, and approved cross-module effects are queued transactionally rather than directly executed. Request workflow state never replaces C1 registration or C5 correspondence approval evidence.
345 -
346 -## Required evidence
347 -`docs/PHASE_1_REDESIGN_VERIFICATION.md` through `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/ELI_1_ENTERPRISE_LICENSE_VERIFICATION.md` through `docs/ELI_4_ENTERPRISE_ORGANIZATION_UX_VERIFICATION.md` · `docs/OFFICE_SLICE_C1_VERIFICATION.md` through `docs/OFFICE_SLICE_C8_RUNTIME_UI_VERIFICATION.md` · `docs/REQUEST_WORKFLOW_D2_CUTOVER_VERIFICATION.md` · `docs/REQUEST_WORKFLOW_D3A_VERIFICATION.md` · `docs/REQUEST_WORKFLOW_D3B_VERIFICATION.md` · `docs/REQUEST_WORKFLOW_D3C_VERIFICATION.md` · `docs/REQUEST_WORKFLOW_D4A_VERIFICATION.md` · `docs/PRODUCTION_RUNBOOK.md` · `supabase/migrations/` · `supabase/tests/request_d1_behavior.sql` · `supabase/tests/request_d2_legacy_behavior.sql` · `supabase/tests/request_d3a_workflow_behavior.sql` · `supabase/tests/request_d3b_condition_timeline.sql` · `supabase/tests/request_d3c_operations.sql`.
348 -
349 -## NOT VERIFIED / external boundary
350 -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.
351 -
352 -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; that drift was resolved on 2026-10-03 by approved migration `20261003033540`. 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.
353 -
354 -## Wave 4 production verification — 2026-10-03
355 -- Owner explicitly approved the archived SQL including schema/function/EXECUTE-grant changes. Applied successfully to `hcsixhqbyuhpshfwqpjx` as `20261003033540 request_wave4_operational_integrity` after recording approval in commit `ed90934f057e85bfd6bd0286bdf309d9c2ded9f7`.
356 -- Exact source: `supabase/migrations/20261002072000_request_wave4_operational_integrity.sql`, Git blob `7e644afd2387d328056356314ebfdeed272963ab`. No SQL modification or duplicate migration file introduced. Production version differs because the migration service assigns the application timestamp.
357 -- Live schema checks PASS: text idempotency column exists; key-length CHECK validated; actor-scoped unique index valid. Seven-argument public/private create RPCs exist; authenticated can execute new signatures and cannot execute old six-argument signatures; anon cannot execute either. Public wrapper is SECURITY INVOKER, private implementation remains guarded SECURITY DEFINER; empty search_path verified. Duplicate-intent and revoke audit-deduplication guards present.
358 -- Live BEGIN READ ONLY tests PASS: valid workflow accepted; normalized duplicate target/action rejected with expected error; unauthenticated delegation rejected with SQLSTATE 28000. Transaction rolled back. Delegation row count remained zero. No financial data mutation or user provisioning occurred. Public tables without RLS=0.
359 -- Security advisor unchanged: 3 private C8 no-policy INFO, 20 authenticated SECURITY DEFINER WARN, 1 disabled leaked-password-protection WARN. Existing remediation references remain below; no unrelated grants or Auth settings changed.
360 -- Baseline main `81bd9bf38e0b02e5baed8a3fa32a89a2b1345572`: Quality `36994542956`, Security `36994542874`, Release `36994665315`, Pages `36994730651` succeeded. Static job `110798133201` logs inspected: 49/49 controlled real-DOM tests and accounting phases 2–6 + Golden passed. Disposable D1 job `110798133021` logs inspected: exact Wave 4 migration and `supabase/tests/request_wave4_operational_integrity.sql` executed successfully with ON_ERROR_STOP. These are controlled/disposable tests, not authenticated production browser E2E.
361 -- VERIFIED boundary: missing migration deployed; structural, permission and read-only negative-control contracts pass. NOT VERIFIED: persistent two-real-user production browser E2E, real-user production delegation creation/replay/revocation, concurrent production overlap, and full historical SQL equivalence. No blanket product COMPLETED claim.
362 -
363 -## Historical reconciliation evidence — 2026-10-02 (Wave 4 absence resolved above)
364 -- 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.
365 -- 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.
366 -- 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.
367 -- 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.
368 -- 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 .
369 -- 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.
370 -- **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.**
371 -- 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.
372 -
373 -## Continuation checkpoint — 2026-10-03
374 -- Request recorded before retry in `f293b533a557b6af2168220608e1182b1e1a4083`. Compared `81bd9bf...62da4cf`: only PROJECT_STATE.md changed. Main Quality attempt 1 failed solely at enterprise-org-ux DOM test (30s); 48 others passed. No error-context artifact was retained in that run, so exact timeout phase/network cause cannot be established from available evidence.
375 -- Failed-job retry on the SAME SHA passed without any code/test/config change: run `37094021032` attempt 2, static-quality job `111122578331`, 49/49 DOM plus accounting invariants and Golden. Database jobs also succeeded. Do not call the intermittent timeout root cause fixed; next recurrence should retain trace/error-context for diagnosis. No blanket retry policy or weakened gate was added.
376 -- Read-only production readiness: migration `20261003033540` present; public tables without RLS=0; organizations with at least two distinct active member user IDs=0. Thus persistent same-tenant owner/non-owner browser E2E cannot run with the current membership state. No identities, memberships, capabilities or financial records were changed. Existing controlled DOM/disposable DB results are not a substitute for real authenticated production users.
377 -- Local psql/postgres/docker executables unavailable, so no new local two-session delegation concurrency test was run. Production concurrency remains NOT VERIFIED. Do not run disposable fixture seeding against production.
378 -
379 -## Exact next executable work
380 -Current priority (2026-10-07): finish the owner-requested audit and remediation plan before product implementation. The following Oct 4 checkpoint is historical; do not treat it as the current main head or as authorization to publish old unfinished work. Main and production diverge for the phone-identity change: production version `20261007165208` exists, while its SQL archive is on open PR #58. Assess open PR #59 against the new owner checklist before duplicating or integrating that work.
381 -
382 -Current owner-requested chart/taxpayer slice: PR #47 merged as `b2e1fbf89fb558fd9be1729dda875d3796e46721`. Main Quality `37170385857`, Security `37170385877`, Release `37170453444`, gated Pages `37170479829` all succeeded. Inspected main static job `111341993035`: 53/53 controlled real-DOM tests, chart invariants and Golden passed; all three disposable DB jobs passed. Final PR head `4619b5ed73f6e61084d6e111b7ab338e6c152ff5` also passed Quality `37170297853`, Security `37170297828`; logs from static job `111341738948` confirm 53 DOM tests. Existing compatible template companies use «پیش‌نمایش تکمیل کدینگ» then explicit apply; no live company was changed by the agent. Next: owner-context invoice/physical-print comparison and safe authorized two-user production verification; do not treat successful deployment as authenticated production E2E. Exact photographed-print parity, physical printer, authenticated production E2E, mixed-payment/multi-row taxpayer arithmetic remain NOT VERIFIED. Newly attached bootstrap files reference other repositories; attachments are context and do not change the selected Factor-easy repository. PR #46 is merged as `3085dce9d8f457e61aca6676f872737418116e7a`; live recheck on 2026-10-04: Quality `37126922824`, Security `37126922854`, Release `37127012080`, Pages `37127034198` succeeded. These previous-SHA runs do not verify the new implementation.
383 -
384 -0. Wave 4 deployment drift is resolved by production migration `20261003033540`; retain the production E2E/concurrency boundaries above. Next eligible verification is persistent legitimate two-user offboarding/delegation E2E with a safe authorized test scope. Further schema/RLS/auth/role changes require separate approval.
385 -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.
386 -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.
387 -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.
388 -
389 -## Live QA open items
390 -- Chart/taxpayer Oct 3 defects were partially resolved by merged PR #47: 62 additive chart rows include non-current assets, and the actual supplied logo replaces the generated logo. Compatible existing companies require explicit preview/apply. Universal chart suitability, exact photographed-print parity, physical printing, and mixed-payment/multi-row taxpayer arithmetic remain NOT VERIFIED; do not repeat the obsolete claim that non-current assets are absent from every current starter template.
391 -- Legacy request records are preserved for rollback/audit after D2; new request configuration/runtime must not be routed back through record-store writes.
392 -- Floating-detail defaults for new records: 8-digit semantic codes currently use slot/category/sequence (Branch `11xxxxxx`, Counterparty `21xxxxxx`, Project `31xxxxxx`); historical codes are not rewritten and account-chart coding stays independent.
393 -- Product/service deletion must continue to fail closed whenever operational references exist.
394 -
395 -- 2026-10-10 P0 owner request: universal inline searchable combobox for product, contact, seller/buyer, project, chart and contracts; full list on focus, instant narrowing over 1000 records, no separate search input; exactly one initial editable invoice line; require real-browser repeated regression before done. Branch fix/combobox-live-search, PR #60. NOT VERIFIED until browser and release checks pass.
396 -
397 -
398 -- 2026-10-10 local isolated QA evidence: 42 static/behavior check scripts PASS; 59/60 Playwright tests PASS against correct repo served on 4174, with the only initial Pages artifact test misrouted to an unrelated process on 4173; Pages artifact test rerun against correct _site/index.html on 4174 PASS (thus 60/60 separately). Five UX search/settings browser tests PASS. Scope caveat: exhaustive click-by-click all controls, 1000-option stress, production authenticated multi-user E2E and live deployment NOT VERIFIED. No production mutation.
399 -
400 -
401 -- 2026-10-10 production issue: index.html referenced unchanged old script query versions despite PR #60 changes; browser/CDN cache could keep stale JS. Cache-bust invoices.js and ux-hardening-r2.js for next gated Pages deployment. Verify exact deployed artifact and refresh user browser before claiming live success.
402 -
403 -
404 -## 2026-10-11 Iran-first accounting design and verification
405 -Owner approved Iranian accounting standards as primary, with future international extensibility. Design: docs/IRAN_FIRST_ACCOUNTING_DESIGN_2026-10-11.md. Added read-only finance integrity auditor and deterministic fixture test. Verified: golden accounting core, phase3 and phase6 behavior, auditor valid/invalid fixtures. Not verified: live invoice save/reload, production data, actual ERPNext/Odoo/Beancount integration, compliance certification. No schema or production data changes. Next: isolated invoice lifecycle tests, posting atomicity and RLS verification, expert review of Iranian standards.
406 -
407 -
408 -2026-10-11 follow-up: GitHub PR #64 Quality and Security workflows succeeded. New accounting audit fixture added to quality workflow. Isolated public invoice-save debug blocked by null currentUser fixture, so save/reload remains unverified (not a confirmed application defect).
409 -
410 -
411 -## 2026-10-11 Stripe sandbox integration probe (requested)
412 -Owner confirmed connected Stripe plugin and requested completion of sandbox invoice create/read and safe Finora integration probe. Scope: Stripe test/sandbox only, read-only production boundaries, no payments, no actual customer contact, no exposed API keys, no Supabase schema/auth/data mutations. Decision: implement and verify bounded standalone integration/tests; record actual API results and connection blockers before claiming completion.
413 -
414 -
415 -2026-10-11 verification checkpoint: Stripe connected plugin test account 'Finora ERP sandbox' (livemode=false): synthetic customer cus_VQ5jO0GvKcuiQd created without email/payment method; draft in_1UPFYbGnbcoujdbeXnuN3Jf0 created (auto_advance=false), invoice item amount 1250 USD minor units added; GET by ID and list both returned draft, total/subtotal/amount_due=1250, exactly one line. Initial send_invoice attempt without email was rejected, so no email was sent; successful draft uses charge_automatically without finalization. New scripts/stripe-sandbox-readonly.mjs is a server-only read-only sandbox guard with synthetic fixture and adversarial test integrated into Quality CI. Local tests PASS: new sandbox adapter, syntax 53 JS + 48 MJS, finance audit, golden accounting journey, git diff check. NO direct Finora backend Stripe API credentials available; no Finora UI/prod DB/schema/auth integration, no charges/ledger writes. Only ChatGPT plugin API access is live-verified. Next: PR Quality/Security CI, then owner-provided private restricted sandbox API key on trusted server and tenant/auth mapping approval for server deployment if desired.
416 -
417 -
418 -## 2026-10-11 Stripe actual Finora server connection preparation
419 -Owner requested implementation to continue autonomously and precise owner-only setup instructions if blocked. Verified live Supabase project hcsixhqbyuhpshfwqpjx is ACTIVE_HEALTHY and existing admin-user-management Edge Function requires JWT. Stripe plugin verified a sandbox synthetic draft invoice; it does not supply a Finora backend API key. Design decision: implement a disabled-by-default, server-side-only, fixed sandbox invoice preview Edge Function guarded by verify_jwt, live verified Supabase user identity, exact user allowlist and restricted rk_test_ key; no financial postings/production data writes or RLS/schema/auth changes. Deployment will be independently checked; missing secret/identity remain explicit blockers. User must set the restricted Stripe sandbox key in Supabase Functions secrets privately, never share it in chat or commit it.
420 -
421 -
422 -2026-10-11 implementation checkpoint: Added JWT-required (Supabase platform verify_jwt intended), server-side-only finora-stripe-qa-read Edge Function with locked one-invoice QA scope, Auth /auth/v1/user revalidation, exact allowed user UUID, Stripe restricted rk_test_ only, origin/method restrictions, no customer PII in output, no ledger/production data writes. Added .gitignore for .env secrets, documented Dashboard-only two-secret onboarding. Local PASS: 26 auth/amount/origin adversarial cases, Stripe fixture read, finance integrity, golden accounting journey, syntax 53 JS/49 MJS, git diff check. PENDING: GitHub PR CI, actual Edge deployment verify_jwt=true, unauthorized live 401 probe, owner private sandbox secrets and authenticated read test. Never mark direct Finora-to-Stripe API as verified before private key is configured.
423 -
424 -
425 -
426 -2026-10-11 verified deployment checkpoint: PR #66 head 67081d8c26253c0413bf014213589066b8ad6728 passed GitHub Quality run 38117668618 (including Stripe Edge 26-case authorization test, Golden accounting, Real DOM) and Security run 38117668637. Merged on main as 70addfe731524341f70115d85451b9dacfb1aaf9. Deployed only the fail-closed Supabase Edge Function finora-stripe-qa-read to verified ACTIVE_HEALTHY Finora project hcsixhqbyuhpshfwqpjx; deployment function ID 1ba946df-11ee-42d1-b86a-3e4b27331b10, version=1, ACTIVE, verify_jwt=true, inspected deployed index.ts + handler.mjs. No schema/RLS/auth/role, payment, user/financial-record or UI mutation. An independent unauthenticated HTTP 401 probe was ATTEMPTED but could not be completed due DNS/network fetch failures from remote PC/container; do not claim 401 live verified. IMPORTANT: no restricted Stripe sandbox key or user allowlist has been provisioned through these tools, so function intentionally returns no sandbox data; direct Finora backend-to-Stripe request and authenticated real user session remain NOT VERIFIED. The owner must privately set STRIPE_SANDBOX_RESTRICTED_KEY (rk_test_, Invoices:Read, all other permissions None) and FINORA_STRIPE_QA_ALLOWED_USER_ID (tester's Auth User UID) in Supabase Edge Function Secrets, without ever sharing values in chat/repo. Next: authenticated end-to-end invoke from approved test user, verify retrieved synthetic Stripe sandbox invoice amount=1250 USD minor units, detect 401/403 for unauthorized actor, confirm no production accounting effect.
427 -
428 -## 2026-10-11 urgent login outage triage
429 -Owner reports login blocked with generic 'check internet/VPN' network error on live Finora. Priority supersedes Stripe rollout. Read-only baseline: origin/main 459d8cfc368fbebf1a5a26f7e7abe1c5e01c4bba; Supabase project ACTIVE_HEALTHY and public key current/enabled; two Chromium live-site synthetic invalid-user password token requests returned expected HTTP 400 invalid_credentials (factoreasy.ir and GitHub Pages), no JS page errors. Windows PC GET site HTTP 200 and DNS resolves Supabase; unauthenticated health without public key 401 as expected. User-side regional/ISP reachability NOT VERIFIED. Do not alter passwords, accounts, schema, auth settings, token policy, or live financial data. First deliver honest diagnostic UI and explain that platform-side working does not verify user's ISP route; public proxy or new Cloudflare Worker/DNS/auth transport is separately security-and-cost approved work.
430 -
431 -
432 -2026-10-11 login diagnostic implementation: added explicit '????? ????? ?? ???? ????' action on login screen, credential-free parallel same-origin manifest + GoTrue /auth/v1/health (publishable key) probe with bounded 12s timeout, stable AUTH_OK/AUTH_UNREACHABLE/AUTH_TIMEOUT/AUTH_HTTP_NNN/SITE_UNREACHABLE statuses and automatic probe when password login rejects due network. Preserved existing sign-in policy, passwords, and Supabase endpoint. Bumped core.js cache key; added login-connectivity.js. Verified on local source AND Pages artifact: Playwright 3/3 diagnostics PASS each; syntax check 54 JS+50 MJS PASS; static diagnostic check PASS; branding/login PASS; golden accounting journey PASS; site build PASS. Live browser fake invalid account got real GoTrue HTTP 400 invalid_credentials from both site origins (client-to-Supabase working from remote Windows); user network route NOT VERIFIED and restored login NOT CLAIMED. Cloudflare DNS for factoreasy.ir is DNS-only; routing a new public proxy would add a security boundary, require approvals/cost checks and must NOT be silently enabled. Next: PR CI and gated Pages exact SHA publication; user to click new button on affected network and share status, then decide whether DNS/ISP or auth route change is justified.
433 -
434 -
435 -## 2026-10-11 invoice product lookup repair — PR #69
436 -- Owner screenshot evidence: populated products master; invoice row initially empty, seller searchable selector works. Source root cause: `finoraEnsureInitialInvoiceRow` creates row before `pullAll()` completes, while initial row `<select>` options are captured only at creation; additional product dropdown is clipped by scrollable invoice table.
437 -- Fix on `fix/invoice-product-search-rehydrate-20261011`: rehydrate live scoped products when selected row is initialized/focused/refreshed (sales and purchases), preserve selected archived/historical product and existing quantities/prices, robust Unicode Persian text filtering by name/code/spec, render product popup in document body to escape table clipping; version `js/ux-hardening-r2.js?v=20261011-product-refresh-v3`.
438 -- Independent Windows remote Desktop Commander `DESKTOP-71SJ63M`: `node scripts/syntax-check.mjs` PASS (54 JS/50 MJS); `node scripts/ux-hardening-r2-check.mjs` PASS; `npx playwright test scripts/ux-hardening-r2.spec.js --reporter=line --workers=1` PASS 6/6 (real Chromium). Screenshot fixtures `qa-product-search_block.png` and `qa-product-search_cement.png` demonstrate visible two-result dropdowns, real purchase/search selection event and price/unit population, scoped user visibility. Screenshots contain synthetic test data, **not real production customer items**.
439 -- PR #69 exact head `9281d7a078144302df4dbf23a066dc11e49a4a97`: GitHub Quality `38134885163` SUCCESS, Security `38134885100` SUCCESS. Initial red run `38134614070` was due to an incorrect test expectation that `سیمان` must match only cement; `بلوک سیمانی` legitimately matches too. Regression corrected with precise product selection; subsequent CI green.
440 -- No schema, RLS, Auth, roles, tenant membership, Supabase records, invoices, posting, or production data changed. Caveat: user's actual authenticated product master and post-merge site cache/live refresh NOT YET VERIFIED at this checkpoint. Verified after merge: PR #69 merged as `7a3f1f7703ff128bcbbf0906e44889b2833e3dd7`; exact SHA main Quality `38135114282` SUCCESS, Security `38135114272` SUCCESS, Release gate `38135220443` SUCCESS, gated Pages deployment `38135239645` SUCCESS; `CNAME` maps Pages to `factoreasy.ir`. Remote Windows Desktop Commander remains connected and Chromium controlled 6/6 PASS, but attempted Windows interactive desktop capture returned `CopyFromScreen: The handle is invalid`, and direct DNS resolution of `factoreasy.ir` failed from remote and sandbox environments. Thus **a real authenticated user-session product-list lookup and domain HTTP inspection are NOT VERIFIED**; do not claim them. Screenshot artifacts were created only on the authorized remote QA machine, with synthetic inputs, and visually returned to the user in chat. No user finance data was changed. Exactly one safest next action: owner hard-refreshes the deployed site and searches a known real product such as `هارد` in invoice item box; if it still fails, capture screenshot plus browser Console error without sharing credentials.
441 -
442 -## 2026-10-11 invoice print Persian-digit consistency — owner request
443 -- Owner reports mixed Persian/Latin glyph digits on printed invoices, including invoice number and trailing digits of date. Requested consistent Persian numerals everywhere in invoice print. **MERGED / MAIN QUALITY+SECURITY+RELEASE+PAGES VERIFIED / LIVE READ-ONLY CHROMIUM QA PASS**.
444 -- Baseline main `7eccf2757c99ea19ede3bac98847be0d2b0782b3`. Scope: all human-readable digit text in regular formal/non-formal/pre-invoice and official taxpayer invoice print/preview (including page counters, monetary amounts, numbers, IDs embedded as visible labels) while retaining original ASCII serial/ID/date values in storage, attributes, URLs, machine integrations and journal calculations. No financial/database/RLS/auth/write changes.
445 -- Required checks: verify exact live browser print and PDF DOM, synthetic values with mixed Latin, Eastern Arabic and Persian digits; ensure no Latin/Eastern-Arabic decimal glyphs remain in printable text, numeric totals intact, sensitive URL/attributes unchanged, preview and isolated iframe consistent, multi-page invoices intact. Final CI and gated Pages deployment only if tests pass. Rollback: revert specific PR.
446 -- Verified implementation on branch: `js/print.js` normalizes only rendered text nodes in preview, iframe/PDF, taxpayer and ordinary invoices; `js/purchases.js` applies same safe shared formatter to popup output. `index.html` cache-busts both bundles. Underlying values `PINV-31` and mixed `۱۴۰5/٠۷/19` remain unchanged in datastore; displayed `PINV-۳۱`, `۱۴۰۵/۰۷/۱۹`. HTML attribute/code remains literal `TAX12A340`; visible human-readable digits become Persian. No data/permission mutations.
447 -- On Windows remote `DESKTOP-71SJ63M`, isolated test server explicitly verified new asset (port 51867, avoiding occupied 4173/4175). `node scripts/syntax-check.mjs` passed 54 JS + 50 MJS, `node scripts/ux-hardening-r2-check.mjs` PASS, `npx playwright test scripts/taxpayer-print.spec.js` PASS **4/4 real Chromium** (official taxpayer landscape, image readiness, formal/nonformal/taxpayer digits, purchase popup) including PDF one-page assertions. Separate formal invoice screenshot `print-persian-formal-qa.png` captured via remote browser, text-node scan reports **0 Latin/Arabic-Indic decimal glyphs**. Screenshot uses only synthetic information, not real customer invoice.
448 -- PR #71 initial head `f9129f5dc6fc52a78e76aa5e9bfe21b383926efd`: Quality `38142219556` **SUCCESS**, Security `38142219616` **SUCCESS**. Pending merge, main gated CI/Pages deployment, and owner-authenticated print check with actual production invoice. No change to tax ID submission, serial storage, numeric math, RLS, schemas or real accounting entries.
449 -
450 -### Persian print digits — final release verification 2026-10-11
451 -- PR #71 merged into protected `main` at exact commit `991c61f70980518e1b9570984108b0fbab025fd2`. Same-SHA main GitHub Quality `38142480225` **SUCCESS**, Security `38142480264` **SUCCESS**, Release gate `38142569490` **SUCCESS**, Pages deployment `38142585021` **SUCCESS**.
452 -- Independent remote desktop `DESKTOP-71SJ63M` GET `https://factoreasy.ir/?printDigitsQa=20261011` returned **HTTP 200**, exact deployed assets `js/print.js?v=20261011-persian-print-v1`, `js/purchases.js?v=20261011-persian-print-v1`, and fetched print bundle contains `localizePrintHtmlDigits`. Headless Chromium loaded the **real production domain's code**, generated a synthetic formal invoice without logging in, and inspected actual isolated printable text: **PASS, zero remaining ASCII/Eastern Arabic decimal digit glyphs**; original serial `PINV-31` and date `۱۴۰5/٠۷/19` remained untouched while human-visible print uses `PINV-۳۱`, `۱۴۰۵/۰۷/۱۹`. Remote screenshot `print-persian-formal-qa.png` was returned inline to owner; image is local QA artifact, not saved in repository.
453 -- Scope caveat: production user-authenticated real customer printer test, printer-driver headers and actual hardcopy **NOT VERIFIED**. No real invoice save/edit or financial data change, no schema/auth/RLS/permission change. Owner can hard-refresh then print-preview any existing saved invoice as a safe final visual check. Rollback: revert PR #71, redeploy gated Pages, and clear browser cache.
454 -
455 -## 2026-10-11 owner-approved eight-phase roadmap — initiation
456 -- Owner explicitly approved the proposed eight-phase Finora roadmap: Phase 0 stabilization/bug triage; Phase 1 security, identity and data integrity; Phase 2 ledger and accounting; Phase 3 commerce/inventory/treasury integration; Phase 4 Iran tax/reporting; Phase 5 integrated acceptance/V1 release; Phase 6 advanced business modules; Phase 7 group/industrial/international extension. **APPROVED PLAN / PHASE 0 BASELINE RECONCILIATION STARTED — NOT V1 ACCEPTED**.
457 -- Baseline protected `main` = `4071072bc457fede62097eb2300ca35b8f516939` (PR #72 final Persian-print evidence). Last exact-head GitHub Quality `38142829987`, Security `38142829957`, Release gate `38142911889`, gated Pages `38142924226`: all SUCCESS. Supabase Finora `hcsixhqbyuhpshfwqpjx` ACTIVE_HEALTHY, 80 migrations (last `20261007165208 phone_identity_profile`), advisor signals: 21 privileged-function execution WARN, 3 RLS no-policy INFO, one leaked-password protection WARN. Open PRs #6, #28, #39, #40, #43, #49, #57, #58 remain open; do not merge stale/sensitive code by default.
458 -- Deliverables generated and independently read back: `docs/FINORA_EIGHT_PHASE_APPROVED_ROADMAP_2026-10-11.md` (exactly eight stages 0–7, owners/dependencies/acceptance, sensitivity boundaries) and `docs/FINORA_PHASE0_BASELINE_2026-10-11.md` (8 evidence-ranked F0 tests, current verified baseline, remaining blockers). Phase 0 **ACTIVE, NOT ACCEPTED**. Remote Desktop Commander `DESKTOP-71SJ63M` read-only production GET: `factoreasy.ir` **HTTP 200**; exact UX combobox, Persian print and login diagnostic versioned assets found; GET both product and print JS **200**, helper functions present. No authenticated real-user production tests performed in this checkpoint. No schema, RLS, authentication, roles, credentials, posted records, payments or production data writes. Approval of roadmap does not authorize sensitive actions. **Next bounded execution:** `F0-03` isolated invoice persistence test, owner-context `F0-01/F0-02/F0-04` as safe authenticated smoke, then close repro defects with PR/QA evidence.
459 -
460 -## 2026-10-11 Phase 0 F0-03 execution restart — invoice persistence QA
461 -- User explicitly asked why work stopped and then whether execution stopped; resume active authorized Phase 0 work without requiring further approval for isolated tests. Phase 0 roadmap PR #73 merged at `836991e895e56b8b7e76a4976d0f9c0f5f43c294`, Quality `38146926629`, Security `38146926660`, Release gate `38147024208`, Pages `38147052590` all SUCCESS on same SHA. Connected Desktop Commander `DESKTOP-71SJ63M` online.
462 -- **CURRENT STAGE: F0-03 CONTROLLED CHROMIUM QA PASSED 2/2 — AUTHENTICATED PRODUCTION STILL UNVERIFIED.** Test real invoice form save → asynchronous sync via fake in-memory server RPC → page reload/pull → edit → reload → print, plus rejected RPC/visible retry. Run against locally-served repository; never post invoices to real Supabase, alter finance data, or collect login secrets. Owner-authenticated production result remains NOT VERIFIED. Next: create test, execute on remote Windows, fix, rerun, CI gate; update ledger with exact evidence and unresolved issues.
463 -
464 -- F0-03 regression added: `scripts/phase0-invoice-persistence.spec.js`. Windows Desktop Commander `DESKTOP-71SJ63M` served isolated repository on local port 51867; `npx playwright test scripts/phase0-invoice-persistence.spec.js --reporter=line --workers=1 --timeout=25000` **PASS 2/2 in real Chromium**. Scenario 1 uses `pre_invoice` so the test does not post financial ledgers: save→mock server RPC→reload→edit→reload→print, totals 3,000→4,500, unchanged ID and exactly one server invoice, zero journal vouchers. Scenario 2 returns a transient error from fake `finora_sync_records`, verifies retry and no duplicate. `node scripts/syntax-check.mjs` **PASS 54 JS + 50 MJS**. Early test harness failures arose from intentionally hidden native selectors replaced by commercial combobox (not evidence of app save failure); fixed fixture to dispatch form change handlers. No actual Supabase/RLS/auth/real invoice write performed. **Next gate:** GitHub PR full Quality+Security and release, then owner-authenticated isolated invoice lifecycle and real affected ISP login remain pending.
465 -
466 -### 2026-10-11 F0-03 final protected-main CI and deployment verification
467 -- Owner asked whether execution stopped; resumed F0-03 rather than closing after roadmap planning. PR **#74** merged to `main` at exact SHA `5f05ea340b37569c78cdfe7ec54c212f22ae3e29`. The changes are **regression test + CI test-list + phase ledger only**; invoice application source code and production Supabase records unchanged.
468 -- Same-SHA GitHub workflows: Quality `38154361473` **SUCCESS**, Security `38154361524` **SUCCESS**, Release gate `38154485595` **SUCCESS**, gated Pages `38154503667` **SUCCESS**. An earlier duplicate release gate was canceled and earlier Pages job skipped due to workflow concurrency; only these successful runs certify release.
469 -- Remote Desktop Commander `DESKTOP-71SJ63M` real Chromium: `npx playwright test scripts/phase0-invoice-persistence.spec.js --reporter=line --workers=1 --timeout=25000` **PASS 2/2 (25.31 s)**. Control sample pre-invoice QA-PINV-0001 saved to disposable fake server, reloaded and edited (3000→4500), persisted once; second sample survived one injected RPC network failure and retry without duplication. No real finance history, live Auth/RLS, Stripe, production data or schema changed.
470 -- **Phase 0 remains OPEN / F0-03 controlled QA passed, production-authenticated verification OPEN.** Next: test owner-authenticated sign-in network fault `F0-01`, live tenant product selection `F0-02` and existing invoice print `F0-04` on authorized user session, plus safe-scope actual server persistence for F0-03 if separately authorized. No claim of real live invoice save success.
471 -
472 -## 2026-10-11 owner screenshots — UI close, admin direct user, dashboard drilldowns and controlled posting
473 -- Owner supplied current production screenshots: `finora-org-access-modal` «بستن» fails and similar modal close buttons across modules; central admin licenses lacks owner-provisioned new user; dashboard financial KPI and recent journal cells lack account→journal drilldown; standard sale invoice save currently auto-posts directly via `jePostSourceRecord`, preventing ordinary pre-finalization edit.
474 -- Work ownership and dependency: **QA/UX** first fixes modal close with real-browser regression; **reporting/UX** implements read-only rollups and traceable recent journal drilldown, with accounting balance invariants; **security/auth** assesses stale PR #58 and designs server-side administrator provision with no client service key; **finance architecture** defines draft/review/posted lifecycle and migration/reversal gate before touching live invoice posting semantics. Implementation of the last two is not implied complete by UI-only release.
475 -- User has requested these features, but **no permission to create a real third-party account right now, assign admin permissions, rewrite posted financial records, change production RLS/schema without a separately reviewed gated procedure, or send any credentials**. Existing historical posted source records remain immutable. A rollback-able UI PR and independent browser QA precede deployment.
476 -
477 -### 2026-10-11 controlled UX acceptance — modal + dashboard (Phase 0)
478 -- Implemented delegated click capture for dynamically rendered `.modal-backdrop.active` closing buttons «بستن»، «✕ بستن» and «انصراف» plus backdrop clicking. This prevents broken inline handlers from trapping the user and never changes stored state. Implemented keyboard-operable cards for assets, cash/bank, receivables and payables; journal-derived asset/cash account drilldown, source voucher/line navigation and the five newest journal rows. Uses scoped getters + existing P6Reports; **read-only**. Dashboard cash KPI currently uses one primary cash account; the expanded ledger explicitly distinguishes related bank/cash/petty accounts rather than silently changing the amount.
479 -- Remote `DESKTOP-71SJ63M` live Chromium against locally served repo: `npx playwright test scripts/phase0-modal-dashboard.spec.js --reporter=line --workers=1 --timeout=20000` **PASS 2/2 (9.9 s)**. `node scripts/syntax-check.mjs` PASS (54 JS/50 MJS). Tests cover close/dynamic/overlay and dashboard asset→account→voucher, cash Enter, recent voucher navigation. Added suite to GitHub Quality; PR CI and production release pending at time of writing.
480 -- Real owner desktop visual recheck is still required. Outstanding admin direct provisioning and draft/post/final document manager remain separately gated; no permissions, credentials, auth, schema or posted financial data changed.
481 -
482 -## 2026-10-11 owner-approved searchable selectors + F2 keyboard workflow (Phase 0)
483 -- User explicitly directs full implementation in production of unified live search for products/services, persons and all applicable large selection controls; ArrowDown/ArrowUp list navigation with visible selected highlight, mouse-wheel scrolling and Enter selecting the **active** choice (not hard-coded first match); keyboard F2 across supported entry forms must validate/save or approve the active form as appropriate, show *specific reason* when blocked, avoid trapping focus or global Enter accidentally saving, and close successful entry dialogs. Baseline `59c904623d0e8e067ee1c02e3169167bcc04841b`.
484 -- **In progress / not yet deployed**. Keep existing `Ctrl+S`, `Ctrl+Enter`, optional Enter-save, purchase/sale behaviors, tenant filtering, print formatting, and product rehydration. F2 in sales invoice must save a draft and **must not post/finalize** financial journal; posting requires explicit user permission and separate confirmation under Accounting→Document Management. F2 must never blindly click a destructive or financial-finalization action.
485 -- Validation: isolated Chromium dynamic product/person picker, Persian normalization, ArrowUp/Down/PageUp/PageDown and Enter, wheel scrolling, Escape, unrelated Enter, F2 supported forms success/failure incl correct messages and no action in unsupported dialog; exact GitHub Quality+Security gates and Pages deployment; owner-authenticated live finance data remain untouched.
486 -
487 -### 2026-10-11 keyboard navigation/F2 controlled verification checkpoint
488 -- Implementation: `js/ux-hardening-r2.js` now tracks highlighted item in each integrated combobox with ARIA listbox active-descendant, filtered search, ArrowUp/ArrowDown, PageUp/PageDown, Home/End, mouse-wheel scrolling and pointer hover; Enter chooses the highlighted exact item rather than first result. Product dropdown remains safely portaled out of clipped invoice table; underlying filtered tenant catalog, price/unit change handlers and Persian normalization preserved.
489 -- F2 routes the active entry view through existing dedicated validation/save handlers (sales invoice, purchases, goods/services, contacts, cheques, expenses, accounting draft journal, default settings, company form when focused). Missing rows, missing product/contact names, invalid native controls and unsupported views explain the block. An active modal is not silently approved via keyboard; modal-specific confirmation must use its own safe action. **Sales F2 creates a draft only; it never finalizes the accounting posting.** Purchases currently auto-post when saved in existing code, so F2 **requires explicit user confirmation** before invoking purchase Save; refusal performs no operation. Ctrl+S and Ctrl+Enter remain available.
490 -- Independent Remote Desktop Commander `DESKTOP-71SJ63M`, cloned exact branch commit `cd5e04408d81eacaf66be97ee9d2b89d85e22915`, `node scripts/ux-hardening-r2-check.mjs` PASS, `node scripts/syntax-check.mjs` PASS (55 JS/52 MJS), Chromium `npx playwright test scripts/ux-keyboard-f2.spec.js scripts/ux-hardening-r2.spec.js scripts/accounting-document-workflow.spec.js --reporter=line --workers=1` **14/14 PASS (19.7 s)**. Real app invoice fixture verifies F2 rejects empty line and saves one formal **draft** with zero journal vouchers. Other tests cover product/person matching, Arrow+Enter selected not first, 48-product wheel/PageDown/Home/End, Escape, F2 form/unsupported modal/company/default settings/purchase explicit confirmation. Synthetic QA data only; no owner accounts or financial writes.
491 -- **IMPLEMENTED / MERGED / PROTECTED-MAIN CI & RELEASE / DEPLOYED / READ-ONLY LIVE ASSET VERIFIED.** PR #83 merged to `main` SHA `641b68669057ef429ae158744a86cba9a00dca31`; exact-SHA main Quality `38173607090` SUCCESS, Security `38173607091` SUCCESS, Release gate `38173716820` SUCCESS, gated Pages `38173732898` SUCCESS (skipped/cancelled duplicate workflow runs were not used as evidence). Independent Desktop Commander `DESKTOP-71SJ63M` real Chromium after checkout of **exact main merge commit**: `scripts/ux-keyboard-f2.spec.js` + `scripts/ux-hardening-r2.spec.js` **PASS 12/12 (6.0s)**; `node scripts/ux-hardening-r2-check.mjs` PASS; `node scripts/syntax-check.mjs` PASS (55 JS + 52 MJS). Remote GET `https://factoreasy.ir/?keyboardQa=20261011` HTTP 200 and exact referenced deployed `js/ux-hardening-r2.js?v=20261011-combo-keyboard-f2-v5` HTTP 200; JS body verified `finoraConfirmActiveFormF2`, active-option ARIA, wheel, PageDown and F2 listener all present. **User-authenticated actual existing-goods list and physical keyboard on owner's browser remain UNVERIFIED**, and not every optional module has an unambiguous save action: when F2 cannot safely determine one, it explains the reason instead of triggering posting/destructive actions. No schema/RLS/auth/roles/posts/customer financial data changed. Rollback: revert PR #83 and redeploy previous UX bundle `v=20261011-modal-close-v4`.
492 -
493 -
494 -## 2026-10-12 Phase 0 F0-05 independent 1000+ selector stress — PLANNED
495 -- **Owner request:** Continue approved Phase 0 without repeating PR #83 or changing production data. Baseline `main` SHA `27170e0291496997a6118b0e72978f852e015a86`; historical PR #83 keyboard/F2 is already deployed. Phase 0 remains OPEN.
496 -- **Accountable owner:** QA/Validation. Scope: disposable Chromium fixture with 1,200+ tenant-scoped product and contact choices; Persian/Arabic normalization; code/spec lookup; Arrow/Enter/Home/End/wheel/Escape; selection persistence; absent and cross-tenant negative cases; measured browser interaction responsiveness. Chapters: 14, 251, 259, 260 (with 252/253 security/event contracts).
497 -- **In scope:** `scripts/phase0-selector-stress.spec.js` and Quality workflow gate; minimum source UX correction only if the test reproduces a defect. **Out of scope:** Supabase writes/migrations, Auth/RLS/roles, secrets, actual user or financial data, postings, invoice finalization and live user-session claims.
498 -- **Acceptance/evidence:** Run new Chromium test, syntax/static/regression checks, GitHub PR Quality + Security; report observed time budgets, exact SHA/run and any failures. Controlled browser PASS does not close F0-05 owner-authenticated acceptance. Rollback: revert isolated QA PR; no operational/DB rollback required.
499 -- **Status:** SPECIFIED / implementation and CI pending. Next action: add bounded independent stress regression, execute and triage failures.
500 -
501 -
502 -### 2026-10-12 F0-05 initial Chromium/CI verification — CONTROLLED_QA_PASSED; OWNER E2E OPEN
503 -- Baseline protected `main`: `27170e0291496997a6118b0e72978f852e015a86`. GitHub official connector verified current repo and approved Phase 0; master 260-chapter DOCX SHA-256 `f445ec30b395319aece8bd7eb7d98e80bd4655eff6cc81b0253688b551bbc29b` matched handoff. Chapters 251/259/260 and related scope consulted. Previous PR #81, #82, #83 and #84 independently confirmed merged; no feature recreated.
504 -- Live read-only Supabase project `hcsixhqbyuhpshfwqpjx`: ACTIVE_HEALTHY, **81** migration history rows, newest `20261011174445 posted_source_idempotency_index`; security advisors 21 authenticated SECURITY DEFINER WARN, 3 private C8 RLS/no-policy INFO, 1 Auth leaked-password WARN. Warnings not treated as exploitable without detailed review.
505 -- PR #86 `qa/phase0-f005-selector-stress-20261012`: adds synthetic 1,208-product and 1,206-contact negative/positive browser regression + required CI gate; no product runtime, Supabase, credentials or financial mutation. Initial head `193b03ddcef33aa06f5dfc936d14626d875be7f7`: GitHub Quality run `38202818187`, static job `114659716442`, **83/83 real Chromium tests PASS (55.8s)** including both F0-05 cases; three disposable database jobs SUCCESS. Security run `38202818169`: CodeQL + release safety PASS; dependency review skipped due disabled graph. Measured interaction latencies now logged by revised test for next run.
506 -- Acceptance boundary: F0-05 **CONTROLLED_QA_PASSED**, not AUTHENTICATED_E2E_PASSED / RELEASED / OWNER_ACCEPTED. Actual owner network, tenant catalog, real printer, dual-role access and safe server invoice persistence remain independent Phase 0/1 gates. No claim that 260 chapters are implemented. Rollback: revert QA-only PR. Next: confirm revised-head CI; merge reviewed QA-only test if green; keep Phase 0 OPEN.
507 -
508 -
509 -### 2026-10-12 F0-05 final protected-main promotion — RELEASED QA GATE / PHASE 0 OPEN
510 -- Approved Phase 0 independent test-only PR **#86** merged by squash to protected `main` exact SHA `a3c7dac165d1c451c635546eecff47e0aaaf562e`; GitHub connector re-fetched `main` after merge and verified the SHA. Files: `scripts/phase0-selector-stress.spec.js`, `.github/workflows/quality.yml`, `docs/FINORA_PHASE0_BASELINE_2026-10-11.md`, `PROJECT_STATE.md`. No production UX/accounting code, schema, RLS, roles, auth or financial data changed. Existing PR #83 searchable/keyboard/F2 stays intact.
511 -- Revised PR head `31d577843440d712db14d1a41658dd2ed2c9a23f`: Quality `38203000078` SUCCESS including static `114660293763` **83/83 Playwright Chromium tests in 57.6 s**, product and person stress both PASS, all three disposable DB jobs SUCCESS; Security `38203000075` SUCCESS (CodeQL and release safety; Dependency Review skipped because Dependency Graph is not enabled). Browser-side synchronous input-to-filter times in the GitHub QA runner: **9.6 ms** (1,208 scoped products), **72.7 ms** (1,206 synthetic contacts via metadata search). These are samples on CI hardware, not an SLA or production-user measurement.
512 -- Same-SHA protected `main` `a3c7dac165d1c451c635546eecff47e0aaaf562e`: Quality **`38203171552` SUCCESS**, Security **`38203171658` SUCCESS**, Release gate **`38203282658` SUCCESS**, gated Pages **`38203309936` SUCCESS**. Duplicated Release `38203264704` cancelled and Pages `38203301879` skipped; neither counted as successful evidence. Deployment is verified at the GitHub Actions boundary, not owner-authenticated browser/runtime/ISP.
513 -- Classification: F0-05 **IMPLEMENTED / CONTROLLED_QA_PASSED / RELEASED regression coverage**. **AUTHENTICATED_E2E_PASSED and OWNER_ACCEPTED remain UNVERIFIED** for real account catalog, desktop performance and live tenant RLS; Phase 0 remains **OPEN** due to F0-01/F0-02/F0-03/F0-04 and the remaining cross-role/print/UI gates. Security advisor findings 21 SECURITY DEFINER, 3 C8 no-policy and disabled leaked-password protection remain review-only/open (no changes made).
514 -- This is a documentation-only closing note, no change to release assets or database behavior. Next safest action: continue remaining independent read-only Phase 0 checks, then perform legitimate owner-authenticated login/catalog/print smoke without credentials in chat; avoid production financial postings. Rollback of the regression/test slice is PR #86 revert if needed.
515 -
516 -
517 -## 2026-10-12 Phase 0 acceptance execution kickoff — OWNER REQUESTED / IN PROGRESS
518 -- **Instruction:** Owner explicitly requests beginning phase acceptance now ("تایید فاز رو استارت بزن"). This starts acceptance verification of approved **Phase 0**, **not** automatic acceptance or promotion of any later phase. Accountable owner: QA/Validation; coordinating manager handles integration.
519 -- **Verified baseline at initiation:** protected `main` SHA `601a5b7b066ce4cf7e68fad2abe642c3e846cdd3`; same-SHA GitHub Quality `38203575835`, Security `38203575840`, Release `38203689209`, gated Pages `38203706432` all SUCCESS. Supabase `hcsixhqbyuhpshfwqpjx` ACTIVE_HEALTHY. No claim of owner-authenticated production proof from these CI gates.
520 -- **Authorized bounded first slice:** inspect existing Phase 0 acceptance evidence; audit open historical PRs against current main **read-only** to prevent stale fixes; create a test/evidence-based acceptance register and categorize each F0-01..F0-08 as controlled-QA-only, awaiting real user session, or blocked. Read-only live HTTP/JS smoke if accessible; document and run any zero-mutation test suitable for available tools. Use reviewable documentation-only branch/PR, verify CI and update this ledger with final evidence.
521 -- **Not authorized / out of scope:** creating users, entering owner credentials, changing Auth/RLS/schema/roles, posting/reversing production ledger, destructive test data or financial history, merging stale PRs, paid services or declaring Phase 0/V1 accepted without authenticated owner checks and explicit acceptance.
522 -- **Currently known open gates:** `F0-01` affected-ISP sign-in, `F0-02` existing tenant product/contact lookup, `F0-03` real safe-scoped server persistence, `F0-04` actual saved-invoice PDF/print; `F0-05` synthetic 1,208/1,206 Chromium regression green and deployed, but owner-authenticated test unverified; `F0-06` full UI review, `F0-07` tenant/roles security, `F0-08` PR audit pending. **Phase 0 = OPEN / ACCEPTANCE CHECKS STARTED**.
523 -- **Exit:** concrete `docs/FINORA_PHASE0_ACCEPTANCE_REGISTER_2026-10-12.md`, verified open-PR disposition, linked CI/risks/blockers and explicit next safe action. Rollback: revert docs-only PR; no runtime or database rollback needed.
524 -
525 -
526 -### 2026-10-12 Phase 0 acceptance evidence + F0-08 first read-only audit — DOCUMENTED / NOT PHASE ACCEPTED
527 -- Branch `qa/phase0-acceptance-start-20261012` created from protected main `601a5b7b066ce4cf7e68fad2abe642c3e846cdd3`; after the owner request was recorded above, created `docs/FINORA_PHASE0_ACCEPTANCE_REGISTER_2026-10-12.md` containing the F0-01..F0-08 gate matrix and owner-safe smoke protocol. This is documentation and review evidence only.
528 -- Exact baseline GitHub Quality `38203575835` SUCCESS (static job `114662032710`: syntax 55 JS / 52 MJS, Golden accounting, **83/83 Chromium PASS** and 3 disposable DB jobs); Security `38203575840`, Release `38203689209`, Pages `38203706432` all SUCCESS. Remote Desktop Commander online; authorized device read-only PowerShell GET `factoreasy.ir` returned HTTP **200**, no authenticated business verification.
529 -- Supabase project `hcsixhqbyuhpshfwqpjx` healthy with 81 migrations (latest `20261011174445 posted_source_idempotency_index`); advisors 21 SECURITY DEFINER WARN / 3 private RLS-no-policy INFO / 1 leaked-password WARN, not proven vulnerabilities. Live phone-identity migration `20261007165208` has no corresponding archive file on current main; proposed migration file remains in stale PR #58. No database changes performed.
530 -- F0-08 first independent scan: **9** open GitHub PRs, all diverged from main. Preliminary buckets: old documentation probably superseded #28/#43/#49; UI inspection required #39/#40/#57; sensitive financial/identity manual review #6/#58/#80. None merged or closed; no user/security/finance changes. Owner-authenticated sign-in F0-01, real tenant search F0-02, real safe-scope invoice save F0-03, real printing F0-04, true access F0-07 remain NOT VERIFIED. F0-05 controlled product/person 1,200+ stress PASS but full real context open.
531 -- **Status:** acceptance started and register independently read back; PHASE 0 OPEN, NOT OWNER-ACCEPTED. Next: review acceptance documentation PR with exact-head CI; then collect approved existing-user login/catalog/print test evidence, addressing actual reproducible bugs before phase signoff. Rollback: docs-only PR revert.
532 -
533 -- **Additional Phase 0 live asset check:** On authorized remote PC, separate read-only HTTP GETs returned 200 for deployed `js/login-connectivity.js`, `js/ux-hardening-r2.js`, and `js/print.js`; this does not establish exact cache-version parity, real sign-in, tenant catalog, invoice data or printer acceptance. The acceptance register records this evidence. PR #88 initial head Quality `38211055354` and Security `38211055404` **SUCCESS**; later head must rerun gates after this documentation update. No runtime/DB/auth/financial changes.
534 -
535 -
536 -### 2026-10-12 Phase 0 acceptance register — protected-main promotion verified / PHASE 0 OPEN
537 -- Owner acceptance kickoff documented and reviewed in PR **#88** (`docs/FINORA_PHASE0_ACCEPTANCE_REGISTER_2026-10-12.md` plus append-only `PROJECT_STATE.md`); PR Quality `38211223226` SUCCESS and Security `38211223103` SUCCESS, including three disposable DB jobs and real Chromium regression suite. Squash merged to protected `main` at SHA **`5c2a5bf263f7a3bfe5a6b2e99cba5c8e5443db04`**. Neither the product runtime nor production Supabase was modified in this docs-only change.
538 -- **All protected-main gates on this exact SHA:** Quality `38211377516` SUCCESS, Security `38211377395` SUCCESS, Release gate `38211501537` SUCCESS, gated Pages `38211523493` SUCCESS. Duplicate Release `38211497461` cancelled and Pages `38211511555` skipped; these duplicates were **not** counted as passing.
539 -- Confirmed persistent `main` acceptance register read back, with F0-01..F0-08 status matrix, nine old PR dispositions, Supabase migration/security-advisor read-only evidence and no unauthorized mutation. Remote read-only HTTP smoke confirmed `factoreasy.ir` plus `js/login-connectivity.js`, `js/ux-hardening-r2.js`, `js/print.js` HTTP 200 from authorized device. No user-authenticated login, real tenant query, true server invoice save, actual printer, dual-account RLS or precise served asset-version parity is claimed.
540 -- **Current decision:** PHASE 0 ACCEPTANCE STARTED / **NOT OWNER-ACCEPTED**. Continue F0-01 owner-ISP login first, F0-02 live catalog/person search, F0-04 print-existing-invoice visual check, then separately authorized isolated safe F0-03 write/read and F0-07 second-account permission proof. F0-05 stress controlled test passed but live tenant acceptance open; F0-06 UI visual review and F0-08 old PR final disposition remain. No code, schema, role, auth, finance or account changes allowed by this docs-only checkpoint. Rollback: revert PR #88 (or the acceptance documentation slice only).
541 -
542 -
543 -## 2026-10-12 Phase 0 F0-04 owner screenshot: remove draft watermark from printed invoices — FIX REQUESTED / IN PROGRESS
544 -- **Owner direction:** The attached photograph of an actual printed sale-goods/services invoice shows a pale diagonal header overlay `پیش‌نویس — غیرقطعی`. Remove that overlay from all ordinary invoice printouts (formal, informal, pro-forma, purchase where applicable), without interrupting ongoing Phase 0 acceptance. The owner requests a clean full invoice layout independent of document draft status.
545 -- **Baseline:** protected `main` `5c2a5bf263f7a3bfe5a6b2e99cba5c8e5443db04`; Phase 0 acceptance register from merged PR #88 is present. Investigation isolated overlay to `js/print.js` `renderAndPrintDirect` lines building `draftMark` and prepending it to `stageInvoicePrint`. Print-preview isolated frame and printable container both use that string. Taxpayer/electronic document printing has a separate explicit post/finalization check and remains unchanged.
546 -- **Accountable:** implementation/print with independent QA. **Narrow authorized scope:** remove display watermark only; add browser regression asserting clean formal draft and a pro-forma/non-formal printed page still contains all invoice content, amounts, and unchanged financial draft status. Preserve `invoiceDocumentStatus` / posting gate, electronic taxpayer safeguards, numeric formatting, pagination, dimensions, signature areas, invoice saving/editing and report status. Change `index.html` print asset cache key to force deployment refresh. Add regression to existing Quality suite, PR gates and gated deployment verification.
547 -- **Forbidden:** changing stored draft/posted status, auto-posting, RLS/Auth/schema/roles, financial data, Supabase, legal/tax declarations, closing Phase 0 by inference. Recheck with owner's real printed invoice remains separate F0-04 authenticated acceptance gate. Revert the targeted PR for rollback if necessary.
548 -- **State:** REPRODUCED IN SOURCE / IMPLEMENTATION STARTING. Phase 0 acceptance stays OPEN.
549 -
550 -
551 -### 2026-10-12 F0-04 owner photo → fixed print → gated live release — PHASE 0 STILL OPEN
552 -- Owner supplied real photograph of an ordinary sales/goods-services invoice stamped by a pale `پیش‌نویس — غیرقطعی` header watermark; requested its removal across ordinary invoice variants **before continuing Phase 0 acceptance**. Confirmed `js/print.js` `renderAndPrintDirect` injected `draftMark`, irrespective of invoice content; the purchase-specific popup already had no watermark.
553 -- **Fix delivered:** PR [#90](https://github.com/davoodmehraban89/Factor-easy/pull/90), squash merged to protected `main` exact SHA **`8a0023c53f0c14b0063ab771fdb3669a05997387`**. Ordinary invoice print now uses clean complete `stageInvoicePrint(containerHtml,spec)`. Cache-busted `js/print.js?v=20261012-clean-invoice-print-v1`. No changes to draft/posted state, financial postings, taxpayer explicit finalization rule, data, Auth, RLS, schema, roles or money formatting. Revert PR #90 and redeploy for rollback if needed.
554 -- **Independent controlled regression:** corrected PR head `72a69b372ef59ffbb7dddebf81d64304b3559b04` Quality `38212287209` SUCCESS (83/83 real Chromium, includes *formal draft* preview+isolated iframe without watermark, subtotal/number retained, draft state and zero vouchers, pro-forma print; Golden financial invariants and 3 disposable DB jobs PASS); Security `38212287223` SUCCESS. Initial static CI failed because its historic assertion **required** the old watermark; intentionally inverted to disallow watermark without relaxing posting safeguards, then retested green.
555 -- **Same merged-main SHA production gate:** Quality **`38212519911`**, Security **`38212519908`**, Release **`38212644579`**, gated Pages **`38212680498`** all SUCCESS. Skipped/cancelled concurrent duplicates not counted. On connected authorized remote Windows device, real domain HTML references exact `20261012-clean-invoice-print-v1` bundle; fetched live JavaScript has `stageInvoicePrint(containerHtml,spec)` and **no `draftMark`**. No owner login, actual tenant invoice or physical printer test made.
556 -- **Acceptance status:** F0-04 **FIX RELEASED / CONTROLLED QA PASS / LIVE BUNDLE VERIFIED**, but **OWNER-AUTHENTICATED REPRINT STILL OPEN**. Phase 0 as a whole remains OPEN; F0-01 affected-ISP login, F0-02 real tenant lookup, F0-03 safe-scoped actual Supabase persistence, F0-06 broader UI, F0-07 role isolation and F0-08 old PR final disposal retain their previous gates. Next: owner reprints same existing invoice with browser hard refresh and confirms no watermark/unchanged totals; continue remaining Phase 0 read-only checks without waiting to build new modules.
557 -
558 -
559 -## 2026-10-12 Phase 0 F0-06 follow-up — owner-directed continuation / DARK-MODE READABILITY SLICE STARTED
560 -- **Latest instruction:** Continue completing the approved Finora phases. Do not promote Phase 0 until real-owner authentication/catalog/save/print and permission acceptance are actually passed. Source canonical protected main at kickoff `9e9e35cd96d294e6f6ad875a45de94a1f968e5d8`, after print fix #90 and its docs evidence #91. GitHub exact-head Quality `38213083866`, Security `38213083815`, Release `38213219253`, Pages `38213261477` all SUCCESS. Supabase `hcsixhqbyuhpshfwqpjx` ACTIVE_HEALTHY, 81 migrations (latest `20261011174445 posted_source_idempotency_index`).
561 -- **Independent safe work chosen:** `F0-06` — verify and correct dark-mode readability (buttons/panels, inputs, typography and organizational shell surfaces) based on current runtime and stale unmerged contrast PR #57 as reference, **without merging old PR** or altering shell scroll geometry, invoice business rules, underlying data, or database. `js/ux-hardening-r2.js` currently sets dark root colors yet leaves `.accordion-item` white and `.btn-secondary` pale background inheriting light foreground; potential contrast mismatch to be independently tested with Chromium computed colors. UX owns targeted visual contract, QA owns browser contrast assertions.
562 -- **Bounded implementation:** add controlled Playwright dark-mode contrast/restore regression to required Quality suite, verify before/after computed color contrast (WCAG normal-text 4.5:1 where appropriate); change theme styles only if failure reproduced; bump `index.html` bundle version; run static/GitHub Quality+Security, merge reviewed PR and verify exact protected-main release. Protect ordinary light theme and previously published printable invoice. No real tenant/browser, physical device screenshot, or owner visual acceptance is implied by controlled tests.
563 -- **Restrictions:** no Auth/RLS/roles/schema, production financial data/postings, migration, financial cutoff, account creation, external costs, or unreviewed #57/#39/#40 merges. Rollback: targeted PR revert and Pages gated redeploy. **Phase 0 remains OPEN** for F0-01/02/03/04/07 and owner F0-06 UI review.
564 -- **Status:** SPECIFIED / REGRESSION AND SOURCE REVIEW IN PROGRESS.
565 -
566 -
567 -### 2026-10-12 F0-06 dark-mode contrast targeted fix — PR QA PASSED / REAL OWNER VISUAL OPEN
568 -- **Reproduced from source:** `js/ux-hardening-r2.js` original dark class set light `--text` but left `.accordion-item` white, `.btn-secondary` pale, and `.module-panel` white, risking unreadable text and non-dark shell; old unmerged PR #57 was reviewed as design reference but **not merged**. No structural sidebar/nav/scroll changes made.
569 -- **Implemented in independent branch `qa/phase0-f006-dark-contrast-20261012`:** dark CSS overrides for card/accordion, secondary controls, form input/placeholder and disabled controls, table, combobox and module shell surfaces; retained light mode. `index.html` references `js/ux-hardening-r2.js?v=20261012-phase0-dark-contrast-v1`. Mandatory Quality includes `scripts/phase0-dark-theme-contrast.spec.js` with two real Chromium assertions (4.5:1 normal text contrast for dark accordion/button/input/shell and healthy return to light theme). `scripts/ux-hardening-r2-check.mjs` version and invariants updated; no finance, account, Auth, RLS, roles, schema, SQL or runtime navigation geometry change.
570 -- **Verification:** Initial PR static-quality attempt `38217822837` failed because an existing static contract still expected `20261011-combo-keyboard-f2-v5` bundle; fixed that contract without bypassing a test, then retested branch head `176b5e42f4a26266b61c7dcd75df2803b315f695`. Final tested head Quality **`38217926742` SUCCESS** (static job `114706936848`, **85/85 Playwright Chromium PASS, 52.2s**, both F0-06 tests passing; JS syntax 55 modules/52 MJS, Golden accounting, draft/posted invariants and three disposable database jobs PASS). Security **`38217926669` SUCCESS**, CodeQL and release safety; dependency review skipped (graph disabled).
571 -- **Acceptance classification:** Targeted theme contrast = **IMPLEMENTED + CONTROLLED_QA_PASSED** on branch. Owner-authenticated visual/browser acceptance of full F0-06 (RTL wheel/scroll, dark/light screens, all save/delete/import/export) is **NOT VERIFIED**; Phase 0 remains **OPEN**, all F0-01/02/03/04/07 gates unchanged. Next: finalize documentation-only branch updates, retest exact PR head, merge if gated, verify exact protected-main Quality/Security/Release/Pages + actual published JS version; do **not** call F0-06 or Phase 0 fully owner-accepted. Rollback targeted PR and gated redeploy.
572 -
573 -
574 -### 2026-10-12 F0-06 dark-mode contrast — PROTECTED MAIN GATES & DEPLOYED / PHASE 0 OPEN
575 -- Owner's ongoing approved Phase 0 development continued as F0-06 isolated dark-theme usability slice. Legacy PR #57 was reviewed but **not merged**. Targeted PR **#92** implemented dark text/surface contrast for accounting panels, inputs, buttons, dropdowns and existing organizational shell, preserving light mode, shell geometry and underlying financial/data semantics. Source: `js/ux-hardening-r2.js` with cache key `20261012-phase0-dark-contrast-v1`, `scripts/phase0-dark-theme-contrast.spec.js`, static asset identity check and Quality workflow. Controlled browser checks use 4.5:1 normal-text contrast and confirm return to light mode.
576 -- Branch QA final head `59e396a17ec3bfd2a2baca50384248f741a981c2`: Quality `38218215989` **SUCCESS** (85/85 Chromium including two F0-06 tests, 3 disposable DB jobs, Golden accounting), Security `38218215992` **SUCCESS**. First version check `38217822837` failed because the old static contract hardcoded the previous asset key; that control was updated and clean tests repeated, not bypassed.
577 -- PR #92 merged by squash to protected `main` exact SHA **`745bdc847a3c2db22048d1d545da0fad0ae5cc67`**. On that SAME SHA: Quality **`38218505600` SUCCESS**, static job `114708817767` Chromium **85/85 PASS (51.1s)** + Golden/draft-posted safety and three disposable DB jobs; Security **`38218505535` SUCCESS**, Release gate **`38218679192` SUCCESS**, gated Pages **`38218725537` SUCCESS**. Concurrent duplicate Release `38218648536` CANCELLED and Pages `38218713325` SKIPPED, neither counted as success.
578 -- Independent read-only remote proof: authorized Windows desktop `DESKTOP-71SJ63M` GET to `https://factoreasy.ir/?phase0dark=20261012` includes `20261012-phase0-dark-contrast-v1` (**True**); fetched live `js/ux-hardening-r2.js?v=20261012-phase0-dark-contrast-v1` contains dark shell and secondary-button selectors (**True / True**). This proves deployed asset parity, **not** customer-authenticated visual experience.
579 -- **Acceptance:** F0-06 targeted contrast **RELEASED / CONTROLLED-QA-PASSED**; broader modal/RTL keyboard/import/export/dark-light owner UI and physical-device acceptance remains **UNVERIFIED**. F0-01/02/03/04/07 and F0-08 outstanding gates remain; **PHASE 0 OPEN / NOT OWNER ACCEPTED**. No customer data, ledger, Auth, RLS, roles, schema, Supabase migration, financial posting or paid-service changes. Rollback: revert PR #92, run gated Pages deploy, refresh cached bundle.
580 -
581 -
582 -## 2026-10-12 F0-01/F0-07 admin provisioning 400 — OWNER REPORTED / ROOT CAUSE VERIFIED / FIX STARTED
583 -- **Owner request:** Screenshot of real Central Admin > New User form reporting `Edge Function returned a non-2xx status code` despite fields entered; fix the issue *before* resuming Phase 0 work. Do **not** record name, email, password, tokens, IP or request metadata from owner screenshot in project logs. Do not create a live user or change an existing password during diagnosis.
584 -- **Verified live source evidence:** protected `main` `487471fe9154ff7b94fab56335ffeb000494c72a`; live Supabase project `hcsixhqbyuhpshfwqpjx`, Edge `admin-user-management` ACTIVE v3 with `verify_jwt=true`. Request log on 2026-10-12 07:13:44Z: authenticated POST to Edge returned HTTP 400; corresponding Auth Admin `/auth/v1/admin/users` returned HTTP 500, with Auth error `ERROR: organization license not found (SQLSTATE 23503)` / `unexpected_failure`. These are exact live logs, **not** guessed password, email, network or unauthorized-role failure.
585 -- **Root cause:** live `public.handle_new_user()` inserts `public.organization_members` active owner BEFORE `public.licenses`; `private.enforce_organization_member_seat()` BEFORE INSERT requires license row and raises SQLSTATE 23503 if absent. Existing migrations lack the function's post-phone-identity live definition in main. Transaction fails during Auth user creation and rolls back. Actual constraints reviewed: licenses FK to profile/organization only, no membership FK; license-first ordering is valid and satisfies unmodified seat trigger.
586 -- **Bounded intended correction:** add reviewed, idempotent one-function migration to reorder fresh-user bootstrap as `profiles → organizations → licenses → owner membership`, preserving all current live email/phone signup support, default `role='user'`, trial entitlements, security-definer fixed search_path and seat enforcement. Reproduce 23503 in disposable PostgreSQL fixture, then verify successful bootstrap and existing seat-limit rejection. Add safe UI parsing of Edge structured error codes and regression test so admin form no longer displays opaque non-2xx errors. Run static/Chromium, disposable DB, Security; gate on exact SHA. Production migration only after independent tests and confirmed source/version equivalence; no changes to existing user/license rows, RLS, Auth JWT verification, or financial data. Rollback: approved previous function definition (do not mutate accounts/data). No live account creation without separately approved isolated identity.
587 -- **Dependent continuation:** PR #92 dark-mode work already merged into latest main; verify its exact protected-main gates before further F0-06 work. Phase 0 remains OPEN; do not claim owner E2E pass from synthetic tests or read-only diagnostics.
588 -- **Current status:** ROOT_CAUSE_VERIFIED / REPRODUCE_AND_FIX_IN_PROGRESS.
589 -
590 -
591 -### 2026-10-12 F0-07 admin new-user provisioning — ROOT CAUSE FIXED IN PRODUCTION / PHASE 0 OPEN
592 -- **Verified incident:** Owner's central administrator create-user request at 2026-10-12 07:13:44 UTC reached live Edge `admin-user-management` v3 (JWT verification enabled) and returned HTTP 400. Supabase Auth logs show underlying admin-user POST HTTP 500 `unexpected_failure` caused by PostgreSQL `organization license not found` (SQLSTATE 23503). No evidence this was bad internet or an invalid user-input password. Avoid reproducing the owner's personal details in logs.
593 -- **Root cause independently confirmed:** Live `public.handle_new_user()` inserted owner into `organization_members` before creating trial `licenses`; existing BEFORE INSERT `private.enforce_organization_member_seat()` correctly rejected membership lacking a license. No existing account or license required repair. The guard remains enabled and unchanged.
594 -- **Fix implemented in PR [#94](https://github.com/davoodmehraban89/Factor-easy/pull/94), merged to protected main SHA `e664e8fdbc77b660dfc1fedff580b206279899f3`:** new `supabase/migrations/20261012080000_fix_identity_bootstrap_license_before_membership.sql` preserves actual email/phone support and ordinary role, reorders new-user bootstrap to `profiles → organizations → trial license → owner membership`. No existing rows/permissions/role/RLS/Auth JWT behavior changed. `js/admin.js` safely renders localized structured server error rather than opaque `Edge Function returned a non-2xx status code`; cache-busted `admin.js?v=20261012-provision-error-v1`, password cleared after submit. No sensitive request/response bodies leaked.
595 -- **Independent disposable verification:** identity PostgreSQL job `114713267003` first **reproduced original 23503**, then applied proposed fix and confirmed owner trial + ordinary role, **second active user blocked** by unmodified seat-limit trigger, phone-only identity support preserved; three disposable DB jobs PASS. PR Quality `38219871219` **86/86 Chromium PASS** (includes real browser Persian failure display) and Golden accounting/security invariants; PR Security `38219871204` PASS.
596 -- **Same-main-SHA verification:** Quality `38220163720` SUCCESS, Security `38220163569` SUCCESS, Release `38220396895` SUCCESS, gated Pages `38220451051` SUCCESS; duplicate release canceled/skipped not counted. Migration applied through Supabase as **`20261012075507 fix_identity_bootstrap_license_before_membership`**; 82 migrations. Read-only function catalog verifies new 4-step order, original seat trigger count 1, ordinary `'user'` profile, phone support, function ACL `postgres,service_role` execute only. Deployed domain HTML references new versioned admin JS and served bundle contains safe error mapper (remote PC read-only HTTP). No test or real user was created in production; no existing financial postings or Auth account credentials were touched.
597 -- **Parallel Phase 0 continuity:** previously delivered F0-06 dark/light contrast #92, exact-main Quality `38218505600` 85/85, Security `38218505535`, Release `38218679192`, Pages `38218725537` SUCCESS; actual deployed `20261012-phase0-dark-contrast-v1` version confirmed on real domain. F0-06 **targeted controlled QA/release PASS** but owner full visual acceptance OPEN. Also F0-04 watermark print #90 released but owner reprint unverified.
598 -- **Current acceptance:** admin provision blocking defect **FIX_RELEASED / SOURCE+CI+MIGRATION VERIFIED**, actual authenticated admin create/retry **NOT OWNER-VERIFIED**. Owner should first check central users list to avoid duplicate, refresh and retry once with authorized personal identity, then verify ordinary role and trial; NEVER send passwords/tokens in chat. F0-01 affected ISP login, F0-02 tenant catalog, F0-03 safe real server invoice, F0-04 owner physical print, F0-05 real 1200+ catalog, F0-06 all visual controls, F0-07 dual-account RLS, F0-08 final stale PR disposition remain pending. **PHASE 0 IS STILL OPEN.**
599 -- **Rollback:** restore reviewed prior `handle_new_user()` definition in a new controlled migration (but this reintroduces recorded incident; do not undo automatically). Frontend rollback via PR #94 revert/gated Pages. No data rollback necessary. Next independent safe slice: F0-08 stale PR read-only evidence or F0-06 additional visual QA; actual owner E2E tests require an authorized session and controlled scope.
600 -
601 -
602 -- **F0-06 QA suite follow-up (no runtime change):** Documentation PR #95 initial Quality run `38220841194` failed **1/86** in the existing F0-06 light-mode contrast test at `button.contrast=1.56`; Security `38220841248` PASS and all three disposable DB jobs PASS. The isolated test toggled the body class and sampled immediately while the actual `.btn` CSS has a 200ms background-color transition; delayed `finoraApplyTheme` boot can also override the manually toggled class. Patched the fixture to hold the requested theme stable using a test-only `getMySettings` wrapper, use the actual `finoraApplyTheme()` transition, and poll for steady-state light-button contrast >=4.5 before asserting other surfaces. This does **not** waive the contrast threshold or alter live application CSS. Retest entire workflow on final PR head; do not merge on a red CI.
603 -
604 -
605 -## 2026-10-12 Phase 0 F0-08 stale PR disposition — OWNER CONTINUATION / IN PROGRESS
606 -- **Instruction:** Owner requested to advance the approved Phase 0. Accountable: Coordination + QA. Baseline protected main `4595dafcb98185984894faacb97244cec2aa55e4`, last release PR #95 accepted and published. Owner-authenticated F0-01/02/03/04/07 and broad F0-06 remain open; we must not claim phase closure.
607 -- **Selected independent safe scope:** complete `F0-08` disposition of 9 stale open PRs, preserving finance/identity/scroll issues pending separate verification. Re-read current main, inspect each historical diff, pin Supabase migration evidence read-only, correct obsolete historical status documents, then document rationale before any reversible PR closure. Do not merge stale changes, mutate live DB/Auth/RLS/roles, create accounts, change accounting, disclose secrets or reinterpret production migrations as live end-to-end acceptance.
608 -- **Initial finding:** Old PR #28 proposed correcting `docs/REQUEST_WORKFLOW_WAVE4B_VERIFICATION.md` to 'merged CI green / production migration NOT APPLIED'. However **live Supabase currently records** `20261002072526 request_wave4b_scheduler_outbox_delivery`, so blindly cherry-picking #28 would preserve a false production-not-applied claim. Current main document still says 'IMPLEMENTED ON BRANCH / CI PENDING' and requires reconciliation distinguishing *migration recorded* from *full D4c delivery consumers verified*. Audit rest of document and archive precise sources.
609 -- **Candidate superseded PRs to independently confirm:** #28 (Wave4b documentation), #43 (heartbeat already in AGENTS), #49 (outdated live status), #57 (dark contrast delivered by #92), #80 (admin provisioning delivered by #84/#94). Retain #6 (financial), #39/#40 (RTL scroll physical behavior), #58 (multi-change identity/migration archive drift) pending evidence. No partial/automated merging. Classification may change on inspection.
610 -- **Done criteria:** reconciliation doc and PROJECT_STATE change pass Quality/Security PR gates, merge to main, optionally close only fully superseded historical PRs with reference to surviving content and audit decision, verify post-merge CI. Exit F0-08 = disposition recorded, not blanket functional acceptance. Rollback: revert docs-only changes or reopen closed PRs, no DB or finance rollback.
611 -
612 -
613 -### 2026-10-12 F0-08 nine historical PR source audit — VERIFIED READ-ONLY / DOC PR GATES NEXT
614 -- Reconciled PR #6/#28/#39/#40/#43/#49/#57/#58/#80 against protected main `4595dafcb98185984894faacb97244cec2aa55e4`. Read changed filenames, relevant patches and current main. Detailed disposition and explicit risk boundaries in `docs/FINORA_PHASE0_F008_PR_RECONCILIATION_2026-10-12.md`.
615 -- **Important stale-fact correction:** current main `docs/REQUEST_WORKFLOW_WAVE4B_VERIFICATION.md` said `IMPLEMENTED ON BRANCH / CI PENDING`. Historical PR #28 described CI/merged PR #27 but said production migration NOT APPLIED. Independently read 82 Supabase migration rows and confirmed `20261002072526 request_wave4b_scheduler_outbox_delivery` **present**, and read-only pg_proc catalog confirms scheduler/outbox public/private RPCs; the original SQL explicitly says **D4c destination consumers remain disabled**. Corrected current main doc with merged historical CI, live migration presence and unverified real destination delivery, not blindly cherry-picking stale PR #28.
616 -- **Superseded candidates:** #28 historical QA docs (useful evidence now ported with current correction), #43 heartbeat already represented by AGENTS, #49 stale operating snapshot, #57 dark UX delivered better by #92/#95, #80 admin creation already delivered by #84/#94 with production identity bootstrap fix. Close only after this documentation PR is merged and read back; closures retain history and can be reopened. **Retain OPEN** #6 financial posted history; #39/#40 physical RTL wheel/scroll geometry; #58 phone-identity migration archive drift and privileged Auth/SMS issues.
617 -- F0-08 = **PRELIMINARY SOURCE RECONCILED**, final disposition depends on exact-head Quality/Security, merged doc and individually verified closure outcomes. Main runtime code unchanged by this slice; no customer data, ledger, DB, schema/RLS/Auth/roles, edge deployments or production scheduler dispatch mutated. **PHASE 0 OPEN** regardless of F0-08.
618 -
619 -
620 -### 2026-10-12 F0-08 historical PR dispositions — VERIFIED / FIVE CLOSED / FOUR AUDIT BLOCKERS OPEN
621 -- Follow-through on owner's instruction to advance Phase 0: PR [#96](https://github.com/davoodmehraban89/Factor-easy/pull/96) reconciled current source and nine historical open PRs, corrected `docs/REQUEST_WORKFLOW_WAVE4B_VERIFICATION.md` from obsolete "CI pending" to *historical merged CI / current production migration recorded / D4c external consumers NOT VERIFIED*. Read-only Supabase has 82 migrations, including `20261002072526 request_wave4b_scheduler_outbox_delivery`, and live scheduler/outbox RPCs exist. This does **not** certify real scheduler runs/deliveries.
622 -- PR #96 head `08afd9f69ca7af4408b0c5e6ba5c8a31a40adcd2` Quality `38223670528` SUCCESS (static job `114725807951`, **86/86 Playwright PASS**, 3 isolated DB tests + Golden/draft-posted PASS), Security `38223670565` SUCCESS. Docs merged as protected main `2a4d637d0145f333412fbce0e299ab6962f0b262`.
623 -- **PR closure verified in live GitHub:** old #28 (comment 6120641718), #43 (6120644468), #49 (6120646995), #57 (6120649594), #80 (6120652469) all **CLOSED / UNMERGED**, with evidence comment and reversible history. **Exactly four old PRs remain OPEN: #6 finance core, #39/#40 competing physical RTL scroll, #58 privileged identity/phone migration archive drift**. These are deliberate specialist hold items, no authorization to merge old code. Detailed evidence in `docs/FINORA_PHASE0_F008_PR_RECONCILIATION_2026-10-12.md`.
624 -- **F0-08 acceptance:** historical PR register and safe dispositions **COMPLETE/READ-ONLY-RECONCILED**. This is distinct from **PHASE 0 OWNER ACCEPTANCE (STILL OPEN)**: affected ISP login F0-01, real tenant catalog F0-02, isolated real server save F0-03, owner saved-invoice print F0-04, live 1,200+ selector F0-05, full modal/RTL UI F0-06, actual admin retry / two-user RLS F0-07 are not all verified.
625 -- **Changes and rollback:** F0-08 docs and nonmerged PR closure only; no runtime changes, customer accounts, production Supabase schema/data, migrations, invoices/posted ledger, roles/RLS/Auth, secret handling or fee. Docs revert and old PR reopen if later evidence requires. Next authorized task: plan owner-real F0-01/02/04 acceptance from existing browser; separately review #58 migration archive parity read-only without schema writes.
626 -
627 -
628 -## 2026-10-12 Owner Phase 0 continuation — F0-05 account/project/contract selector large-list QA
629 -- **User instruction:** «ادامه بده» — continue verified Phase 0 execution. Baseline latest protected main `c45d849a138370b89e9f251757f229f6b8fa55d8` after PR #97, with Phase 0 OPEN and F0-08 nine-PR audit completed; #6/#39/#40/#58 remain specialist holds. F0-05 currently checks **1,208 products and 1,206 contacts** in synthetic Chromium only; account, project and contract high-volume selectors have no 1,200+ browser coverage. Account journal select `.je-account` is intentionally excluded from general combobox and is NOT a target of this test.
630 -- **Selected independent safe slice (QA/Implementation):** extend `scripts/phase0-selector-stress.spec.js` with controlled tenant-scoped **1,200+** account rules selector (`#af-rule-account`), project selector (`#invoice-project-id`) and generic contract selector using real `finoraRefreshSearchableSelect` from `js/ux-hardening-r2.js`. Include keyboard Enter/Escape/End, Persian label/code/metadata filtering, no-match, no cross-tenant fixture option and explicit no `saveDatastore` / `jePostSourceRecord` / side-effect. Measure synchronous filter cost and use existing **5000ms safety ceiling**, NOT a production hardware SLA. Assert each selected value and no implicit writes.
631 -- **Safeguards:** This is a synthetic DOM fixture with tenant-scoped option construction, NOT a production RLS/security isolation test; do not change runtime UI, auth, accounts, RLS, schema, Supabase, financial posting, user data or invoicing. Keep F0-01..04/07 and physical owner acceptance open. Add only the independent tests to the existing Quality Playwright suite, verify Chromium/Golden/3 disposable DB/Security then gate PR merge and protected-main deployment. Rollback: revert QA-only PR; no data or permissions rollback needed.
632 -- **Accountable:** QA/Verification. **Status:** SCOPE RECORDED / CODE PENDING.
633 -
634 -
635 -### 2026-10-12 F0-05 account/project/contract high-volume selector — CONTROLLED QA PASS / OWNER GATE OPEN
636 -- Branch `qa/phase0-f005-account-project-contract-stress-20261012` extends existing F0-05 synthetic Playwright with **1,206** tenant-scoped entries each for accounting-rule `#af-rule-account`, invoice `#invoice-project-id` and representative generic contract select; using existing `finoraRefreshSearchableSelect` (no runtime changes), metadata/code search, Persian labels, Enter/End/Escape, no-results, excludes foreign-tenant fixture options, checks selected IDs, zero `saveDatastore` and zero accounting post. The journal-special `.je-account` path is excluded by runtime design and **not** tested by this generic selector fixture.
637 -- Exact first-tested PR #98 head `99be1b33ea6b8792f1be85e82a08367352bae223`: Quality **`38225392045` SUCCESS**, static job `114731529004`: **87/87 Chromium PASS (59.7s)** (prior 86 + new F0-05), Golden accounting and draft/posted safety PASS, three disposable PostgreSQL jobs PASS. Security **`38225392014` SUCCESS** (CodeQL/release safety; dependency review skipped when graph disabled). Synchronous filter samples in Chromium CI: **account 108.5ms; project 107.6ms; contract 113.4ms**, under existing 5000ms *safety ceiling*, **not** a performance SLA. No network/client production data in test.
638 -- Acceptance register F0-05 updated to **CONTROLLED-QA-PASSED for products, people, account rule, project and generic contract 1200+ lists**, while authorized tenant/real workstation performance, account-journal `.je-account` and true backend RLS remain **UNVERIFIED**. Full **PHASE 0 OPEN / NOT OWNER ACCEPTED**; no finance, Supabase, Auth/RLS/roles/schema or production data changes.
639 -- Next: check final PR head Quality/Security, merge only if green, verify protected-main Quality/Security/Release/Pages, append final exact-SHA release evidence if available. Rollback QA-only PR; no data rollback.
640 -
641 -
642 -### 2026-10-12 F0-05 account/project/contract selector extension — RELEASED QA GATE / PHASE 0 OPEN
643 -- Owner directed Phase 0 continuation. QA-only [PR #98](https://github.com/davoodmehraban89/Factor-easy/pull/98) extends controlled F0-05 regression to **1,206** tenant-scoped synthetic options each for account-rule, invoice project and generic contract selector, alongside prior 1,208 product and 1,206 contact tests. Tests cover Persian/name/code/floating-code, keyboard Enter/End/Escape, absence/no-match and zero invoice save/ledger posting. This tests the actual existing combobox implementation with synthetic options, **not real Supabase RLS, real company catalogs or accounting journal .je-account selector**.
644 -- Final PR head `dfc4b21d4e7392d188acfc86b6bc2d7cf8394e3c`: Quality **`38225738789` SUCCESS**, static job `114733039452` **87/87 Chromium PASS (59.2s)**; Golden sale/receipt/purchase/payment/expense/reversal/trial/financial reports PASS; draft/posted safety PASS; three disposable DB jobs SUCCESS. Security `38225738773` SUCCESS. Real Chromium CI observed **107.4ms account, 106.3ms project, 112.5ms contract** synthetic filter latency (sample only, 5-second safety cap, NOT a contractual SLA).
645 -- PR #98 squash merged to protected `main` exact SHA **`20cca7e4cf5a411022a30929a513b7cdf2d53779`**. Independent exact-main Quality **`38226518516` SUCCESS**, Security **`38226518662` SUCCESS**, Release Gate **`38226697531` SUCCESS**, gated Pages **`38226717496` SUCCESS**. Duplicate Release `38226696979` cancelled / Pages `38226704861` skipped, correctly not counted.
646 -- **Acceptance state:** F0-05 enlarged **CONTROLLED_QA_PASSED / RELEASED QA GATE**; owner actual-workstation/catalog and journal-account-specific high-volume test **NOT OWNER_VERIFIED**, whole **PHASE 0 OPEN**. F0-01/02/03/04/07 real authorization and live data gates remain open; F0-08 historic PR audit complete and four specialist PRs held. Zero runtime application files changed in PR #98; no Auth/RLS/schema/migrations/production financial or identity data altered. Rollback test-only PR; no customer data rollback required. Next: owner browser/safe-invoice acceptance or separately bounded read-only #58 migration-drift audit; do not begin Phase 1 signoff prematurely.
647 -
648 -
649 -## 2026-10-12 Owner-reported Finora slow startup / Phase 0 loading performance — IN PROGRESS
650 -- **Owner request:** Live Finora takes unacceptably long to open and become usable. Diagnose real startup critical path, implement bounded performance fix, independently QA/ship; continue approved Phase 0 without declaring unfinished user-authenticated gates accepted.
651 -- **Baseline:** protected main `61cbcf3113c598022d6877e447bf8c97b4788a19`. Read AGENTS and complete PROJECT_STATE, `index.html`, `js/bootstrap.js`, `js/core.js` and `js/sync.js`. Current index declares approximately 40 non-deferred app script tags and an **external parser-blocking SheetJS CDN bundle** and external Vazirmatn CSS; `js/bootstrap.js` on DOMContentLoaded **awaits 14 script insertions sequentially** before calling `initAuthSystem()`, so network round trips delay both login panel and session restoration. For logged-in users `enterApp()` additionally awaits `fetchCurrentUser()` and **sequential paginated `pullAll()` of every collection** before rendering; not authorized to change that financial data/consistency path without separate tests.
652 -- **Bounded fix:** preserve exact extension order and Auth timing dependency, use ordered **parallel download** for dynamic extension scripts through `script.async=false` before append, await all settled only after ordered execution, and make optional Excel CDN non-parser-blocking (without breaking export/import or replacing it). Capture read-only site/CDN response timings where available. Add deterministic real Chromium startup network test simulating high-latency extension downloads, proving serial-vs-parallel critical path, exact dependency order, once-only Auth after all scripts and graceful error under blocked CDN. Ensure no actual account/tenant data is read, no altered Auth/RLS/roles, schema/ledger, no test account creation, no unapproved data migration.
653 -- **QA and release:** preserve fallback if an extension asset fails, maintain existing Quality/Golden/Playwright and Security gates, merge reviewed PR only with verified checks, confirm protected-main CI and published assets. Capture cold-start comparative behavior with synthetic throttled requests; no claim of owner ISP metric without actual owner-machine browser timings.
654 -- **Owner-visible progress:** Phase 0 OPEN. F0-01 affected-ISP sign-in, F0-02 real tenant catalog, F0-03 safe persistence, F0-04 physical print, F0-07 two-user access checks remain unverified; do not mark them passed. Rollback: revert this narrowly scoped PR and gated Pages redeploy, no data rollback.
655 -
656 -
657 -### 2026-10-12 Phase 0 startup speed correction — PR controlled browser QA PASS / PRODUCTION RELEASE PENDING
658 -- Investigated owner-reported cold-start delay from actual protected-main sources and authorized remote read-only Windows HTTP probes: `https://factoreasy.ir/` **HTTP 200 ~1.616s**, representative extension **HTTP 200 ~0.477s**, optional CDN SheetJS **HTTP 200 ~2.663s** (one measurement each; not full user-browser timings). Source `js/bootstrap.js` previously waited for **14 individual network-loaded extension modules serially** *before* calling `initAuthSystem`; `index.html` contained parser-blocking third-party XLSX script and CSS. Assets across `js/` total ~0.75 MiB (55 scripts); network round-trip waterfall is a demonstrated structural issue. Authenticated `pullAll()` still uses sequential pages for full tenant data, and its latency on the owner's ISP is **not measured**.
659 -- Fixed in [PR #100](https://github.com/davoodmehraban89/Factor-easy/pull/100): classic extension scripts now append concurrently with `async=false` set before injection (preserves execution/dependencies), wait `Promise.allSettled` before session check; credential-free `window.FinoraStartupStatus` records only extension count/failure count/load time and `authChecked`. Optional Excel CDN loads `async`; external font CSS loads nonblocking with CSP-compatible local listener and Tahoma fallback. `scripts/build-pages.mjs` continues to replace SheetJS with the pre-existing **pinned SRI** cdnjs equivalent and strict CSP, now carrying `async`; no security gate relaxation. Existing admin fake-user browser test now waits for `authChecked` before its fixture, eliminating race from faster real initialization; no user-auth data accessed.
660 -- New `scripts/phase0-startup-performance.spec.js` has two real Chromium cases: artificial **170ms per extension** latency checks all **14 requested in parallel** and ordered bootstrap still shows login; unavailable third-party Excel/font does not prevent auth screen and Excel guard remains. Exact tested PR head `278bda0836aa650d5cf1d96611e4001097433131`: **Quality `38229232737` SUCCESS**, static job **89/89 Playwright Chromium PASS (48.6s)**, extension dispatch spread **5ms** in synthetic slowed network, all 3 disposable DB jobs PASS, Golden accounting and draft/posted safety PASS, 55 JS/52 MJS syntax PASS; **Security `38229232632` SUCCESS**, SRI/CSP release-safety and CodeQL. The earlier initial PR head Security `38228347152` failed on SRI release-builder detection; corrected builder preserved SRI. Initial browser run `38228617932` had exactly one test fixture auth-initialization race (88/89; not published); corrected and rerun fully green.
661 -- **Current classification:** IMPLEMENTED / PR-HEAD_CONTROLLED_QA_PASSED; protected-main merge/Quality/Security/Release/Pages/published-asset verification **PENDING**. F0-01 affected ISP login and owner-specific post-login latency still **UNVERIFIED**, Phase 0 remains OPEN. No Supabase/Auth/RLS/roles/schema, production user, financial ledger, stored records, login permissions or external accounts modified. Rollback PR and gated Pages.
662 -
663 -
664 -### 2026-10-12 Phase 0 startup waterfall optimization — RELEASED VIA GATED PAGES / OWNER LATENCY OPEN
665 -- Owner observed very slow startup. Investigated real main: **14 ordered extension scripts loaded one-by-one** *before* starting login/session restoration; optional third-party XLSX was parser-blocking, remote font CSS also contributed blocking. Read-only authorized Windows probe (one sample each): homepage HTTP 200 ~**1.616s**, extension ~**0.477s**, optional Excel CDN ~**2.663s**. `js/` contains 55 files ~0.75 MiB. Live Supabase `public.records` `pg_stat_user_tables.n_live_tup` **estimated ~441 rows / ~600 kB**, no per-user lookup; this does **not** prove user session/pullAll fast, which remains separately unmeasured.
666 -- **Fix shipped:** [PR #100](https://github.com/davoodmehraban89/Factor-easy/pull/100) merged to protected `main` exact SHA **`a67c07a717bffc2a8ee90c7e3cc9db55c2d05881`**. Startup `js/bootstrap.js` now downloads all 14 extension scripts concurrently with `script.async=false` (execute in original dependency order), awaits all loaded/failed before running real Auth and exposes only credential-free timing/asset count and `authChecked`. `index.html` moves optional XLSX script to async, font stylesheet to nonblocking media with safe local-JS activation, cache-busts bootstrap; build-pages retains pre-approved **pinned SRI** for cdnjs Excel under strict production CSP. Existing fake-admin Playwright test waits `authChecked` to avoid test-only race. No client user data or financial write modified.
667 -- **Exact final PR-head evidence** `c45807d949c36c32b6e00aaef3e8f47fa9f1e833`: Quality **`38230103321` SUCCESS** (static 55 JS / 52 MJS syntax PASS, Golden accounting and draft/posted PASS, 3 disposable PostgreSQL jobs PASS, **89/89 Chromium Playwright PASS**; synthetic network **170ms/extension** and extension request spread **3ms**; third-party CDN abort still shows login); Security **`38230103301` SUCCESS** including CSP/SRI release safety and CodeQL. First dry run exposed SRI build guard and then a mock-admin timing race; both were fixed and fully rerun. Never waived release security.
668 -- **Exact protected-main SHA gate verified:** Quality **`38230349289` SUCCESS**, Security **`38230349290` SUCCESS**, Release Gate **`38230688599` SUCCESS**, gated Pages deployment **`38230726054` SUCCESS**. Earlier duplicate Release `38230517388` was CANCELLED, duplicate Pages `38230704316` SKIPPED; excluded from successes.
669 -- **Honest external check:** The authorized remote Windows machine `DESKTOP-71SJ63M` was **offline** when post-publish HTTP parity check was attempted; alternate public fetch was inaccessible. Therefore GitHub proves SHA-gated Pages deploy but **direct domain HTTP parity and owner's actual observed latency not independently verified in this last check**. Owner should hard-refresh once at `factoreasy.ir`, record approximate time to see login and time after sign-in; no password/session/network token disclosure. A remaining possible factor is `enterApp()` awaiting `fetchCurrentUser()` and serial tenant `pullAll()` after authentication, not changed without data-consistency tests.
670 -- **Acceptance:** Focused Phase-0 startup/performance **FIX_IMPLEMENTED / CONTROLLED_QA_PASSED / PAGES_DEPLOYED**; **OWNER_REAL_ISP_BENCHMARK_OPEN**. F0-01/02/03/04/07 remain unaccepted; Phase 0 **OPEN**. No Auth/RLS/roles, server schema, Supabase data, financial posting or account credentials changed. Rollback: revert PR #100 and rerun guarded Pages; no data rollback.
671 -
672 -### 2026-10-14 Company form action-state / license permission follow-up
673 -- Owner requested autonomous continuation with short summaries after completed work parts.
674 -- Live read-only TinyFish dashboard showed expired organization subscription for an account expected to have lifetime entitlement; license truth is not independently verified against live database. `js/organization-rbac.js` replaces profile subscription with organization license; `js/core.js` `canWrite()` prevents edits when expired. Do not bypass license or change financial data.
675 -- Company editor action state updated in `js/companies.js`: require nonempty name, subsidiary parent, actual edit changes and `canWrite()` before enabling save. Save handler still enforces `requireWrite()`; button tooltip explains blocked license. Source originated PR #140; old branch was behind `main` by one merge and GitHub returned `405` requiring 3 missing status checks despite green Quality/Security workflows. Rebased changes on current `main` in a new PR branch, without bypassing branch protection.
676 -- Verification: previous head `2a8dc526ec4b3eaae077d0614b060e421c081d91` Quality and Security both SUCCESS, but fresh branch CI and production real DOM not yet verified. Next: verify CI and merge gates; test real DOM without modifying production accounting records; investigate organization entitlement only with authorized live DB access.
677 -
678 -
679 -### 2026-10-14 owner-approved card-free offline encrypted database backup — WORK IN PROGRESS
680 -- **User request:** implement a zero-new-subscription, no-card, no-usage-billing backup solution for Finora ERP Production. Cloudflare R2 activation requires a card and was declined; do not attempt to reuse or store any card details.
681 -- **Verified deployment locator:** production Supabase project `hcsixhqbyuhpshfwqpjx` belongs to the newly named `Finora – Production / Finora ERP – Production` organization/project. The authenticated Supabase connection available to this assistant currently lists only other inactive projects; it does **not** provide production admin or DB-password access. Remote Desktop Commander `DESKTOP-71SJ63M` was offline during this slice.
682 -- **Design authority:** implement a client-side PostgreSQL `pg_dump` custom archive streamed directly into `age` encryption without any plaintext dump file, ciphertext hash manifest, read-only validation, and opt-in localhost disposable restore check. Owner retains private age key and two independent offline copies outside the Git repository. No production changes, credential logging, sensitive secrets in repo, automatic data deletion, or billable service activation.
683 -- **Acceptance remains open:** synthetic tests and code review are not a live production backup. Production operation must be run with securely entered database credentials and supported PostgreSQL client on an authorized machine, an off-device second copy must be verified, and an isolated restore test must pass before backup is declared operational.
684 -
685 -- **Implemented scoped deliverables on branch `feat/finora-offline-encrypted-backup-20261014`:** `scripts/finora_local_backup.py` (backup, verify, localhost-only restore-test), `scripts/finora_local_backup_test.py`, `docs/FINORA_OFFLINE_BACKUP_FA.md`, README navigation, Git ignore guards and Quality workflow Python contract step. No R2 subscription, bucket, paid account, GitHub Secrets, Supabase production queries, or backup schedule was created.
686 -- **Independent local verification:** Python 3.13.5 offline unittest **7/7 PASS**, including encrypted-stream contract (with a deliberately fake age executable; real cryptography **not** verified), manifest/hash checks, dump/encryption failure cleanup, blocked remote/ordinary restore targets, local disposable restore process contract and out-of-repository output path. Repeated twice. Exact GitHub blob IDs match locally tested byte content: `scripts/finora_local_backup.py` `f38d6778d355818588e3b59113781bce2d4e6b8e` and `scripts/finora_local_backup_test.py` `edd94ec3fea2678127e9ebba0fbc1e5661cb89ee`.
687 -- **Explicit remaining acceptance:** live Production pg_dump, real age encryption/decryption, verified offline second copy, actual isolated PostgreSQL restore, Supabase Storage and external configuration backup all **NOT TESTED**. Windows owner device `DESKTOP-71SJ63M` was offline (47 hours since last seen); this assistant's connected Supabase projects are not the production project. Need owner to install client tools, locally generate and safeguard age key, obtain production database connection details (do not share password here), run commands on authorized connected host and provide non-sensitive success/failure evidence. Automatic scheduling is NOT configured.
688 -- **Rollback:** revert scoped PR, remove optional Python CLI/tests/docs; since no production DB writes or new subscriptions occurred, no DB rollback is needed. Quality/Security CI and merge **PENDING**.
689 -
690 -- **Safety correction before final CI:** backup process now catches interruption for ciphertext/manifest cleanup and consumes `pg_restore` stderr asynchronously to avoid pipe deadlock during failures. Reverified **7/7 local synthetic tests PASS** on exact new script blob `f38d6778d355818588e3b59113781bce2d4e6b8e`; GitHub quality/security remain PENDING. No real backup or recovery claim.
691 -
692 -
693 -### 2026-10-14 no-card offline backup merged — code/CI VERIFIED; recovery OPEN
694 -- [PR #143](https://github.com/davoodmehraban89/Factor-easy/pull/143), exact feature head `2138dd89a63a25763d1152800107834572b186d4`, Quality `38620402478` SUCCESS (all disposable DB jobs + full static/DOM job; new offline backup test step PASS), Security `38620402571` SUCCESS. Protected `main` squash merge `ae008ee6b27397513a417ed2e130d89b4d7da0f1` confirmed. Only Python backup CLI/test, documentation, .gitignore and CI workflow changed; no web application runtime, schema, Auth, tenant RLS, license, financial records, Cloudflare account billing or Production credentials changed.
695 -- No-card implementation: PostgreSQL `pg_dump -Fc` streams bytes directly to `age` to an OWNER-held offline folder (no plaintext archive persisted); sidecar SHA-256 manifest; `verify` decrypts in memory and lists archive contents; `restore-test` refuses non-localhost database targets and non-disposable database names. Windows/mobile owner should NEVER share real DB password or age private key in chat, GitHub or files.
696 -- **Truthful acceptance:** 7/7 synthetic local tests PASS and matching GitHub CI contract PASS. Genuine age crypto, production pg_dump, second off-device copy and full PostgreSQL/Supabase restore are **UNEXECUTED**. The authorized desktop remains offline; current connected Supabase integration does not expose production admin. Manual first backup only; unattended scheduler and offsite retention are not enabled. Supabase Storage files/Auth external settings are outside this SQL backup.
697 -- Owner environment: Supabase organization now `Finora – Production`, project `Finora ERP – Production`, project ref `hcsixhqbyuhpshfwqpjx` (matches `js/core.js`). Supabase Free scheduled backup unavailable; Cloudflare R2 activation requires a valid card and was not completed, so this solution uses no paid subscription.
698 -- **Exact next work:** owner powers on authorized Windows computer and brings Desktop Commander online; obtain Direct or Session-pooler DB endpoint without disclosing password; locally generate/secure an age identity; install matching PostgreSQL 17 client and age; run first encrypted backup with password entered privately; verify archive, copy to a second device, restore to *empty localhost disposable DB*, independently validate recovered rows/config, then plan time-based Windows Task Scheduler with OS-protected credentials and log rotation. Keep status `PRODUCTION_BACKUP_NOT_RUN / RECOVERY_NOT_VERIFIED` until each test is evidenced.
699 -- Historical continuity from superseded documentation PR #142: [PR #141](https://github.com/davoodmehraban89/Factor-easy/pull/141) head `c33a6a89dccfe2558c4cc77b041ef3910a4e4f77`, Quality `38605198345` SUCCESS, Security `38605198098` SUCCESS, protected main squash `9693b342670915271e3b471cf68da44b2530d99a`. Company-form Save state respects `canWrite()`; lifetime organization license discrepancy still unverified and must not be overridden.
700 -
701 -
702 -### 2026-10-14 test-account lifetime license rendered expired — ORGANIZATION BOOTSTRAP RACE CONFIRMED IN SOURCE / FIX IN PROGRESS
703 -- **Owner-provided READ-ONLY production SQL:** both owner and test account separately have exactly one active organization ownership, with a `public.licenses` organization record `plan=lifetime, status=active, ends_at=2099-01-01`; the test account's organization is `davood_mehraban`. Do not change licenses or confuse the two identities. Screenshots are evidence of DB state; production browser account matching is still an independent acceptance gate.
704 -- **Reproduced source ordering concern:** `js/core.js` calls `initAuthSystem()` while HTML is parsing; a saved session triggers `enterApp()`, which currently starts `fetchCurrentUser()` in parallel with `window.FinoraAppAssetsReady`. The original core `fetchCurrentUser` returns placeholder `type=none,status=unavailable`; `js/organization-rbac.js` arrives later through asynchronous ordered extension loading (`js/bootstrap.js`) and **then** wraps `fetchCurrentUser` to load the real org license. If auth lookup starts earlier, the app retains an unavailable placeholder and `updateLicenseDisplay()` treats missing end date as expired. This is a plausible deterministic race; a mocked Chromium interleaving must be added to prove it.
705 -- **Authorized minimal fix:** signal when organization-context wrapper is installed; gate profile entitlement fetch on that signal while keeping the login form interactive and all existing bounded aborts; retain parallel wait for remaining app assets; distinguish genuinely expired/cancelled subscription from unavailable/unknown in the read-only badge. No Supabase schema, RLS, Auth, role, entitlement, financial data or migration changes. Synthetic Playwright race/regression tests, Quality/Security/Pages gates and real owner/test-account production acceptance are required separately. Rollback: revert scoped PR and guarded redeploy.
706 -- **Status before implementation:** branch `fix/finora-org-license-bootstrap-race-20261014` created from protected `main`; code fix/CI/merge/release all PENDING.
707 -
708 -- **Scoped code/test implemented (CI PENDING):** `js/core.js` now creates `FinoraOrganizationContextReady`, keeps auth controls independent, and waits for organization adapter readiness before starting entitlement/profile fetch; asset loading still runs concurrently and inherits existing abort timeout. `js/organization-rbac.js` signals after its full module/wrapper installation. `updateLicenseDisplay` differentiates unavailable/unknown from truly expired/cancelled without loosening `canWrite()`. `index.html` and `js/bootstrap.js` cache-bust updated core, loader and org adapter for previously cached browser sessions. New synthetic Chromium test in `scripts/phase0-startup-performance.spec.js` delays organization module 1600ms while starting a fake authenticated transition and asserts no premature placeholder fetch, correct lifetime badge, non-expiry for unavailable state and preserved no-write-to-production behavior. No real account credentials or SQL changes.
709 -- **Evidence needed:** exact head static/build/browser + disposable DB and security CI; protected main merge; guarded Pages deploy + owner test-account hard reload should show `وضعیت اشتراک : نامحدود` if same verified organization context. If not, inspect browser account/organization/version rather than changing entitlements.
710 -
711 -### 2026-10-15 test-account license bootstrap fix — MERGED / EXACT-SHA RELEASE VERIFIED / LIVE USER ACCEPTANCE BLOCKED ON SESSION
712 -- **Fix merged in protected main:** [PR #145](https://github.com/davoodmehraban89/Factor-easy/pull/145), squash commit `4288e4a0473f7b58d4e7ac5865d3396825a34d00`. The initial fix attempt exposed a stale-version assertion in `scripts/login-connectivity-check.mjs`, which was corrected. The next run found the pre-existing expired-license DOM fixture now needed to wait for organization readiness; that was corrected without changing genuine expired-license enforcement.
713 -- **Exact PR-head checks at `1c16da89a07409ebd3a2b91e8780a6e30d06bf2c`:** Quality `38632344973` SUCCESS, Security `38632344751` SUCCESS; 119/119 Chromium Playwright PASS, including synthetic delayed organization module and synthetic genuinely expired license; all three disposable DB jobs PASS. No production SQL writes or real account data touched by tests.
714 -- **Exact protected-main SHA release evidence:** Quality [38633048129](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38633048129) SUCCESS; Security [38633048164](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38633048164) SUCCESS; Release gate [38633828981](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38633828981) SUCCESS; Deploy gated Pages [38633933732](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38633933732) SUCCESS. A redundant prior release-gate run was cancelled; the succeeding gate and its Pages deploy are verified on the same main SHA.
715 -- **Actual read-only authenticated acceptance remains OPEN:** TinyFish run `3d97a4ee-e576-4905-b251-fe94a8a26628` reached `https://factoreasy.ir` and reloaded, but showed login only, no signed-in session/dashboard/license badge. TinyFish browser profile `prof_beabc8beb1f04ed4` was independently checked and reports `signed_in_sites=[]`; the prior remembered test-account session is not presently saved/usable. This does NOT establish that the fix failed, nor that the real badge displays unlimited. Production Auth/organization/entitlement cannot be inspected through this run. Do not change production licenses or bypass Auth.
716 -- **Owner action to unblock only if they wish:** reauthenticate the TEST/WORK account using TinyFish profile setup (password entered on official site, never in chat; save signed-in browser context) or personally log into the real site with test account and share the sanitized license badge. Then observe `وضعیت اشتراک : نامحدود` after an authenticated page reload, confirming the visible organization belongs to the correct test account; if still expired, collect redacted UI status and inspect client freshness/network/organization context without license updates. Owner account remains a separate account; don't ask to use it for this test.
717 -- **Other open gates unchanged:** owner affected-network login repeatability (Phase 0), production encrypted SQL backup + off-device copy + isolated restore (`PRODUCTION_BACKUP_NOT_RUN / RECOVERY_NOT_VERIFIED`), migration parity and comprehensive tenant tests. Documentation-only continuation; rollback revert doc PR.
718 -
719 -
720 -### 2026-10-15 LIVE TEST/WORK LICENSE ACCEPTANCE — PASS (READ ONLY)
721 -- **Owner action:** set up and saved a distinct TinyFish Browser Context Profile named `Finora ERP — Test / Work Account`, separate from the original Default/admin profile. Do not interchange those identities; no credentials were supplied in chat, committed to Git, or submitted to a SQL editor.
722 -- **Verified post-deploy real-browser read-only run:** TinyFish [run `f4e14d1a-d144-4172-b43b-15d71b00f976`](https://agent.tinyfish.ai/runs/f4e14d1a-d144-4172-b43b-15d71b00f976), `https://factoreasy.ir`, status COMPLETED, authenticated session resumed automatically without a login form. Actual dashboard rendered; **exact visible subscription badge** `وضعیت اشتراک : نامحدود` (stable). The run reported a visible organization/company label `آرابتن`; do not equate a company selector label with the database `organization_id` absent independent proof.
723 -- **Disposition:** TEST/WORK-account false-`expired` subscription badge **CLOSED for observed production flow**. This is actual read-only browser acceptance of the fix introduced in PR #145 and deployed on protected-main SHA `4288e4a0473f7b58d4e7ac5865d3396825a34d00`, in addition to 119/119 synthetic Playwright and exact-SHA Quality/Security/Release Gate/Pages checks cited in the previous entry. This does not prove every browser/network, refresh duration, role, company or real financial write path.
724 -- **No database mutation:** never changed `public.licenses`, membership, RLS, Auth, role or financial history. No tests submitted forms, switched organizations or changed financial records.
725 -- **Remaining separate deliverables:** unstable initial login on owner's affected network and duration/retry acceptance (Phase 0); no-card production encrypted backup, second-device copy and isolated restore (`PRODUCTION_BACKUP_NOT_RUN / RECOVERY_NOT_VERIFIED`); other roadmap QA/deployment phases. Do not require Desktop Commander for basic GitHub/Supabase workflow.
726 -- **Exact next step:** evaluate Phase 0 repeat-login stability using separate non-destructive browser checks and available evidence, or proceed with next safe backlog slice; do NOT revisit false expiry without regression evidence. Owner can keep the dedicated test profile for later read-only QA.
727 -
728 -
729 -### 2026-10-15 Owner continues Finora / Phase 0 repeated existing-session stability — STARTED (READ ONLY)
730 -- **Latest direction:** owner: «ادامه بده». Choose the highest-value non-destructive open slice: saved Test/Work-account session reload stability and startup/login status following successful real lifetime-license acceptance, while maintaining separate owner/admin identity.
731 -- **Live repository baseline verified:** protected main `a730a9e4a806058ae130b46c4dff92b9312eff04` (PR #147, documentation only). Exact main Quality `38772208876`, Security `38772209272`, Release gate `38772666911`, gated Pages `38772767566`: all SUCCESS. Thus production test now targets that documented release, not an unverified preview.
732 -- **Scope:** with saved `Finora ERP — Test / Work Account` browser profile, run read-only multiple reload/navigation cycles; record login/dashboard access, stable badge `وضعیت اشتراک : نامحدود`, visible organization/company ambiguity, any timeout/blank screen and browser-visible failures. Never post changes, inspect private financial record details, switch org, expose cookies/token or use owner's admin profile.
733 -- **Stop condition / acceptance:** at least 3 independent reload checks and bounded navigation; if any repro failure, diagnose/repair client startup in a branch with synthetic Playwright regression and exact-SHA Quality/Security/Pages. Otherwise document that the single test-browser route passes while affected owner ISP performance and non-saved fresh login remain OPEN. Separately, backup live extraction/restoration still NOT VERIFIED, no desktop subscription required for this read-only smoke.
734 -- **Execution started:** no Supabase/Cloudflare/R2/schema/Auth/licensing/financial writes authorized or planned. Rollback for QA-only notes is doc PR revert. Production rollback only if source fix separately shown necessary.
735 -
736 -- **Phase 0 F0-01 test-profile real-browser QA checkpoint:** TinyFish run [`b92edc28-63ed-40cc-9052-e1b539399738`](https://agent.tinyfish.ai/runs/b92edc28-63ed-40cc-9052-e1b539399738) COMPLETED, four sequential browser navigation/reload cycles on `https://factoreasy.ir` with separate saved test/work session. 4/4 loaded dashboard; no sign-in prompt, blank loading, or transient stuck state; exact license badge `وضعیت اشتراک : نامحدود` each time; no data writes. Browser agent **estimated** initial 2–3s and refresh ~1–2s; these estimates are NOT controlled performance traces and do not verify owner's affected ISP or cold signed-out login.
737 -- **Next scope (owner's ongoing Phase 0 continuation):** safe READ-ONLY `F0-02` catalog/search smoke with test/work session: navigate existing invoice item selector and query known `هارد` / `بلوک`, seller/contact lookup if visible; do NOT save/create/edit/post invoice, switch companies or expose record details. This tests UI/search accessibility only; tenant isolation and actual save cannot be inferred without separate controlled tests.
738 -
739 -- **F0-02 live read-only navigation attempt, NOT VERIFIED product search:** TinyFish [run `3583d6a5-196a-42ed-ba47-727021d9a224`](https://agent.tinyfish.ai/runs/3583d6a5-196a-42ed-ba47-727021d9a224) completed on saved test/work profile. Navigation from Accounting to Commerce was attempted, but the agent could not expose Commerce submenu or reach Sales Invoice. No product/contact selectors were inspected; no invoice created or financial data changed. This is inconclusive between interaction/scroll/navigation misunderstanding and a real UI bug. Mark **F0-02 REAL ACCOUNT PRODUCT/CONTACT LOOKUP NOT VERIFIED** rather than FAIL/PASS.
740 -- **Isolated browser regression added to distinguish source problem from agent limitation:** `scripts/phase0-modal-dashboard.spec.js` now clicks Accounting then Commerce tab and verifies invoice page activation, Commerce sidebar links, absence of Accounting links, and round trip Products → Invoices with synthetic session. CI test still PENDING. Do not patch production navigation or claim source bug unless reproduced and independently validated.
741 -
742 -- **PR #148 first QA checkpoint on exact code head `119093f80b07c27517e2bd857b55f07ce9f4018f`:** Quality [`38774914246`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38774914246) **SUCCESS**, Security [`38774914170`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38774914170) **SUCCESS**. Static job `116559947340` log reports **120/120 Playwright Chromium PASS** (new F0-02 Commerce actual tab-click UI test at sequence [77/120]); D1/C8/identity disposable DB jobs SUCCESS; CodeQL + Release safety SUCCESS. This demonstrates controlled navigation works; no user-session product options inspected. No code change or speculative UI repair is warranted based on this evidence alone.
743 -- **Acceptance verdict by scope:** F0-01 saved test/work session warm-route **4/4 PASS**, but owner affected-network first login and real cold signed-out flow remain NOT VERIFIED. F0-02 Commerce tab rendering in isolated Chromium **PASS**, but real account product/party selector exercise **NOT VERIFIED** due browser-agent navigation blocker. No real invoice or contact data was read or written. Next bounded action: user-authenticated UI walkthrough of sales invoice selector from known menu path or carefully scoped read-only browser replay; preserve company context and do not mutate production records. Await **final head PR #148** Quality/Security before protected merge, then verify exact main deploy.
744 -
745 -
746 -### 2026-10-15 Phase 0 F0-02 published Pages event-wiring differential — STARTED
747 -- **Owner's latest directive:** continue project autonomously. The previous #148 test was the repository's *raw* `index.html` (120/120 Playwright passes) and the read-only production user had 4/4 saved-session page reload successes. Protected main after #148 `e544127a8a4fbc062c1c8d3b4595ef9877793c4a`, exact-SHA Quality `38776168331` SUCCESS, Security `38776168144` SUCCESS, Release gate `38776599946` SUCCESS and Pages `38776694944` SUCCESS.
748 -- **New production browser discrepancy:** TinyFish test/work session [`f95fad51-50a6-41e7-bfd2-338ed706d59a`](https://agent.tinyfish.ai/runs/f95fad51-50a6-41e7-bfd2-338ed706d59a) successfully loaded dashboard and unlimited-license badge but *could not visibly expand* the top-bar `+ ایجاد سریع` menu using click. Together with earlier Commerce tab navigation attempt, this could indicate an actual Pages CSP event-handler binding problem OR browser automation limitations. Neither real product nor contact selector was reached, so F0-02 remains NOT VERIFIED. No production data written.
749 -- **Distinct mechanism to test:** GitHub Pages is built by `scripts/build-pages.mjs` which replaces `index.html` inline onclick attributes with generated CSP-safe listeners. Existing #148 Playwright ran **raw development HTML**, which does not validate actual event binding in generated `_site/index.html`. Extend `scripts/pages-artifact.spec.js` with isolated synthetic (not production financial data) real Chromium clicks on Accounting tab, Commerce tab, top-bar Quick Create and Sales Invoice menu; assert actual content/sidebars and alert-free navigation.
750 -- **Scope/acceptance:** no license/auth/schema/RLS/roles/migration/financial data writes. If artifact test reproduces, implement a scoped CSP wiring fix + regression + exact PR Quality/Security; if PASS, document automation browser limitation versus unresolved real-account manual verification without changing source needlessly. Proceed only on evidence.
751 -
752 -- **Hardened Pages differential COMPLETED and PASS on first test head `3f42dc353eaf4398e2a5dabcfe0cfd0145f36f6c`:** Quality [`38777091455`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38777091455) SUCCESS; Security [`38777091429`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38777091429) SUCCESS. Static Quality job `116567441821` reports **121/121 Playwright Chromium PASS**, specifically `scripts/pages-artifact.spec.js:147` test `Published Pages CSP event bindings open Commerce and the top-bar sales invoice menu` PASS; all three D1/C8/identity disposable DB jobs PASS. Tested generated CSP-safe button handlers in built `_site` with synthetic license, from Accounting through Commerce, then topbar Quick Create > Sales Invoice, including panel, dropdown and aria state, with no real data/production writes.
753 -- **Triage decision:** no confirmed client-side navigation/CSP wiring defect. Both real signed-in TinyFish runs were unable to navigate to invoice form, but the actual hardened artifact demonstrates button handlers and UI change work in isolated Chromium. Distinguish **agent automation interaction blocker** from production end-user behavior. Do **not** loosen CSP, adjust finance modules, or patch navigation without credible real user repro; F0-02 real-account product/contact selectors remain **NOT VERIFIED**. Keep owner-ISP fresh sign-in acceptance and encrypted backup/live isolated restore OPEN. Rollback for this test-only change: revert PR, no DB changes.
754 -- **Release gate:** await exact final PR head checks and protected-main Pages promotion; no product source change means no functional regression introduced, but tests must remain in main.
755 -
756 -
757 -### 2026-10-15 Phase 0 saved-session & hardened Pages navigation QA — FINAL VERIFIED RELEASE
758 -- **Owner requested continued work / task complete for current bounded slice:** Saved test/work account warm-session four-cycle read-only TinyFish [run `b92edc28-63ed-40cc-9052-e1b539399738`](https://agent.tinyfish.ai/runs/b92edc28-63ed-40cc-9052-e1b539399738) 4/4 PASS: dashboard consistently available, no reauthentication, no spinner, badge `وضعیت اشتراک : نامحدود`. Browser-reported approximate 2–3s initial and 1–2s reload are NOT external performance benchmarks, and **affected owner ISP fresh login remains OPEN**.
759 -- **Two separate read-only real-account F0-02 navigations:** test/work TinyFish `3583d6a5-196a-42ed-ba47-727021d9a224` did not reach Sales Invoice through Commerce tab; `f95fad51-50a6-41e7-bfd2-338ed706d59a` saw Quick Create control but did not see its menu expand. Neither reached product/contact selectors; actual real-account search **NOT VERIFIED**. Both runs made no financial writes. Do not interpret browser agent's failure alone as a proven client defect.
760 -- **Development-source test release:** [PR #148](https://github.com/davoodmehraban89/Factor-easy/pull/148), merge SHA `e544127a8a4fbc062c1c8d3b4595ef9877793c4a`, Quality `38776168331` SUCCESS, Security `38776168144` SUCCESS, Release gate `38776599946` SUCCESS, Pages `38776694944` SUCCESS. Synthetic Chromium source navigation from Accounting → Commerce → Products → Invoice passes.
761 -- **Production-hardened Pages differential test released:** [PR #150](https://github.com/davoodmehraban89/Factor-easy/pull/150), merge SHA `928493f695eef8b5b6facbdca85dc96f3c9f67d9`. Added synthetic Chromium test `Published Pages CSP event bindings open Commerce and the top-bar sales invoice menu` against generated `_site` CSP-safe event handlers, with actual button clicks, quick menu aria toggle and invoice-page navigation. 121/121 Chromium tests PASS in QA job `116567441821` at initial test head; final PR head `64eb58adfdcd35f907fd2afe883fd3d4f2c90b98` Quality `38777656678` SUCCESS, Security `38777656686` SUCCESS. Exact protected main merge Quality [`38778221013`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38778221013) SUCCESS, Security [`38778220937`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38778220937) SUCCESS, Release gate [`38778697708`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38778697708) SUCCESS, gated Pages [`38778783998`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38778783998) SUCCESS. A superseded duplicate release-gate job was cancelled; accepted gate and Pages on exact SHA succeeded.
762 -- **Disposition/security:** no further production navigation code change indicated by current tests. No Supabase Auth, license, schema/RLS/role, tenancy, financial records, payments, Stripe, Cloudflare, GitHub credential or paid service touched. Existing validated license fix remains CLOSED for observed test-account flow.
763 -- **Remaining Phase 0 / release blockers:** F0-01 fresh first sign-in and fluctuating load on owner's affected internet/actual device **NOT VERIFIED**; F0-02 sales invoice product/customer search against actual authorized company **NOT VERIFIED**; F0-03 real persistent invoice-safe scope/physical print **NOT VERIFIED**. No-card encrypted production DB backup, independent offline copy and restore **NOT RUN**. Next safe path: owner-supplied read-only screenshot or scoped browser recording showing commerce navigation + existing product search; independent client/network diagnostics before any code change; no live invoice creation without explicit safe test scope.
764 -
765 -
766 -### 2026-10-15 F0-02 production product search PASS / buyer filtering acceptance still open — TEST STARTED
767 -- **Current owner continuation:** test-work account read-only browser [run `43e95484-3ecf-4576-a4b1-528cac50a8eb`](https://agent.tinyfish.ai/runs/43e95484-3ecf-4576-a4b1-528cac50a8eb) reached Commerce/Invoices by clicking visible Persian tab; the agent's claim that DOM `data-module` attributes are absent contradicts canonical source `index.html` and synthetic Chromium, so **do not adopt the unverified explanation as root cause**.
768 -- **Real saved test-work session targeted [run `341e1f6d-a792-4b5e-b0b9-69908056b460`](https://agent.tinyfish.ai/runs/341e1f6d-a792-4b5e-b0b9-69908056b460) COMPLETE:** Commerce Sales Invoice form reached; first existing item product combobox filter `بلوک` returned **three** options; buyer combobox/search input visible. No item selected, no invoice saved, no production data mutated. F0-02 real product lookup **PASS** for this path, but buyer filtering and metadata acceptance were only visually observed (no actual filtered buyer result).
769 -- **Contradictory next agent run [`a31d48d6-34ea-4b6d-91b3-7d28a0c817f5`](https://agent.tinyfish.ai/runs/a31d48d6-34ea-4b6d-91b3-7d28a0c817f5):** could not reach invoice, so buyer-filter and product metadata still **NOT VERIFIED** in that run. Treat intermittent browser agent navigation as a separate reproducibility issue, not proof of failing app; hardened Pages navigation regression #150 PASS 121/121.
770 -- **Planned bounded corrective QA:** extend generated hardened `_site` Pages Playwright with isolated synthetic customer/product records for own and another user; open Commerce, filter product `بلوک`, filter buyer `شرکت` without choosing; assert matching scoped options only and source select values unchanged, expected unit/price metadata on product options, zero calls to `saveDatastore`, no production Supabase write. No production schema/Auth/RLS/financial/data change or external charges.
771 -- **Exact repository baseline:** protected `main` after documentation PR #151 `b7d287ac15f7f7a6e6db1f9bc1b2778afa9193d9`. Required acceptance: new isolated browser test + full quality/security, protected merge, guarded Pages release; real buyer search remains open pending authentic read-only evidence. Rollback: revert test/docs PR; no DB change.
772 -
773 -
774 -- **TEST PASS on exact initial PR code head `f7128b21c3b65e03d1a418e07a1818a8aa98abda`:** [PR #153](https://github.com/davoodmehraban89/Factor-easy/pull/153), Quality [`38784715204`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38784715204) SUCCESS, Security [`38784715247`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38784715247) SUCCESS. Job `116593641627` logs **122/122 Chromium PASS** (new `scripts/pages-artifact.spec.js:185` test at [72/122]), all disposable DB D1, C8, identity jobs SUCCESS. The generated Pages CSP-safe product filter for `بلوک` and buyer filter for `شرکت` each returns only TWO synthetic own-user records, no cross-user options, and product `data-unit`/`data-price` metadata stays available; neither selects a different product/buyer, invokes `saveDatastore` nor creates invoice. This proves **synthetic filter behavior only**, not real buyer search or persisted invoice correctness.
775 -- **Exact next work:** await final PR head Quality/Security checks after appending this evidence, squash merge #153 if green, recheck protected-main Quality/Security/Release Gate/Pages exact SHA. Keep F0-02 real buyer filter NOT VERIFIED, affected owner ISP cold sign-in NOT VERIFIED, production backup+restore NOT RUN. Avoid additional paid-agent browsing absent a reliable way to reach the real buyer dropdown; no financial actions were taken.
776 -
777 -### 2026-10-15 concurrent PR reconciliation and isolated accounting QA bootstrap stabilization — STARTED
778 -- **Owner's ongoing instruction:** continue safe Finora execution, do not overwrite concurrent work. Existing F0-02 real saved TEST/WORK account run `341e1f6d-a792-4b5e-b0b9-69908056b460` reached Sales Invoice and filtered `بلوک` to 3 choices without save. Another TinyFish run `a31d48d6-34ea-4b6d-91b3-7d28a0c817f5` failed to navigate: real buyer filter/owner-ISP login remain NOT VERIFIED. Historical agent claim that Commerce data-module is missing contradicts source and must not be adopted.
779 -- **Concurrent main change:** while PR #152 was green on head `100969c479425151ad98967e25a2b01fe748bfba` (Quality `38785133659` SUCCESS, Security `38785133640` SUCCESS; 122/122 Playwright PASS), another agent/workstream merged equivalent [PR #153](https://github.com/davoodmehraban89/Factor-easy/pull/153) as `700846635d5a6a213885a32bbd9f9164e42c731d`. It already adds the hardened-Pages synthetic product/buyer filter + option metadata + zero-write test, head Quality `38784715204`, Security `38784715247`, 122/122 PASS. PR #152 became conflicting and was **closed without merging** rather than duplicating source or overriding PROJECT_STATE. No live database mutation.
780 -- **Additional independent QA issue from PR #152 CI:** initial Quality attempt `38784436583` had the F0-02 selector test PASS but unrelated existing `scripts/accounting-document-workflow.spec.js` 'seamless sale correction' fixture intermittently failed because `#auth-screen` remained visible. Its `authenticatedMockBrowser` waits for base `enterApp`, `commitSaveInvoice`, `pullAll` function existence but not full delayed organization/ERP bootstrap. It can invoke the mocked login before `organization-rbac.js` installs its wrapper, violating ready-order requirements. Branch `test/finora-accounting-boot-readiness-20261015` will apply a **test-only** readiness wait for `FinoraStartupStatus.extensionsReady`, `failedExtensionCount===0`, `authChecked===true`, without altering production app, finance data or Auth. Exact CI retest and protected merge pending.
781 -- **Separate legitimate side effect confirmed by captured stack:** the previously unexplained synthetic `saveDatastore` call before search was `afMigrateLegacyProjects` one-time compatibility marker when `renderContacts` initialized. PR #153 tests no writes by instrumenting save **after** fixture initialization. Preserve current migration behavior; production migration correctness remains independent open audit, no automatic change.
782 -
783 -
784 -### 2026-10-15 F0-02 selector release and treasury fixture stabilization — EXACT MAIN VERIFIED
785 -- **Real test/work account read-only evidence:** authenticated [TinyFish `341e1f6d-a792-4b5e-b0b9-69908056b460`](https://agent.tinyfish.ai/runs/341e1f6d-a792-4b5e-b0b9-69908056b460) reached Commerce/Sales Invoice and filtered `بلوک` to **3** real options without choosing a product, saving invoice or modifying records. Buyer combobox was visible/interactive but **real buyer-result filtering was NOT performed**. The next run `a31d48d6-34ea-4b6d-91b3-7d28a0c817f5` could not reach the form; intermittent TinyFish navigation is not independently confirmed as an app defect.
786 -- **Synthetic hardened Pages browser acceptance:** [PR #153](https://github.com/davoodmehraban89/Factor-easy/pull/153) merged into protected `main` as `700846635d5a6a213885a32bbd9f9164e42c731d`. Adds Playwright on built `_site` invoice product & buyer dropdowns with fake records owned by the fixture user plus unrelated owner. Product query `بلوک` and buyer query `شرکت` yield 2 own-user options each; never select, save or create. Assert no cross-owner suggestions, unchanged select values, correct underlying unit/price metadata, zero `saveDatastore` calls, zero created invoices; script is test-only. PR-final-head Quality `38785302511` SUCCESS, Security `38785302405` SUCCESS, **122/122** Chromium PASS.
787 -- **Exact-main initial Quality detected intermittent finance-fixture bootstrap issue:** Quality `38785778369` FAILURE, **121/122** Playwright PASS; sole failing treasury test `scripts/accounting-document-workflow.spec.js:499` was still on visible auth screen after mock login, before financial checks. Security `38785778160` SUCCESS; gated Pages intentionally SKIPPED until fixed. This is an actual release blocker, not a verified bug in treasury accounting amounts.
788 -- **Concurrent solution reconciled:** Another workstream merged [PR #154](https://github.com/davoodmehraban89/Factor-easy/pull/154) as protected-main `5f4ca4a6746557edc43a5106500587ad7784beab`. Its fixture-only change waits for `FinoraStartupStatus.extensionsReady===true`, `failedExtensionCount===0`, `authChecked===true` before installing synthetic `fetchCurrentUser`. No production finance/Auth/license/RLS/schema changes. Our equivalent [PR #155](https://github.com/davoodmehraban89/Factor-easy/pull/155) was closed **without merge** due to overlap/conflict; never overwrite concurrent fix.
789 -- **Final exact-main checks on `5f4ca4a6746557edc43a5106500587ad7784beab`:** Quality [`38787027438`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38787027438) SUCCESS, static job `116601549493` **122/122 Chromium PASS**, including previous intermittent treasury scenario; Security [`38787027331`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38787027331) SUCCESS; Release Gate [`38787487143`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38787487143) SUCCESS; gated Deploy Pages [`38787580775`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38787580775) SUCCESS. Superseded duplicate release runs are cancelled/skipped, not missing accepted gates.
790 -- **Current acceptance:** F0-02 real **product** lookup PASS for one authorized account, **synthetic product/buyer** filtered search PASS on production-built artifact; **real buyer filtered results still OPEN**, as are affected-ISP initial sign-in, actual financial write/recovery flows and encrypted production SQL backup+off-device copy+isolated restore (`PRODUCTION_BACKUP_NOT_RUN / RECOVERY_NOT_VERIFIED`). Do not mark full Phase 0 complete. No live Supabase operations, changed entitlements, financial saves or new paid services.
791 -- **Next safe action:** only if needed, owner/test-account read-only in-browser screen recording of buyer dropdown filter `شرکت`; keep no-write protection. Separately prepare on-device owner-held age key and authorized production database connection for first no-card backup/restore—cannot execute securely from expired Desktop Commander access. Rollback: revert test PR #153 / fixture PR #154 separately, each with exact protected-main regression gates.
792 -
793 -
794 -### 2026-10-15 Phase 0 F0-02 REAL test/work buyer search — VERIFIED READ-ONLY
795 -- **Owner asked whether work had stopped:** continued live F0-02 acceptance on saved separate Test/Work TinyFish profile; independent protected-main baseline `ac14127081aae650eeee4b34ff3b571130a39afe` was verified. Exact-main Quality `38788499153`, Security `38788499145`, Release gate `38788990403`, Pages `38789047657`: all SUCCESS. Prior concurrent work already delivered [PR #153](https://github.com/davoodmehraban89/Factor-easy/pull/153) hardened-Pages product/buyer synthetic combobox tests and [PR #154](https://github.com/davoodmehraban89/Factor-easy/pull/154) isolated accounting login test stabilization; do NOT reimplement/revert these.
796 -- **New independent LIVE authenticated acceptance:** TinyFish [run `501d5e90-8394-40d1-b6e7-1661c4233fcf`](https://agent.tinyfish.ai/runs/501d5e90-8394-40d1-b6e7-1661c4233fcf), saved TEST/WORK browser profile `prof_5ea28cf6866d447d`, reached `https://factoreasy.ir`, clicked left rail `بازرگانی` ONCE, invoice form `صدور سند تجاری` became visible. Opened visible buyer combobox corresponding to hidden `#invoice-contact-id`; option count **2 before filter, 1 after input `شرکت`**. `Escape` closed dropdown/restored previous buyer selection; no selection/record change. No save, create, post, edit, delete, or changes to Supabase/financial records. Do not republish real company/customer names in reports.
797 -- **Prior independent LIVE product filter:** TinyFish [run `341e1f6d-a792-4b5e-b0b9-69908056b460`](https://agent.tinyfish.ai/runs/341e1f6d-a792-4b5e-b0b9-69908056b460) with same Test/Work profile reached invoice and filtered `بلوک` to **3 matching product options**, without selecting/saving. Later run `a31d48d6-34ea-4b6d-91b3-7d28a0c817f5` was inconclusive for navigation, but the new run confirms navigation and buyer search in a separate successful session. Generic TinyFish agent claims about absent `data-module=commerce` contradicted source HTML and should not be treated as a root cause.
798 -- **Acceptance:** Phase 0 **F0-02 interactive product and buyer filtering PASS for observed authorized test account**; opening the invoice and reverting transient search state also PASS. Combined with 122/122 synthetic Playwright and protected Pages release, this closes the *two lookup UI acceptance checks only*. It does NOT prove committed invoice persistence, financial posting, cross-company data isolation, cold login performance on owner's affected ISP, or all user devices.
799 -- **Next safe work:** Phase 0 F0-01 affected-network fresh login needs owner-device evidence; F0-03 actual invoice persistence/print cannot be certified by no-write TinyFish test; live backup and isolated restore remain `PRODUCTION_BACKUP_NOT_RUN / RECOVERY_NOT_VERIFIED` due missing secure authorized machine and owner-held age identity. Continue source-side audit/tests without operating on live financial records. This PR updates documentation only; rollback by reverting doc PR.
800 -
801 -### 2026-10-16 Owner continuation — F0-01 delayed Pages dispatcher / legacy-request differential (PLANNED, QA ONLY)
802 -- **Owner direction:** «ادامه بده». Rechecked current protected main `69e0721d7004e8497cf43aaf6ab259b49ac97681`, open login Issue #106 and latest buyer/product acceptance #157. Main Quality `38793466628`, Security `38793466635`, Release `38793944702`, Pages `38794031181` all SUCCESS; 122/122 controlled Chromium PASS, not owner-ISP cold-login acceptance.
803 -- **Evidence and hypothesis:** owner Chrome waterfall on prior affected hotspot had unusually slow `generated-dynamic-handlers.js` (~43s) and accounting Pages group (~15s), plus an unexpected pending standalone `enterprise-iran.js`. Current `scripts/build-pages.mjs` inserts the CSP-safe dynamic dispatcher as a bottom classic blocking script. This can delay `DOMContentLoaded` and therefore extension bootstrap; the network/initiator root cause and live current release remain unproven. Current bundler intentionally consolidates 38 core scripts into three ordered groups and 14 extensions into one bundle.
804 -- **Scoped plan:** add an isolated Playwright regression for generated `_site` Pages, with delayed dynamic dispatcher and a request ledger asserting early credential controls, expected DOM readiness sequencing, no premature workspace, complete later module readiness and no unexpected standalone legacy ERP request. Do not alter runtime/Auth/schema/RLS/roles/financial records/permissions; do not hide missing assets, bypass readiness or assume 304 is a failed response. If test reveals source defect, stop and separately review minimum fix; do not assume this QA proves owner affected-network performance.
805 -- **Acceptance / rollback:** exact PR-head Quality (122+ Chromium, Golden, three disposable DB) and Security PASS; docs and test-only branch, no production writes. Restore by reverting isolated PR. Live first signed-out login on owner's impacted Chrome/ISP remains F0-01 P0 OPEN; no invoice persistence/real backup signoff.
806 -- **First independent CI result on PR #158 head `926a44321daf56f989a595b74048145e155451cc`:** Security `38813224607` SUCCESS; Quality `38813224500` FAIL, **122/123 Chromium PASS**. The one new synthetic hardened-Pages test confirmed early login remains available during deliberately delayed bottom dynamic dispatcher, but detected a standalone `enterprise-iran.js` network request, contrary to expected bundling. Three disposable DB jobs, Golden and other financial invariants passed. Do not merge or deploy this test-only PR while failing. Next: capture request resource type + Chromium Network initiator on this isolated fixture to distinguish duplicate executed script, speculative preload, or diagnostic fetch. This is an actual test failure, not yet proven runtime financial corruption or a confirmed owner-ISP fix.
807 -- **CDP root cause evidence / bounded implementation decision, before code edit:** PR #158 head `6dc91cddf403a2d482c30795f2b32e20cd6b82d2`, Quality `38814011317` 122/123 Chromium with same intentional test FAIL, Security `38814011321` PASS. Chromium `Network.requestWillBeSent` identifies a real **Script** request to `/_site/js/enterprise-iran.js`, initiator `finora-pages-foundation.js` line 565. Source mapping through ordered foundation bundle reveals `js/ui.js` line 218: a `DOMContentLoaded` listener injects a second `<script src=js/enterprise-iran.js>`. This duplicates the same ERP module already in the required accounting Pages bundle; raw development `index.html` also separately includes it statically at line 941. **Authorized narrow fix:** delete ONLY this dynamic redundant script insertion from `js/ui.js`, retain enterprise module in original static index and Pages accounting bundle and preserve module rail rendering; keep strict fail-closed gating and test full Chromium/Golden/DB/Security. Do not combine unrelated CSP handler files in this fix. Rollback by reverting ui.js one-line change.
808 -- **One-line repair controlled CI VERIFIED on PR #158 code HEAD `6dfdf41b7694ef6397c19bce8613f68cd6b724d4`:** [Quality `38814776887`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38814776887) SUCCESS; static job logs **123/123 Chromium PASS**, including the delayed CSP handler + no redundant source-script fetch regression; Golden sale→receipt→purchase→payment→reversal→trial balance→statements and accounting P0 invariants PASS; **three disposable DB jobs SUCCESS**. [Security `38814776751`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38814776751) SUCCESS. Production source change is only removal of redundant DOMContentLoaded dynamic load in `js/ui.js` (enterprise module remains in built accounting group). **PENDING:** after this evidence-only documentation append, recheck exact final PR head CI before merge; protected-main Release/Pages and actual owner-ISP cold login are NOT VERIFIED at this checkpoint. Phase 0/Issue #106 remain OPEN.
1 +# PROJECT STATE — FINORA 1.0 / FACTOR-EASY (فشرده‌شده در فاز صفر)
2 +> **مرجع اجرایی جاری برای AI و توسعه‌دهندگان** · مخزن `davoodmehraban89/Factor-easy` · شاخه محافظت‌شده `main` · تاریخ ۱۴۰۵/۰۷/۲۴.
3 +> **تاریخچه کامل بدون حذف یک بایت:** [`docs/archive/PROJECT_STATE_PRE_MASTER_PHASE0_2026-10-16.md`](docs/archive/PROJECT_STATE_PRE_MASTER_PHASE0_2026-10-16.md). Blob SHA پیش/پس از آرشیو: `4e8adb5c82b4c7e5d16f26c94cc904ba5774bca6`، ۲۹۰٬۹۱۳ کاراکتر، ۸۰۹ خط؛ برای جزئیات هر فاز/شناسه PR و تصمیم‌های قدیمی به همین سند رجوع شود. آرشیو را بدون درخواست مالک تغییر ندهید.
4 +
5 +## ۱. اصول و اختیار
6 +- قبل از کار `AGENTS.md`، `README.md` و **همین فایل** را بخوان؛ از وضعیت زنده `main`، CI، نسخه استقرار و در کارهای مرتبط Supabase را مستقل اطمینان بگیر. آخرین درخواست مالک نسبت به تاریخچه اولویت دارد. تاریخچه پشتیبان، ادعای اجرای فعلی نیست.
7 +- هماهنگ‌کننده مسئول اجرا/QA/امنیت/مستندات است. بدون ابزار واقعی ادعای ایجنت موازی نکن. تغییرات کوچک و قابل بازگشت، شاخه و PR مستقل؛ نتیجه واقعی با SHA و لاگ تست. CI موفق ≠ تایید مرورگر مشتری.
8 +- **مرز توقف:** تغییر schema/RLS/Auth/role/grants، بازنویسی تاریخچه مالی، عملیات مخرب، cutover یا هزینه و ارسال بیرونی نیازمند اجازه صریح جداگانه است. شرکت/tenant/RLS، تاریخچه posted، audit و idempotency حفظ شود؛ سرویس پولی یا کارت بین‌المللی راه‌حل اجباری نباشد.
9 +- هر migration تولیدشده باید فایل واقعی در `supabase/migrations/` داشته باشد؛ فقط محیط تست مستقل، rollback، و مجوز عملیات Production. اسناد قطعی را بازنویسی نکن؛ اصلاح با تاریخچه برگشت و سند جدید.
10 +- ماژول‌های اتوماسیون اداری، workflow، OCR و SLA موجود **فریز**ند، حذف یا توسعه نمی‌شوند مگر درخواست جدید مالک. معماری UI مرجع: `docs/reference/finora-ui-target-v1.jpg`.
11 +
12 +## ۲. تفکیک نقشه‌راه‌ها
13 +- **پرامپت جدید مالک** `finora-master-prompt-cloud.md`، اجرا فقط **فاز به فاز**: ۰ ممیزی/فشرده‌سازی؛ ۱ هسته مالی سمت سرور؛ ۲ موتور سند خودکار؛ ۳ سلامت دفتر؛ ۴ تجربه کاربر؛ ۵ آمادگی فروش. **فقط فاز ۰ در این PR مجاز است.** فاز ۱ به مجوز مشخص تغییر اسکیما و محیط تست مستقل نیاز دارد.
14 +- نقشه راه هشت‌فازی قدیمی در `docs/FINORA_EIGHT_PHASE_APPROVED_ROADMAP_2026-10-11.md` محفوظ است؛ نام فاز صفر آن «پایداری/ورود» با فاز صفر جدید «ممیزی سند مالی» **یکی نیست**. شماره فاز قدیمی را به جای فاز جدید گزارش نکن.
15 +
16 +## ۳. آخرین baseline قابل اتکا
17 +- **قبل از ممیزی جدید:** protected `main` = `612998edb51274ac1e6136a31265cd17b9abd265` (PR #158، حذف درخواست تکراری `enterprise-iran.js`). GitHub exact-SHA Quality `38815971255` **123/123 Playwright PASS**، Golden Accounting PASS، هر سه Postgres disposable jobs PASS؛ Security `38815971233`، Release Gate `38816410495`، gated Pages `38816440543` همگی SUCCESS.
18 +- اصلاح تکرار JS بر اساس CDP/Playwright بود؛ **ورود سرد/پایداری اینترنت رایانه مالک همچنان تأیید نشده**. Issue #106 باز بماند. Product+buyer live lookup در یک حساب تست/کار read-only قبول شده، ولی ذخیره/چاپ واقعی و مالک-ISP cold login جداگانه باز است.
19 +- Supabase Production با ref `hcsixhqbyuhpshfwqpjx` شناخته می‌شود؛ تاریخچه پیشین حدود ۸۲ migration تا ۱۴۰۵/۰۷/۲۱، drift آرشیو `phone_identity_profile` و warningهای امنیتی ثبت شده‌اند. **در ممیزی جدید Supabase Production فقط read-only catalog بررسی شد: وضعیت `ACTIVE_HEALTHY`، ۸۲ migration، آخرین `20261012075507`، فقدان ستون `records.version` و RPC `finora_post_event`، وجود دو امضای ۲/۳ آرگومانی `finora_sync_records`، و تریگرهای journal فقط UPDATE/DELETE. هیچ داده مالی/DDL/DML خوانده یا تغییر داده نشد.** بدون preflight ادعای وضعیت زنده امروز نکن.
20 +
21 +## ۴. فاز صفر جدید پرامپت مالی — خروجی/مرز
22 +- **مالک کار:** هماهنگی + ممیزی مالی/کیفیت. **ورودی:** SHA ثابت بالا، JS مالی، SQL migration، workflow و فایل پرامپت کاربر.
23 +- **خروجی:** `docs/EVENT_COVERAGE.md` (جدول رویدادها، سند خودکار/مشروط/مفقود و همه مسیرهای دستی)، `docs/TEST_AUDIT_PHASE0.md` (۳۸ مجموعه Playwright + ۳۵ چک ایستا/regex + ۱۴ رفتاری/ترکیبی + ۵ ابزار)، `docs/PHASE0_FINANCIAL_AUDIT_2026-10-16.md` (گزارش یک‌صفحه‌ای، P0/P1 و مرز تست) و آرشیو کامل تاریخچه.
24 +- **یافته فنی:** موتور اصلی `jeCreateDraft/jePost/jeAutoPost` مرورگری است؛ `finora_sync_records` رکورد JSONB را upsert می‌کند؛ guardهای posted روی UPDATE/DELETE هستند و INSERT زیر سند posted فاقد حفاظت هم‌ارز است؛ `jeNextNumber` سمت مرورگر اجرا می‌شود. عدم تعادل/هم‌زمانی و source-idempotency سراسری هنوز بر سرور با تست‌های منفی فاز ۱ تأیید نشده است.
25 +- **خطرات دیگر:** چک مستقل، COGS، FX، closing/opening، VAT settlement و بخشی از چرخه برگشتی سند خودکار ندارند؛ `js/sync.js:139–143` رشته‌ها را با `neutralize` دگرگون می‌کند. در فاز ۰ هیچ مورد اصلاح عملیاتی نشده است.
26 +- **تست موجود baseline:** `123/123` Chromium + Golden + ۳ DB و Security PASS (با شماره اجرا در بالا)؛ تست واقعی ۱۰۰۰ رویداد تصادفی، concurrency مالی و production E2E را **NOT VERIFIED** ثبت کن. تست‌ها از source/CI بررسی شده‌اند؛ clone به محیط محلی این چت به دلیل DNS ممکن نبود.
27 +- **تغییرات این فاز:** چهار فایل سند/آرشیو، همین خلاصه، و افزودن اجرای `public-qa-regression-check.mjs` به Quality CI؛ **هیچ کد JS، اسکیما، Production SQL، نقش یا داده مالی تغییر نکرده است.** برای تکمیل، PR scoped باید Quality/Security موفق و یکپارچگی آرشیو تأیید شود.
28 +
29 +## ۵. تعهدها/کارهای معوق (در فاز صفر انجام نشد)
30 +- فاز ۱ جدید تنها پس از دستور صریح مالک + دسترسی به Postgres آزمایشی مستقل و preflight/rollback: deferred balance+min lines، guard درج، optimistic version، شماره سند تراکنشی، قفل دوره، ممیزی append-only، event RPC/idempotency و گزارش read-only ناسازگاری تاریخی.
31 +- Issue #106 ورود روی اینترنت مالک، آزمون واقعی تسویه/چاپ، QA دوکاربره tenant، رفع drift مایگریشن، Leaked Password Protection و بکاپ رمزنگاری‌شده Production + کپی بیرونی + بازیابی آزمایشی همچنان **OPEN / NOT VERIFIED**. بدون مجوز در این موارد کاری نکن.
32 +- مدارک مرجع دیگر: `docs/FINORA_OFFLINE_BACKUP_FA.md`، `docs/FINORA_PHASE0_ACCEPTANCE_REGISTER_2026-10-12.md`، `docs/PRODUCTION_ACCOUNTING_CUTOVER_READINESS_2026-09-30.md` و آرشیو کامل بالا.
33 +
34 +## ۶. ثبت پایان این نوبت
35 +- درخواست مالک در ۱۴۰۵/۰۷/۲۴: «پرامپت را کامل مبنا بگیر؛ **فقط فاز ۰** را اجرا کن و بعد از پایان گزارش خلاصه بده؛ ادامه فاز ۱ با دستور جداگانه».
36 +- شروع از `main` SHA بالا، ایجاد شاخه `audit/finora-master-prompt-phase0-20261016`، آرشیو کامل و گزارش‌ها تولید شد. **وضعیت QA این شاخه باید از GitHub PR-head جدا بررسی شود**؛ تایید نهایی فاز فقط با قبولی آن و ادغام مستندات معتبر است.
docs/EVENT_COVERAGE.md new
+57
@@ -0,0 +1,57 @@
1 +# Finora — EVENT_COVERAGE (ممیزی فاز صفر پرامپت هسته کنترلی)
2 +**مبنای بررسی:** کد شاخه `main` در commit `612998edb51274ac1e6136a31265cd17b9abd265`، ۱۴۰۵/۰۷/۲۴. این جدول **ممیزی مسیر کد** است، نه پذیرش عملیات مالی روی دیتابیس Production. `بله/مشروط` یعنی کد با موتور `jeCreateDraft → jePost` پیوند دارد؛ **به معنی کنترل کامل سمت سرور نیست**. وضعیت «ثبت رویداد» با «ایجاد سند دوبل» تفکیک شده است.
3 +
4 +## ۱. ماتریس پوشش رویداد مالی
5 +
6 +| رویداد تجاری/مالی | محل ثبت/منطق | سند دوبل کنونی | شرط و شکاف مستند |
7 +|---|---|---|---|
8 +| فروش قطعی | `js/invoices.js:386–409`، `js/journal-engine.js:138–151` | **بله، از مرورگر** | `sale` به حساب دریافتنی/نقد، درآمد و مالیات می‌نشیند؛ پیش‌نویس سند ندارد؛ Posting اتمیک سرور اثبات نشده است. |
9 +| برگشت از فروش / اصلاح فاکتور قطعی | `js/invoices.js:455–490` | **مشروط؛ از مسیر برگشت و صدور اصلاحی** | `jeReverse` سند قبلی را برمی‌گرداند؛ event type مستقل `sale_return` / شابلون برگشتی پیدا نشد. |
10 +| خرید قطعی | `js/purchases.js:168–175, 295–300`؛ `jeAutoPost('purchase')` | **بله، از مرورگر** | خرید/پرداختنی/مالیات؛ حالت‌های تاریخی و اصلاحات متفاوت‌اند. |
11 +| برگشت از خرید / اصلاح خرید قطعی | `js/purchases.js:130–174` | **مشروط؛ از مسیر برگشت و اصلاح** | event type مستقل `purchase_return` پیدا نشد؛ تطبیق تجاری/انبار مستقل لازم است. |
12 +| دریافت نقد/بانک/کارت | `js/payments.js:207–216`، `js/journal-engine.js:135,157–165` | **بله، برای رکورد جدید** | `receipt` پس از ایجاد پرداخت؛ یک روش در هر رکورد؛ چندروش در یک برگه/قواعد `بابت` عمومی اثبات نشده است. |
13 +| پرداخت نقد/بانک/کارت | `js/payments.js:207–216` | **بله، برای رکورد جدید** | `payment` با پروفایل دوحسابی؛ ثبت چندطرفه ترکیبی در یک برگه پیاده‌سازی‌شده به‌صورت کامل دیده نشد. |
14 +| تخصیص و تسویه جزئی/چندفاکتوری | `js/payments.js:145–235` | **وابسته به سند دریافت/پرداخت** | تخصیص تجاری وجود دارد؛ تضمین سروری برابری تخصیص/دفترکل و هم‌زمانی جداگانه اثبات نشده است. |
15 +| چک دریافتی/پرداختی و حالات آن | `js/cheques.js:1–15`؛ ارتباط روش چک در `payments.js` | **برای رکورد مستقل چک: خیر** | `commitSaveCheque` فقط `datastore.cheques.push` و `saveDatastore` می‌کند؛ برای دریافت/خواباندن/وصول/برگشت/خرج/عودت شابلون دفتر مستقل دیده نشد. |
16 +| هزینه | `js/expenses.js:1–10`، `js/journal-engine.js:135` | **بله، برای رکورد جدید** | `expense` با پروفایل دوحسابی کلاینت؛ هزینه بانکی جداگانه نیازمند الگوست. |
17 +| درآمد متفرقه | `js/expenses.js:1–10` | **بله، برای رکورد جدید** | `income` با پروفایل دوحسابی کلاینت. |
18 +| تنخواه: شارژ/هزینه/استرداد | `js/enterprise-iran-v2.js:15–16` | **بله، هنگام تأیید عملیات** | `petty_cash` با سه حالت `issue/expense/return`؛ فقط سند مرورگری. |
19 +| حقوق و دستمزد | `js/enterprise-iran-v2.js:12–13` | **بله، با اقدام جداگانه قطعی‌سازی** | ذخیره ردیف حقوق سند نمی‌سازد؛ `entPostPayroll` برای دوره `payroll_run` سند تولید می‌کند؛ معوقه مستقل دیده نشد. |
20 +| ذخیره تعهدات کارکنان | `js/enterprise-iran-v2.js:14` | **بله، هم‌زمان با عملیات محاسبه/ثبت** | `employee_benefit_accrual` ایجاد می‌شود؛ کلاینت صاحب محاسبات است. |
21 +| انبار: تعدیل افزایشی/کاهشی | `js/phase5-enterprise.js:49–57` | **مشروط؛ بله اگر بهای واحد مثبت** | فقط `adjustment_in/out` با `unitCost > 0` سند `inventory_adjustment` می‌گیرد؛ حرکت کالایی دیگر لزوماً سند ندارد. |
22 +| انبارگردانی | `js/phase5-enterprise.js:59–63` | **مشروط** | در صورت اختلاف مقدار، حرکت تعدیلی ثبت و سپس در صورت هزینه معتبر سند صادر می‌شود؛ ارزش‌گذاری صفر/نامعتبر خطر ایجاد می‌کند. |
23 +| انتقال بین انبار / مانده آغازین انبار | `js/phase5-enterprise.js:2,49–57` | **خیر / بر اساس مسیر فعلی** | وضعیت `posted` حرکت به معنی سند دوبل نیست؛ سیاست محاسبه بهای انبار مرکزی نیازمند تفکیک است. |
24 +| بهای تمام‌شده کالای فروخته‌شده (COGS) | `js/accounting.js:5–15`، `js/phase5-enterprise.js:22–44` | **سند خودکار مستقل اثبات نشد** | موجودی/گردش از فاکتور و حرکات محاسبه می‌شود؛ سند COGS هم‌زمان فروش در `jeAutoPost('sale')` وجود ندارد. |
25 +| تحصیل دارایی ثابت | `js/phase5-enterprise.js:68–70` | **خیر** | ذخیره دارایی در `fixedAssets` انجام می‌شود؛ سند تحصیل خودکار در این مسیر پیدا نشد. |
26 +| استهلاک ماهانه | `js/phase5-enterprise.js:74–84` | **بله، با درخواست کاربر** | `asset_depreciation` و سند معکوس موجود؛ زمان‌بندی ماهانه خودکار دیده نشد. |
27 +| قرارداد، الحاقیه، تضمین | `js/phase4-contracting.js:18–31` | **برای تعریف/تمدید/آزادسازی تضمین: خیر** | داده عملیاتی و سابقه نگه داشته می‌شود؛ سند انتظامی/وثیقه خودکار مستقل نیست. |
28 +| صورت‌وضعیت پیمان و کسورات | `js/phase4-contracting.js:32–47` | **بله، هنگام قطعی‌سازی** | `contract_statement` و برگشت حسابداری؛ قالب ردیف کسورات در مرورگر ثابت است. |
29 +| ارز، نرخ ارز | `js/phase5-enterprise.js:85–91` | **ثبت نرخ: خیر** | مرجع نرخ ارز وجود دارد؛ رویداد تسعیر و صدور سند اختلاف نرخ پیدا نشد. |
30 +| تسویه دوره‌ای مالیات ارزش افزوده | `js/journal-engine.js:142–147` | **خیر، برای تسویه دوره** | مالیات خطوط فروش/خرید هست؛ دوره‌بندی و تصفیه VAT مستقل مشاهده نشد. |
31 +| اختتامیه / افتتاحیه سال مالی | `js/journal-ui.js:57–63` | **فقط نوع سند دستی قابل انتخاب است** | موتور تولید خودکار جفت اختتامیه/افتتاحیه با پیش‌نمایش پیدا نشد. |
32 +
33 +**مواردی که در کد نام ماژول دارند الزاماً به معنی سند خودکار نیستند.** وضعیت موارد «پیدا نشد» بر اساس فایل‌های JS مالی بررسی‌شده است؛ ادعای نبودن مطلق در تمام سوابق/Production نیست.
34 +
35 +## ۲. مسیرهای سند دستی و نیمه‌دستی
36 +1. **سند مستقل دستی:** `js/journal-ui.js:25–30,57–61` (ورود حساب، آرتیکل، تفصیلی، تاریخ، نوع، شماره؛ `jeSaveManual`، قطعی‌سازی `jePostUi`، برگشت `jeReverseUi`، کپی `jeCopyVoucherUi`).
37 +2. **موتور مرکزی در مرورگر:** `js/journal-engine.js:44–62,78–126,132–165` شامل `jeNextNumber`، `jeCreateDraft`، `jePost`، `jeReverse`، `jeAutoPost`، `jePostSourceRecord`، `jePostLegacySource`. «سند خودکار» غالباً کلاینتی است، نه RPC اتمیک صدور.
38 +3. **قطعی‌سازی منبع با دکمه:** `js/invoices.js:386–409`، `js/purchases.js:168–175`، `js/document-management.js:9–17`؛ سند موقت/قطعی با عمل کاربر و داده رکورد منبع.
39 +4. **ثبت نیمه‌دستی تخصصی:** `js/phase4-contracting.js:37–47` صورت‌وضعیت؛ `js/phase5-enterprise.js:54–57,78–84` تعدیل انبار و استهلاک؛ `js/enterprise-iran-v2.js:13–16` حقوق/ذخایر/تنخواه؛ همه مستقیماً خطوط را در JS می‌سازند.
40 +5. **سوابق تاریخی:** `js/phase6-reporting.js:22–25`، `jePostLegacySource` و کدینگ/انتساب‌های قدیمی؛ انتقال به دفتر با تأیید دستی و مخاطرات سازگاری.
41 +6. **چک مستقل:** `js/cheques.js:1–15` صرفاً رکورد ثبت می‌کند، بدون اتصال مستقیم به `jePostSourceRecord`.
42 +
43 +## ۳. تأیید مستقل Live metadata پایگاه‌داده (فقط SELECT، بدون رکورد مالی)
44 +- در ۱۴۰۵/۰۷/۲۴، اتصال Supabase پروژه `hcsixhqbyuhpshfwqpjx` وضعیت `ACTIVE_HEALTHY` را گزارش داد؛ **۸۲ migration** در تاریخچه است؛ آخرین ثبت `20261012075507`.
45 +- پرس‌وجوی `information_schema.columns` روی `public.records`: `owner_id, collection, id, data, updated_at, organization_id`؛ **هیچ ستون `version` وجود ندارد**.
46 +- `pg_proc` دو امضای `public.finora_sync_records` با ۲ و ۳ آرگومان (سوم `p_organization_id uuid`) نشان داد؛ **`public.finora_post_event` پیدا نشد**. مبنای source مایگریشن قدیمی با نسخه Live چندامضایی یکی نیست و این تفاوت در فاز ۱ باید بررسی شود.
47 +- `information_schema.triggers`: `trg_finora_guard_posted_journal` و `trg_finora_guard_posted_journal_children` فقط برای `UPDATE/DELETE` ثبت شده‌اند، نه `INSERT`. این **شواهد ساختار Live** است، نه تلاش برای درج سطر متقلبانه در Production.
48 +- هیچ جدول داده مالی کاربر انتخاب نشد، هیچ SQL DDL/DML و هیچ credential در گزارش وارد نشده است.
49 +
50 +## ۴. تفکیک تضمین‌های موجود از تضمین‌های موردنیاز در فاز ۱
51 +- سرور `public.records` را با `collection, id, data(jsonb)` نگه می‌دارد و `public.finora_sync_records(jsonb,jsonb)` آپسرت می‌کند؛ مطابق `supabase/migrations/20260929083130_phase3_hardening_atomic_sync_and_ledger_guards.sql:1–22` هنوز مسیر اصلی صدور رویداد به RPC پیشنهادی `finora_post_event` تبدیل نشده است.
52 +- تریگر قفل `journalVouchers` و `journalLines/journalLineDimensions` روی **UPDATE/DELETE** اعمال شده (`...phase3_hardening...sql:24–75`)؛ قبل از `INSERT` جدید زیر سند قطعی قفل هم‌ارز مشاهده نشد.
53 +- شاخص یکتایی شماره/منبع (`...phase3_hardening...sql:76–82` و `20261011174445_posted_source_idempotency_index.sql`) **تا حدی مانع تکرار می‌شود**، اما جای صدور اتمیک، نسخه‌گذاری optimistic، قفل دوره و deferred balance check را نمی‌گیرد.
54 +- `js/sync.js:139–143` تابع `neutralize` رشته‌های ورودی را با جایگزینی `<` و `>` تغییر می‌دهد؛ ریسک تغییر معنای محتوای اصلی است، **بدون تغییر در فاز صفر**.
55 +- تعادل سند، حداقل دو آرتیکل، کنترل شماره و تاریخ، ابعاد و دوره مالی اکنون در `js/journal-engine.js:37–57` بررسی می‌شوند؛ کنترل‌های سمت سرور باید مستقل و قابل آزمون ساخته شوند.
56 +
57 +**نکته پذیرش:** تست رفتار فعلی مرورگر با تأیید اتمیک‌بودن/ایزولاسیون عملیات مالی سرور یکسان نیست. برای فاز ۱ نیاز به مجوز مستقل اسکیما/RLS/Auth طبق پرامپت و خط‌مشی مخزن است.
docs/PHASE0_FINANCIAL_AUDIT_2026-10-16.md new
+30
@@ -0,0 +1,30 @@
1 +# گزارش یک‌صفحه‌ای فاز صفر — ممیزی هسته کنترلی و سند خودکار Finora
2 +**تاریخ:** ۱۴۰۵/۰۷/۲۴ · **دامنه:** فقط «فاز ۰» پرامپت `finora-master-prompt-cloud.md`، **نه** فاز صفر نقشه‌راه هشت‌فازی قدیمی · **Baseline کد:** `612998edb51274ac1e6136a31265cd17b9abd265`. ارزیابی با مطالعه `AGENTS.md`، `README.md`، کل `PROJECT_STATE.md`، ساختار مخزن، JS عملیاتی، SQL و CI انجام شد. **بدون تغییر رفتار/اسکیما/داده مالی.**
3 +
4 +## خلاصه واقعی
5 +- موتور سند دوبل **وجود دارد**: `js/journal-engine.js` سند draft/posted/reversed، تعادل دوبل، ابعاد، منبع و شش پروفایل اصلی `sale/purchase/receipt/payment/expense/income` را در مرورگر مدیریت می‌کند. فروش/خرید/دریافت/پرداخت/هزینه/درآمد به آن وصل‌اند؛ صورت‌وضعیت، تنخواه، حقوق، ذخایر، تعدیل انبار و استهلاک نیز **در برخی عملیات** خطوط سند می‌سازند. جزئیات و ۲۴ ردیف رویداد در [EVENT_COVERAGE.md](EVENT_COVERAGE.md) ثبت شده است.
6 +- **پوشش کامل نیست:** چک مستقل فقط در datastore ثبت می‌شود؛ سند اختصاصی چرخه چک، برگشتی مستقل فروش/خرید، COGS فروش، تحصیل دارایی، تسعیر ارز، تسویه VAT و اختتامیه/افتتاحیه خودکار مشاهده نشد. بعضی اعمال مثل حقوق/استهلاک/صورت‌وضعیت نیاز به کلیک جدا برای قطعی‌سازی دارند. «خودکار» در کد کنونی عمدتاً **کلاینتی** است.
7 +- **مسیرهای دستی/نیمه‌دستی:** `jeSaveManual/jePostUi/jeReverseUi` و `jeCreateDraft/jePost/jeReverse/jeAutoPost/jePostLegacySource` شناسایی و در فایل پوشش فهرست شدند.
8 +- **کنترل سرور فعلی محدود است (با تطبیق خواندنی کاتالوگ Production):** داده دفترکل در `public.records(collection,id,data JSONB)` نگهداری می‌شود؛ `finora_sync_records` از کلاینت upsert می‌گیرد. تریگرهای قفل posted برای UPDATE/DELETE موجودند، اما محافظ INSERT زیر سند قطعی در SQL دیده نشد؛ منطق تعادل/شماره‌دهی/قفل در JS اصلی است. `ux_finora_posted_source_identity` از تکرار بعضی منبع‌ها جلوگیری می‌کند، ولی معادل RPC اتمیک جامع نیست.
9 +- **ریسک داده خام:** `js/sync.js:139–143` تابع `neutralize` پیش از استفاده رشته‌ها `<` و `>` را تغییر می‌دهد؛ در فاز صفر به داده یا تابع دست نزدیم.
10 +- **تست‌ها:** ۳۸ فایل Playwright، ۳۵ چک استاتیک/regex، ۱۴ اسکریپت رفتاری/ترکیبی، ۵ ابزار/کتابخانه و ۱ فایل Python شناسایی شد. اجرای واقعی baseline در GitHub **123/123 Chromium PASS**، تست‌های Golden/accounting PASS، سه DB آزمایشی PASS و Security SUCCESS بود. [TEST_AUDIT_PHASE0.md](TEST_AUDIT_PHASE0.md) شامل فهرست نام فایل‌ها و تفاوت تست رفتاری/وجود عبارت است. این شواهد **آزمون کامل Postgres هسته مالیِ فاز ۱ نیست**.
11 +- **تطبیق زنده بدون نوشتن:** پروژه Supabase `hcsixhqbyuhpshfwqpjx` در حالت `ACTIVE_HEALTHY` و ۸۲ migration است؛ `public.records` ستون `version` ندارد؛ `finora_sync_records` امضای ۲ و ۳ آرگومانی دارد؛ `finora_post_event` وجود ندارد؛ triggerهای قفل journal روی UPDATE/DELETE هستند، نه INSERT. هیچ داده مالی خوانده/تغییر داده نشد.
12 +- **تاریخچه:** نسخه کامل `PROJECT_STATE.md` (۲۹۰٬۹۱۳ کاراکتر، ۸۰۹ خط) عیناً در `docs/archive/PROJECT_STATE_PRE_MASTER_PHASE0_2026-10-16.md` بایگانی شد؛ SHA فایل مبدأ و آرشیو یکسان است. فایل اصلی به راهنمای فشرده تداوم تبدیل می‌شود.
13 +- **اختلاف مستندات:** `README.md` هنوز `index.html` را «تک‌فایل» معرفی می‌کند درحالی‌که برنامه اکنون ۵۵ فایل JS منبع و باندل‌ساز Pages دارد. این اختلاف فقط گزارش شده؛ README یا معماری در فاز صفر تغییر نکرد.
14 +
15 +## فهرست ریسک‌های اولویت‌دار برای تصمیم فاز ۱
16 +| اولویت | ریسک مبتنی بر شواهد | کنترل لازم / اقدام فاز بعد |
17 +|---|---|---|
18 +| **P0** | `posted` فقط در کلاینت balance-check می‌شود؛ API همگام‌سازی رکورد JSONB را می‌پذیرد | Deferred validation server + آزمون منفی Postgres |
19 +| **P0** | INSERT آرتیکل/ابعاد زیر voucher قطعی محافظت هم‌ارز ندارد | قفل INSERT + UPDATE/DELETE مستقل |
20 +| **P0** | `finora_sync_records` بدون `expected_version`، خطر overwrite هم‌زمان | optimistic concurrency و خطای تعارض قابل‌فهم |
21 +| **P0** | `jeNextNumber` شماره را از snapshot محلی می‌دهد؛ شاخص uniqueness کافی برای تخصیص ترتیبی امن نیست | شماره‌گذار تراکنشی سمت سرور به‌ازای شرکت/دوره/شعبه |
22 +| **P0/P1** | کلید idempotency و posting بر اساس کل چرخه رویداد/ابطال RPC اتمیک عمومی نیست | `finora_post_event`، event key و ممیزی append-only |
23 +| **P1** | `neutralize` محتوای واردشده را تغییر می‌دهد | خروجی escape شود، داده خام حفظ شود؛ تست برگشت‌پذیری |
24 +| **P1** | شکاف سند مالی مستقل چک، COGS، ارز، افتتاحیه/اختتامیه و چرخه کامل | **فاز ۲** پس از تثبیت سرور؛ بدون تغییر رفتار در فاز صفر |
25 +| **P1** | پذیرش Production روی اینترنت آسیب‌دیده کاربر، بازیابی بکاپ و E2E چندکاربره باز است | شواهد جدا و کنترل امنیتی؛ CI ≠ owner acceptance |
26 +
27 +## مرز اختیار، معیار پایان و اقدام بعد
28 +**کار تکمیل‌شده فاز صفر (پس از قبولی CI شاخه ممیزی):** جدول `EVENT_COVERAGE`، مسیرهای دستی، ممیزی اسامی تست‌ها و نتیجه اجرای واقعی، آرشیو بدون اتلاف تاریخچه و این گزارش؛ تغییرات محدود به مستندات و یک گام تازه Quality CI برای اجرای تست موجود `public-qa-regression-check.mjs` هستند؛ هیچ کد اجرایی Production تغییر نکرد. **بررسی‌نشده:** هیچ نوشتن/پاک‌سازی روی Production، تست ۱۰۰۰ رویداد تصادفی و migration سرور، تست کاربران واقعی و بازگردانی بکاپ انجام نشده است.
29 +
30 +**دسترسی برای فاز صفر:** فقط GitHub؛ دسترسی به رمز/حساب مشتری یا دیتابیس عملیاتی لازم نبود. **برای فاز ۱** چون اسکیما و RPC/Postgres باید عوض شود، پیش از هر migration، مجوز صریح جداگانه و محیط تست مستقل/بازیابی امن لازم است. این گزارش خود مجوز فاز ۱ نیست.
docs/TEST_AUDIT_PHASE0.md new
+38
@@ -0,0 +1,38 @@
1 +# Finora — فهرست و اعتبارسنجی تست‌های موجود (فاز صفر)
2 +**Commit مرجع کد:** `612998edb51274ac1e6136a31265cd17b9abd265` · **تاریخ:** ۱۴۰۵/۰۷/۲۴. شمارش فایل‌های این فهرست از درخت واقعی GitHub و تطبیق مجموعه‌ها انجام شده؛ آزمون‌ها را به‌لحاظ «اجرای واقعی رفتار» و «جست‌وجوی واژه در سورس» یکسان تلقی نکنید.
3 +
4 +## دسته‌بندی و نتایج اجرا
5 +| خانواده | تعداد فایل | ماهیت ادعا / کیفیت شواهد |
6 +|---|---:|---|
7 +| `scripts/*.spec.js` | **38** | Playwright/Chromium روی DOM واقعی، اما اغلب با دادهٔ mock/fixture. کیفیت از بازشدن صفحه تا گردش واقعی سند متفاوت است؛ **نه** E2E مالی روی Production. |
8 +| `*.mjs` ایستا و regex/substring | **35** | کنترل قرارداد ساختار، وجود شناسه‌ها، تابع، token SQL و UI؛ عبورشان تضمین نمی‌کند تابع درست اجرا شود یا ممنوعیت مالی واقعاً enforce شود. |
9 +| `*.mjs` رفتاری/ترکیبی | **14** | اجرای VM/تابع، فرآیند Node، fixture یا PostgreSQL؛ بخشی علاوه بر آزمون رفتاری regex هم دارد. بعضی نیازمند DB تست هستند و جداگانه اجرا می‌شوند. |
10 +| `*.mjs` ابزار/کتابخانه | **5** | build، audit CLI، parser/syntax، helper؛ همه «تست» مستقل نیستند. |
11 +| `finora_local_backup_test.py` | **1 فایل** | 7 آزمون Python شبیه‌سازی‌شده، نه بازگردانی واقعی Production. |
12 +
13 +### فهرست ۳۸ مجموعه Playwright (رفتار مرورگر)
14 +`scripts/accounting-document-workflow.spec.js`، `scripts/accounting-p0-journal.spec.js`، `scripts/admin-provisioning.spec.js`، `scripts/branding-login.spec.js`، `scripts/chart-completeness.spec.js`، `scripts/dom-smoke.spec.js`، `scripts/enterprise-invitation.spec.js`، `scripts/enterprise-license.spec.js`، `scripts/enterprise-org-ux.spec.js`، `scripts/enterprise-role.spec.js`، `scripts/identity-wave5a.spec.js`، `scripts/identity-wave5b.spec.js`، `scripts/identity-wave5c.spec.js`، `scripts/login-connectivity.spec.js`، `scripts/office-slice-c1.spec.js`، `scripts/office-slice-c2.spec.js`، `scripts/office-slice-c3.spec.js`، `scripts/office-slice-c4.spec.js`، `scripts/office-slice-c5.spec.js`، `scripts/office-slice-c6.spec.js`، `scripts/office-slice-c7.spec.js`، `scripts/office-slice-c8-runtime.spec.js`، `scripts/office-slice-c8.spec.js`، `scripts/pages-artifact.spec.js`، `scripts/phase0-dark-theme-contrast.spec.js`، `scripts/phase0-invoice-persistence.spec.js`، `scripts/phase0-modal-dashboard.spec.js`، `scripts/phase0-selector-stress.spec.js`، `scripts/phase0-startup-performance.spec.js`، `scripts/platform-office.spec.js`، `scripts/request-workflow-d2.spec.js`، `scripts/request-workflow-d3b.spec.js`، `scripts/request-workflow-d3c.spec.js`، `scripts/request-workflow-d4a.spec.js`، `scripts/shell-scroll-ownership.spec.js`، `scripts/taxpayer-print.spec.js`، `scripts/ux-hardening-r2.spec.js`، `scripts/ux-keyboard-f2.spec.js`.
15 +
16 +### ۳۵ چک ایستا؛ نیازمند جایگزین/تکمیل با تست شکست‌پذیر
17 +`accounting-p0-check.mjs`، `accounting-product-guidance-check.mjs`، `admin-provisioning-contract.mjs`، `branding-login-check.mjs`، `commercial-rnd-check.mjs`، `enterprise-invitation-check.mjs`، `enterprise-license-check.mjs`، `enterprise-org-ux-check.mjs`، `enterprise-role-check.mjs`، `identity-wave5a-check.mjs`، `identity-wave5b-check.mjs`، `identity-wave5c-check.mjs`، `login-connectivity-check.mjs`، `office-slice-c1-check.mjs`، `office-slice-c2-check.mjs`، `office-slice-c3-check.mjs`، `office-slice-c4-check.mjs`، `office-slice-c5-check.mjs`، `office-slice-c6-check.mjs`، `office-slice-c7-check.mjs`، `office-slice-c8-check.mjs`، `phase3-check.mjs`، `platform-office-check.mjs`، `posting-idempotency-check.mjs`، `quality-check.mjs`، `release-safety-check.mjs`، `request-workflow-d1-check.mjs`، `request-workflow-d1-security-check.mjs`، `request-workflow-d1-transition-check.mjs`، `request-workflow-d2-check.mjs`، `request-workflow-d3b-check.mjs`، `request-workflow-d3c-check.mjs`، `request-workflow-d4a-check.mjs`، `slice-b-rbac-check.mjs`، `ux-hardening-r2-check.mjs`.
18 +
19 +**مصادیق قطعی regex/substring:** `accounting-p0-check.mjs` (۱۷ فراخوانی match/includes/test و بدون اجرای رفتار)، `accounting-product-guidance-check.mjs` (۲۵ جست‌وجوی متنی)، `branding-login-check.mjs`، `office-slice-c8-check.mjs`، `posting-idempotency-check.mjs` و `quality-check.mjs`. این‌ها باید حفظ شوند، ولی عنوان «اثبات حسابداری دوبل» نگیرند.
20 +
21 +### ۱۴ اسکریپت رفتاری / ترکیبی
22 +`chart-completeness-check.mjs`، `enterprise-behavior-check.mjs`، `finance-integrity-audit-test.mjs`، `golden-accounting-core-check.mjs`، `kavenegar-otp-preflight-test.mjs`، `office-c8-concurrency.mjs`، `phase2-check.mjs`، `phase3-behavior-check.mjs`، `phase4-behavior-check.mjs`، `phase5-behavior-check.mjs`، `phase6-behavior-check.mjs`، `public-qa-regression-check.mjs`، `stripe-edge-sandbox-test.mjs`، `stripe-sandbox-readonly-test.mjs`.
23 +
24 +**نمونه‌های معتبرتر:** `golden-accounting-core-check.mjs` موتور سند را داخل VM با فروش→دریافت→خرید→پرداخت→برگشت→تراز اجرا می‌کند؛ `finance-integrity-audit-test.mjs` عمداً سند نامتعادل و شماره فاکتور تکراری می‌سازد و باید خطا بگیرد؛ `office-c8-concurrency.mjs` روی Postgres تست رقابت می‌کند (حوزه اتوماسیون اداری، نه هسته سند مالی). `kavenegar-otp-preflight-test.mjs` امضای رویداد را در محیط مصنوعی آزمایش می‌کند، نه پیامک واقعی. `phase2-check.mjs` و `phase5-behavior-check.mjs` **ترکیبی** هستند: بخش اجرای رفتار دارند و بخشی فقط عبارت‌های کد را بررسی می‌کنند.
25 +
26 +### ۵ ابزار/ماژول (نه لزوماً case تست)
27 +`build-pages.mjs`، `finance-integrity-audit.mjs`، `pages-blocking-bundles.mjs`، `stripe-sandbox-readonly.mjs`، `syntax-check.mjs`.
28 +
29 +## گزارش اجرا و مرزها
30 +- **آخرین اجرای مستقل روی exact `main` پیش از تغییرات اسنادی فاز صفر:** GitHub [Quality run `38815971255`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38815971255) SUCCESS و لاگ `static-quality` صریحاً **`123 passed (2.9m)`** در Chromium، **`Golden accounting core journey passed`**، همه سه PostgreSQL disposable jobs SUCCESS. [Security `38815971233`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38815971233) SUCCESS؛ [Release `38816410495`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38816410495) و [Pages `38816440543`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38816440543) SUCCESS. این‌ها شواهد **کد قبل از ممیزی** هستند؛ برای تغییر اسنادی جدید، اجرای دقیق SHA آن باید جداگانه کنترل شود.
31 +- مطابق `.github/workflows/quality.yml:21–124`، syntax check، 7 تست Python، `*.mjs`های نام‌برده در pipeline، و **تمام 38 فایل `*.spec.js`** در گام `Real DOM smoke` فراخوانی می‌شوند. سه DB جداگانه هویت، C8 و درخواست D1 دارند؛ این سه **تست جامع Postgres هسته مالی فاز ۱ نیستند**.
32 +- اجرای `*.mjs`های ابزار یا تست‌هایی که به دلایل طراحی در `quality.yml` فراخوانی نمی‌شوند، صرفاً از داشتن فایل **PASS** اعلام نشده است. آزمون concurrency C8 در workflow مخصوص DB اجرا می‌شود؛ **در این فاز یک گام تازه فقط در Quality CI** برای اجرای `node scripts/public-qa-regression-check.mjs` اضافه شد تا آزمون مستقل Pages نیز از قلم نیفتد. نتیجه دقیق آن به قبولی همان SHA جدید در CI وابسته است. `.github/workflows/qa.yml` شامل آزمون لاگین واقعی با credentialهای محیط QA است؛ **اجرای Live Auth عمومی/Production بدون مجوز و Secret مناسب تأیید نشده**.
33 +- **محدودیت اجرایی:** در محیط محلی این نشست شبکه دسترسی clone مخزن ندارد؛ از گزارش واقعی GitHub Actions روی exact SHA و بازخوانی کد/لاگ‌ها استفاده شده است. هیچ نتیجه‌ای برای تست Postgres مالی فاز ۱، ۱۰۰۰ رویداد تصادفی، تعارض نسخه‌ای، قفل دوره یا کاربر دوگانه از CI فعلی ادعا نمی‌شود.
34 +
35 +## اولویت جایگزینی تست‌های ایستا (پس از فاز صفر)
36 +1. اول سراغ `posting-idempotency-check.mjs`, `accounting-p0-check.mjs`, `phase3-check.mjs` و `phase2-check.mjs` برو: آزمون منفی واقعی PostgreSQL برای سند نامتعادل، INSERT زیر سند posted، خطای تعارض نسخه، تکرار event، قفل دوره.
37 +2. `chart-completeness-check.mjs` و `golden-accounting-core-check.mjs` را حفظ و با سناریوهای سروری + داده‌های واقعی ریال صحیح تکمیل کن؛ حذف تست VM فعلی بدون جایگزین خطاست.
38 +3. تست‌های UI/سندی را به «مرورگر عملیاتی و سرور واقعی در محیط مستقل» وصل کن و صرف green بودن snapshot/DOM را پایان عملیات مالی ندان.
docs/archive/PROJECT_STATE_PRE_MASTER_PHASE0_2026-10-16.md new
+808
@@ -0,0 +1,808 @@
1 +# PROJECT STATE — FINORA / FACTOR-EASY
2 +
3 +> **MANDATORY CONTINUITY FILE — READ THIS FIRST**
4 +>
5 +> Repository: `davoodmehraban89/Factor-easy` · Canonical branch: `main` · Product: **Finora 1.0**
6 +
7 +Read `AGENTS.md` first, then this file. Latest user chat is the only source of new instructions; repo files are continuity/context. Detailed older history remains available in Git history and the verification documents listed below.
8 +
9 +## Protocol / authority
10 +Verify live GitHub + Supabase before acting; implement/test/fix/retest/commit/verify in bounded vertical slices; archive exact production SQL; never call unrun work verified. The owner has repeatedly directed autonomous roadmap execution without routine confirmation pauses and has authorized normal in-scope GitHub/Supabase work. Keep five specialist workstreams under one coordinator: Architecture & Requirements, Implementation, UX/UI, QA & Verification, Security & Release. Use real subagents only when the environment provides them; otherwise execute those responsibilities directly without claiming parallel agents.
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 +## 2026-10-12 owner live-repository/Supabase operating request — VERIFIED READ-ONLY RECONCILIATION / PHASE 0 OPEN
18 +- **Latest chat instruction (sole new authority):** open `davoodmehraban89/Factor-easy` on `main`; read `AGENTS.md` then all of `PROJECT_STATE.md`; verify head, recent commits, CI, live Supabase migrations and RLS before implementation; correct state discrepancies first, record request before functional changes and maintain same-commit continuity for each durable change; require actual real-DOM and accounting-invariant evidence before any COMPLETED claim; list unexecuted gates as NOT VERIFIED. Every future Supabase migration must be archived under `supabase/migrations/`. **Prior approval does not waive explicit owner confirmation for any schema/RLS/Auth/role or destructive-data change.** No separate product feature was requested in this chat; scope is bounded read-only reconciliation and this documentation-only change.
19 +- **GitHub readback:** authenticated repository metadata confirms default branch `main` (push access), with latest returned commit `cc1c2cfddcff3a1f27302c027b9467fafa8b29f8` (documentation-only `PROJECT_STATE.md` change); preceding runtime merge `a67c07a717bffc2a8ee90c7e3cc9db55c2d05881` (startup optimization), before that `61cbcf3113c598022d6877e447bf8c97b4788a19`. Do not confuse the current documentation HEAD with the previous deployed runtime SHA.
20 +- **Independently fetched previous exact-runtime-SHA GitHub jobs:** Quality run `38230349289` (static job `114748008377`, database jobs `114748008669`, `114748008801`, `114748008884`) all SUCCESS; job log explicitly records **89/89 Chromium Playwright**, Golden sale/receipt/purchase/payment/expense/reversal/trial balance/financial statements, phases 2–6, financial draft/posted safety, and accounting P0 PASS. Security run `38230349290` CodeQL `114748007614` and release safety `114748008097` SUCCESS; dependency review `114748009940` SKIPPED, not passed. Exact-SHA release gate `38230688599` and Pages `38230726054` jobs SUCCESS. **Current documentation-only HEAD `cc1c2cf...` individual Actions/check-run result was not obtainable from the available commit-check endpoint (empty statuses and PR-only run lookup): NOT VERIFIED; earlier a67 runs do not certify cc1.**
21 +- **Independently read live Supabase `hcsixhqbyuhpshfwqpjx`:** `ACTIVE_HEALTHY`, PostgreSQL `17.6.1.166`, **82 recorded migrations**, latest `20261012075507 fix_identity_bootstrap_license_before_membership`; `20261007165208 phone_identity_profile`, `20261011174445 posted_source_idempotency_index`, and Wave 4/4b are present. Live records are not proof of exact SQL text parity with repository migration archives. The historical missing phone-identity archive/PR #58 issue remains unresolved; sampled `supabase/migrations/20261007165208_phone_identity_profile.sql` is 404 on `main`, while current bootstrap correction `supabase/migrations/20261012080000_fix_identity_bootstrap_license_before_membership.sql` exists. **Complete 82-to-repo migration SQL parity: NOT VERIFIED**; do not invent/reapply or replace historical migration SQL.
22 +- **Direct PostgreSQL permission audit, read-only:** **18/18 `public` tables have RLS enabled**. In `private`, **3/10 RLS enabled**, **7/10 disabled**. Despite generic Supabase RLS-warning wording alleging client exposure, actual `has_table_privilege` checks show **zero direct SELECT/INSERT/UPDATE/DELETE grants for both `anon` and `authenticated` on all ten private tables**; anon also lacks private-schema USAGE. Treat seven disabled-RLS tables as a recorded defense-in-depth/security review item **not verified as publicly accessible**, not a reason to enable RLS or modify grants without approval. This does **not** prove every SECURITY DEFINER RPC authorization path safe. Security Advisor: three private RLS-no-policy INFO, 21 authenticated-callable SECURITY DEFINER WARN and one leaked-password-protection-disabled WARN; performance advisor identified two unindexed private scheduler FKs (review only). Public RLS predicate adversarial tests, authenticated production two-user isolation, and end-user browser tests remain NOT VERIFIED.
23 +- **Reconciliation outcome:** updated the dated 2026-10-02 continuity snapshot with verified October 12 evidence while preserving historical entries, and distinguished current doc HEAD from released runtime. **Phase 0 remains OPEN, not owner accepted.** No product feature, finance data, accounts, Auth/RLS/role/schema, Supabase migration or deployment changed in this slice. Documentation branch only, rollback by reverting this entry. **Next safe step:** review/merge this documentation-only PR after exact-PR-head Quality/Security evidence; separately audit PR #58 archive parity read-only and obtain owner-session F0 acceptance evidence without credentials or financial writes.
24 +
25 +### 2026-10-12 live-state reconciliation — PR #102 merged, source and tests read back
26 +- The immediately preceding entry's `documentation branch only / pending merge` was the pre-merge checkpoint. Documentation-only PR [#102](https://github.com/davoodmehraban89/Factor-easy/pull/102), head `a053d2e3627105566c09d82475ff916fcd5e804e`, has now **MERGED** to protected `main` as `4be48f74a4add63d3f1dc8791ade6ce7c1e4c651`. Independent GitHub commit inspection confirms **only `PROJECT_STATE.md` changed**; main-branch content and new live-Supabase reconciliation entry read back intact.
27 +- **Exact PR-head verification:** Quality `38263379525` SUCCESS, static job `114859322898` logs **89/89 actual Chromium DOM PASS**, Accounting P0, double-entry, Golden and posted-history invariant PASS; disposable DB jobs `114859322415`, `114859323040`, `114859323233` SUCCESS. Security `38263379761` SUCCESS, CodeQL job `114859321621` and release safety job `114859321310` SUCCESS; Dependency Review `114859324783` SKIPPED. The post-merge main exact-SHA workflows for `4be48f74...` remain **NOT VERIFIED**, as do any owner-authenticated production F0-01/F0-02/F0-03/F0-04/F0-07, complete migration SQL parity and true adversarial RLS checks; these must not be inferred from CI or documented as COMPLETED.
28 +- **Outcome and rollback:** state reconciliation recorded and merged, **PHASE 0 STILL OPEN**; no application runtime, production ledger, Supabase schema/RLS/Auth/roles/migrations, or destructive data changed. Documentation-only rollback is a targeted revert; next independent safe task is read-only PR #58 archive-parity assessment, then owner-authorized browser acceptance against legitimate existing data with no confidential credentials in chat.
29 +
30 +## 2026-10-12 Phase 0 owner escalation — login screen looks ready but ignores interaction (PLANNED / NOT FIXED)
31 +- **User symptom and P0 priority:** the email/password form becomes visible while login resources/session initialization are still loading; entering credentials and clicking login can appear to do nothing, sometimes never reaching the application. This is distinct from the previously shipped 14-extension download optimization PR #100 and must not be declared resolved by its CI.
32 +- **Baseline:** protected main `3445a87592341512dea56745e291c10e5225d8b4`; no Auth/DB/account changes authorized. Source investigation found 40+ synchronous parser-blocking local JS tags, auth init delayed until the 14 extension scripts settle, and `handleLogin()` silently returns when `authBusy` while `enterApp()` awaits full account-record download with no visible per-step status.
33 +- **Narrow intended correction:** preserve ordered script dependencies while fetching parser-blocking app JS in parallel; initialize the login form before non-auth extensions finish; keep authenticated app transition gated on complete scripts and tenant-scoped data loading; make login-in-progress/busy/error state visible rather than leaving an apparently inert form. Add Chromium network-throttled before/after regression and preserve all accounting/Golden/Security/DB gates. No mutation of real accounts, RLS, schema, roles, financial data or Auth server settings.
34 +- **Acceptance:** fresh login form becomes actionable before intentionally delayed optional app module, mocked/unauthenticated negative tests show no credential disclosure or duplicate sign-in, restored session never renders partial app, app status never silently ignores a second click. Gate release on same-SHA Quality/Security/Release/Deploy; owner affected-network authenticated acceptance remains separately OPEN. Rollback: revert single scoped PR and gated redeploy.
35 +
36 +### 2026-10-12 Phase 0 login interactivity repair — PR #104 CONTROLLED QA PASS / MERGE PENDING
37 +- **Verified baseline and root cause:** pre-fix email/password controls painted before the application finished downloading numerous parser-blocking scripts. Core login initialization also previously waited for all 14 extension scripts to settle. Once clicked, `authBusy` silently ignored repeat clicks while authenticated `enterApp()` awaited account + `pullAll()` with no inline stage status. This matches a plausible mechanism for the owner's reported unresponsive/spinning login; **affected ISP production session not reproduced**.
38 +- **Patch in [PR #104](https://github.com/davoodmehraban89/Factor-easy/pull/104):** priority preload of versioned `js/core.js` and `js/login-connectivity.js` in HTML; explicit disabled-until-handler-ready auth controls; immediate `initAuthSystem()` after core runs and the auth DOM exists, without waiting for 14 optional ordered extension requests. Restored and newly authenticated sessions wait `FinoraAppAssetsReady` before tenant-scoped hydration; the original 41 classic ERP script execution order remains unchanged (trial `defer` was rolled back after browser regressions). Login now reports ready / authenticating / waiting for modules / loading company records / slow network / error, and duplicate clicks never trigger duplicate Auth calls. Auth HTTP requests have a bounded 12s abort using the Supabase client fetch adapter; record/ledger writes and reads are unchanged.
39 +- **Actual Chromium regressions added:** optional extension held 3.5 seconds while password form was enabled at **379ms** in one controlled runner sample; mocked incomplete hydration retains progress and suppresses duplicate sign-in; synthetic hung Auth transport aborts without modifying records endpoint behavior; optional CDN outage and ordered extensions still covered. Synthetic times are **not** owner workstation benchmarks.
40 +- **Exact tested feature-head SHA `872d26e144aab81dc6c04a5eae536f02e15ec1b3`:** [Quality `38277314941`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38277314941) SUCCESS; static quality job **92/92 actual Chromium Playwright PASS (53.7s)**, 55 JS / 52 MJS syntax PASS, Golden accounting + immutable posted-history PASS; disposable PostgreSQL C8/D1/identity jobs all SUCCESS. [Security `38277315134`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38277315134) SUCCESS. Earlier full-defer attempt failed regression (16/92), rolled back; next failure 91/92 arose from duplicate role=status and was corrected without weakening the test. **This documentation follow-up commit has not yet received same-head CI.**
41 +- **Acceptance boundaries:** coded fix and controlled QA verified; protected-main merge, exact-SHA Release/Deploy and live domain readback are **PENDING**. Owner-authenticated sign-in on affected ISP, latency after tenant `pullAll()`, real user/password and device-specific stability remain **NOT VERIFIED / F0-01 OPEN**. Phase 0 remains OPEN. No accounts, Auth server config, schema, RLS, permissions, production data or financial history modified. Rollback: revert #104 and gated Pages redeploy.
42 +
43 +### 2026-10-12 Owner-critical login responsiveness #104 — RELEASED / CONTROLLED QA PASS / REAL OWNER ISP OPEN
44 +- [PR #104](https://github.com/davoodmehraban89/Factor-easy/pull/104) reviewed and squash-merged to protected `main` as exact runtime SHA **`8217f7ebb3cb66f4be471cadd62e70a9991524cf`**. The earlier PR checkpoint above is historical, not an outstanding merge.
45 +- **Final PR tested head `b8e2529bdbda00a1c2825e892854f0aa5977eb75`:** Quality [`38277769229`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38277769229) SUCCESS, actual Chromium **92/92 PASS**, three disposable Postgres jobs PASS, Golden accounting, syntax and posting safety PASS; Security [`38277769217`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38277769217) SUCCESS.
46 +- **Exact protected-main runtime verification:** Quality [`38278039076`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38278039076) SUCCESS, Security [`38278039045`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38278039045) SUCCESS, Release Gate [`38278232706`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38278232706) SUCCESS, and gated Pages Deploy [`38278322395`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38278322395) SUCCESS. Duplicate Release `38278217834` CANCELLED / earlier Pages `38278301298` SKIPPED are not counted as success.
47 +- **Live deployed asset readback on authorized remote Windows device:** unauthenticated read-only GET of `https://factoreasy.ir/?phase0_login_release=20261012` returned HTML containing `js/core.js?v=20261012-login-ready-v2`, `js/bootstrap.js?v=20261012-login-ready-v2`, and `auth-login-status`. Independent GET of live versioned `js/core.js` contained `finoraBoundedAuthFetch` and `FinoraAppAssetsReady` strings. No password, local cookie, login session, customer records or financial writes accessed.
48 +- **Acceptance:** FIX_RELEASED + CI_CONTROLLED_QA_PASSED. Owner's affected ISP/device real sign-in/response timing, two-user RLS, full post-login `pullAll()` latency, live company/accounting and physical printer are **NOT VERIFIED**. F0-01 and Phase 0 remain **OPEN**. No Auth server/RLS/role/schema or stored finance data mutated. Next safest step is authenticated owner-device F0-01 test (without sharing any credential) and targeted read-only timings for login to workspace; only if latency persists consider a separately tested data-hydration change. Rollback: revert merged #104 and gated redeploy, no DB rollback.
49 +
50 +### 2026-10-12 P0 owner photo: inert login connectivity button / lingering session hydration (OPEN FIX)
51 +- **User evidence:** Owner's photographed latest production login shows `در حال آماده‌سازی محیط کار...` although no fresh credentials are visible, and clicking `بررسی اتصال به سرور ورود` reportedly has no visible response. This is **owner-reported real UI failure**, not evidence of an actual failed Auth HTTP request. Related [issue #106](https://github.com/davoodmehraban89/Factor-easy/issues/106).
52 +- **Confirmed source-level root cause for inert buttons under production CSP:** the Pages builder externalizes static `onclick` handlers into `js/generated-event-handlers.js` and appends that script only at the bottom of the HTML **after dozens of parser-blocking ERP scripts**, whereas `js/core.js` enables all login buttons and declares them ready early. Thus the user can click apparently enabled controls before their production event listeners are installed. Local (unbuilt) Chromium tests retain raw inline handlers, so existing coverage did not detect the gap.
53 +- **Separate suspected hang:** restored Supabase session calls `enterApp()` before a manual login and awaits `FinoraAppAssetsReady`, profile and sequential `pullAll()` without a bounded read timeout. The screenshot matches a pending restore but does not identify the precise stalled request.
54 +- **Implementation authority and safety:** change only Pages event-binding ordering and bounded READ-ONLY hydration with visible retry/error; ensure diagnostic handler is loaded before buttons enable; add realistic built Pages Chromium test with artificially stalled unrelated JS and a synthetic restored-session read. Preserve the legacy ERP script execution order and tenant-safe, atomic datastore replacement; no modification to Supabase Auth/RLS/roles/schema, stored financial records or real customer users.
55 +- **Acceptance:** demonstrate diagnostic click starts changing UI before intentionally delayed ERP script completes in built CSP artifact; synthetic stuck read must time out and return operable login without prematurely entering app; complete Golden/92+ Chromium/3 DB/Security checks and gated release; actual affected owner ISP acceptance still OPEN. Rollback narrow PR; no DB rollback.
56 +
57 +### 2026-10-12 P0 owner photo: nonresponsive login diagnostics / session restore — PR #107 RELEASED / OWNER ACCEPTANCE PENDING
58 +- **Owner field evidence:** latest photographed production login displayed `در حال آماده‌سازی محیط کار...` without an observed fresh password attempt; the button `بررسی اتصال به سرور ورود` was reported non-responsive. Photo alone does not establish that live GoTrue/Auth or any specific Supabase SQL endpoint failed. Related [issue #106](https://github.com/davoodmehraban89/Factor-easy/issues/106) remains OPEN for actual affected-ISP acceptance.
59 +- **Proven root cause #1 (inert action):** strict-CSP Pages builder replaced `onclick` attributes with handlers registered in `js/generated-event-handlers.js`, but only appended this script after 40+ blocking application JS modules. Core declared `authFormReady` and enabled controls before listeners were bound. [PR #107](https://github.com/davoodmehraban89/Factor-easy/pull/107) moves generated static handlers ahead of core in the built artifact and loads the credential-free connectivity helper before core; only marks controls ready when built handlers exist. Unbuilt legacy ERP script ordering and CSP/SRI enforcement remain intact.
60 +- **Proven root cause #2 (uncancellable hydration wrappers):** `js/organization-rbac.js` overrides both `fetchCurrentUser` (membership/licenses/roles/permissions across multiple queries) and `pullAll` (organization-filtered records), previously discarding the new bounded-read AbortSignal. Fixed by forwarding the same signal to every read-only PostgREST query, retaining strict `organization_id` filter, checking abort/org context before atomic datastore replacement and preserving server RLS as authority; unaffected reads use the existing behavior. Restored-session hydration now has a 25s upper bound, inline error and enabled diagnostics rather than indefinite apparent loading. Versioned cache URLs updated for core/sync/organization module. No financial writes or server Auth policy change.
61 +- **Controlled browser/QA evidence:** final PR head `0911c25cd039785a853b52f0189737c01cdfbe57`: [Quality `38283874464`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38283874464) SUCCESS, **96/96 Chromium Playwright PASS**, including actual built strict-CSP site click on diagnosis and login validation while a later ERP module was artificially delayed, client session timeout and atomic/cross-tenant aborted-read assertions; Golden accounting, full syntax, three isolated Postgres DB jobs passed. [Security `38283874574`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38283874574) SUCCESS. Earlier red CI exposed that organization wrappers dropped AbortSignal, a real bug which was fixed rather than weakening the test; a separate dark/light luminance intermittent failure was not treated as success.
62 +- **Exact runtime release:** #107 squash merged to protected `main` as **`23c5f5426bc2f8ad48c6323f1d43b7cf5b556875`**. Exact-SHA Quality [`38284275379`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38284275379) SUCCESS, Security [`38284275367`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38284275367) SUCCESS, Release Gate [`38284524466`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38284524466) SUCCESS, gated Pages deployment [`38284609169`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38284609169) SUCCESS. Duplicate Release `38284453656` cancelled and Pages `38284586024` skipped, **not** successes.
63 +- **Direct live-domain parity, authorized remote Windows read-only GET:** `https://factoreasy.ir/?loginCspProof=20261012` HTML includes `js/generated-event-handlers.js`, `js/core.js?v=20261012-login-wiring-v3` and `js/sync.js?v=20261012-login-read-cancel-v1`; versioned `js/bootstrap.js` points to `organization-rbac.js?v=20261012-login-scoped-read-v1`, and direct retrieved module contains `finoraOrganizationRead`, `FINORA_LOGIN_READ_TIMEOUT` and scoped read references. No owner credentials, session data, backend mutations, accounts or financial history were accessed.
64 +- **Acceptance boundary / next step:** CODE_RELEASED / SYNTHETIC_E2E_PASSED / LIVE_ASSET_PARITY_VERIFIED; owner actual affected-ISP behavior remains **NOT VERIFIED**, F0-01 and overall Phase 0 remain **OPEN**. Owner should fully refresh `factoreasy.ir`, click `بررسی اتصال به سرور ورود` with no password and report only code (AUTH_OK/AUTH_TIMEOUT/AUTH_UNREACHABLE/SITE_UNREACHABLE), then test permitted existing account login privately. Distinguish slow restored-session permissions/records from Auth service network. Rollback #107 via guarded Pages, no DB rollback.
65 +
66 +### 2026-10-12 Kavenegar OTP preparation — OWNER APPROVED OFFLINE PREPARATION ONLY / PENDING
67 +- **Owner intent:** move future Finora primary sign-in from email toward mobile OTP using previously created Kavenegar verification template `FinoraLogin`; correct owner clarification: the owner approved **preparing the technical infrastructure**, not Kavenegar's template. Most recent visible provider status was **UNDER REVIEW**, and provider template approval and SMS delivery are **NOT VERIFIED**. Preserve existing password/email/Google sign-in and all existing Supabase Auth user IDs/organizations. No automatic new accounts or reassignment of an existing identity.
68 +- **Scope/owner:** code preparation on isolated branch only; design server-side Supabase Auth Send SMS Hook -> verified webhook -> Kavenegar `verify/lookup` using template `FinoraLogin`, feature disabled/fail-closed by default, no API key in public GitHub/browser. Add a provider adapter with synthetic offline tests and setup/runbook. No Auth settings, hook, live Edge Function, environment secrets, phone mappings, database or production site modifications under this slice.
69 +- **Verified baseline:** main `833b795b7b0320260b91dcbe621bbce04b23f0c3`; live Supabase `hcsixhqbyuhpshfwqpjx` HEALTHY; `public.profiles.phone` and unique partial index existing, live `phone_identity_profile` migration recorded; no Kavenegar sender Edge Function deployed; historical PR #58 remains open, must not blindly merge/duplicate migration. Windows Desktop Commander `DESKTOP-71SJ63M` ONLINE. Its working copy `C:\Temp\Factor-easy` was observed on stale `main` SHA `b1a35fdc...`, with **0 tracked modifications / 2189 untracked files**, and is read-only for this operation; GitHub branch is canonical source.
70 +- **Acceptance:** offline contract tests cover signed hook body/gate, phone formatting, token/template injection protection, provider status/errors/timeouts and no sensitive logging; source/docs checked on feature-head CI. Activation requires independently verified **approved provider template**, securely configured API/hook secrets, admin owner confirmation before Auth provider setting changes and actual SMS send/test costs, safe linking/verification for existing user phone identities, staged user test without creating duplicate accounts, owner affected-network sign-in acceptance. RLS/tenant isolation and ledger remain unchanged. **Phase 0 F0-01 still OPEN.**
71 +
72 +### 2026-10-12 Kavenegar OTP server-only preparation — PR #110 OFFLINE QA PASS / NOT ACTIVATED
73 +- **Owner clarification upheld:** `FinoraLogin` template **NOT verified approved by Kavenegar**, only owner-approved infrastructure preparation. Provider SDK API documented; **no provider key received**, no live outbound SMS or Auth hook configuration. Keep existing email/password/Google functioning unchanged. Historical phone PR #58 remains pending and was not merged.
74 +- **PR [#110](https://github.com/davoodmehraban89/Factor-easy/pull/110):** isolated `supabase/functions/finora-kavenegar-send-sms/{handler.mjs,index.ts}` stage, `scripts/kavenegar-otp-preflight-test.mjs`, Quality workflow step and detailed `docs/FINORA_KAVENEGAR_OTP_PREPARATION_2026-10-12.md`. Feature disabled unless explicit `FINORA_KAVENEGAR_OTP_ENABLED=true` plus Edge-only `KAVENEGAR_API_KEY` and `SEND_SMS_HOOK_SECRET`. Checks Standard Webhooks HMAC and 5-minute timestamp before parsing, validates `+989...` and 6–10-digit token, uses provider's fixed template `FinoraLogin` and 3.5s timeout. Responds non-200 on disabled/invalid/provider failure; synthetic tests never contact Kavenegar. No account management, DB migrations, RLS, Auth configuration, website login UI, edge deployment, secret creation or cost.
75 +- **Observed Quality head `b6e72973a45bd48f3b2ad28f31a4da54c8094633`:** GitHub [Quality run `38296251394`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38296251394), **attempt 2 SUCCESS**, 96/96 Chromium PASS, Golden accounting PASS, OTP synthetic signed-hook/provider regression PASS, three isolated PostgreSQL suites PASS; [Security `38296251305`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38296251305) SUCCESS. First attempt had 95/96 Chromium with old F0-06 light-theme luminance assertion failing (reported 0.456 < 0.5), but no OTP regression; reran exact code job without weakening or changing the visual assertion and passed 96/96. This *documentation follow-up* commit still requires a new exact-head validation before merge.
76 +- **Acceptance still OPEN:** Kavenegar template approval/real delivery/cost, staging Edge deploy with signature verification and `verify_jwt=false`, protected server secrets, Supabase Auth phone provider & SMS hook configuration and real-account mobile binding must receive separate explicit owner approval and testing. NO automatic signup or newly created unrelated Auth user is allowed during legacy identity migration. Phase 0 F0-01 owner-real-ISP sign-in and Phase 0 as a whole remain OPEN.
77 +
78 +### 2026-10-12 Kavenegar OTP Stage 0 — SERVER SOURCE + OFFLINE QA MERGED / SMS NOT ENABLED
79 +- Owner confirmed **approve preparation, not Kavenegar template approval**. Kavenegar `FinoraLogin` approval, live credit, delivery and message cost remain **NOT VERIFIED**. Do not silently progress to live SMS.
80 +- [PR #110](https://github.com/davoodmehraban89/Factor-easy/pull/110) squash-merged to `main` commit **`6d0882810ca66e105f2c80c745daf6bc4dcfb88b`**. Committed a **disabled** server-only Supabase Auth Send SMS Hook and Kavenegar sender, signed/raw-body/expiry/phone/token guards, 3.5s external provider deadline, synthetic offline tests under Quality, and staged operational instructions. `FINORA_KAVENEGAR_OTP_ENABLED` is deliberately unset; no key in repo.
81 +- **Exact runtime main CI:** [Quality `38297230687`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38297230687) SUCCESS, `96/96` actual Chromium, Golden accounting PASS, synthetic Kavenegar OTP PASS, disposable C8/D1/identity PostgreSQL jobs PASS. [Security `38297230690`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38297230690) SUCCESS; [Release Gate `38297468930`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38297468930) SUCCESS; [gated Pages `38297514635`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38297514635) SUCCESS. Duplicate Release `38297363249` CANCELLED and Pages `38297498599` SKIPPED are not successes.
82 +- **Independent Supabase deployment inspection:** `list_edge_functions` still returned only `admin-user-management` and `finora-stripe-qa-read`, neither the new SMS hook nor phone Auth settings activated or modified. No SMS sent, no new Auth users created, no financial DB writes/RLS/schema changes. Existing email/password/Google login remains untouched. User's Desktop Commander device available; checkout `C:\Temp\Factor-easy` is stale with 2189 untracked files and was not edited.
83 +- **Remaining independent activation authorization:** vendor approval, secure server secrets, hook deployment + verify_jwt=false, enabling Supabase phone Auth and signed Send SMS hook, validated existing-user phone linking (never duplicate `auth.users.id`), SMS delivery costs/test number, CAPTCHA/rate limiting/replay dedupe plan, staged mobile UI and affected owner ISP acceptance. **No next step may infer any of these authorized. F0-01 and Phase 0 OPEN.**
84 +
85 +### 2026-10-12 Phase 0 F0-01 affected network: screenshot SITE_UNREACHABLE and account timeout — DIAGNOSIS OPEN
86 +- **Owner evidence:** real Chrome screenshot of Finora email/password login shows `دریافت اطلاعات حساب بیش از حد طول کشید...` and `SITE_UNREACHABLE` from the built-in connectivity diagnostic. The screenshot contains private login address: NEVER copy user email/credential into tickets, public logs or code. It does not prove password invalid, that all ERP assets are inaccessible or which tenant/network fetch failed. Earlier owner video/photo documented blank/inert handlers, separately addressed in PR #107; this observation is AFTER that deployment.
87 +- **Confirmed code-level limitation:** `js/login-connectivity.js` currently runs two probes: same-origin `manifest.json` and Supabase GoTrue `/auth/v1/health`, then **returns SITE_UNREACHABLE whenever ONLY manifest fetch fails**, masking the Auth outcome and without testing any executable JS. The `manifest.json` exists in GitHub and is copied by `scripts/build-pages.mjs`, but owner ISP actual asset HTTP result remains unknown. `enterApp()` read-only account bootstrap/profile/org membership/paginated records has a 25s timeout and shows the independent account timeout message. These two strings do not prove one shared cause.
88 +- **Diagnostic remediation scope:** test one same-origin critical local JS file **and** manifest independently alongside Supabase Auth health, preserve truthful independent codes and avoid false blanket unreachable from manifest alone. Add deterministic Chromium tests for manifest-only HTTP failure, actual script failure, Auth failure and combined failures. Do not log personal identifiers, passwords, JWTs, API keys or HTTP response bodies. No Supabase/Auth/RLS/roles/schema, financial posting or real account modifications. Preserve exact legacy login behavior pending actual owner ISP result. Rollback narrow UI-only PR.
89 +- **Availability limitation:** Desktop Commander device `DESKTOP-71SJ63M` reports ONLINE, but **monthly tool quota is exhausted** (explicit tool error); do not retry/reconnect/circumvent. Public external fetch of owner domain was also inaccessible in current external inspection context. Therefore real owner-ISP CDN/site/GoTrue HTTP status and precise 25s timeout stage are **NOT VERIFIED**; F0-01 and overall Phase 0 OPEN. Next owner validation: same browser and alternate network comparing independent probe codes without sharing login secrets.
90 +
91 +### 2026-10-12 F0-01 login SITE_UNREACHABLE screenshot — DIAGNOSTIC FIX RELEASED / OWNER NETWORK OPEN
92 +- **Evidence:** user Chrome screenshot showed two independent observations: `دریافت اطلاعات حساب بیش از حد طول کشید` after 25s read-only session/organization hydration; connectivity probe reported `SITE_UNREACHABLE`. Review of old `js/login-connectivity.js` proved that code was derived **solely from unsuccessful `manifest.json` fetch**, masking GoTrue health and never probing critical JS. The photo is not proof of invalid credentials or general loss of every app asset.
93 +- **Scoped remedy** [PR #112](https://github.com/davoodmehraban89/Factor-easy/pull/112), merged on protected `main` runtime SHA **`86913c74a1abc88a2912f5ba393ef3fb01dcde49`**. New credential-free diagnostic independently tests executable local `js/login-connectivity.js`, PWA `manifest.json` and `/auth/v1/health`; preserves separate `SITE_JS_*`, `MANIFEST_*`, `AUTH_*` statuses when any other probe fails. Warns that only a missing manifest does not establish sign-in failure. Cache-busts diagnostic JS. It does **not** change Auth/session/data hydration/login policy, user profile, accounting, Supabase server or posted invoices.
94 +- **PR head `b13b7273efac47961404a7196e7ced5217e0bfdf`:** [Quality run `38299516328`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38299516328) SUCCESS, **99/99 actual Chromium Playwright**, including three synthetic network failure regressions, Golden accounting, offline OTP and three PostgreSQL suites PASS. [Security run `38299516301`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38299516301) SUCCESS.
95 +- **Exact main runtime:** [Quality `38299894628`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38299894628) SUCCESS, [Security `38299894494`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38299894494) SUCCESS, [Release Gate `38300110596`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38300110596) SUCCESS, gated [Pages Deploy `38300160000`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38300160000) SUCCESS. Duplicate Release `38300060543` CANCELLED and Pages `38300138479` SKIPPED are excluded.
96 +- **Operational blocker:** authorized Windows Desktop Commander is paired/ONLINE but tool explicitly said MONTHLY USAGE EXCEEDED and instructed not to retry or reconnect; no tool quota bypass attempted. Independent external `factoreasy.ir` HTTP fetch also inaccessible through web tool. Thus live same-ISP critical-JS/manifest/Auth HTTP outcomes, browser load latency, and authenticated company data read are **NOT VERIFIED**. The CI-gated deploy is proof of publishing but not a user-network acceptance. Owner should hard-refresh Chrome, click built-in diagnostic without entering credentials, report `SITE_JS_*`, `MANIFEST_*`, `AUTH_*` code; compare once using independent mobile hotspot if available. No username/password/private email/tokens. [Issue #106](https://github.com/davoodmehraban89/Factor-easy/issues/106) and F0-01 / Phase 0 remain OPEN.
97 +- **Rollback:** revert #112 through protected gated Pages release; no financial DB rollback necessary.
98 +
99 +### 2026-10-12 Owner confirmed post-authentication login still times out — F0-01 P0 ACTIVE
100 +- **New real user result:** on the affected Chrome/ISP, initial diagnostic `SITE_JS_OK | MANIFEST_OK | AUTH_OK` but password sign-in **does not reach the workspace** and ends with `دریافت اطلاعات حساب بیش از حد طول کشید`. This is a **25-second `enterApp()` bootstrap timeout**, not evidence of incorrect credentials; `AUTH_OK` only probes public GoTrue health. Avoid sharing/storing the owner's screenshot email/password; no live credentials collected.
101 +- **Inspected source:** `enterApp()` concurrently waits `fetchCurrentUser()` (profile + membership + 7 authorization/license organization reads) and `FinoraAppAssetsReady`; it then performs paginated, tenant-scoped `pullAll()` with full atomic snapshot. All are under one 25s cancel signal, but the existing UI gives the same timeout message regardless of which step stalled. Supabase project is ACTIVE_HEALTHY, and read-only pg_indexes shows scoped `records` indexes and membership indexes; database service health does **not** demonstrate reliable owner-ISP PostgREST connectivity.
102 +- **This bounded step:** instrument stages with **strictly fixed, privacy-safe identifiers** for account/profile, organization membership, access/license, optional startup assets, and company record hydration; show exact pending stages on timeout and add a *separate read-only PostgREST reachability check* to existing site/manifest/Auth diagnostic. Add synthetic Chromium network-failure tests, keep tenant-scoped atomic data and RLS/auth paths entirely unchanged. No user DB read, schema/RLS/Auth changes, no credential/URL logging. Rollback this UI-only PR.
103 +- **Acceptance:** full Chromium/Golden/three disposable PostgreSQL/Security checks, gated main Publish and affected-browser retest showing `REST_*` + safe `BOOT_*` stage code; actual root cause cannot be claimed fixed before owner network trace. Keep [Issue #106](https://github.com/davoodmehraban89/Factor-easy/issues/106) / F0-01 / Phase 0 OPEN. Desktop Commander reported monthly usage quota exhausted; no attempts to bypass limitation or modify stale 2189 untracked files in `C:\Temp\Factor-easy`.
104 +
105 +### 2026-10-12 F0-01 actual owner login timeout after AUTH_OK — FIXED BOUNDED WAIT / STAGED DIAGNOSTIC RELEASED / ACCEPTANCE OPEN
106 +- **Owner-verified issue:** on affected Chrome ISP, owner reports password login **still did not enter** and returned `دریافت اطلاعات حساب بیش از حد طول کشید` even though earlier login diagnostic had `SITE_JS_OK | MANIFEST_OK | AUTH_OK`. Auth health does NOT validate authenticated organization/profile/tenant-record reads. Screenshots contain identifying account information; do not publish that email or collect credentials in any QA artifacts.
107 +- **Root-cause class and limited fix:** `enterApp()` awaited a top-level `fetchCurrentUser()` promise inside `Promise.all` with a 25s AbortController, but did NOT wrap that whole outer promise in `finoraAbortableRead` if its helper ignored cancellation; a synthetic permanently pending account-context operation **survived its timeout**. [PR #114](https://github.com/davoodmehraban89/Factor-easy/pull/114) fixes the outer cancellation and adds allow-listed no-PII `BOOT_*` timeout labels for `ACCOUNT_CONTEXT`, `PROFILE`, `ORG_MEMBERSHIP`, `ORG_ACCESS`, `APP_ASSETS`, and `TENANT_RECORDS`. Also adds a separate **public, read-only** Supabase PostgREST root reachability check (`REST_*`) to existing site/manifest/GoTrue connectivity without reading any company records, credentials or session. All legacy tenant-scoped authorization and atomic financial datastore synchronization remains unchanged.
108 +- **PR-head correction/reverification:** First Quality run `38302258531` FAILED **1/103 Chromium** (a synthetic never-settling account-context fixture exposed the unbounded outer wait) while 102/103 passed; fixed without weakening any test. Corrected PR exact head `c7d46a8633fc01519e044bd1bc380796ca2c777c`: [Quality `38302642079`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38302642079) SUCCESS **103/103 Chromium Playwright**, Golden core PASS, 3 disposable PostgreSQL jobs PASS; [Security `38302641996`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38302641996) SUCCESS.
109 +- **Protected-main release:** merged runtime **`bead02fbc48f04e12de8b1565d99d2a3c4af761d`**, exact SHA [Quality `38303068200`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38303068200) SUCCESS (103/103), [Security `38303068209`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38303068209) SUCCESS, [Release Gate `38303361728`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38303361728) SUCCESS and [Deploy gated Pages `38303407938`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38303407938) SUCCESS; duplicate `38303255014` Release CANCELLED and `38303388240` Pages SKIPPED excluded.
110 +- **Acceptance still NOT verified:** no direct live `factoreasy.ir` GET or owner-ISP runtime trace after this release; Desktop Commander was ONLINE but latest remote command attempt returned MONTHLY QUOTA EXCEEDED; no bypass/reconnect attempted. No actual authenticated owner sign-in, company data loading or delay root cause yet. User to hard-refresh, run built-in diagnostic, report only `REST_*` code, then attempt sign-in privately, report `BOOT_*` code on a repeated timeout; compare a different ISP if useful. The fixed outer wait prevents indefinite hanging but is **not proof full login latency has been cured**. [Issue #106](https://github.com/davoodmehraban89/Factor-easy/issues/106), F0-01 and Phase 0 remain OPEN. No server Auth/RLS/schema/roles, user identity, financial data or customer payload modifications. Rollback via #114 revert and gated redeploy, no database rollback.
111 +
112 +### 2026-10-13 Owner affected-ISP evidence pinpoints BOOT_APP_ASSETS / slow local files — REMEDIATION IN PROGRESS
113 +- **Actual photographed owner browser after #114:** `BOOT_APP_ASSETS` when attempting authenticated workspace entry; connectivity check `SITE_JS_TIMEOUT | MANIFEST_TIMEOUT | AUTH_OK | REST_HTTP_401`. The later screenshot shows cleared email/password fields, but earlier supplied login contains private email: **never reproduce identifiers**. `AUTH_OK` means GoTrue health only; `REST_HTTP_401` for unauthenticated REST root is not proof PostgREST is offline and must not be treated as the login root cause. Two same-origin no-store diagnostics timed out under owner ISP, a strong signal of unstable own-domain asset delivery, not definitive server infrastructure fault.
114 +- **Code-proven wait:** `js/bootstrap.js` currently dispatches 14 separate extension script downloads, `Promise.allSettled` has no per-resource deadline and sets `FinoraAppAssetsReady` only after **all 14** finish/fail; `enterApp()` refuses full app until that promise resolves. This exactly matches `BOOT_APP_ASSETS`, whereas the owner code did not name a specific file. The existing flow even resolves this readiness promise if any extension fails, risking partially usable financial software.
115 +- **Safe fix scope:** build a same-origin, deterministic **single production extension JS bundle** from the exact 14 source modules in dependency order (all IIFEs, preserve CSP and source); retain existing unbundled source/dev loader; bound the extension load (including missing network) and on any failure explicitly reject workspace readiness, leave login responsive and show actionable asset-failure status, NEVER render incomplete ERP. Cache-bust built script. Add real Playwright built Pages/browser tests for one-request delivery, missing bundle fail-closed, and original parallel development behavior. No network-unapproved external CDNs, no Auth/RLS/schema/users/posting/tenant data modifications. Rollback #PR via protected Pages; no DB rollback.
116 +- **Required acceptance:** full 103+ Chromium/Golden/disposable 3 PostgreSQL/Security and exact SHA Pages gate; actual affected-ISP sign-in **remains OPEN** until owner real network retest. Desktop Commander quota previously explicitly exhausted; no retry/bypass. Keep F0-01 and Phase 0 OPEN.
117 +
118 +### 2026-10-13 Owner F0-01 BOOT_APP_ASSETS — bounded production bundle RELEASED / owner sign-in OPEN
119 +- Owner's affected Chrome screenshots show `BOOT_APP_ASSETS`, `SITE_JS_TIMEOUT`, `MANIFEST_TIMEOUT`, `AUTH_OK` and `REST_HTTP_401`; these are no-store local-file delays plus GoTrue health, **not proof of incorrect credentials or PostgREST outage**. Public notes exclude account identifying information.
120 +- Source root cause class: startup waited on 14 individual extension script downloads without individual deadlines and previously marked the full ERP ready even on script errors. [PR #116](https://github.com/davoodmehraban89/Factor-easy/pull/116) merged to runtime SHA `c72a83981860ca38a68b6f4a7b9900dd664c64f7`. Pages builds one hashed, same-origin, syntax-checked bundle of the same 14 dependency-ordered IIFEs; source/dev remains independent. Extension wait bounded at 18s and failed assets reject readiness with `BOOT_APP_ASSETS_FAILED`; no partial accounting workspace is displayed.
121 +- PR-head Quality run `38311574244` SUCCESS **105/105 Chromium** (bundled production + blocked-bundle negative), Golden and 3 PostgreSQL PASS; Security `38311574218` SUCCESS. Exact merged main Quality `38311972925` SUCCESS, Security `38311972939` SUCCESS, Release Gate `38312280586` SUCCESS and Pages `38312349416` SUCCESS. Cancelled/skipped duplicate checks excluded.
122 +- No Auth/RLS/schema/users/financial data/posting, no SMS/provider or remote desktop modifications. Remote Desktop Commander previously exhausted monthly quota; no bypass. **Owner affected-ISP full sign-in and performance not yet verified**; issue #106, F0-01, Phase 0 OPEN. Next: affected Chrome hard refresh and one actual sign-in, report result, elapsed and any BOOT code; if still failing compare an independent Internet connection. Rollback: revert #116 and gated deploy.
123 +
124 +### 2026-10-13 F0-01 owner photo STILL BOOT_APP_ASSETS after #116 — bounded critical-pages optimization
125 +- Actual owner photograph shows password login reverting to `BOOT_APP_ASSETS` rather than later `BOOT_APP_ASSETS_FAILED`; therefore user success after #116 NOT VERIFIED. This does not distinguish stale HTML from slow parser-blocking scripts or an unchanged owner network. No credentials or personal email copied from photo. Browser's first JS/manifest tests previously timed out, while public Auth health worked; PostgREST root 401 is not proof of database outage.
126 +- Source review at runtime `main=9b8d4cd7fa3bcb3b8175019525eaca0ffa97fb59`: production bundle optimization #116 only consolidated 14 **dynamically loaded extension modules**; `index.html` still has **38 other, parser-blocking, same-origin local JS tags** (12 before bootstrap and 26 after it). `DOMContentLoaded` waits for these, and `js/bootstrap.js` only starts its 18s deadline at DOMContentLoaded, so the account's 25s deadline can fire first, yielding `BOOT_APP_ASSETS` despite newer #116 code.
127 +- Safe implementation scope: build three content-hashed source-order-preserving **Pages-only blocking script bundles** corresponding to exact contiguous script ranges (admin..words, patches..accounting, accounting-foundation..ux-hardening). Preserve standalone `vendor/supabase.js`, `js/login-connectivity.js`, `js/core.js`, `js/bootstrap.js`, generated CSP event listeners and extension bundle. Preserve original source/dev `index.html`; only rewrite built `_site/index.html` in `scripts/build-pages.mjs`. Static dependency and VM parse checks, real Chromium Pages runtime DOM/CSP test, withheld-late-bundle responsive login test and exactly three bundle-request assertion required. No production tenant/auth/finance changes.
128 +- Genuine remedy acceptance: full Quality Chromium, Golden accounting, three disposable PostgreSQL, Security, exact SHA protected-main Release/Pages and owner actual affected-ISP login. Do not claim owner network repaired on CI pass. Existing issue #106 / F0-01 / Phase 0 OPEN. No remote-desktop quota circumvention.
129 +
130 +### 2026-10-13 F0-01 owner BOOT_APP_ASSETS repeated after #116 — 38 parser-blocking scripts bundled / PAGES RELEASED / OWNER LOGIN OPEN
131 +- **Owner evidence:** affected Chrome still showed `BOOT_APP_ASSETS` after earlier 14-extension bundling #116. The screenshot does not prove whether the latest HTML executed or rule out ISP/cache faults. Separate earlier `SITE_JS_TIMEOUT`/`MANIFEST_TIMEOUT` were own-domain no-store fetch failures; `AUTH_OK` public GoTrue health and `REST_HTTP_401` unauthenticated REST-root reply are not proofs of credential/account faults.
132 +- **New source-proven bottleneck:** original source `index.html` had **38 other synchronous same-origin JS loads**, blocking `DOMContentLoaded`. Extension load's 18s deadline started only at `DOMContentLoaded`; the account's 25s timeout could therefore expire while APP_ASSETS was still pending even with PR #116 in the repository. The issue was diagnosed from GitHub source, not a live Chrome network timeline.
133 +- **Runtime fix** [PR #118](https://github.com/davoodmehraban89/Factor-easy/pull/118) merged on protected main SHA **`192c04a7e4c6324131f5c1b50a45bfa091c46a7a`**: Pages builder creates three SHA-hashed local classic JS bundles in strict original source execution order (12 foundation + 10 business + 16 accounting), VM syntax validates, preserves CSS boundaries, early auth handlers and existing CSP; source/dev remains unchanged. A failing required script bundle rejects workspace readiness instead of exposing partially loaded financial ERP. Together with #116 (14 extension files -> one bundle), production now downloads four bundled files instead of 52 separate foundation/enterprise extension files; vendor Supabase, CSP handler, core, bootstrap and diagnostic resources remain independent.
134 +- **Verified controls:** PR corrected head `84e840dd8fb99a83ccda109a81c48428a3cf79e1`: [Quality 38314360631](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38314360631) SUCCESS **107/107 Chromium**, including Pages grouped-bundle and blocked-group fail-closed, Golden accounting PASS and 3 disposable PostgreSQL PASS; [Security 38314360655](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38314360655) SUCCESS. Initial test run was superseded after fixing a test-only `_site` path assertion; no weakened tests.
135 +- **Exact protected-main release:** [Quality 38314813962](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38314813962) SUCCESS, [Security 38314813972](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38314813972) SUCCESS, [Release gate 38315115231](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38315115231) SUCCESS, [gated Pages 38315149869](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38315149869) SUCCESS. Duplicate Release 38314958511 CANCELLED and Pages 38315138483 SKIPPED are excluded.
136 +- **Critical boundary:** cannot assert the actual owner's ISP login is repaired; no owner device authenticated success, real waterfall or affected-ISP asset HTTP readback. Desktop Commander monthly quota previously exhausted, not bypassed. No changes to Supabase Auth/RLS/schema/roles/accounts, finance/posted invoices, SMS or production customer data. Owner to hard-refresh affected Chrome, try real sign-in once and report only success/time/`BOOT_*` code; compare independent hotspot if it still fails. Issue #106 / F0-01 / overall Phase 0 **OPEN**. Rollback: revert #118 via Quality/Security/Release/Pages; no DB rollback.
137 +
138 +### 2026-10-13 F0-01 owner actual Chrome sign-in after #118 — FIRST AFFECTED-ISP SUCCESS / REPEATABILITY OPEN
139 +- **Latest owner test (direct statement in chat):** In the same Windows Chrome, owner pressed `Ctrl+Shift+R` at `https://factoreasy.ir/`, signed in with the existing account privately, and **the primary Finora workspace opened successfully**. Owner-reported wait was approximately **20 seconds**. This is the **first positive owner-reported authenticated, affected-browser sign-in result following bundled Pages release #118**; unlike synthetic CI, it exercises the real owner network/browser. The assistant did not remotely witness the session, collect credentials, independently time navigation, or inspect the loaded asset hashes.
140 +- **Interpretation:** Earlier blanket "real login not verified" is superseded for **one manually tested login**. Record status as **OWNER_REPORTED_AUTHENTICATED_LOGIN_PASS (one run, ~20s)**, **NOT** proven reliable cold/warm start, logout/relogin, tab/browser reopen, repeat refresh, acceptable latency SLA, financial workspace hydration correctness, F0-02/03/04 or two-user RLS. A 20s total wait is a measured concern for usability, but it does not alone localize network or code delay. Do **not** assert F0-01 fully OWNER-ACCEPTED or close issue #106 until repeatability/expectations are established. Do not infer `BOOT_APP_ASSETS` can never recur.
141 +- **Verified code/release baseline re-read:** protected `main` = `47b2aa7a70f4fc4a01ce5e39dd3578b1d3563e9b`; same SHA Quality `38315777620`, Security `38315777523`, Release Gate `38316074399`, gated Pages `38316127506` all SUCCESS (cancelled/skipped counterparts excluded). PR #118 runtime merge `192c04a7e4c6324131f5c1b50a45bfa091c46a7a` uses three ordered critical bundles and one extension bundle. Live Supabase `hcsixhqbyuhpshfwqpjx` `ACTIVE_HEALTHY`, 82 migrations, latest `20261012075507`; `public` RLS 18/18, `private` RLS 3/10, with no permissions altered in this review. These independently verified repository/backend controls are not proof of user-side latency.
142 +- **Next minimal owner acceptance check:** without sharing identifiers or network captures, try one ordinary logout→login **or** a browser close/reopen followed by login on the same ISP; report workspace yes/no and approximate elapsed time. Once stable, user may verify the original company's visible data and a safe page refresh (no posting/writing). If only a 20s delay remains, investigate an explicitly defined acceptable target with browser timing evidence; do not optimize financially sensitive `pullAll()` based on guesswork.
143 +- **Change boundary:** documentation-only evidence ledger and F0-01 acceptance register; no application JS, deployment, production account/Auth, server role/RLS/schema, financial records, OTP/SMS or credentials touched. Keep [issue #106](https://github.com/davoodmehraban89/Factor-easy/issues/106) open with updated owner-positive result and follow-up. **Phase 0 OPEN**; remaining F0-02/03/04/05/06/07 owner-context gates unaffected. Rollback: revert docs-only PR.
144 +
145 +### 2026-10-13 F0-01 second-device owner login FAILED (~40s) after first-device success — CROSS-DEVICE STABILITY OPEN
146 +- **New direct owner report in chat:** A second computer was available; owner attempted Finora F0-01 sign-in, reports **login failed after approximately 40 seconds**, and then attached a screenshot. The precise on-screen error code is **NOT INDEPENDENTLY TRANSCRIBED/VERIFIED** from the attachment in this session; **do not invent or attribute** a `BOOT_*`, credentials or network error. The second computer's browser, ISP, refresh state and exact loading stage are unspecified, and may differ from the first computer. Any private identities visible in the screenshot must not be copied into repository issues.
147 +- **Paired acceptance evidence:** First owner device showed one successful authenticated main-workspace entry after Chrome `Ctrl+Shift+R` (~20s), as recorded above. Second device now failed (~40s). Mark **F0-01 CROSS_DEVICE_INCONSISTENT / OWNER_ACCEPTANCE_OPEN / P0**. One successful login is not a reliable rollout, and one failed login does not prove an outage for all users. Overall Phase 0 **OPEN**; none of F0-02/F0-03/F0-04/F0-07 can be inferred from this result.
148 +- **Independent read-only reconciliation:** latest protected main `6ac8d68ae669cbe1e914c71064a3c1fa45d6fe5c`, same-SHA Quality `38345404409`, Security `38345404529`, Release Gate `38345621057`, gated Pages `38345647098` all SUCCESS; Production Supabase `hcsixhqbyuhpshfwqpjx` `ACTIVE_HEALTHY`, 82 migrations (newest `20261012075507`). Existing authorized remote desktop remains OFFLINE. These facts certify GitHub release/backend metadata, not remote owner-browser performance.
149 +- **Source-based diagnosis boundary:** `js/core.js` shows a 9s slow-login notice for the Auth request and a **separate 25s timeout after Auth in `enterApp`**. Thus ~40s overall is consistent with multiple possible delays, but it does **not** identify a particular `BOOT_*` stage, asset failure, rejected password or tenant fetch. Login connectivity button performs four *credential-free* read-only checks with a 12s deadline (`SITE_JS`, `MANIFEST`, `AUTH`, `REST`); `REST_HTTP_401` at the unauthenticated root is not itself proof of an outage. Avoid guess-based bypasses, 25s extension, disabling readiness checks or auth/RLS changes.
150 +- **Next evidence:** ask owner for the *exact, privacy-safe* short error/status code shown under the login form (if visible) and the four connectivity codes from clicking `بررسی اتصال به سرور ورود` on that same second computer. Do not request credentials, email addresses, token/cookies, network HAR or private tenant records. Compare one normal retry or independent connection **only after** code classification. If `SITE_JS` or `MANIFEST` timeout, inspect same-origin resource timing; if `BOOT_ACCOUNT_CONTEXT` / `BOOT_TENANT_RECORDS`, inspect latency with safe browser timing, no data exfiltration. A source fix requires reproducible evidence, controlled Chromium/Golden/3DB/Security, isolated PR and exact-SHA release.
151 +- **Change boundary:** this is a **documentation + open issue evidence update only**. No runtime/login, Supabase schema/Auth/RLS/roles, identity credentials, ledger, invoices, payments, OTP, production traffic or account settings modified. Rollback: revert this docs-only PR. Issue #106 **OPEN**.
152 +
153 +### 2026-10-13 F0-01 second-device diagnostic screenshot — SECOND-DEVICE DIAGNOSTIC CONFIRMED: SITE_JS_OK / MANIFEST_OK / AUTH_TIMEOUT / REST_TIMEOUT
154 +- **Actual visible evidence from owner-provided photo (privacy-safe codes only):** after the owner reported second-device login failure at ~40 seconds, they clicked the built-in `بررسی اتصال به سرور ورود` control on that device. The on-screen diagnostic reports **`SITE_JS_OK | MANIFEST_OK | AUTH_TIMEOUT | REST_TIMEOUT`** and says the main site file is accessible but the Auth server check was unsuccessful. Unlike the prior screenshot with a generic login alert, this photo *does* resolve the four connectivity codes. It does **not** show a `BOOT_*` code from the login attempt or timing of the actual Auth request, and the second device's ISP/browser/network route are not known. No account identifiers or private content are copied.
155 +- **Verified implementation semantics:** `js/login-connectivity.js` fires four parallel, credential-free `fetch` requests (own-origin `js/login-connectivity.js`, own-origin `manifest.json`, cross-origin Supabase `/auth/v1/health`, cross-origin Supabase `/rest/v1/`) with **one shared `AbortController` and a 12-second deadline**. Hence two `*_TIMEOUT` statuses indicate that both Supabase endpoint requests had no successful fetch completion before the shared abort; they are **not evidence of two sequential 12s delays**, a Supabase outage for everyone, invalid credentials or RLS failure. The two checked same-origin resources were reachable (`*_OK`). `AUTH_TIMEOUT` here is a health-probe code, not the password API response.
156 +- **Independent read-only reconciliation:** protected `main` before this documentation change `167fbcb1e5bb198d1025121a4ce0d97e01929519`; exact SHA Quality `38348991795`, Security `38348991712`, Release `38349249193`, Pages `38349291823` all SUCCESS. Live Supabase `hcsixhqbyuhpshfwqpjx` `ACTIVE_HEALTHY`, 82 migrations (last `20261012075507`). Neither GitHub CI nor Supabase project metadata proves the owner computer's cross-origin connectivity.
157 +- **Assessment:** first computer one login PASS ~20s; second computer login FAIL ~40s, with static website reachable but Supabase Auth/REST credential-free probes timing out at 12s. **F0-01 = P0 / CROSS_DEVICE_INCONSISTENT / NETWORK_PATH_SUSPECTED, NOT ROOT_CAUSE_PROVEN / NOT OWNER_ACCEPTED**. Phase 0 remains OPEN; do not weaken fail-closed financial workspace checks or blame/change passwords.
158 +- **Next discriminator:** owner keeps **same computer and browser** and temporarily changes only Internet access to a phone mobile hotspot; clicks the same built-in connectivity test once more, returns only four status codes and optional login success/time. If Auth and REST respond on hotspot, investigate current ISP/DNS/routing/firewall/proxy. If both still time out, assess local device/browser/proxy or service edge via privacy-safe diagnostics before any code change. Do not request email/password/tokens/cookies/HAR. No Auth/RLS/schema/roles, financial history, invoice or OTP modifications. A bounded runtime fix, if proven necessary, needs independent Chromium/Golden/DB/Security gates and owner retest. Issue #106 OPEN.
159 +- **Change boundary:** evidence-only documentation update and Issue #106 comment; rollback revert docs-only PR. No runtime change or customer production mutation.
160 +
161 +### 2026-10-13 Owner: pause Phase 0 login performance; progress independent Phase 1 security — EXECUTION STARTED
162 +- **Latest owner instruction:** defer sign-in/startup slowness, continue approved Finora execution phases. **Explicit boundary:** leave F0-01 / #106 OPEN; do not optimize login or claim Phase 0 complete. Per approved eight-phase roadmap, perform a **Phase 1 read-only security/data-integrity audit** in parallel with blocked owner-authenticated Phase 0 gates. No production Auth/RLS/schema/role, data, permissions, billing, or finance cutover changes authorized by this instruction.
163 +- **Verified beginning main:** `1fa5cf99be9eb790d1192b7597d2dbf65cc9d3fa`. Live Supabase `hcsixhqbyuhpshfwqpjx` ACTIVE_HEALTHY; **82 migrations** last `20261012075507`; existing open PR #58 contains a migration archive under a **different timestamp** (`20261007163500`) from the production-recorded `20261007165208`, and mixes old auth/frontend features; do **not** merge, rename blindly, reapply, or issue replacement SQL. Outstanding PR #6/#39/#40 also not accepted.
164 +- **Initial independently executed read-only catalog findings:** public tables **18/18 RLS**, private tables **3/10 RLS**, **zero anon/authenticated SELECT grants to all 10 private tables**; SECURITY DEFINER routines: public **27** (of which **21 authenticated EXECUTE**, **0 anon EXECUTE**, **27 configured search_path**); private **66** (of which **43 authenticated EXECUTE**, **0 anon EXECUTE**, **66 configured search_path**). Authenticated has USAGE on private schema, whereas anon does not; this requires reviewing actual API exposure and callable routine guards, **not** assuming no possible access or an exploitable vulnerability. The 21 public authenticated-callable warnings are review inputs. Six sampled public admin-license mutators explicitly call `public.is_admin()`; sampled organization invitation/workflow functions use `auth.uid()` and capability checks, but this is **source review, not authenticated adversarial execution proof**.
165 +- **This isolated slice:** deliver an executable **read-only permissions/assertion SQL audit** and a Phase 1 evidence memo with repeat procedure, expected invariants, unresolved negative tests and risk priority. Verify against live metadata with SELECT only, plus repo presence/readback; no DB or service changes, no test identities. Record exact output, SHA and outcome after the fact. This is a **Phase 1 verification slice**, not Phase 1 acceptance; additional two-user revocation, adversarial grants, backup/restore, advisor reviews and sign-off remain OPEN. Rollback revert docs/test-file PR.
166 +
167 +### 2026-10-13 Phase 1 permissions audit — LIVE SQL 4 PASS / 2 REVIEW / NO DATABASE MUTATION / PR CI PENDING
168 +- **Executable deliverables on isolated branch:** `supabase/tests/phase1_permissions_readonly.sql` (catalog-only SELECT audit) and `docs/FINORA_PHASE1_SECURITY_READONLY_AUDIT_2026-10-13.md` (repeat procedure, 21-function risk roster, historic migration discrepancy). SQL was **fetched back from GitHub** and executed read-only via production Supabase metadata access. Exact results: `PUBLIC_ALL_RLS` PASS **18/18**, `PRIVATE_NO_CLIENT_DIRECT_READ` PASS **0 of 10 exposed**, `PUBLIC_DEFINER_NO_ANON_EXEC` PASS **0 of 27**, `DEFINER_EXPLICIT_SEARCH_PATH` PASS **93/93**; `PUBLIC_AUTHENTICATED_DEFINER_REVIEW` REVIEW **21**, `PRIVATE_RLS_COVERAGE_REVIEW` REVIEW **3/10**. **4 PASS / 2 REVIEW / 0 FAIL**. The 21 live advisor warnings match exactly the 21 `public` authenticated-callable SECURITY DEFINER routines.
169 +- **Concrete regression hazard from independent production function review:** stale open PR #58 `20261007163500_phone_identity_profile.sql` defines `public.handle_new_user` with `organization_members` inserted **before** `licenses`. Current live function, after Oct-12 safeguard, deliberately inserts `licenses` **before** `organization_members` so the seat guard can evaluate capacity. **Do not reapply the stale old function or merge PR #58 as-is.** Mismatched old archive filename `20261007163500` vs live migration ledger `20261007165208` remains unresolved; exact executed SQL-body parity NOT VERIFIED.
170 +- **Source review of all 21 public authenticated-callable SECURITY DEFINER routines** completed using `pg_get_functiondef`, grouped into six admin license mutators (explicit `is_admin`), two read predicates, seven office, five organizational/invitation, one own-profile RPC. Static guard presence does **not** prove correct tenant isolation or absence of privilege escalation. Authenticated two-user revocation/adversarial parameter checks, private RPC exposure, leaked-password protection, backup/restore and migration parity remain OPEN and require appropriate approval/test identities.
171 +- **Boundaries:** Owner-directed deferral of F0-01 slowness persists; F0-01/Phase 0 OPEN. Phase 1 audit slice metadata verification PASS only; **Phase 1 owner acceptance NOT CLAIMED**. No JS runtime, production SQL DDL/DML, Auth/RLS/grant change, new identities, financial records, subscription payments or secrets touched. PR Quality/Security and any post-merge exact-SHA gates **PENDING at this checkpoint**; do not claim release until verified. Rollback revert documentation+read-only SQL check.
172 +
173 +### 2026-10-14 Owner pilot request — allow correction and cancellation of finalized accounting documents — IMPLEMENTATION GATED
174 +- **New explicit owner request:** while Finora is an incomplete pilot, expose in document management an action described as «برگشت سند قطعی به حالت موقت» so previously finalized records can be amended and re-finalized, and provide deletion/cancellation of documents. Owner requests this even for older finalized documents. This is separate from earlier OTP and slow startup scope.
175 +- **Accounting contract verified before implementation:** `js/journal-engine.js` has distinct draft/posted/reversed states and `jeReverse`, `jeCopyVoucherToDraft`, `jeDeleteDraft`; `js/invoices.js` finalizes new sale invoices explicitly with idempotent source-linked journal posting, and blocks edits to posted sources. Existing `public.finora_guard_posted_journal` and child triggers reject direct changes/deletes of posted or reversed vouchers and lines; only posted→reversed with linked reversal ID is allowed. Current docs require immutable posted history and balanced reversals. **Never** grant direct editing/physical deletion of historical posted rows.
176 +- **Safe product interpretation and first slice:** Provide understandable UX for **post→linked reversal→new editable draft→edit→post** preserving original source/voucher and explicit previous-ID provenance; for 'delete' of posted records expose **audited cancellation/reversal**, not physical erase. For never-posted drafts, permit deletion with confirmation and block any linked references. Use explicit confirmation, authorization `requireWrite`, owner/company/fiscal-period checks, and no retroactive mutation of old finance entries. Start with manual journal and sales invoices under «مدیریت اسناد» in an isolated PR; other document types (purchases, receipts, payments, expenses, tax submissions, linked documents, legacy chartless records) require separate type-specific QA/approval; do not present them as implemented. If atomic data persistence cannot be guaranteed, do not enable live controls prematurely.
177 +- **Authority boundary:** user authorizes the **feature design/development** and ordinary reversible PR, but production posted-data bulk conversion, schema/RLS/Auth/role changes, real ledger correction/deletion, closed-period reversal, offboarding, or migration are **not** authorized by a feature request alone. Test isolated synthetic ledger only, preserve tenant isolation and accounting Golden. No existing production 'final' record is automatically modified. Verify exact SHA Quality/Security/Chromium/three disposable PostgreSQL and independent posting invariants before release; keep owner live acceptance OPEN.
178 +- **Baseline before changes:** protected `main=9d40b70be90172772d12eb9fa33915fe9c055c67`, prior Phase 1 security audit PR #123 merged with Quality, Security, Release Gate, Pages successful. Live Supabase state to be checked read-only before merge. Rollback targeted PR revert; correction/cancellation must retain audit history.
179 +
180 +### 2026-10-14 Pilot correction MVP — CODE + SYNTHETIC E2E TESTS IMPLEMENTED ON BRANCH / CI NOT YET RUN
181 +- **Implemented (isolated GitHub branch only):** `js/journal-engine.js` now has `jeReturnPostedToDraft`, `jeUpdateDraft`, `jeCancelPostedManual`. `js/journal-ui.js` exposes editable saved manual drafts and buttons «برگشت به موقت» and «ابطال» for posted **manual** vouchers, preserving old voucher/lines and creating a balanced posted reversal plus a new linked draft. `js/invoices.js` adds `reopenPostedInvoiceAsDraft`, `cancelPostedInvoicePilot`, `deleteInvoicePilotDraft` for **sale invoices** only. `js/document-management.js` shows confirmed corrective return, auditable cancellation and draft-only delete; old original invoice/number/posted voucher remain linked and unchanged, correction gets a new unique number/ID, `correctsInvoiceId` and `correctionReversalId`, and can be edited and re-finalized through the existing path. It checks owner, active company, open fiscal year, current source posting, an electronic-document exclusion and visible payment references. The server's immutable posted journal triggers are not disabled or changed.
182 +- **Tests:** added two isolated authenticated-mock Chromium journeys in `scripts/accounting-document-workflow.spec.js`: sale save→post→return-to-draft→edit→repost and manual journal post→return→edit→repost→cancel with old ledger history/amount immutability, no duplicate replay, reconciliation and reload. Authoring-side JS syntax parsed **5/5 PASS** via V8 on actual GitHub branch blobs; Chromium E2E, Golden, 3 disposable PostgreSQL, CodeQL, CI and owner real authenticated acceptance **PENDING/NOT VERIFIED** until exact PR-head workflows complete. Do not merge/release on syntax alone.
183 +- **Explicit coverage caveat:** this **is not an 'all financial documents' implementation yet**: purchase source, receipts, payment settlements, expenses, tax-submitted/legal documents, closed fiscal periods, and historical records without valid source-voucher linkage are intentionally not converted automatically. Individual record deletion of a posted voucher is never performed; the visible 'delete/cancel' action records reversal, which is legally and technically distinct. Draft sale deletion is allowed only if not linked to journal/tax doc/payments. No automatic bulk unposting of previously posted records.
184 +- **Risk and follow-up:** `jeReverse` stages multiple saves on the existing debounced sync path; invoice correction requires a server acknowledgment before showing success, whereas manual journal correction relies on existing sync badge. Validate server-side immutable triggers and race/partial write scenarios in independent controlled tests before accepting production correction. If these safeguards fail CI, do not merge. No schema, RLS, Auth, user roles, SMS or live financial documents touched in this branch. Rollback by reverting exact scoped code PR; actual user reversals after future rollout remain immutable historical business events and cannot be erased by code rollback.
185 +
186 +### 2026-10-14 Pilot posted-document correction — PR #124 MERGED / EXACT-SHA QA, SECURITY, PAGES SUCCESS / OWNER ACCEPTANCE OPEN
187 +- Owner request: in pilot show «برگشت سند قطعی به موقت», edit/re-finalize and delete/cancel. This first release handles **manual journal vouchers** and **formal/nonformal sales invoices** through a linked compensating posted reversal and a NEW editable draft. Old posted vouchers and source history remain immutable.
188 +- Delivery: PR [#124](https://github.com/davoodmehraban89/Factor-easy/pull/124) squash merged as protected main **e66cbfe4e2a59519af0095f0187a4d1e7aab16d7**. Updated js/journal-engine.js, js/journal-ui.js, js/invoices.js, js/document-management.js, scripts/accounting-document-workflow.spec.js. Added manual journal draft edit/return/cancel; sales invoice correction with unique replacement ID/number and correctsInvoiceId lineage, server-acknowledged correction sync and guarded draft deletion. Confirmations, reason capture, company/identity/fiscal safeguards; electronic-tax/recognized payment-linked sources held for separate workflow.
189 +- Final PR test head **ddaeac6bcb86d1a96024c70d953a3d773b62e5af**: Quality **38514364453 SUCCESS**; Chromium **110/110 actual Playwright PASS**, Golden accounting PASS, three disposable PostgreSQL jobs PASS. Security **38514364423 SUCCESS** (CodeQL and release-safety; dependency review SKIPPED). Previously tested interim head 109/109 superseded.
190 +- Exact protected-main **e66cbfe4e2a59519af0095f0187a4d1e7aab16d7**: Quality **38514715350 SUCCESS**, Security **38514715371 SUCCESS**, Release Gate **38514995868 SUCCESS**, gated Pages **38515017469 SUCCESS**. Duplicate release **38514854574 CANCELLED** and Pages **38515005679 SKIPPED**, explicitly not counted. Gated Pages is not a live owner authenticated document acceptance claim.
191 +- **Explicitly not implemented / not accepted:** purchase invoices, receipts/payments, expenses/income, electronic submitted tax documents, legacy records without valid source-voucher linkage, locked fiscal years, adversarial second-user/tenant tests, real production owner corrective edit/repost. Source-specific inventory/settlement contracts require separate verified slices. No automatic unposting or physical deletion of posted records. Rollback of software cannot delete future legitimate compensating financial entries.
192 +- Boundary: no Supabase DDL/DML/permissions/Auth/RLS/roles, paid resource, SMS, real financial-history rewrite or live posted user record mutation occurred in this engineering delivery. Owner pilot acceptance and F0-01 slowness remain OPEN. Next: separately controlled purchase-correction workflow and authorized non-financial/synthetic owner smoke.
193 +
194 +### 2026-10-14 Owner approves in-system pilot correction rollout and continuation — PURCHASE SLICE STARTED
195 +- **New owner instruction:** «تاییده انجام بده من می خوام داخل سیستم ببینم» following PR #124 sale/manual document correction. Live protected `main=3f596568ccbfb8a63e980e672dbb45aa49bd25ef` has Quality `38515487117`, Security `38515487169`, Release `38515771924`, Pages `38515796836` all SUCCESS on this same commit. Existing sale/manual controls should be visible at `factoreasy.ir` under حسابداری ← مدیریت اسناد / فهرست اسناد حسابداری after fresh load; real user login/browser proof still open.
196 +- **Scope now:** extend the same traceable posted→compensating reversal→editable corrective draft→repost/cancel UX to **purchase invoices**, including purchase list and central document manager, with server-acknowledged sync and correct warehouse/project reporting that excludes reversed originals and unposted corrective drafts. Retain legacy purchases outside automatic conversion unless source/voucher mapping is proven. Cover posted settlement references, ownership/company and locked fiscal year fail-closed. For already posted purchase rows keep existing source and ledger history unchanged. Normal new purchase posting behavior should not silently change unless explicitly tested.
197 +- **Next dependencies and constraints:** first verify current source and live Supabase read-only, use isolated synthetic read/write fixture for tests and same-commit state notes, PR-head and protected-main Quality/Security/Chromium/Golden/three disposable PostgreSQL plus gated Pages. Do not mutate real production financial records or Auth/RLS/schema. Receipts/payments and expenses/income remain distinct follow-up types and are not implemented by a purchase-only slice.
198 +- **Rollback:** revert specific JS/document manager/QA PR. A real user financial reversal is immutable historical evidence and cannot be erased by code rollback. Owner acceptance on actual app is separate from CI.
199 +
200 +### 2026-10-14 Purchase pilot correction implementation checkpoint — SIX PARSE PASSES, E2E PENDING
201 +- `js/purchases.js`: new posted purchase eligibility on authenticated owner/active company, source-linked posted purchase voucher, current and source open fiscal years, no linked purchase payments, product catalog matches, and nonnegative available stock if the purchase is compensated. `returnPostedPurchaseAsDraft` records linked **posted balancing reversal** and adds a distinct user-owned corrective purchase draft with new unique supplier number/ID and source lineage; `finalizePurchasePilotDraft` posts an explicitly edited replacement through existing purchase journal and waits for `finora_sync_records` server sync acknowledgment; `cancelPostedPurchasePilot` creates compensating posting instead of physical delete; `deletePurchasePilotDraft` is draft-only. Normal new purchase creation remains auto-posted by existing code; editing a correction draft does not auto-post or reset supplier default prices.
202 +- `js/document-management.js` plus `js/journal-ui.js`: purchase register in **same حسابداری ← مدیریت اسناد** area and purchase actions; `js/purchases.js` own list now shows posted/draft/reversed/legacy states and corresponding actions. `js/accounting.js` excludes reversed/correction-draft purchases from derived stock and project costs while retaining historical unlinked purchase treatment. `js/payments.js` disallows allocating payment to unposted/reversed purchase.
203 +- Two synthetic authenticated Chromium journeys appended to `scripts/accounting-document-workflow.spec.js`: posted purchase→UI return→manual edit→draft save→explicit repost with old lines unchanged and balanced, linked history and reload; payment-allocation block, stock-consumption block, cancel with original retained. Fixture adds isolated supplier and purchase accounts. **Six changed JS/Playwright files parsed PASS in V8**, actual DOM, Golden, 3 disposable PostgreSQL, CodeQL and protected release gates **NOT YET RUN** at this checkpoint.
204 +- **Known boundary:** Other document classes (receipts/payments as sources, expenses/income, taxpayer submissions, standalone legacy unlinked) are not touched. Production financial rows and SQL/Auth/RLS/schema remain unchanged. The no-negative-inventory guard is a bounded catalog/derived-stock check, not evidence of fully reconciled warehouse reservations. User authenticated on-site correction acceptance OPEN. Do not merge without tests.
205 +
206 +### 2026-10-14 Owner-approved purchase correction — PR #126 MERGED / EXACT-SHA QA + PAGES VERIFIED
207 +- **Owner-approved execution:** requested in-system view after sale/manual pilot correction, and continuation toward more editable finalized documents. Latest shipped **purchase invoice** corrective workflow merges [PR #126](https://github.com/davoodmehraban89/Factor-easy/pull/126) to protected `main=07de4f974916180399d40b0064322a9480748cdf`. New purchase rows appear under **حسابداری ← مدیریت اسناد** and in purchase register; posted→reversed with posted compensating journal and a separate uniquely numbered/linked editable draft→edit→explicit repost. Original voucher/lines and original purchase record are kept immutable. Cancel posted purchase by balancing reversal; physical delete only for never-posted drafts. No existing production financial records were converted on release.
208 +- **Scope verification:** `js/purchases.js` source/voucher matching, owner+company, open fiscal year, payment-linked and stock availability guards; `js/accounting.js` removes reversed/correction-draft purchases from derived stock and project cost calculations but maintains legacy unlinked accounting semantics; `js/payments.js` allocates only to posted purchase invoices; `js/journal-ui.js` and `js/document-management.js` central purchase UX. Original new purchase creation remains auto-posted, while corrective drafts require explicit repost.
209 +- **Verified PR head `dfdb8221404b440e1bc9d8a148786f3a386801e9`:** Quality `38517172479` SUCCESS, static job `115698467172` **112/112 actual Chromium PASS (2.3m)** including two new purchase correction, inventory/payment-denial/cancellation scenarios, accounting Golden PASS, all three disposable PostgreSQL jobs SUCCESS; Security `38517172309` SUCCESS. Initial QA for prior commit failed **one unrelated transient CSS transition**: light-mode button background luminance sampled mid-animation (0.456 below >0.5), whereas purchase scenarios PASSED; fix made test await steady-state target luminance while preserving existing contrast/luminance assertions; full retest PASS.
210 +- **Protected-main exact-runtime-SHA `07de4f974916180399d40b0064322a9480748cdf`:** Quality **`38517528253` SUCCESS**, Security **`38517528297` SUCCESS**, Release Gate **`38517811727` SUCCESS**, gated Pages **`38517838093` SUCCESS**. Duplicate release `38517673640` CANCELLED, Pages `38517826545` SKIPPED; not counted as successful gates. Browser session on owner's affected ISP **NOT VERIFIED**; workflow success ≠ authenticated owner acceptance.
211 +- **Still OPEN:** receipts/payments and expense/income source corrections, taxpayer-submitted documents, linked bank/warehouse allocations beyond bounded guards, legacy chartless records and closed fiscal years; two-user adversarial permission tests, production correction atomicity/reload and owner confirmation. Global 'all documents' request is partially implemented only; no bulk unposting or physical deletion of posted evidence. F0-01 slow startup remains separately OPEN.
212 +- **Security/cost:** no production SQL DDL/DML, Auth/RLS/grant/role changes, external messaging, paid resource, existing posted ledger rewrite or live financial test transaction. Version rollback by reverting the targeted PR; real user reversal history, once created in future, is immutable and cannot be erased by reverting UI.
213 +
214 +### 2026-10-14 Owner UX correction — SAME visible document during pilot amendment — STARTED
215 +- **Exact latest owner instruction:** an employee clicks «اصلاح» on an existing finalized sales or purchase document and immediately edits **that same visible document, number, form and print view**. Employee must NOT see a "new invoice", correction suffix/ID or special bookkeeping messages; internal journal history remains with compensating reversal and properly posted amended transaction, never physical rewrite of historical accounting lines. Browser cancellation/no-op must NOT create a compensating entry. Save should complete amendment and maintain a single current visible document. Scope follows owner-approved sale/purchase and manual journal workflows where safe; no automatically unposting all existing documents.
216 +- **Starting verified live main** `d4d9e6df34f67c5f80b51daa4bb6e5512be31a8a`, protected main Quality `38518349856`, Security `38518349912`, Release Gate `38518625874`, Pages `38518677412` all SUCCESS. Current visible sale/purchase correction engines create separate physical source rows with `correctsInvoiceId` / `correctsPurchaseId` and internal numbered suffix; existing UI currently exposes these technical source versions. New user-directed correction supersedes that UX.
217 +- **Intended implementation:** change posted edit entry to in-place form prefill with deferred mutation until SAVE, use existing reversal/source-version safeguards behind the interface and invisible public history folding (one current visible version with original displayed number). Old source row and financial posting stay queryable in accounting audit. Receipt/payment allocations, external tax documents, locked periods and legacy unlinked sources remain hold cases. When full server transaction atomicity cannot be proven, fail closed and never present success before server acknowledgment; tests include open-and-cancel zero write, save+reopen, print same number, old history retained, balanced ledger, no duplicate visible rows after reload.
218 +- **No production user financial rows or Auth/RLS/SQL/schema touched; no new paid resources.** Build on isolated branch, PR-head Chromium/Golden/3 disposable PG/CodeQL, exact-main gated Pages; user acceptance remains distinct from CI.
219 +
220 +### 2026-10-14 Same-document correction UX implementation checkpoint — PR QA PENDING
221 +- **Implemented on isolated branch:** `js/invoices.js` uses `invoiceVisibleRecords` / `invoiceVisibleNumber` to fold internal version chain and show one active business invoice under the original number; `beginInvoiceAmendment` opens the existing posted invoice's **same edit form** with zero accounting mutations until Save. Save privately creates linked compensating posting and corrected source, persists edited data, re-posts and confirms server sync. `js/purchases.js` implements same in-form deferred purchase correction, one logical purchase record and original supplier number, while preserving payment/stock/period restrictions. `js/document-management.js` renders one sale and purchase row per logical invoice, and `js/print.js` prints corrected sale content with original number; purchase print follows current active revision and original supplier number. Existing journal audit displays original/reversal/new source-linked postings.
222 +- **No user-visible correction suffix, new invoice message or internal journal prompt** on normal posted→edit form workflow; editing can be cancelled without reversal. Original source data and posted voucher/lines remain physically unchanged. This design still stores internal technical source revisions, distinct from a user-visible business document ID; genuine single-row storage requires a separately approved schema redesign.
223 +- **Automated test coverage added:** 2 browser journeys for posted sale and purchase: click same document→cancel=no write→reopen→edit→single Save→internal reversal/repost→single visible item, same printed number, original transaction unchanged, reload consistency. **5/5 V8 syntax PASS**. Full Chromium/Golden/3 DB/CodeQL and exact-main Pages: PENDING; do not merge if any gate fails.
224 +- **Caveats:** source amendment is currently a multi-step application sync (not a server transaction) and waits for acknowledged stages; fail closed on sync trouble and do not retry blindly. Do not edit production historical customer records for testing; owner sign-in & UI acceptance remain OPEN. Payment/expense/tax source families remain unimplemented.
225 +
226 +### 2026-10-14 Same-document sales/purchase amendments — RELEASED PR #128 / EXACT SHA VERIFIED / OWNER ACCEPTANCE OPEN
227 +- **Owner UX contract:** Click «اصلاح فاکتور» on an already-posted sale/purchase to open the same invoice form, with its original business number. No technical correction-number, separate new invoice or reversal confirmation is shown to employees; cancelling does not post/reverse anything. Saving internally preserves the initial immutable voucher and source, records a linked compensating reversal and amended voucher/source, waits for server synchronization, and presents one current logical business invoice in manager/list/print. The technical source revisions remain visible for authorized accounting audit. Historical legacy user-issued correction drafts are still editable with their internal IDs preserved.
228 +- **Merged source:** [PR #128](https://github.com/davoodmehraban89/Factor-easy/pull/128) squash-merged protected main **635db7de4e71143fd167539780731f9277e20da0**. Updated js/invoices.js, js/purchases.js, js/document-management.js, js/print.js, scripts/accounting-document-workflow.spec.js. Pre-implementation scope + checkpoint committed to this file on isolated PR branch.
229 +- **Feature PR head:** **faeae40835631c08da12c6145913419549f1c6ed**. Quality **38522695691 SUCCESS**, static job **114/114 actual Chromium PASS**, Golden accounting PASS, three disposable PostgreSQL jobs SUCCESS. Security **38522695697 SUCCESS**. Earlier intermediate test runs at prior heads failed regression checks and were corrected/retested; do not count earlier failure as acceptance.
230 +- **Exact released main SHA:** Quality **38523130482 SUCCESS**, Security **38523130453 SUCCESS**, Release Gate **38523454291 SUCCESS**, gated Pages **38523518579 SUCCESS**. Duplicate Release **38523282456 CANCELLED** and Pages **38523502557 SKIPPED**, not counted as passes. Gated Pages attests workflow publishing; owner-authenticated real ISP/login/finance browser test not yet verified.
231 +- **Financial/operational limits:** Existing live customer financial records, permissions, RLS, roles, schema, Stripe, SMS and production DB rows were not modified by this source release. Sale/purchase historical accounting remains immutable. This is an application-level linked revision workflow using multiple sync stages, not independently verified as one server-side atomic amendment transaction; if a stage loses server confirmation, recovery must inspect state before retry. Closed periods, settled allocations, submitted tax invoices and historical unlinked vouchers still fail closed. Manual journal, payment/receipt, expense/income, taxpayer and multi-tenant concurrent correction acceptance remain separate tasks. F0-01 slow real owner sign-in still open.
232 +- **User-visible acceptance next:** In browser, refresh site, open posted purchase/sale, select اصلاح فاکتور, verify original number and edit form; cancel = zero posting, then authorized disposable test edit/save/print yields one visible record and same number after reload, while auditing all linked vouchers. Never use actual production business financial records solely as test fixtures.
233 +
234 +### 2026-10-14 Owner: continue Finora development — P0 treasury receipt/payment amendment slice OPEN
235 +- **Owner latest instruction:** «ادامه کار توسعه پیش ببر». Same-document sale/purchase UX PR #128 has been released; prior auth startup F0-01 still OPEN/deferred, no owner-authenticated acceptance claimed. Work on next independent Phase 3 treasury source corrections, preserving original document in employee view, without adding technical revision rows or changing posted accounting.
236 +- **Read-only baseline:** protected `main=b4d5da725a68af6c2a534422d3de85c13bf17b4d`; exact-main Quality `38524072782`, Security `38524072853`, Release `38524404953` and Pages `38524466785` all SUCCESS. Supabase `hcsixhqbyuhpshfwqpjx` ACTIVE_HEALTHY. This status is CI/provider metadata, not a customer login or genuine bank transfer test.
237 +- **Confirmed source problem:** `js/payments.js` posts new receipt/payment entries via `jePostSourceRecord`, but `editPayment` on a linked posted source reaches `jeGuardSourceMutation` and blocks saving. `deletePayment` likewise guards immutable journal; project cash totals and invoice outstanding currently aggregate raw payment rows, which would double count additive revisions unless filtered. `js/journal-engine.js` only allows posted historical correction through balanced compensating reversal; old source and voucher must remain immutable.
238 +- **First narrow authorized slice:** One **current visible** payment/receipt with same reference/date/form, backend correction version chain; only `cash`, `bank`, `card` postings **without** invoice allocation, cheque instrument or external reconciliation link. Preserve original direction, counterparty/company/project; allow changing amount/method/reference/note, creating no financial event on Open/Cancel. On Save, validate open fiscal year, current posted source, operator company/permission, source linkage and correction lineage; only then create linked balanced reversal and new posted source/ledger. Fold past revisions in `renderPayments`, derived cash/project totals and any allocated payment aggregates; visible delete of posted record must mean auditable reversal, not physical deletion. Deny or hold linked invoice/cheque and legacy unlinked records until separate reconciliation tests. No third-party banking action or external SMS.
239 +- **Required tests:** isolated browser mock with synthetic user/company and payment: open+cancel zero ledger writes; revise→reversal→new balanced posted voucher→same visible row after reload; original posted lines/metadata untouched; treasury totals count current revision once; reject allocated or cheque; fiscal-year lock; double-click/idempotency; aborted sync fail-closed and no duplicate blind retry. Existing Chromium Golden accounting and 3 disposable PostgreSQL, Security/CodeQL, exact main Release+Pages gates. No production financial data writes, schema/RLS/role/Auth changes, new paid costs. If tests reveal unsatisfied integrity, do not merge.
240 +- **Owner acceptance:** native browser authenticated test still OPEN. Rollback targeted code PR; legitimate future financial reversals remain historical and cannot be destroyed by reverting code.
241 +
242 +### 2026-10-14 Treasury correction implementation — 5/5 syntax PASS, Chromium+Golden+DB+Security PENDING
243 +- **Delivered on isolated branch:** `js/payments.js` adds `paymentPostingStatus`, `paymentCurrentVisible`, `paymentVisibleRecords`, `paymentEffectiveRecords` and `paymentAmendPosted` / `paymentCancelPosted`. A posted unallocated non-cheque cash/card/bank receipt/payment opens in **its original form** with unchanged reference/date/contact/direction and no journal write on open/cancel. On Save, it validates permissions, active company, open fiscal year, source-voucher posting and immutable contact/direction/invoice allocation, then **synchronously stages** balanced original-voucher reversal and corrected posted source with a new internal revision before the first async boundary. Debounced `finora_sync_records` sends the resulting diff as one batch and a server ack is required before employee success. A synchronous exception restores local journal/source/profile staging before sync. Cancel only reverses the internal accounting, clearly warning it **does not** undo actual bank/card movement.
244 +- **Employee UX:** central `حسابداری ← مدیریت اسناد` treasury table in `js/journal-ui.js` and `js/document-management.js` lists one current visible receipt/payment and routes «اصلاح» directly to `view-payments` existing form; earlier source versions remain in accounting audit. `js/payments.js` treasury list also folds technical rows; `invoiceOutstanding` / `purchaseOutstanding` count effective current settled records only; `js/accounting.js` project cash totals exclude reversed/historical versions and retain legacy unlinked treatment.
245 +- **Safety boundary:** only **unallocated cash/card/bank** receipt/payment documents with currently posted canonical vouchers. Cheques, invoice-linked settlement, historical unlinked, locked fiscal years, cross-company and different-party/direction edits fail closed. Do not allow actual banking cancellation from local accounting UI; real bank/cheque movements require external reconciliation. No production financial rows altered, and no schema/RLS/Auth/role or paid service change.
246 +- **Tests authored:** four new `scripts/accounting-document-workflow.spec.js` isolated real-DOM scenarios: employee central-manager → same form → cancel=no writes; amendment → original journal reversed + balancing compensator + new posting in **one server diff** with one visible row, same reference, old lines unchanged, reload; denial for cheque, invoice-linked and fiscal lock; cancellation keeps original history; simulated one-RPC network failure produces no partial server commit and no false UI success. Syntax 5/5 PASS on actual branch files; **real browser/Golden/three disposable PostgreSQL/Security PR-head and exact-main release NOT VERIFIED at this checkpoint**. Fail CI → fix/retest, never release red.
247 +- **Remaining risk:** client-side multi-record staging uses existing shared sync RPC and auto-retry; single-call SQL atomicity, lost-ack retry behavior and concurrency cannot be considered owner-accepted solely from synthetic browser tests. Full integrated receipt→invoice settlement/cheque/bank reconciliation and independent authorized two-user tests remain Phase 3/Phase 5 dependencies. Owner live acceptance open; original Phase 0 startup F0-01 open.
248 +
249 +### 2026-10-14 Phase 3 treasury source correction — PR #131 RELEASED / EXACT-SHA GATES PASS / OWNER ACCEPTANCE OPEN
250 +- **Delivered and shipped:** PR [#131](https://github.com/davoodmehraban89/Factor-easy/pull/131) merged to protected **main=e32a540b863d7931afefc140ed3417065b9a3d01**. New owner-approved bounded UX under `حسابداری ← مدیریت اسناد` and native `دریافت و پرداخت` form: employee sees one effective posted receipt/payment, opens existing form for amount/method (cash, card, bank), reference and note editing, with no reversal on open/cancel. On Save, original source and posted accounting lines stay immutable; one compensating journal and one new balanced posting with linked internal source revision are staged synchronously and sent in one RPC diff. Posted cancellation creates only an auditable accounting reversal; **does not reverse an actual bank/card transfer**. Invoice outstanding and project cash summaries skip reversed prior physical revisions; legacy unlinked history retains separate review handling.
251 +- **Mandatory limitations:** corrections only for **unallocated non-cheque** posted canonical receipts/payments within operator's company and open fiscal year. Invoice-linked settlements, cheques, bank reconciliation, noncurrent/legacy vouchers, cross-party/direction changes fail closed. Correction does not authorize real bank operations, automatic historical ledger bulk changes or financial DDL; the broader Phase 3 and fully authenticated owner acceptance remain open. F0-01 login startup slowness remains open/deferred.
252 +- **Exact PR head=68d9c99368f17cbd81ae77dc3f98971e07e4123b:** GitHub Quality **38528960651 SUCCESS**, static job **115735923478** **117/117 Playwright Chromium PASS** (including three newly authored treasury test cases; fourth item cancellation included in guarded case), accounting Golden sale→receipt→purchase→payment→expense/income→reversal→statements PASS, three disposable PostgreSQL jobs `115735923279`, `115735923290`, `115735923452` SUCCESS; Security **38528960665 SUCCESS** with CodeQL/release-safety and dependency review SKIPPED (not passed).
253 +- **Exact protected main=e32a540b863d7931afefc140ed3417065b9a3d01:** Quality **38529415899 SUCCESS**, Security **38529415779 SUCCESS**, Release Gate **38529791374 SUCCESS**, gated Pages **38529861751 SUCCESS**. Superseded Release `38529592570` CANCELLED and Pages `38529842842` SKIPPED, not classified as success. This proves release workflow, **not** user ISP login/customer-document UI acceptance.
254 +- **Independent live backend review:** `pg_get_functiondef(public.finora_sync_records)` shows both 2-param and 3-param overloads are PostgreSQL `plpgsql` routines without `EXCEPTION WHEN` partial-success handling, using transaction-scoped upsert/deletes. The browser test confirmed one RPC call for combined reversal+new posted source and no partial server writes on a simulated failed RPC. **Lost-response retries, concurrency, true bank statement reconciliation and offboarding two-user access remain unverified**; no promise of real-world exactly-once payment transfer semantics. Supabase `hcsixhqbyuhpshfwqpjx` ACTIVE_HEALTHY; no production financial rows, grants, roles, Auth/RLS/schema, vendor/SMS or paid resources changed by PR.
255 +- **Next verified work:** owner authenticated disposable receipt/payment test (do not use actual bank entries) then controlled separate slices for **expense/income** source correction and **allocated receipts/cheques** after complete settlement/treasury reconciliation. Maintain immutable original accounting and single visible employee-facing document. No owner acceptance claimed yet.
256 +
257 +### 2026-10-14 Owner regression — invoice/purchase listings must obey active Settings company — STARTED
258 +- **New owner request:** a user belonging to multiple companies must see **only invoices for the company currently selected under Settings**, not combined documents from other companies. Do not delete/migrate historical data. Changing default company must immediately update displayed register. This applies to invoice archive, purchase register, central document management, and must not be bypassed by a stale 'show all companies' dropdown. Existing financial entries and source correction chains must remain intact.
259 +- **Verified starting baseline:** protected main `c5a1a93dc13f1cf39dc55d0a47a75a35d7ef50c5`, `AGENTS.md` plus full `PROJECT_STATE.md` read, live existing invoices code: `renderInvoices` chooses `#filter-invoice-company` and defaults to ALL; `renderCompanies` reinstalls **نمایش همه شرکت‌ها** on each render; `purchaseVisibleRecords` returns all owners' purchases without company scoping. Central manager already filters by `afCompanyId`, but must be tested with both companies. `setDefaultCompany` calls `refreshAllSurfaces` and renders immediately.
260 +- **Fix contract:** derive active company only from owned Settings `default_company_id` or owned first company fallback `afCompanyId` (do not trust unowned arbitrary ID), and **fail closed** when none selected. Remove the cross-company selection from invoice archive, synchronize invoicing seller header to active setting, restrict visible invoice/purchase logical leaf records and direct edit/print entry where necessary, maintain separate original/revision chain per company. Reset any in-progress edited document on company switch to prevent accidental cross-company writes. No RLS/schema/Auth grants/data changes.
261 +- **Acceptance:** isolated two-company authenticated browser fixture showing same user, different sales and purchases; settings switch company A→B→A refreshes company-specific invoice archive and central manager and purchase list immediately, no 'ALL' escape; switching during edit does not permit cross-company invoice writes; legacy missing-company record held for reconciliation. Full Playwright Chromium/Golden/3 disposable DB and CodeQL release on exact SHA; owner authenticated browser acceptance remains independent/open.
262 +- **Rollback:** revert isolated UI/data-filter PR. No live production accounting records mutated.
263 +
264 +### 2026-10-14 Active Settings company for invoice visibility — IMPLEMENTED ON PR BRANCH / QA PENDING
265 +- **Regression reproduced from main:** `renderCompanies` installed `نمایش همه شرکت‌ها` and `renderInvoices` obeyed that selector, leaking all user-owned companies into the same invoice archive; `purchaseVisibleRecords` returned the owner's whole purchase store without company filtering. No evidence of cross-account RLS bypass: this is a **same-user, multi-company UI scope regression**.
266 +- **Code changed (isolated only):** `js/companies.js` now restricts both invoice seller/header and archive-company selectors to the **sole active company chosen in Settings** (disabled selectors, no ALL), validates company ownership on `setDefaultCompany`, closes any in-flight sales/purchase edits before switching, refreshes document manager and topbar. `js/invoices.js` and `js/purchases.js` fold original/correction versions and **only expose records with companyId === active owned company**, never unassigned records when another company is active; direct stale ID edit/save and print are guarded by active company; `js/print.js` denies stale off-company sale print. Other tenant/company business rows remain unchanged in cloud storage and accounting history. No DB/Auth/RLS/grant migrations.
267 +- **Real-DOM regression authored:** an isolated two-company one-user fixture has separate sale and purchase draft rows plus an unassigned legacy invoice. Check selected Settings company A restricts sale archive, purchase register, central manager, seller header; NO `ALL` selection; Settings B switches all three lists immediately with no reload and excludes A/legacy; off-company direct edit stays denied; switching company during an edit clears the draft context; switching back and app reload preserve separation and both companies' source rows.
268 +- **Verification at checkpoint:** each changed JavaScript file V8-parse and browser test compile are to be checked before PR; exact PR-head Quality, Chromium, Golden accounting, three PostgreSQL databases and Security are PENDING. Do not merge until green. Phase 0 owner affected-ISP login and real authenticated user multi-company acceptance remain OPEN. Rollback by revert scoped code PR.
269 +
270 +## Current change ledger
271 +| 2026-10-07 | Owner requested accounting/product usability refinement from live screenshots: automatic non-user-entered floating-detail codes, contextual in-product guides (especially accounting/chart/dimensions), remove duplicate product internal tax ID and use product code as internal item ID, strengthen in-control product/person search, introduce hierarchical product group/subgroup coding with deterministic 6-digit product codes, and keep sale/purchase commercial-document workspace layout stable while only semantic fields change. | **IMPLEMENTED / LOCAL VERIFICATION PASSED / CI PENDING** | Baseline main = `7e58c75f7d754f378d94ca3f356c1ae580aa7ee3`. Automatic dimension type/value codes, contextual guides, product-code-as-internal-ID, normalized multi-token search, and additive six-digit product coding implemented. Existing historical codes preserved. Commercial sale/purchase workspaces now share a stable `صدور سند تجاری` header/actions layout; duplicate purchase sidebar injection removed; the public selector is the single document-type selector and the legacy internal invoice-kind control is hidden. Local syntax/static/commerce/UX/accounting phases 2–6/Golden checks passed; protected-branch CI remains pending. |
272 +
273 +| Date | Request / decision | Status | Evidence / next action |
274 +| 2026-10-11 | Owner supplied live invoice screenshots: contact/seller combobox correctly shows choices, but invoice product/service combobox shows no known products and typed `ها` does not find existing `هارد`. Requested remote-desktop verified repair and screenshot with `بلوک`/`سیمان` suggestions. | **MERGED / GATED PAGES DEPLOYED / REMOTE DOM VERIFIED / OWNER-AUTHENTICATED SESSION PENDING** | Baseline `b1a35fdc1df71c46c287bec47be54fa6e8641428`. Scope `js/ux-hardening-r2.js`, `index.html` cache version, regression browser tests; investigate stale initial invoice row product options created before Supabase sync, preserve selected invoice product/quantity/price/history, ensure complete suggestions and Persian normalization. Negative tests for absent data, no cross-tenant exposure, selection and price/unit update; remote Playwright screenshot; gated CI. No Supabase schema/auth/RLS/roles, no financial data edits. Rollback: revert product-search PR. |
275 +|---|---|---|---|
276 +| 2026-10-07 | Owner requested an audit of all changes since the last shared verified baseline, assessment of the supplied accounting/product/search/invoice-layout issues, and a remediation plan before implementation. Owner offered a remote PC if useful; use the current environment for repository/database review because no direct remote-desktop control is exposed. | **AUDIT IN PROGRESS / NO PRODUCT OR DATABASE MUTATION** | Pinned main `7e58c75f7d754f378d94ca3f356c1ae580aa7ee3`, seven commits after `dfaa4d65918ea3bca14be2c4737af734c9328083`. Quality `37646679015` static job `112879152160` logs show 60/60 controlled real-DOM tests and accounting/Golden PASS; Security `37646679026`, Release `37646878995`, exact-SHA Pages `37646973160` succeeded. Live Supabase: 80 migrations, newest `20261007165208 phone_identity_profile`; public RLS 18/18, private RLS 3/10 with zero anon/authenticated CRUD on all ten private tables. Production identity SQL is archived on open PR #58, absent from main; do not reapply it. PR #59 contains unmerged accounting/product/guidance work and must be reviewed separately from deployed behavior. Audit findings and test boundaries follow in the audit report; no old unfinished arithmetic patch is being published. |
277 +| 2026-10-07 | Owner supplied live screenshots and requested immediate invoice-workspace cleanup: remove redundant top workflow buttons (sale/purchase/pre-invoice) and redundant sale/purchase shortcut buttons beside the document heading; keep Excel import + sample download; keep only the commercial-document type selector with sale, purchase, sales pre-invoice, sales progress statement; replace the separate search-above-select UX with a single in-control searchable product selector that matches product code/name/specification and numeric fragments. | **COMPLETED / MERGED / RELEASE VERIFIED** | Merged to `main` as `6e7fa6e861ebdd89e5712ed7d64bb5fe3128f307`. PR #54 Quality `37644940991` and Security `37644940960` SUCCESS; inspected static logs confirm commercial + UX-R2 + Golden PASS and **60/60 Real-DOM tests**. Main Quality `37645195629`, Security `37645195698`, Release gate `37645411897`, exact gated Pages `37645464262` all SUCCESS. Live `factoreasy.ir` no longer contains the sale/purchase heading shortcuts; live UX bundle contains `finora-combobox-input` and no `finora-select-search`. Four-value document selector and Excel import/sample controls retained. No schema/RLS/auth/role/data mutation. |
278 +| 2026-10-07 | Owner requested the next integrated UX/commerce/settings hardening slice: reuse global projects from counterparty screens instead of per-contact duplicate project records; searchable large selectors across product/contact/project/account lists; refresh sale/purchase default prices after master-data edits and latest transactions; purchase-invoice UI parity with sales while preserving purchase semantics; modal/close/Escape/Enter/button real behavior QA; active-company factory reset for authorized company admin with multi-step destructive warnings; richer settings (hotkeys, quick-zero shortcuts, light/dark/auto theme, data statistics, backup/restore); configurable Excel sample/import/export field selection; and consistent Persian-digit rendering in invoice UI/print. | **MERGED / CONTROLLED DOM + ACCOUNTING VERIFIED** | Baseline `main` = `b88f0f35902cc99ebd09c9fffcd5700ce759ac69`. Implemented global project reuse/attach from counterparties, large-list search, product price-default refresh from latest posted sale/purchase, purchase project/accounting separation and commerce-switch parity, Escape/modal + configurable Ctrl+S, Ctrl+Enter, Enter-save and quick-zero hotkeys, light/dark/auto theme, active-company stats, configurable Excel templates/exports, authorized-manager active-company factory reset that skips ambiguous multi-company legacy rows, and Persian-digit normalization in isolated invoice print. Local syntax, quality, commercial, UX-R2, accounting phases 2-6 and Golden PASS; `git diff --check` PASS. Merged as `6dae96fac9bd5c513209932ae777f12bd8bd95a6`. Current descendant main Quality `37646679015`, inspected job `112879152160`, passes 60/60 controlled DOM and accounting/Golden. These tests do not establish production reset safety; production reset not executed. Settings reference image still not supplied, so exact visual parity to that future image is NOT VERIFIED. |
279 +| 2026-10-07 | Owner directed autonomous continuation to finish the remaining Finora development backlog, starting with the agreed P0 accounting core: extensible analytical/floating dimensions, journal UX, context-driven posting rules and end-to-end accounting integration, then continue through remaining verified blockers without routine pauses. | **MERGED / CONTROLLED DOM + ACCOUNTING VERIFIED** | P0 adds independent COST_CENTER analytics, role-driven dimension compatibility without rewriting posted history, strict per-fiscal-year journal numbers, voucher type/reference, generic dimension-to-legacy compatibility fields, independent project vs cost-center posting, copy-to-draft, account search, row copy, and live debit/credit/difference totals. Implementation head `de2c58a52cb36bfe54eeb3c90985cd6c94cae812`; PR #52 Quality `37539607474` SUCCESS including Accounting P0 invariant step and Real DOM smoke, Security `37539607498` SUCCESS. Local quality + phases 2-6 + Golden PASS. No schema/RLS/auth/role/destructive production data change. Merged as `b88f0f35902cc99ebd09c9fffcd5700ce759ac69`; descendant main `7e58c75` passed inspected 60-test DOM + accounting/Golden and exact-SHA release/deploy. This supersedes the old merge-pending checkpoint. |
280 +| 2026-10-07 | Owner authorized implementation to completion of the researched commerce/accounting redesign: one invoice workspace in Commerce, context-driven reusable floating counterparties, purchase parity (quick supplier + Excel template), and selected-company factory reset that preserves the company. | **COMPLETED / MERGED / RELEASE VERIFIED** | Merged to `main` as `5ae9117c776a33a3cc39775c68ad0c10e13b9c44`. Push Quality run `37529032595` = success; Security `37529032630` = success; Release gate `37529230156` = success; exact gated Pages deployment `37529272934` = success and deployed the same SHA to `http://factoreasy.ir/`. Live HTML loads `js/commercial-rnd.js?v=20261007-commerce-r1`; live bundle contains factory-reset guard, quick supplier, and Excel-template code. PR Real-DOM/accounting gates were green. No production reset and no schema/RLS/auth/role mutation. |
281 +| 2026-10-04 | Continue the recorded chart and taxpayer-reference correction after interrupted sessions. | **MERGED / CONTROLLED DOM + ACCOUNTING VERIFIED / GATED PAGES DEPLOYED** | 62 additive chart rows across all eight templates, including non-current assets and contra accounts; explicit preview/apply for compatible existing templates preserves old accounts and posted history. Actual supplied tax logo and reference-aligned totals/settlement layout; image-ready printing. Local chart invariants and 3 chart DOM tests passed; 2 print DOM tests plus single-page landscape PDF passed; accounting phases 2–6 and Golden passed. Full local DOM: 52/53 passed, Pages artifact failed on external ERR_CERT_AUTHORITY_INVALID; no gate weakened. PR #47 implementation SHA `db9e7f2375e914bfa9e78932e63222af68c4c9d3`: Quality `37170173739` and Security `37170173740` passed; inspected static job `111341365938` confirms 53/53 real-DOM tests, chart invariants, phases 2–6 and Golden passed, including Pages artifact. All three disposable DB jobs passed. Production recheck on 2026-10-04: 79 migrations, latest `20261003033540`; public RLS 18/18, private 3/10. See docs/CHART_OF_ACCOUNTS_RESEARCH_2026-10-03.md and docs/CHART_TAXPAYER_VERIFICATION_2026-10-03.md. No schema/RLS/auth/role or production record mutation. |
282 +| 2026-10-03 | Owner requested continuation of unfinished work, deep Iranian chart-of-accounts research/completion (especially missing non-current assets), and exact taxpayer invoice layout matching the first supplied reference with the supplied official logo. | **REQUEST RECORDED / IMPLEMENTATION NOT VERIFIED** | PR #46 merged as `3085dce9d8f457e61aca6676f872737418116e7a`; Quality `37094979694`, Security `37094979835`; inspected job `111122956074`: 49 DOM tests and accounting gates passed. Live Supabase has 79 migrations including `20261003033540`; public RLS 18/18, private 3/10. Existing print exactness claim is superseded by owner-reported/reference-visible differences. Preserve historical account IDs/codes/postings; no schema/RLS/auth/role changes authorized by this request. |
283 +| 2026-10-03 | Owner directed continuation after Wave 4 deployment; inspect post-merge verification and two-user/concurrency readiness. | **SAME-SHA RETRY PASSED / TIMEOUT ROOT CAUSE OPEN / TWO-USER PRODUCTION E2E BLOCKED** | Main `62da4cf24b5505d9dfe41b43acafa04af74c06c9`; Quality `37094021032` failed with 48/49 DOM passing and 30s timeout in `scripts/enterprise-org-ux.spec.js`; accounting and all disposable DB jobs passed. Security `37094021045` passed. Live Wave 4 version `20261003033540` remains present, public tables without RLS=0, organizations with two distinct active users=0. No test users or access changes authorized/performed. Same-SHA retry `37094021032` attempt 2 succeeded: job `111122578331` logs confirm 49/49 DOM and accounting phases 2–6 + Golden passed. No assertion, timeout or product-code changes. Timeout did not reproduce on retry; root cause remains NOT VERIFIED. |
284 +| 2026-10-03 | Owner explicitly approved applying archived Wave 4 migration (`بله تاییده`) and directed continuation after reconnecting GitHub. | **PRODUCTION APPLIED / READ-ONLY CONTRACTS VERIFIED / PRODUCTION E2E NOT VERIFIED** | Scope: only `20261002072000_request_wave4_operational_integrity.sql` on `hcsixhqbyuhpshfwqpjx`, including column/index/functions/EXECUTE grants. Baseline main `81bd9bf38e0b02e5baed8a3fa32a89a2b1345572`; SQL blob `7e644afd2387d328056356314ebfdeed272963ab`. Live preflight: migration absent, idempotency column absent, delegation rows=0, six-argument RPC present and seven-argument RPC absent. Exact SQL applied as `20261003033540 request_wave4_operational_integrity`; approval recorded before apply in `ed90934f057e85bfd6bd0286bdf309d9c2ded9f7`. Other sensitive changes remain approval-gated. |
285 +| 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. |
286 +| 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. |
287 +| 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. |
288 +| 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. |
289 +| 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. |
290 +| 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. |
291 +| 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. |
292 +| 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. |
293 +| 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. |
294 +| 2026-10-02 | Gmail/GitHub failure review: latest Wave 5a Quality run failed only because the disposable PostgreSQL harness lacked Supabase roles `anon`/`authenticated`; Security latest run is green. | **TEST HARNESS VERIFIED** | Added the two no-login Supabase compatibility roles to the disposable identity DB bootstrap. Wave 5a identity DB gate passed on PR head and main Quality `36980655736`; the earlier failure was harness-only. |
295 +| 2026-10-02 | Second CI retest showed the safety-check regex itself was over-escaped. | **REGEX FIX VERIFIED** | Normalized regex literals to match the workflow labels/variable gate exactly; main Security `36980655725` passed Release/QA safety + CodeQL. |
296 +| 2026-10-02 | CI retest exposed a literal `\\n` introduced while editing the release-safety checker. | **TEST SYNTAX FIX VERIFIED** | Replaced the escaped text with a real newline; subsequent PR and main security checks passed. |
297 +| 2026-10-02 | Release-safety invariant initially rejected the explicit Dependency Graph availability gate. | **TEST CONTRACT VERIFIED** | Safety checker requires both properties: Dependency Review is conditional on `DEPENDENCY_GRAPH_ENABLED=true`, and remains fail-closed whenever enabled; main Security `36980655725` succeeded. |
298 +| 2026-10-02 | Wave 5a identity/signup/invitation bootstrap remediation (WS-01, F-121/F-122 and OTP bootstrap boundary). | **MERGED / PRODUCTION + CI VERIFIED** | PR #30 merged as `cfd15dcf51cf8b9085a5512ded497fe0363ae322`. Main Quality `36980655736` SUCCESS including identity disposable-DB + static/Real-DOM gates; Security `36980655725` SUCCESS. Production migration `20261002075156 identity_wave5a_bootstrap` applied to `hcsixhqbyuhpshfwqpjx`; live reconciliation confirms `search_path=''`, organization-bound trial creation, trigger present, `licenses_without_org=0`, duplicate organization licenses=0 and orphan memberships=0. Persistent two-real-user production E2E and offboarding cache/session purge remain NOT VERIFIED. |
299 +| 2026-10-02 | PR #29 exposed that Dependency Review now fails hard when GitHub Dependency Graph is disabled. | **CI BOUNDARY VERIFIED** | Security workflow runs Dependency Review only when repository variable `DEPENDENCY_GRAPH_ENABLED=true`; when enabled the action remains fail-closed. Main Security `36980655725` passed Release/QA safety + CodeQL; Dependency Review was skipped because the graph remains unavailable. |
300 +| 2026-10-02 | Owner granted standing approval to continue in-scope project work without repeated confirmation. | **WAVE 4B PRODUCTION APPLIED + VERIFIED** | Supabase production `hcsixhqbyuhpshfwqpjx` recorded `request_wave4b_scheduler_outbox_delivery` as migration version `20261002072526`. Read-only reconciliation confirmed scheduler tables, outbox delivery columns, and all five Wave 4b RPC contracts exist. GitHub main `41aff95d11a66c67e2c64df3eac11a122f94dfd7`: Quality `36975968198`, Security `36975968108`, Release Gate `36976087514`, Deploy `36976115600` succeeded. Automatic external scheduling and D4c destination consumers remain NOT VERIFIED. |
301 +| 2026-10-02 | Wave 4b first disposable-DB run exposed an ambiguous PL/pgSQL test variable in the final replay assertion. | **TEST FIX APPLIED / RETEST PENDING** | Product migration executed through all scheduler/outbox assertions; failure was confined to the final test query where local variable `k` shadowed temp-table column `k`. Renamed/qualified the assertion; no production permission or state-machine rollback. |
302 +| 2026-10-02 | Owner said «ادامه بده» after Wave 4 F-420/F-421/F-422 merge. | **IMPLEMENTED ON BRANCH / CI PENDING** | Added server-clock five-minute scheduler slots, durable run/claim evidence, replay binding, skip-locked overdue claims, stable outbox destination command identity, lease claims, retry/backoff, dead-letter and idempotent authorized replay. D4c destination consumers remain disabled. Production migration is NOT APPLIED pending the schema-change gate. |
303 +| 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. |
304 +| 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. |
305 +| 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. |
306 +| 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`. |
307 +| 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. |
308 +| 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. |
309 +| 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. |
310 +| 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. |
311 +| 2026-10-01 | Owner authorized starting the canonical remediation pack after external full-system audit. | **WAVE 0 CLOSED** | Release/QA fail-open paths, exact-SHA promotion and Pages deployment ordering are now verified by positive and negative controls above. |
312 +| 2026-10-01 | Owner said «ادامه بده» after D3a handoff. | **D3B + D3C VERIFIED** | D3b visual editor/conditions/timeline and D3c SLA/delegation/outbox are production + disposable-DB + real-DOM verified. Remediation audit supersedes roadmap ordering. |
313 +| 2026-10-01 | Slice D3c — SLA/escalation, delegation/substitution, transactional outbox. | **IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + CI VERIFIED** | `js/request-workflow-d3c.js`; migrations `20261001235500`, `20261002000500`, `20261002001000`; Quality run `36917772952` all three jobs SUCCESS. Evidence: `docs/REQUEST_WORKFLOW_D3C_VERIFICATION.md`. |
314 +| 2026-10-01 | Slice D3b — visual workflow editor + conditions + timeline. | **IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + CI VERIFIED** | `js/request-workflow-d3b.js`; migration `20261001233000`; bounded predicate DSL, skipped-step evidence and authorized timeline RPC. Quality run `36915696611` all three jobs SUCCESS. Evidence: `docs/REQUEST_WORKFLOW_D3B_VERIFICATION.md`. |
315 +| 2026-10-01 | Slice D3a — sequential/parallel request workflow runtime. | **IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + CI VERIFIED** | Migrations `20261001230000`, `20261001230500`; private step/vote runtime, quorum semantics, capability checks, idempotent decisions and immutable evidence. Quality run `36913565943` all three jobs SUCCESS. |
316 +| 2026-10-01 | Slice D2 — request UI/read-model + legacy cutover. | **IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + CI VERIFIED** | `js/request-workflow-d2.js`; migrations `20261001223500`, `20261001224500`; Quality run `36912668369` all three jobs SUCCESS. Legacy source records remain preserved and imported rows traceable. |
317 +| 2026-10-01 | Slice D1 — requests/BPMS-lite server foundation. | **IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + CI VERIFIED** | Migrations `20261001204500`, `20261001205500`, `20261001210500`, `20261001211500`; Quality run `36910187257` all three jobs SUCCESS. |
318 +| 2026-10-01 | Office Slice C8 workflow policy/runtime. | **IMPLEMENTED / PRODUCTION + ADVERSARIAL + CONCURRENCY + REAL-DOM + SECURITY VERIFIED** | Immutable workflow evidence, pinned policy versions, capability-gated transitions, optimistic revision checks, idempotency, private runtime tables and SECURITY INVOKER public wrappers. |
319 +| 2026-10-01 | Owner reconfirmed autonomous GitHub + Supabase execution and free-tier-only development. | **ACTIVE OPERATING DIRECTIVE** | No repeated routine approval requests; no paid development resource. Preserve safety/cost boundaries. |
320 +| 2026-10-01 | Live QA: commerce/tax IDs/request builder/personnel/license/floating-detail coding. | **PARTIALLY IMPLEMENTED / FOLLOW-UPS OPEN** | Kardex/tax-ID/request/profile/license/floating-code work landed. Exact Taxpayer-System print layout owner reference is now available and has regression coverage. |
321 +| 2026-09-30—2026-10-01 | Office C1–C7, ELI-1–ELI-4, Slice A/B and accounting phases 1–6. | **VERIFIED WITH DOCUMENTED BOUNDARIES** | See required evidence; do not redo completed phases without verified regression evidence. |
322 +| 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 lifecycle/accounting/permissions/tests exist. |
323 +
324 +## Wave 0 checkpoint — CLOSED 2026-10-02
325 +- Manual QA no longer uses `continue-on-error`; live/all require credentials; live credential-bearing runs reject non-allowlisted origins before secrets are injected into the test step; authenticated browser origin is rechecked before/after login/navigation; menu click errors are no longer swallowed and each navigated item must change observable UI state.
326 +- QA evidence retention reduced to 3 days and screenshots changed to failure-only.
327 +- Security dependency review no longer uses `continue-on-error`. Security runs `scripts/release-safety-check.mjs` to prevent regression of Wave 0 code contracts.
328 +- Exact-SHA `Release gate` requires successful Quality + Security for the same SHA and explicitly checks `static-quality`, `c8-policy-database`, and `d1-request-database` before promotion.
329 +- Historical reproduction: Pages run `36922017645` for SHA `6b529647...` completed before Quality/Security, proving the old branch-deploy path was unsafe.
330 +- Negative control after `Protect main` + Pages source change: failing SHA `03561a33...` on PR #15 failed `static-quality`; merge was rejected; no Release gate or gated Pages deployment existed for that SHA.
331 +- Positive control on protected main SHA `150ff54d938a45b9a9b476f3a4a8fdabbb45d065`: Quality `36932956964` SUCCESS; Security `36932956877` SUCCESS; Release gate `36933115365` SUCCESS; `Deploy gated Pages` `36933151878` SUCCESS. The earlier Pages trigger `36933134567` was skipped, as designed, and no legacy dynamic branch deployment ran.
332 +- Wave 0 findings F-402/F-403/F-406/F-407/F-423/F-424 are closed at the verified GitHub/repository boundary.
333 +
334 +## Implemented foundations
335 +- Accounting phases 1–6: accepted high-assurance accounting foundation; posted history remains immutable and balanced.
336 +- Slice A/B + ELI-1–4: modular entitlements, tenant/RBAC, seats, delegated admin, reusable roles, secure invitations and organization UX.
337 +- Office C1–C8: registration/read evidence, referrals, archive/classification, numbering/templates, approvals/SLA, OCR provenance boundary and versioned correspondence workflow runtime.
338 +- Requests D1/D2: independent versioned request definitions/forms/workflows, pinned versions, idempotent create/transition, immutable evidence, server authorization, server-backed UI/read model and non-destructive legacy cutover.
339 +- Requests D3a: ordered sequential/parallel approval steps, quorum voting, per-step capability authorization and private runtime state.
340 +- Requests D3b: visual ordered-step editor, bounded server condition predicates, skipped-step evidence and authorized runtime timeline.
341 +- Requests D3c: step SLA/deadline/escalation evidence, explicit time-bounded delegation with provenance, and transactional approved-request outbox intents.
342 +
343 +## Invariants
344 +Posted accounting history is immutable and balanced; tenant isolation is enforced at the data boundary; commercial entitlement and member authorization are independent; UI hiding is never security; expired licenses are read-only; office numbering is server-atomic; private scans remain private; seat/company limits are server-enforced; delegated customer admins cannot mutate commercial license entitlements; invitation acceptance is authenticated/email-bound/seat-safe; raw invitation tokens are never persisted or audited; organization-unit parents cannot cross tenants or form cycles. Request type/workflow versions are immutable snapshots; request instances pin both versions; runtime mutation is server-authorized, idempotency/revision guarded and append-only evidence is retained. D2 legacy import is non-destructive/idempotent/traceable. D3a votes require distinct actors for parallel quorum. D3b conditions are bounded server-validated predicates and skipped results remain evidence. D3c delegation never impersonates the source actor, source capability is revalidated, SLA escalation appends evidence, and approved cross-module effects are queued transactionally rather than directly executed. Request workflow state never replaces C1 registration or C5 correspondence approval evidence.
345 +
346 +## Required evidence
347 +`docs/PHASE_1_REDESIGN_VERIFICATION.md` through `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/ELI_1_ENTERPRISE_LICENSE_VERIFICATION.md` through `docs/ELI_4_ENTERPRISE_ORGANIZATION_UX_VERIFICATION.md` · `docs/OFFICE_SLICE_C1_VERIFICATION.md` through `docs/OFFICE_SLICE_C8_RUNTIME_UI_VERIFICATION.md` · `docs/REQUEST_WORKFLOW_D2_CUTOVER_VERIFICATION.md` · `docs/REQUEST_WORKFLOW_D3A_VERIFICATION.md` · `docs/REQUEST_WORKFLOW_D3B_VERIFICATION.md` · `docs/REQUEST_WORKFLOW_D3C_VERIFICATION.md` · `docs/REQUEST_WORKFLOW_D4A_VERIFICATION.md` · `docs/PRODUCTION_RUNBOOK.md` · `supabase/migrations/` · `supabase/tests/request_d1_behavior.sql` · `supabase/tests/request_d2_legacy_behavior.sql` · `supabase/tests/request_d3a_workflow_behavior.sql` · `supabase/tests/request_d3b_condition_timeline.sql` · `supabase/tests/request_d3c_operations.sql`.
348 +
349 +## NOT VERIFIED / external boundary
350 +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.
351 +
352 +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; that drift was resolved on 2026-10-03 by approved migration `20261003033540`. 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.
353 +
354 +## Wave 4 production verification — 2026-10-03
355 +- Owner explicitly approved the archived SQL including schema/function/EXECUTE-grant changes. Applied successfully to `hcsixhqbyuhpshfwqpjx` as `20261003033540 request_wave4_operational_integrity` after recording approval in commit `ed90934f057e85bfd6bd0286bdf309d9c2ded9f7`.
356 +- Exact source: `supabase/migrations/20261002072000_request_wave4_operational_integrity.sql`, Git blob `7e644afd2387d328056356314ebfdeed272963ab`. No SQL modification or duplicate migration file introduced. Production version differs because the migration service assigns the application timestamp.
357 +- Live schema checks PASS: text idempotency column exists; key-length CHECK validated; actor-scoped unique index valid. Seven-argument public/private create RPCs exist; authenticated can execute new signatures and cannot execute old six-argument signatures; anon cannot execute either. Public wrapper is SECURITY INVOKER, private implementation remains guarded SECURITY DEFINER; empty search_path verified. Duplicate-intent and revoke audit-deduplication guards present.
358 +- Live BEGIN READ ONLY tests PASS: valid workflow accepted; normalized duplicate target/action rejected with expected error; unauthenticated delegation rejected with SQLSTATE 28000. Transaction rolled back. Delegation row count remained zero. No financial data mutation or user provisioning occurred. Public tables without RLS=0.
359 +- Security advisor unchanged: 3 private C8 no-policy INFO, 20 authenticated SECURITY DEFINER WARN, 1 disabled leaked-password-protection WARN. Existing remediation references remain below; no unrelated grants or Auth settings changed.
360 +- Baseline main `81bd9bf38e0b02e5baed8a3fa32a89a2b1345572`: Quality `36994542956`, Security `36994542874`, Release `36994665315`, Pages `36994730651` succeeded. Static job `110798133201` logs inspected: 49/49 controlled real-DOM tests and accounting phases 2–6 + Golden passed. Disposable D1 job `110798133021` logs inspected: exact Wave 4 migration and `supabase/tests/request_wave4_operational_integrity.sql` executed successfully with ON_ERROR_STOP. These are controlled/disposable tests, not authenticated production browser E2E.
361 +- VERIFIED boundary: missing migration deployed; structural, permission and read-only negative-control contracts pass. NOT VERIFIED: persistent two-real-user production browser E2E, real-user production delegation creation/replay/revocation, concurrent production overlap, and full historical SQL equivalence. No blanket product COMPLETED claim.
362 +
363 +## Historical reconciliation evidence — 2026-10-02 (Wave 4 absence resolved above)
364 +- 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.
365 +- 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.
366 +- 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.
367 +- 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.
368 +- 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 .
369 +- 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.
370 +- **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.**
371 +- 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.
372 +
373 +## Continuation checkpoint — 2026-10-03
374 +- Request recorded before retry in `f293b533a557b6af2168220608e1182b1e1a4083`. Compared `81bd9bf...62da4cf`: only PROJECT_STATE.md changed. Main Quality attempt 1 failed solely at enterprise-org-ux DOM test (30s); 48 others passed. No error-context artifact was retained in that run, so exact timeout phase/network cause cannot be established from available evidence.
375 +- Failed-job retry on the SAME SHA passed without any code/test/config change: run `37094021032` attempt 2, static-quality job `111122578331`, 49/49 DOM plus accounting invariants and Golden. Database jobs also succeeded. Do not call the intermittent timeout root cause fixed; next recurrence should retain trace/error-context for diagnosis. No blanket retry policy or weakened gate was added.
376 +- Read-only production readiness: migration `20261003033540` present; public tables without RLS=0; organizations with at least two distinct active member user IDs=0. Thus persistent same-tenant owner/non-owner browser E2E cannot run with the current membership state. No identities, memberships, capabilities or financial records were changed. Existing controlled DOM/disposable DB results are not a substitute for real authenticated production users.
377 +- Local psql/postgres/docker executables unavailable, so no new local two-session delegation concurrency test was run. Production concurrency remains NOT VERIFIED. Do not run disposable fixture seeding against production.
378 +
379 +## Exact next executable work
380 +Current priority (2026-10-07): finish the owner-requested audit and remediation plan before product implementation. The following Oct 4 checkpoint is historical; do not treat it as the current main head or as authorization to publish old unfinished work. Main and production diverge for the phone-identity change: production version `20261007165208` exists, while its SQL archive is on open PR #58. Assess open PR #59 against the new owner checklist before duplicating or integrating that work.
381 +
382 +Current owner-requested chart/taxpayer slice: PR #47 merged as `b2e1fbf89fb558fd9be1729dda875d3796e46721`. Main Quality `37170385857`, Security `37170385877`, Release `37170453444`, gated Pages `37170479829` all succeeded. Inspected main static job `111341993035`: 53/53 controlled real-DOM tests, chart invariants and Golden passed; all three disposable DB jobs passed. Final PR head `4619b5ed73f6e61084d6e111b7ab338e6c152ff5` also passed Quality `37170297853`, Security `37170297828`; logs from static job `111341738948` confirm 53 DOM tests. Existing compatible template companies use «پیش‌نمایش تکمیل کدینگ» then explicit apply; no live company was changed by the agent. Next: owner-context invoice/physical-print comparison and safe authorized two-user production verification; do not treat successful deployment as authenticated production E2E. Exact photographed-print parity, physical printer, authenticated production E2E, mixed-payment/multi-row taxpayer arithmetic remain NOT VERIFIED. Newly attached bootstrap files reference other repositories; attachments are context and do not change the selected Factor-easy repository. PR #46 is merged as `3085dce9d8f457e61aca6676f872737418116e7a`; live recheck on 2026-10-04: Quality `37126922824`, Security `37126922854`, Release `37127012080`, Pages `37127034198` succeeded. These previous-SHA runs do not verify the new implementation.
383 +
384 +0. Wave 4 deployment drift is resolved by production migration `20261003033540`; retain the production E2E/concurrency boundaries above. Next eligible verification is persistent legitimate two-user offboarding/delegation E2E with a safe authorized test scope. Further schema/RLS/auth/role changes require separate approval.
385 +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.
386 +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.
387 +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.
388 +
389 +## Live QA open items
390 +- Chart/taxpayer Oct 3 defects were partially resolved by merged PR #47: 62 additive chart rows include non-current assets, and the actual supplied logo replaces the generated logo. Compatible existing companies require explicit preview/apply. Universal chart suitability, exact photographed-print parity, physical printing, and mixed-payment/multi-row taxpayer arithmetic remain NOT VERIFIED; do not repeat the obsolete claim that non-current assets are absent from every current starter template.
391 +- Legacy request records are preserved for rollback/audit after D2; new request configuration/runtime must not be routed back through record-store writes.
392 +- Floating-detail defaults for new records: 8-digit semantic codes currently use slot/category/sequence (Branch `11xxxxxx`, Counterparty `21xxxxxx`, Project `31xxxxxx`); historical codes are not rewritten and account-chart coding stays independent.
393 +- Product/service deletion must continue to fail closed whenever operational references exist.
394 +
395 +- 2026-10-10 P0 owner request: universal inline searchable combobox for product, contact, seller/buyer, project, chart and contracts; full list on focus, instant narrowing over 1000 records, no separate search input; exactly one initial editable invoice line; require real-browser repeated regression before done. Branch fix/combobox-live-search, PR #60. NOT VERIFIED until browser and release checks pass.
396 +
397 +
398 +- 2026-10-10 local isolated QA evidence: 42 static/behavior check scripts PASS; 59/60 Playwright tests PASS against correct repo served on 4174, with the only initial Pages artifact test misrouted to an unrelated process on 4173; Pages artifact test rerun against correct _site/index.html on 4174 PASS (thus 60/60 separately). Five UX search/settings browser tests PASS. Scope caveat: exhaustive click-by-click all controls, 1000-option stress, production authenticated multi-user E2E and live deployment NOT VERIFIED. No production mutation.
399 +
400 +
401 +- 2026-10-10 production issue: index.html referenced unchanged old script query versions despite PR #60 changes; browser/CDN cache could keep stale JS. Cache-bust invoices.js and ux-hardening-r2.js for next gated Pages deployment. Verify exact deployed artifact and refresh user browser before claiming live success.
402 +
403 +
404 +## 2026-10-11 Iran-first accounting design and verification
405 +Owner approved Iranian accounting standards as primary, with future international extensibility. Design: docs/IRAN_FIRST_ACCOUNTING_DESIGN_2026-10-11.md. Added read-only finance integrity auditor and deterministic fixture test. Verified: golden accounting core, phase3 and phase6 behavior, auditor valid/invalid fixtures. Not verified: live invoice save/reload, production data, actual ERPNext/Odoo/Beancount integration, compliance certification. No schema or production data changes. Next: isolated invoice lifecycle tests, posting atomicity and RLS verification, expert review of Iranian standards.
406 +
407 +
408 +2026-10-11 follow-up: GitHub PR #64 Quality and Security workflows succeeded. New accounting audit fixture added to quality workflow. Isolated public invoice-save debug blocked by null currentUser fixture, so save/reload remains unverified (not a confirmed application defect).
409 +
410 +
411 +## 2026-10-11 Stripe sandbox integration probe (requested)
412 +Owner confirmed connected Stripe plugin and requested completion of sandbox invoice create/read and safe Finora integration probe. Scope: Stripe test/sandbox only, read-only production boundaries, no payments, no actual customer contact, no exposed API keys, no Supabase schema/auth/data mutations. Decision: implement and verify bounded standalone integration/tests; record actual API results and connection blockers before claiming completion.
413 +
414 +
415 +2026-10-11 verification checkpoint: Stripe connected plugin test account 'Finora ERP sandbox' (livemode=false): synthetic customer cus_VQ5jO0GvKcuiQd created without email/payment method; draft in_1UPFYbGnbcoujdbeXnuN3Jf0 created (auto_advance=false), invoice item amount 1250 USD minor units added; GET by ID and list both returned draft, total/subtotal/amount_due=1250, exactly one line. Initial send_invoice attempt without email was rejected, so no email was sent; successful draft uses charge_automatically without finalization. New scripts/stripe-sandbox-readonly.mjs is a server-only read-only sandbox guard with synthetic fixture and adversarial test integrated into Quality CI. Local tests PASS: new sandbox adapter, syntax 53 JS + 48 MJS, finance audit, golden accounting journey, git diff check. NO direct Finora backend Stripe API credentials available; no Finora UI/prod DB/schema/auth integration, no charges/ledger writes. Only ChatGPT plugin API access is live-verified. Next: PR Quality/Security CI, then owner-provided private restricted sandbox API key on trusted server and tenant/auth mapping approval for server deployment if desired.
416 +
417 +
418 +## 2026-10-11 Stripe actual Finora server connection preparation
419 +Owner requested implementation to continue autonomously and precise owner-only setup instructions if blocked. Verified live Supabase project hcsixhqbyuhpshfwqpjx is ACTIVE_HEALTHY and existing admin-user-management Edge Function requires JWT. Stripe plugin verified a sandbox synthetic draft invoice; it does not supply a Finora backend API key. Design decision: implement a disabled-by-default, server-side-only, fixed sandbox invoice preview Edge Function guarded by verify_jwt, live verified Supabase user identity, exact user allowlist and restricted rk_test_ key; no financial postings/production data writes or RLS/schema/auth changes. Deployment will be independently checked; missing secret/identity remain explicit blockers. User must set the restricted Stripe sandbox key in Supabase Functions secrets privately, never share it in chat or commit it.
420 +
421 +
422 +2026-10-11 implementation checkpoint: Added JWT-required (Supabase platform verify_jwt intended), server-side-only finora-stripe-qa-read Edge Function with locked one-invoice QA scope, Auth /auth/v1/user revalidation, exact allowed user UUID, Stripe restricted rk_test_ only, origin/method restrictions, no customer PII in output, no ledger/production data writes. Added .gitignore for .env secrets, documented Dashboard-only two-secret onboarding. Local PASS: 26 auth/amount/origin adversarial cases, Stripe fixture read, finance integrity, golden accounting journey, syntax 53 JS/49 MJS, git diff check. PENDING: GitHub PR CI, actual Edge deployment verify_jwt=true, unauthorized live 401 probe, owner private sandbox secrets and authenticated read test. Never mark direct Finora-to-Stripe API as verified before private key is configured.
423 +
424 +
425 +
426 +2026-10-11 verified deployment checkpoint: PR #66 head 67081d8c26253c0413bf014213589066b8ad6728 passed GitHub Quality run 38117668618 (including Stripe Edge 26-case authorization test, Golden accounting, Real DOM) and Security run 38117668637. Merged on main as 70addfe731524341f70115d85451b9dacfb1aaf9. Deployed only the fail-closed Supabase Edge Function finora-stripe-qa-read to verified ACTIVE_HEALTHY Finora project hcsixhqbyuhpshfwqpjx; deployment function ID 1ba946df-11ee-42d1-b86a-3e4b27331b10, version=1, ACTIVE, verify_jwt=true, inspected deployed index.ts + handler.mjs. No schema/RLS/auth/role, payment, user/financial-record or UI mutation. An independent unauthenticated HTTP 401 probe was ATTEMPTED but could not be completed due DNS/network fetch failures from remote PC/container; do not claim 401 live verified. IMPORTANT: no restricted Stripe sandbox key or user allowlist has been provisioned through these tools, so function intentionally returns no sandbox data; direct Finora backend-to-Stripe request and authenticated real user session remain NOT VERIFIED. The owner must privately set STRIPE_SANDBOX_RESTRICTED_KEY (rk_test_, Invoices:Read, all other permissions None) and FINORA_STRIPE_QA_ALLOWED_USER_ID (tester's Auth User UID) in Supabase Edge Function Secrets, without ever sharing values in chat/repo. Next: authenticated end-to-end invoke from approved test user, verify retrieved synthetic Stripe sandbox invoice amount=1250 USD minor units, detect 401/403 for unauthorized actor, confirm no production accounting effect.
427 +
428 +## 2026-10-11 urgent login outage triage
429 +Owner reports login blocked with generic 'check internet/VPN' network error on live Finora. Priority supersedes Stripe rollout. Read-only baseline: origin/main 459d8cfc368fbebf1a5a26f7e7abe1c5e01c4bba; Supabase project ACTIVE_HEALTHY and public key current/enabled; two Chromium live-site synthetic invalid-user password token requests returned expected HTTP 400 invalid_credentials (factoreasy.ir and GitHub Pages), no JS page errors. Windows PC GET site HTTP 200 and DNS resolves Supabase; unauthenticated health without public key 401 as expected. User-side regional/ISP reachability NOT VERIFIED. Do not alter passwords, accounts, schema, auth settings, token policy, or live financial data. First deliver honest diagnostic UI and explain that platform-side working does not verify user's ISP route; public proxy or new Cloudflare Worker/DNS/auth transport is separately security-and-cost approved work.
430 +
431 +
432 +2026-10-11 login diagnostic implementation: added explicit '????? ????? ?? ???? ????' action on login screen, credential-free parallel same-origin manifest + GoTrue /auth/v1/health (publishable key) probe with bounded 12s timeout, stable AUTH_OK/AUTH_UNREACHABLE/AUTH_TIMEOUT/AUTH_HTTP_NNN/SITE_UNREACHABLE statuses and automatic probe when password login rejects due network. Preserved existing sign-in policy, passwords, and Supabase endpoint. Bumped core.js cache key; added login-connectivity.js. Verified on local source AND Pages artifact: Playwright 3/3 diagnostics PASS each; syntax check 54 JS+50 MJS PASS; static diagnostic check PASS; branding/login PASS; golden accounting journey PASS; site build PASS. Live browser fake invalid account got real GoTrue HTTP 400 invalid_credentials from both site origins (client-to-Supabase working from remote Windows); user network route NOT VERIFIED and restored login NOT CLAIMED. Cloudflare DNS for factoreasy.ir is DNS-only; routing a new public proxy would add a security boundary, require approvals/cost checks and must NOT be silently enabled. Next: PR CI and gated Pages exact SHA publication; user to click new button on affected network and share status, then decide whether DNS/ISP or auth route change is justified.
433 +
434 +
435 +## 2026-10-11 invoice product lookup repair — PR #69
436 +- Owner screenshot evidence: populated products master; invoice row initially empty, seller searchable selector works. Source root cause: `finoraEnsureInitialInvoiceRow` creates row before `pullAll()` completes, while initial row `<select>` options are captured only at creation; additional product dropdown is clipped by scrollable invoice table.
437 +- Fix on `fix/invoice-product-search-rehydrate-20261011`: rehydrate live scoped products when selected row is initialized/focused/refreshed (sales and purchases), preserve selected archived/historical product and existing quantities/prices, robust Unicode Persian text filtering by name/code/spec, render product popup in document body to escape table clipping; version `js/ux-hardening-r2.js?v=20261011-product-refresh-v3`.
438 +- Independent Windows remote Desktop Commander `DESKTOP-71SJ63M`: `node scripts/syntax-check.mjs` PASS (54 JS/50 MJS); `node scripts/ux-hardening-r2-check.mjs` PASS; `npx playwright test scripts/ux-hardening-r2.spec.js --reporter=line --workers=1` PASS 6/6 (real Chromium). Screenshot fixtures `qa-product-search_block.png` and `qa-product-search_cement.png` demonstrate visible two-result dropdowns, real purchase/search selection event and price/unit population, scoped user visibility. Screenshots contain synthetic test data, **not real production customer items**.
439 +- PR #69 exact head `9281d7a078144302df4dbf23a066dc11e49a4a97`: GitHub Quality `38134885163` SUCCESS, Security `38134885100` SUCCESS. Initial red run `38134614070` was due to an incorrect test expectation that `سیمان` must match only cement; `بلوک سیمانی` legitimately matches too. Regression corrected with precise product selection; subsequent CI green.
440 +- No schema, RLS, Auth, roles, tenant membership, Supabase records, invoices, posting, or production data changed. Caveat: user's actual authenticated product master and post-merge site cache/live refresh NOT YET VERIFIED at this checkpoint. Verified after merge: PR #69 merged as `7a3f1f7703ff128bcbbf0906e44889b2833e3dd7`; exact SHA main Quality `38135114282` SUCCESS, Security `38135114272` SUCCESS, Release gate `38135220443` SUCCESS, gated Pages deployment `38135239645` SUCCESS; `CNAME` maps Pages to `factoreasy.ir`. Remote Windows Desktop Commander remains connected and Chromium controlled 6/6 PASS, but attempted Windows interactive desktop capture returned `CopyFromScreen: The handle is invalid`, and direct DNS resolution of `factoreasy.ir` failed from remote and sandbox environments. Thus **a real authenticated user-session product-list lookup and domain HTTP inspection are NOT VERIFIED**; do not claim them. Screenshot artifacts were created only on the authorized remote QA machine, with synthetic inputs, and visually returned to the user in chat. No user finance data was changed. Exactly one safest next action: owner hard-refreshes the deployed site and searches a known real product such as `هارد` in invoice item box; if it still fails, capture screenshot plus browser Console error without sharing credentials.
441 +
442 +## 2026-10-11 invoice print Persian-digit consistency — owner request
443 +- Owner reports mixed Persian/Latin glyph digits on printed invoices, including invoice number and trailing digits of date. Requested consistent Persian numerals everywhere in invoice print. **MERGED / MAIN QUALITY+SECURITY+RELEASE+PAGES VERIFIED / LIVE READ-ONLY CHROMIUM QA PASS**.
444 +- Baseline main `7eccf2757c99ea19ede3bac98847be0d2b0782b3`. Scope: all human-readable digit text in regular formal/non-formal/pre-invoice and official taxpayer invoice print/preview (including page counters, monetary amounts, numbers, IDs embedded as visible labels) while retaining original ASCII serial/ID/date values in storage, attributes, URLs, machine integrations and journal calculations. No financial/database/RLS/auth/write changes.
445 +- Required checks: verify exact live browser print and PDF DOM, synthetic values with mixed Latin, Eastern Arabic and Persian digits; ensure no Latin/Eastern-Arabic decimal glyphs remain in printable text, numeric totals intact, sensitive URL/attributes unchanged, preview and isolated iframe consistent, multi-page invoices intact. Final CI and gated Pages deployment only if tests pass. Rollback: revert specific PR.
446 +- Verified implementation on branch: `js/print.js` normalizes only rendered text nodes in preview, iframe/PDF, taxpayer and ordinary invoices; `js/purchases.js` applies same safe shared formatter to popup output. `index.html` cache-busts both bundles. Underlying values `PINV-31` and mixed `۱۴۰5/٠۷/19` remain unchanged in datastore; displayed `PINV-۳۱`, `۱۴۰۵/۰۷/۱۹`. HTML attribute/code remains literal `TAX12A340`; visible human-readable digits become Persian. No data/permission mutations.
447 +- On Windows remote `DESKTOP-71SJ63M`, isolated test server explicitly verified new asset (port 51867, avoiding occupied 4173/4175). `node scripts/syntax-check.mjs` passed 54 JS + 50 MJS, `node scripts/ux-hardening-r2-check.mjs` PASS, `npx playwright test scripts/taxpayer-print.spec.js` PASS **4/4 real Chromium** (official taxpayer landscape, image readiness, formal/nonformal/taxpayer digits, purchase popup) including PDF one-page assertions. Separate formal invoice screenshot `print-persian-formal-qa.png` captured via remote browser, text-node scan reports **0 Latin/Arabic-Indic decimal glyphs**. Screenshot uses only synthetic information, not real customer invoice.
448 +- PR #71 initial head `f9129f5dc6fc52a78e76aa5e9bfe21b383926efd`: Quality `38142219556` **SUCCESS**, Security `38142219616` **SUCCESS**. Pending merge, main gated CI/Pages deployment, and owner-authenticated print check with actual production invoice. No change to tax ID submission, serial storage, numeric math, RLS, schemas or real accounting entries.
449 +
450 +### Persian print digits — final release verification 2026-10-11
451 +- PR #71 merged into protected `main` at exact commit `991c61f70980518e1b9570984108b0fbab025fd2`. Same-SHA main GitHub Quality `38142480225` **SUCCESS**, Security `38142480264` **SUCCESS**, Release gate `38142569490` **SUCCESS**, Pages deployment `38142585021` **SUCCESS**.
452 +- Independent remote desktop `DESKTOP-71SJ63M` GET `https://factoreasy.ir/?printDigitsQa=20261011` returned **HTTP 200**, exact deployed assets `js/print.js?v=20261011-persian-print-v1`, `js/purchases.js?v=20261011-persian-print-v1`, and fetched print bundle contains `localizePrintHtmlDigits`. Headless Chromium loaded the **real production domain's code**, generated a synthetic formal invoice without logging in, and inspected actual isolated printable text: **PASS, zero remaining ASCII/Eastern Arabic decimal digit glyphs**; original serial `PINV-31` and date `۱۴۰5/٠۷/19` remained untouched while human-visible print uses `PINV-۳۱`, `۱۴۰۵/۰۷/۱۹`. Remote screenshot `print-persian-formal-qa.png` was returned inline to owner; image is local QA artifact, not saved in repository.
453 +- Scope caveat: production user-authenticated real customer printer test, printer-driver headers and actual hardcopy **NOT VERIFIED**. No real invoice save/edit or financial data change, no schema/auth/RLS/permission change. Owner can hard-refresh then print-preview any existing saved invoice as a safe final visual check. Rollback: revert PR #71, redeploy gated Pages, and clear browser cache.
454 +
455 +## 2026-10-11 owner-approved eight-phase roadmap — initiation
456 +- Owner explicitly approved the proposed eight-phase Finora roadmap: Phase 0 stabilization/bug triage; Phase 1 security, identity and data integrity; Phase 2 ledger and accounting; Phase 3 commerce/inventory/treasury integration; Phase 4 Iran tax/reporting; Phase 5 integrated acceptance/V1 release; Phase 6 advanced business modules; Phase 7 group/industrial/international extension. **APPROVED PLAN / PHASE 0 BASELINE RECONCILIATION STARTED — NOT V1 ACCEPTED**.
457 +- Baseline protected `main` = `4071072bc457fede62097eb2300ca35b8f516939` (PR #72 final Persian-print evidence). Last exact-head GitHub Quality `38142829987`, Security `38142829957`, Release gate `38142911889`, gated Pages `38142924226`: all SUCCESS. Supabase Finora `hcsixhqbyuhpshfwqpjx` ACTIVE_HEALTHY, 80 migrations (last `20261007165208 phone_identity_profile`), advisor signals: 21 privileged-function execution WARN, 3 RLS no-policy INFO, one leaked-password protection WARN. Open PRs #6, #28, #39, #40, #43, #49, #57, #58 remain open; do not merge stale/sensitive code by default.
458 +- Deliverables generated and independently read back: `docs/FINORA_EIGHT_PHASE_APPROVED_ROADMAP_2026-10-11.md` (exactly eight stages 0–7, owners/dependencies/acceptance, sensitivity boundaries) and `docs/FINORA_PHASE0_BASELINE_2026-10-11.md` (8 evidence-ranked F0 tests, current verified baseline, remaining blockers). Phase 0 **ACTIVE, NOT ACCEPTED**. Remote Desktop Commander `DESKTOP-71SJ63M` read-only production GET: `factoreasy.ir` **HTTP 200**; exact UX combobox, Persian print and login diagnostic versioned assets found; GET both product and print JS **200**, helper functions present. No authenticated real-user production tests performed in this checkpoint. No schema, RLS, authentication, roles, credentials, posted records, payments or production data writes. Approval of roadmap does not authorize sensitive actions. **Next bounded execution:** `F0-03` isolated invoice persistence test, owner-context `F0-01/F0-02/F0-04` as safe authenticated smoke, then close repro defects with PR/QA evidence.
459 +
460 +## 2026-10-11 Phase 0 F0-03 execution restart — invoice persistence QA
461 +- User explicitly asked why work stopped and then whether execution stopped; resume active authorized Phase 0 work without requiring further approval for isolated tests. Phase 0 roadmap PR #73 merged at `836991e895e56b8b7e76a4976d0f9c0f5f43c294`, Quality `38146926629`, Security `38146926660`, Release gate `38147024208`, Pages `38147052590` all SUCCESS on same SHA. Connected Desktop Commander `DESKTOP-71SJ63M` online.
462 +- **CURRENT STAGE: F0-03 CONTROLLED CHROMIUM QA PASSED 2/2 — AUTHENTICATED PRODUCTION STILL UNVERIFIED.** Test real invoice form save → asynchronous sync via fake in-memory server RPC → page reload/pull → edit → reload → print, plus rejected RPC/visible retry. Run against locally-served repository; never post invoices to real Supabase, alter finance data, or collect login secrets. Owner-authenticated production result remains NOT VERIFIED. Next: create test, execute on remote Windows, fix, rerun, CI gate; update ledger with exact evidence and unresolved issues.
463 +
464 +- F0-03 regression added: `scripts/phase0-invoice-persistence.spec.js`. Windows Desktop Commander `DESKTOP-71SJ63M` served isolated repository on local port 51867; `npx playwright test scripts/phase0-invoice-persistence.spec.js --reporter=line --workers=1 --timeout=25000` **PASS 2/2 in real Chromium**. Scenario 1 uses `pre_invoice` so the test does not post financial ledgers: save→mock server RPC→reload→edit→reload→print, totals 3,000→4,500, unchanged ID and exactly one server invoice, zero journal vouchers. Scenario 2 returns a transient error from fake `finora_sync_records`, verifies retry and no duplicate. `node scripts/syntax-check.mjs` **PASS 54 JS + 50 MJS**. Early test harness failures arose from intentionally hidden native selectors replaced by commercial combobox (not evidence of app save failure); fixed fixture to dispatch form change handlers. No actual Supabase/RLS/auth/real invoice write performed. **Next gate:** GitHub PR full Quality+Security and release, then owner-authenticated isolated invoice lifecycle and real affected ISP login remain pending.
465 +
466 +### 2026-10-11 F0-03 final protected-main CI and deployment verification
467 +- Owner asked whether execution stopped; resumed F0-03 rather than closing after roadmap planning. PR **#74** merged to `main` at exact SHA `5f05ea340b37569c78cdfe7ec54c212f22ae3e29`. The changes are **regression test + CI test-list + phase ledger only**; invoice application source code and production Supabase records unchanged.
468 +- Same-SHA GitHub workflows: Quality `38154361473` **SUCCESS**, Security `38154361524` **SUCCESS**, Release gate `38154485595` **SUCCESS**, gated Pages `38154503667` **SUCCESS**. An earlier duplicate release gate was canceled and earlier Pages job skipped due to workflow concurrency; only these successful runs certify release.
469 +- Remote Desktop Commander `DESKTOP-71SJ63M` real Chromium: `npx playwright test scripts/phase0-invoice-persistence.spec.js --reporter=line --workers=1 --timeout=25000` **PASS 2/2 (25.31 s)**. Control sample pre-invoice QA-PINV-0001 saved to disposable fake server, reloaded and edited (3000→4500), persisted once; second sample survived one injected RPC network failure and retry without duplication. No real finance history, live Auth/RLS, Stripe, production data or schema changed.
470 +- **Phase 0 remains OPEN / F0-03 controlled QA passed, production-authenticated verification OPEN.** Next: test owner-authenticated sign-in network fault `F0-01`, live tenant product selection `F0-02` and existing invoice print `F0-04` on authorized user session, plus safe-scope actual server persistence for F0-03 if separately authorized. No claim of real live invoice save success.
471 +
472 +## 2026-10-11 owner screenshots — UI close, admin direct user, dashboard drilldowns and controlled posting
473 +- Owner supplied current production screenshots: `finora-org-access-modal` «بستن» fails and similar modal close buttons across modules; central admin licenses lacks owner-provisioned new user; dashboard financial KPI and recent journal cells lack account→journal drilldown; standard sale invoice save currently auto-posts directly via `jePostSourceRecord`, preventing ordinary pre-finalization edit.
474 +- Work ownership and dependency: **QA/UX** first fixes modal close with real-browser regression; **reporting/UX** implements read-only rollups and traceable recent journal drilldown, with accounting balance invariants; **security/auth** assesses stale PR #58 and designs server-side administrator provision with no client service key; **finance architecture** defines draft/review/posted lifecycle and migration/reversal gate before touching live invoice posting semantics. Implementation of the last two is not implied complete by UI-only release.
475 +- User has requested these features, but **no permission to create a real third-party account right now, assign admin permissions, rewrite posted financial records, change production RLS/schema without a separately reviewed gated procedure, or send any credentials**. Existing historical posted source records remain immutable. A rollback-able UI PR and independent browser QA precede deployment.
476 +
477 +### 2026-10-11 controlled UX acceptance — modal + dashboard (Phase 0)
478 +- Implemented delegated click capture for dynamically rendered `.modal-backdrop.active` closing buttons «بستن»، «✕ بستن» and «انصراف» plus backdrop clicking. This prevents broken inline handlers from trapping the user and never changes stored state. Implemented keyboard-operable cards for assets, cash/bank, receivables and payables; journal-derived asset/cash account drilldown, source voucher/line navigation and the five newest journal rows. Uses scoped getters + existing P6Reports; **read-only**. Dashboard cash KPI currently uses one primary cash account; the expanded ledger explicitly distinguishes related bank/cash/petty accounts rather than silently changing the amount.
479 +- Remote `DESKTOP-71SJ63M` live Chromium against locally served repo: `npx playwright test scripts/phase0-modal-dashboard.spec.js --reporter=line --workers=1 --timeout=20000` **PASS 2/2 (9.9 s)**. `node scripts/syntax-check.mjs` PASS (54 JS/50 MJS). Tests cover close/dynamic/overlay and dashboard asset→account→voucher, cash Enter, recent voucher navigation. Added suite to GitHub Quality; PR CI and production release pending at time of writing.
480 +- Real owner desktop visual recheck is still required. Outstanding admin direct provisioning and draft/post/final document manager remain separately gated; no permissions, credentials, auth, schema or posted financial data changed.
481 +
482 +## 2026-10-11 owner-approved searchable selectors + F2 keyboard workflow (Phase 0)
483 +- User explicitly directs full implementation in production of unified live search for products/services, persons and all applicable large selection controls; ArrowDown/ArrowUp list navigation with visible selected highlight, mouse-wheel scrolling and Enter selecting the **active** choice (not hard-coded first match); keyboard F2 across supported entry forms must validate/save or approve the active form as appropriate, show *specific reason* when blocked, avoid trapping focus or global Enter accidentally saving, and close successful entry dialogs. Baseline `59c904623d0e8e067ee1c02e3169167bcc04841b`.
484 +- **In progress / not yet deployed**. Keep existing `Ctrl+S`, `Ctrl+Enter`, optional Enter-save, purchase/sale behaviors, tenant filtering, print formatting, and product rehydration. F2 in sales invoice must save a draft and **must not post/finalize** financial journal; posting requires explicit user permission and separate confirmation under Accounting→Document Management. F2 must never blindly click a destructive or financial-finalization action.
485 +- Validation: isolated Chromium dynamic product/person picker, Persian normalization, ArrowUp/Down/PageUp/PageDown and Enter, wheel scrolling, Escape, unrelated Enter, F2 supported forms success/failure incl correct messages and no action in unsupported dialog; exact GitHub Quality+Security gates and Pages deployment; owner-authenticated live finance data remain untouched.
486 +
487 +### 2026-10-11 keyboard navigation/F2 controlled verification checkpoint
488 +- Implementation: `js/ux-hardening-r2.js` now tracks highlighted item in each integrated combobox with ARIA listbox active-descendant, filtered search, ArrowUp/ArrowDown, PageUp/PageDown, Home/End, mouse-wheel scrolling and pointer hover; Enter chooses the highlighted exact item rather than first result. Product dropdown remains safely portaled out of clipped invoice table; underlying filtered tenant catalog, price/unit change handlers and Persian normalization preserved.
489 +- F2 routes the active entry view through existing dedicated validation/save handlers (sales invoice, purchases, goods/services, contacts, cheques, expenses, accounting draft journal, default settings, company form when focused). Missing rows, missing product/contact names, invalid native controls and unsupported views explain the block. An active modal is not silently approved via keyboard; modal-specific confirmation must use its own safe action. **Sales F2 creates a draft only; it never finalizes the accounting posting.** Purchases currently auto-post when saved in existing code, so F2 **requires explicit user confirmation** before invoking purchase Save; refusal performs no operation. Ctrl+S and Ctrl+Enter remain available.
490 +- Independent Remote Desktop Commander `DESKTOP-71SJ63M`, cloned exact branch commit `cd5e04408d81eacaf66be97ee9d2b89d85e22915`, `node scripts/ux-hardening-r2-check.mjs` PASS, `node scripts/syntax-check.mjs` PASS (55 JS/52 MJS), Chromium `npx playwright test scripts/ux-keyboard-f2.spec.js scripts/ux-hardening-r2.spec.js scripts/accounting-document-workflow.spec.js --reporter=line --workers=1` **14/14 PASS (19.7 s)**. Real app invoice fixture verifies F2 rejects empty line and saves one formal **draft** with zero journal vouchers. Other tests cover product/person matching, Arrow+Enter selected not first, 48-product wheel/PageDown/Home/End, Escape, F2 form/unsupported modal/company/default settings/purchase explicit confirmation. Synthetic QA data only; no owner accounts or financial writes.
491 +- **IMPLEMENTED / MERGED / PROTECTED-MAIN CI & RELEASE / DEPLOYED / READ-ONLY LIVE ASSET VERIFIED.** PR #83 merged to `main` SHA `641b68669057ef429ae158744a86cba9a00dca31`; exact-SHA main Quality `38173607090` SUCCESS, Security `38173607091` SUCCESS, Release gate `38173716820` SUCCESS, gated Pages `38173732898` SUCCESS (skipped/cancelled duplicate workflow runs were not used as evidence). Independent Desktop Commander `DESKTOP-71SJ63M` real Chromium after checkout of **exact main merge commit**: `scripts/ux-keyboard-f2.spec.js` + `scripts/ux-hardening-r2.spec.js` **PASS 12/12 (6.0s)**; `node scripts/ux-hardening-r2-check.mjs` PASS; `node scripts/syntax-check.mjs` PASS (55 JS + 52 MJS). Remote GET `https://factoreasy.ir/?keyboardQa=20261011` HTTP 200 and exact referenced deployed `js/ux-hardening-r2.js?v=20261011-combo-keyboard-f2-v5` HTTP 200; JS body verified `finoraConfirmActiveFormF2`, active-option ARIA, wheel, PageDown and F2 listener all present. **User-authenticated actual existing-goods list and physical keyboard on owner's browser remain UNVERIFIED**, and not every optional module has an unambiguous save action: when F2 cannot safely determine one, it explains the reason instead of triggering posting/destructive actions. No schema/RLS/auth/roles/posts/customer financial data changed. Rollback: revert PR #83 and redeploy previous UX bundle `v=20261011-modal-close-v4`.
492 +
493 +
494 +## 2026-10-12 Phase 0 F0-05 independent 1000+ selector stress — PLANNED
495 +- **Owner request:** Continue approved Phase 0 without repeating PR #83 or changing production data. Baseline `main` SHA `27170e0291496997a6118b0e72978f852e015a86`; historical PR #83 keyboard/F2 is already deployed. Phase 0 remains OPEN.
496 +- **Accountable owner:** QA/Validation. Scope: disposable Chromium fixture with 1,200+ tenant-scoped product and contact choices; Persian/Arabic normalization; code/spec lookup; Arrow/Enter/Home/End/wheel/Escape; selection persistence; absent and cross-tenant negative cases; measured browser interaction responsiveness. Chapters: 14, 251, 259, 260 (with 252/253 security/event contracts).
497 +- **In scope:** `scripts/phase0-selector-stress.spec.js` and Quality workflow gate; minimum source UX correction only if the test reproduces a defect. **Out of scope:** Supabase writes/migrations, Auth/RLS/roles, secrets, actual user or financial data, postings, invoice finalization and live user-session claims.
498 +- **Acceptance/evidence:** Run new Chromium test, syntax/static/regression checks, GitHub PR Quality + Security; report observed time budgets, exact SHA/run and any failures. Controlled browser PASS does not close F0-05 owner-authenticated acceptance. Rollback: revert isolated QA PR; no operational/DB rollback required.
499 +- **Status:** SPECIFIED / implementation and CI pending. Next action: add bounded independent stress regression, execute and triage failures.
500 +
501 +
502 +### 2026-10-12 F0-05 initial Chromium/CI verification — CONTROLLED_QA_PASSED; OWNER E2E OPEN
503 +- Baseline protected `main`: `27170e0291496997a6118b0e72978f852e015a86`. GitHub official connector verified current repo and approved Phase 0; master 260-chapter DOCX SHA-256 `f445ec30b395319aece8bd7eb7d98e80bd4655eff6cc81b0253688b551bbc29b` matched handoff. Chapters 251/259/260 and related scope consulted. Previous PR #81, #82, #83 and #84 independently confirmed merged; no feature recreated.
504 +- Live read-only Supabase project `hcsixhqbyuhpshfwqpjx`: ACTIVE_HEALTHY, **81** migration history rows, newest `20261011174445 posted_source_idempotency_index`; security advisors 21 authenticated SECURITY DEFINER WARN, 3 private C8 RLS/no-policy INFO, 1 Auth leaked-password WARN. Warnings not treated as exploitable without detailed review.
505 +- PR #86 `qa/phase0-f005-selector-stress-20261012`: adds synthetic 1,208-product and 1,206-contact negative/positive browser regression + required CI gate; no product runtime, Supabase, credentials or financial mutation. Initial head `193b03ddcef33aa06f5dfc936d14626d875be7f7`: GitHub Quality run `38202818187`, static job `114659716442`, **83/83 real Chromium tests PASS (55.8s)** including both F0-05 cases; three disposable database jobs SUCCESS. Security run `38202818169`: CodeQL + release safety PASS; dependency review skipped due disabled graph. Measured interaction latencies now logged by revised test for next run.
506 +- Acceptance boundary: F0-05 **CONTROLLED_QA_PASSED**, not AUTHENTICATED_E2E_PASSED / RELEASED / OWNER_ACCEPTED. Actual owner network, tenant catalog, real printer, dual-role access and safe server invoice persistence remain independent Phase 0/1 gates. No claim that 260 chapters are implemented. Rollback: revert QA-only PR. Next: confirm revised-head CI; merge reviewed QA-only test if green; keep Phase 0 OPEN.
507 +
508 +
509 +### 2026-10-12 F0-05 final protected-main promotion — RELEASED QA GATE / PHASE 0 OPEN
510 +- Approved Phase 0 independent test-only PR **#86** merged by squash to protected `main` exact SHA `a3c7dac165d1c451c635546eecff47e0aaaf562e`; GitHub connector re-fetched `main` after merge and verified the SHA. Files: `scripts/phase0-selector-stress.spec.js`, `.github/workflows/quality.yml`, `docs/FINORA_PHASE0_BASELINE_2026-10-11.md`, `PROJECT_STATE.md`. No production UX/accounting code, schema, RLS, roles, auth or financial data changed. Existing PR #83 searchable/keyboard/F2 stays intact.
511 +- Revised PR head `31d577843440d712db14d1a41658dd2ed2c9a23f`: Quality `38203000078` SUCCESS including static `114660293763` **83/83 Playwright Chromium tests in 57.6 s**, product and person stress both PASS, all three disposable DB jobs SUCCESS; Security `38203000075` SUCCESS (CodeQL and release safety; Dependency Review skipped because Dependency Graph is not enabled). Browser-side synchronous input-to-filter times in the GitHub QA runner: **9.6 ms** (1,208 scoped products), **72.7 ms** (1,206 synthetic contacts via metadata search). These are samples on CI hardware, not an SLA or production-user measurement.
512 +- Same-SHA protected `main` `a3c7dac165d1c451c635546eecff47e0aaaf562e`: Quality **`38203171552` SUCCESS**, Security **`38203171658` SUCCESS**, Release gate **`38203282658` SUCCESS**, gated Pages **`38203309936` SUCCESS**. Duplicated Release `38203264704` cancelled and Pages `38203301879` skipped; neither counted as successful evidence. Deployment is verified at the GitHub Actions boundary, not owner-authenticated browser/runtime/ISP.
513 +- Classification: F0-05 **IMPLEMENTED / CONTROLLED_QA_PASSED / RELEASED regression coverage**. **AUTHENTICATED_E2E_PASSED and OWNER_ACCEPTED remain UNVERIFIED** for real account catalog, desktop performance and live tenant RLS; Phase 0 remains **OPEN** due to F0-01/F0-02/F0-03/F0-04 and the remaining cross-role/print/UI gates. Security advisor findings 21 SECURITY DEFINER, 3 C8 no-policy and disabled leaked-password protection remain review-only/open (no changes made).
514 +- This is a documentation-only closing note, no change to release assets or database behavior. Next safest action: continue remaining independent read-only Phase 0 checks, then perform legitimate owner-authenticated login/catalog/print smoke without credentials in chat; avoid production financial postings. Rollback of the regression/test slice is PR #86 revert if needed.
515 +
516 +
517 +## 2026-10-12 Phase 0 acceptance execution kickoff — OWNER REQUESTED / IN PROGRESS
518 +- **Instruction:** Owner explicitly requests beginning phase acceptance now ("تایید فاز رو استارت بزن"). This starts acceptance verification of approved **Phase 0**, **not** automatic acceptance or promotion of any later phase. Accountable owner: QA/Validation; coordinating manager handles integration.
519 +- **Verified baseline at initiation:** protected `main` SHA `601a5b7b066ce4cf7e68fad2abe642c3e846cdd3`; same-SHA GitHub Quality `38203575835`, Security `38203575840`, Release `38203689209`, gated Pages `38203706432` all SUCCESS. Supabase `hcsixhqbyuhpshfwqpjx` ACTIVE_HEALTHY. No claim of owner-authenticated production proof from these CI gates.
520 +- **Authorized bounded first slice:** inspect existing Phase 0 acceptance evidence; audit open historical PRs against current main **read-only** to prevent stale fixes; create a test/evidence-based acceptance register and categorize each F0-01..F0-08 as controlled-QA-only, awaiting real user session, or blocked. Read-only live HTTP/JS smoke if accessible; document and run any zero-mutation test suitable for available tools. Use reviewable documentation-only branch/PR, verify CI and update this ledger with final evidence.
521 +- **Not authorized / out of scope:** creating users, entering owner credentials, changing Auth/RLS/schema/roles, posting/reversing production ledger, destructive test data or financial history, merging stale PRs, paid services or declaring Phase 0/V1 accepted without authenticated owner checks and explicit acceptance.
522 +- **Currently known open gates:** `F0-01` affected-ISP sign-in, `F0-02` existing tenant product/contact lookup, `F0-03` real safe-scoped server persistence, `F0-04` actual saved-invoice PDF/print; `F0-05` synthetic 1,208/1,206 Chromium regression green and deployed, but owner-authenticated test unverified; `F0-06` full UI review, `F0-07` tenant/roles security, `F0-08` PR audit pending. **Phase 0 = OPEN / ACCEPTANCE CHECKS STARTED**.
523 +- **Exit:** concrete `docs/FINORA_PHASE0_ACCEPTANCE_REGISTER_2026-10-12.md`, verified open-PR disposition, linked CI/risks/blockers and explicit next safe action. Rollback: revert docs-only PR; no runtime or database rollback needed.
524 +
525 +
526 +### 2026-10-12 Phase 0 acceptance evidence + F0-08 first read-only audit — DOCUMENTED / NOT PHASE ACCEPTED
527 +- Branch `qa/phase0-acceptance-start-20261012` created from protected main `601a5b7b066ce4cf7e68fad2abe642c3e846cdd3`; after the owner request was recorded above, created `docs/FINORA_PHASE0_ACCEPTANCE_REGISTER_2026-10-12.md` containing the F0-01..F0-08 gate matrix and owner-safe smoke protocol. This is documentation and review evidence only.
528 +- Exact baseline GitHub Quality `38203575835` SUCCESS (static job `114662032710`: syntax 55 JS / 52 MJS, Golden accounting, **83/83 Chromium PASS** and 3 disposable DB jobs); Security `38203575840`, Release `38203689209`, Pages `38203706432` all SUCCESS. Remote Desktop Commander online; authorized device read-only PowerShell GET `factoreasy.ir` returned HTTP **200**, no authenticated business verification.
529 +- Supabase project `hcsixhqbyuhpshfwqpjx` healthy with 81 migrations (latest `20261011174445 posted_source_idempotency_index`); advisors 21 SECURITY DEFINER WARN / 3 private RLS-no-policy INFO / 1 leaked-password WARN, not proven vulnerabilities. Live phone-identity migration `20261007165208` has no corresponding archive file on current main; proposed migration file remains in stale PR #58. No database changes performed.
530 +- F0-08 first independent scan: **9** open GitHub PRs, all diverged from main. Preliminary buckets: old documentation probably superseded #28/#43/#49; UI inspection required #39/#40/#57; sensitive financial/identity manual review #6/#58/#80. None merged or closed; no user/security/finance changes. Owner-authenticated sign-in F0-01, real tenant search F0-02, real safe-scope invoice save F0-03, real printing F0-04, true access F0-07 remain NOT VERIFIED. F0-05 controlled product/person 1,200+ stress PASS but full real context open.
531 +- **Status:** acceptance started and register independently read back; PHASE 0 OPEN, NOT OWNER-ACCEPTED. Next: review acceptance documentation PR with exact-head CI; then collect approved existing-user login/catalog/print test evidence, addressing actual reproducible bugs before phase signoff. Rollback: docs-only PR revert.
532 +
533 +- **Additional Phase 0 live asset check:** On authorized remote PC, separate read-only HTTP GETs returned 200 for deployed `js/login-connectivity.js`, `js/ux-hardening-r2.js`, and `js/print.js`; this does not establish exact cache-version parity, real sign-in, tenant catalog, invoice data or printer acceptance. The acceptance register records this evidence. PR #88 initial head Quality `38211055354` and Security `38211055404` **SUCCESS**; later head must rerun gates after this documentation update. No runtime/DB/auth/financial changes.
534 +
535 +
536 +### 2026-10-12 Phase 0 acceptance register — protected-main promotion verified / PHASE 0 OPEN
537 +- Owner acceptance kickoff documented and reviewed in PR **#88** (`docs/FINORA_PHASE0_ACCEPTANCE_REGISTER_2026-10-12.md` plus append-only `PROJECT_STATE.md`); PR Quality `38211223226` SUCCESS and Security `38211223103` SUCCESS, including three disposable DB jobs and real Chromium regression suite. Squash merged to protected `main` at SHA **`5c2a5bf263f7a3bfe5a6b2e99cba5c8e5443db04`**. Neither the product runtime nor production Supabase was modified in this docs-only change.
538 +- **All protected-main gates on this exact SHA:** Quality `38211377516` SUCCESS, Security `38211377395` SUCCESS, Release gate `38211501537` SUCCESS, gated Pages `38211523493` SUCCESS. Duplicate Release `38211497461` cancelled and Pages `38211511555` skipped; these duplicates were **not** counted as passing.
539 +- Confirmed persistent `main` acceptance register read back, with F0-01..F0-08 status matrix, nine old PR dispositions, Supabase migration/security-advisor read-only evidence and no unauthorized mutation. Remote read-only HTTP smoke confirmed `factoreasy.ir` plus `js/login-connectivity.js`, `js/ux-hardening-r2.js`, `js/print.js` HTTP 200 from authorized device. No user-authenticated login, real tenant query, true server invoice save, actual printer, dual-account RLS or precise served asset-version parity is claimed.
540 +- **Current decision:** PHASE 0 ACCEPTANCE STARTED / **NOT OWNER-ACCEPTED**. Continue F0-01 owner-ISP login first, F0-02 live catalog/person search, F0-04 print-existing-invoice visual check, then separately authorized isolated safe F0-03 write/read and F0-07 second-account permission proof. F0-05 stress controlled test passed but live tenant acceptance open; F0-06 UI visual review and F0-08 old PR final disposition remain. No code, schema, role, auth, finance or account changes allowed by this docs-only checkpoint. Rollback: revert PR #88 (or the acceptance documentation slice only).
541 +
542 +
543 +## 2026-10-12 Phase 0 F0-04 owner screenshot: remove draft watermark from printed invoices — FIX REQUESTED / IN PROGRESS
544 +- **Owner direction:** The attached photograph of an actual printed sale-goods/services invoice shows a pale diagonal header overlay `پیش‌نویس — غیرقطعی`. Remove that overlay from all ordinary invoice printouts (formal, informal, pro-forma, purchase where applicable), without interrupting ongoing Phase 0 acceptance. The owner requests a clean full invoice layout independent of document draft status.
545 +- **Baseline:** protected `main` `5c2a5bf263f7a3bfe5a6b2e99cba5c8e5443db04`; Phase 0 acceptance register from merged PR #88 is present. Investigation isolated overlay to `js/print.js` `renderAndPrintDirect` lines building `draftMark` and prepending it to `stageInvoicePrint`. Print-preview isolated frame and printable container both use that string. Taxpayer/electronic document printing has a separate explicit post/finalization check and remains unchanged.
546 +- **Accountable:** implementation/print with independent QA. **Narrow authorized scope:** remove display watermark only; add browser regression asserting clean formal draft and a pro-forma/non-formal printed page still contains all invoice content, amounts, and unchanged financial draft status. Preserve `invoiceDocumentStatus` / posting gate, electronic taxpayer safeguards, numeric formatting, pagination, dimensions, signature areas, invoice saving/editing and report status. Change `index.html` print asset cache key to force deployment refresh. Add regression to existing Quality suite, PR gates and gated deployment verification.
547 +- **Forbidden:** changing stored draft/posted status, auto-posting, RLS/Auth/schema/roles, financial data, Supabase, legal/tax declarations, closing Phase 0 by inference. Recheck with owner's real printed invoice remains separate F0-04 authenticated acceptance gate. Revert the targeted PR for rollback if necessary.
548 +- **State:** REPRODUCED IN SOURCE / IMPLEMENTATION STARTING. Phase 0 acceptance stays OPEN.
549 +
550 +
551 +### 2026-10-12 F0-04 owner photo → fixed print → gated live release — PHASE 0 STILL OPEN
552 +- Owner supplied real photograph of an ordinary sales/goods-services invoice stamped by a pale `پیش‌نویس — غیرقطعی` header watermark; requested its removal across ordinary invoice variants **before continuing Phase 0 acceptance**. Confirmed `js/print.js` `renderAndPrintDirect` injected `draftMark`, irrespective of invoice content; the purchase-specific popup already had no watermark.
553 +- **Fix delivered:** PR [#90](https://github.com/davoodmehraban89/Factor-easy/pull/90), squash merged to protected `main` exact SHA **`8a0023c53f0c14b0063ab771fdb3669a05997387`**. Ordinary invoice print now uses clean complete `stageInvoicePrint(containerHtml,spec)`. Cache-busted `js/print.js?v=20261012-clean-invoice-print-v1`. No changes to draft/posted state, financial postings, taxpayer explicit finalization rule, data, Auth, RLS, schema, roles or money formatting. Revert PR #90 and redeploy for rollback if needed.
554 +- **Independent controlled regression:** corrected PR head `72a69b372ef59ffbb7dddebf81d64304b3559b04` Quality `38212287209` SUCCESS (83/83 real Chromium, includes *formal draft* preview+isolated iframe without watermark, subtotal/number retained, draft state and zero vouchers, pro-forma print; Golden financial invariants and 3 disposable DB jobs PASS); Security `38212287223` SUCCESS. Initial static CI failed because its historic assertion **required** the old watermark; intentionally inverted to disallow watermark without relaxing posting safeguards, then retested green.
555 +- **Same merged-main SHA production gate:** Quality **`38212519911`**, Security **`38212519908`**, Release **`38212644579`**, gated Pages **`38212680498`** all SUCCESS. Skipped/cancelled concurrent duplicates not counted. On connected authorized remote Windows device, real domain HTML references exact `20261012-clean-invoice-print-v1` bundle; fetched live JavaScript has `stageInvoicePrint(containerHtml,spec)` and **no `draftMark`**. No owner login, actual tenant invoice or physical printer test made.
556 +- **Acceptance status:** F0-04 **FIX RELEASED / CONTROLLED QA PASS / LIVE BUNDLE VERIFIED**, but **OWNER-AUTHENTICATED REPRINT STILL OPEN**. Phase 0 as a whole remains OPEN; F0-01 affected-ISP login, F0-02 real tenant lookup, F0-03 safe-scoped actual Supabase persistence, F0-06 broader UI, F0-07 role isolation and F0-08 old PR final disposal retain their previous gates. Next: owner reprints same existing invoice with browser hard refresh and confirms no watermark/unchanged totals; continue remaining Phase 0 read-only checks without waiting to build new modules.
557 +
558 +
559 +## 2026-10-12 Phase 0 F0-06 follow-up — owner-directed continuation / DARK-MODE READABILITY SLICE STARTED
560 +- **Latest instruction:** Continue completing the approved Finora phases. Do not promote Phase 0 until real-owner authentication/catalog/save/print and permission acceptance are actually passed. Source canonical protected main at kickoff `9e9e35cd96d294e6f6ad875a45de94a1f968e5d8`, after print fix #90 and its docs evidence #91. GitHub exact-head Quality `38213083866`, Security `38213083815`, Release `38213219253`, Pages `38213261477` all SUCCESS. Supabase `hcsixhqbyuhpshfwqpjx` ACTIVE_HEALTHY, 81 migrations (latest `20261011174445 posted_source_idempotency_index`).
561 +- **Independent safe work chosen:** `F0-06` — verify and correct dark-mode readability (buttons/panels, inputs, typography and organizational shell surfaces) based on current runtime and stale unmerged contrast PR #57 as reference, **without merging old PR** or altering shell scroll geometry, invoice business rules, underlying data, or database. `js/ux-hardening-r2.js` currently sets dark root colors yet leaves `.accordion-item` white and `.btn-secondary` pale background inheriting light foreground; potential contrast mismatch to be independently tested with Chromium computed colors. UX owns targeted visual contract, QA owns browser contrast assertions.
562 +- **Bounded implementation:** add controlled Playwright dark-mode contrast/restore regression to required Quality suite, verify before/after computed color contrast (WCAG normal-text 4.5:1 where appropriate); change theme styles only if failure reproduced; bump `index.html` bundle version; run static/GitHub Quality+Security, merge reviewed PR and verify exact protected-main release. Protect ordinary light theme and previously published printable invoice. No real tenant/browser, physical device screenshot, or owner visual acceptance is implied by controlled tests.
563 +- **Restrictions:** no Auth/RLS/roles/schema, production financial data/postings, migration, financial cutoff, account creation, external costs, or unreviewed #57/#39/#40 merges. Rollback: targeted PR revert and Pages gated redeploy. **Phase 0 remains OPEN** for F0-01/02/03/04/07 and owner F0-06 UI review.
564 +- **Status:** SPECIFIED / REGRESSION AND SOURCE REVIEW IN PROGRESS.
565 +
566 +
567 +### 2026-10-12 F0-06 dark-mode contrast targeted fix — PR QA PASSED / REAL OWNER VISUAL OPEN
568 +- **Reproduced from source:** `js/ux-hardening-r2.js` original dark class set light `--text` but left `.accordion-item` white, `.btn-secondary` pale, and `.module-panel` white, risking unreadable text and non-dark shell; old unmerged PR #57 was reviewed as design reference but **not merged**. No structural sidebar/nav/scroll changes made.
569 +- **Implemented in independent branch `qa/phase0-f006-dark-contrast-20261012`:** dark CSS overrides for card/accordion, secondary controls, form input/placeholder and disabled controls, table, combobox and module shell surfaces; retained light mode. `index.html` references `js/ux-hardening-r2.js?v=20261012-phase0-dark-contrast-v1`. Mandatory Quality includes `scripts/phase0-dark-theme-contrast.spec.js` with two real Chromium assertions (4.5:1 normal text contrast for dark accordion/button/input/shell and healthy return to light theme). `scripts/ux-hardening-r2-check.mjs` version and invariants updated; no finance, account, Auth, RLS, roles, schema, SQL or runtime navigation geometry change.
570 +- **Verification:** Initial PR static-quality attempt `38217822837` failed because an existing static contract still expected `20261011-combo-keyboard-f2-v5` bundle; fixed that contract without bypassing a test, then retested branch head `176b5e42f4a26266b61c7dcd75df2803b315f695`. Final tested head Quality **`38217926742` SUCCESS** (static job `114706936848`, **85/85 Playwright Chromium PASS, 52.2s**, both F0-06 tests passing; JS syntax 55 modules/52 MJS, Golden accounting, draft/posted invariants and three disposable database jobs PASS). Security **`38217926669` SUCCESS**, CodeQL and release safety; dependency review skipped (graph disabled).
571 +- **Acceptance classification:** Targeted theme contrast = **IMPLEMENTED + CONTROLLED_QA_PASSED** on branch. Owner-authenticated visual/browser acceptance of full F0-06 (RTL wheel/scroll, dark/light screens, all save/delete/import/export) is **NOT VERIFIED**; Phase 0 remains **OPEN**, all F0-01/02/03/04/07 gates unchanged. Next: finalize documentation-only branch updates, retest exact PR head, merge if gated, verify exact protected-main Quality/Security/Release/Pages + actual published JS version; do **not** call F0-06 or Phase 0 fully owner-accepted. Rollback targeted PR and gated redeploy.
572 +
573 +
574 +### 2026-10-12 F0-06 dark-mode contrast — PROTECTED MAIN GATES & DEPLOYED / PHASE 0 OPEN
575 +- Owner's ongoing approved Phase 0 development continued as F0-06 isolated dark-theme usability slice. Legacy PR #57 was reviewed but **not merged**. Targeted PR **#92** implemented dark text/surface contrast for accounting panels, inputs, buttons, dropdowns and existing organizational shell, preserving light mode, shell geometry and underlying financial/data semantics. Source: `js/ux-hardening-r2.js` with cache key `20261012-phase0-dark-contrast-v1`, `scripts/phase0-dark-theme-contrast.spec.js`, static asset identity check and Quality workflow. Controlled browser checks use 4.5:1 normal-text contrast and confirm return to light mode.
576 +- Branch QA final head `59e396a17ec3bfd2a2baca50384248f741a981c2`: Quality `38218215989` **SUCCESS** (85/85 Chromium including two F0-06 tests, 3 disposable DB jobs, Golden accounting), Security `38218215992` **SUCCESS**. First version check `38217822837` failed because the old static contract hardcoded the previous asset key; that control was updated and clean tests repeated, not bypassed.
577 +- PR #92 merged by squash to protected `main` exact SHA **`745bdc847a3c2db22048d1d545da0fad0ae5cc67`**. On that SAME SHA: Quality **`38218505600` SUCCESS**, static job `114708817767` Chromium **85/85 PASS (51.1s)** + Golden/draft-posted safety and three disposable DB jobs; Security **`38218505535` SUCCESS**, Release gate **`38218679192` SUCCESS**, gated Pages **`38218725537` SUCCESS**. Concurrent duplicate Release `38218648536` CANCELLED and Pages `38218713325` SKIPPED, neither counted as success.
578 +- Independent read-only remote proof: authorized Windows desktop `DESKTOP-71SJ63M` GET to `https://factoreasy.ir/?phase0dark=20261012` includes `20261012-phase0-dark-contrast-v1` (**True**); fetched live `js/ux-hardening-r2.js?v=20261012-phase0-dark-contrast-v1` contains dark shell and secondary-button selectors (**True / True**). This proves deployed asset parity, **not** customer-authenticated visual experience.
579 +- **Acceptance:** F0-06 targeted contrast **RELEASED / CONTROLLED-QA-PASSED**; broader modal/RTL keyboard/import/export/dark-light owner UI and physical-device acceptance remains **UNVERIFIED**. F0-01/02/03/04/07 and F0-08 outstanding gates remain; **PHASE 0 OPEN / NOT OWNER ACCEPTED**. No customer data, ledger, Auth, RLS, roles, schema, Supabase migration, financial posting or paid-service changes. Rollback: revert PR #92, run gated Pages deploy, refresh cached bundle.
580 +
581 +
582 +## 2026-10-12 F0-01/F0-07 admin provisioning 400 — OWNER REPORTED / ROOT CAUSE VERIFIED / FIX STARTED
583 +- **Owner request:** Screenshot of real Central Admin > New User form reporting `Edge Function returned a non-2xx status code` despite fields entered; fix the issue *before* resuming Phase 0 work. Do **not** record name, email, password, tokens, IP or request metadata from owner screenshot in project logs. Do not create a live user or change an existing password during diagnosis.
584 +- **Verified live source evidence:** protected `main` `487471fe9154ff7b94fab56335ffeb000494c72a`; live Supabase project `hcsixhqbyuhpshfwqpjx`, Edge `admin-user-management` ACTIVE v3 with `verify_jwt=true`. Request log on 2026-10-12 07:13:44Z: authenticated POST to Edge returned HTTP 400; corresponding Auth Admin `/auth/v1/admin/users` returned HTTP 500, with Auth error `ERROR: organization license not found (SQLSTATE 23503)` / `unexpected_failure`. These are exact live logs, **not** guessed password, email, network or unauthorized-role failure.
585 +- **Root cause:** live `public.handle_new_user()` inserts `public.organization_members` active owner BEFORE `public.licenses`; `private.enforce_organization_member_seat()` BEFORE INSERT requires license row and raises SQLSTATE 23503 if absent. Existing migrations lack the function's post-phone-identity live definition in main. Transaction fails during Auth user creation and rolls back. Actual constraints reviewed: licenses FK to profile/organization only, no membership FK; license-first ordering is valid and satisfies unmodified seat trigger.
586 +- **Bounded intended correction:** add reviewed, idempotent one-function migration to reorder fresh-user bootstrap as `profiles → organizations → licenses → owner membership`, preserving all current live email/phone signup support, default `role='user'`, trial entitlements, security-definer fixed search_path and seat enforcement. Reproduce 23503 in disposable PostgreSQL fixture, then verify successful bootstrap and existing seat-limit rejection. Add safe UI parsing of Edge structured error codes and regression test so admin form no longer displays opaque non-2xx errors. Run static/Chromium, disposable DB, Security; gate on exact SHA. Production migration only after independent tests and confirmed source/version equivalence; no changes to existing user/license rows, RLS, Auth JWT verification, or financial data. Rollback: approved previous function definition (do not mutate accounts/data). No live account creation without separately approved isolated identity.
587 +- **Dependent continuation:** PR #92 dark-mode work already merged into latest main; verify its exact protected-main gates before further F0-06 work. Phase 0 remains OPEN; do not claim owner E2E pass from synthetic tests or read-only diagnostics.
588 +- **Current status:** ROOT_CAUSE_VERIFIED / REPRODUCE_AND_FIX_IN_PROGRESS.
589 +
590 +
591 +### 2026-10-12 F0-07 admin new-user provisioning — ROOT CAUSE FIXED IN PRODUCTION / PHASE 0 OPEN
592 +- **Verified incident:** Owner's central administrator create-user request at 2026-10-12 07:13:44 UTC reached live Edge `admin-user-management` v3 (JWT verification enabled) and returned HTTP 400. Supabase Auth logs show underlying admin-user POST HTTP 500 `unexpected_failure` caused by PostgreSQL `organization license not found` (SQLSTATE 23503). No evidence this was bad internet or an invalid user-input password. Avoid reproducing the owner's personal details in logs.
593 +- **Root cause independently confirmed:** Live `public.handle_new_user()` inserted owner into `organization_members` before creating trial `licenses`; existing BEFORE INSERT `private.enforce_organization_member_seat()` correctly rejected membership lacking a license. No existing account or license required repair. The guard remains enabled and unchanged.
594 +- **Fix implemented in PR [#94](https://github.com/davoodmehraban89/Factor-easy/pull/94), merged to protected main SHA `e664e8fdbc77b660dfc1fedff580b206279899f3`:** new `supabase/migrations/20261012080000_fix_identity_bootstrap_license_before_membership.sql` preserves actual email/phone support and ordinary role, reorders new-user bootstrap to `profiles → organizations → trial license → owner membership`. No existing rows/permissions/role/RLS/Auth JWT behavior changed. `js/admin.js` safely renders localized structured server error rather than opaque `Edge Function returned a non-2xx status code`; cache-busted `admin.js?v=20261012-provision-error-v1`, password cleared after submit. No sensitive request/response bodies leaked.
595 +- **Independent disposable verification:** identity PostgreSQL job `114713267003` first **reproduced original 23503**, then applied proposed fix and confirmed owner trial + ordinary role, **second active user blocked** by unmodified seat-limit trigger, phone-only identity support preserved; three disposable DB jobs PASS. PR Quality `38219871219` **86/86 Chromium PASS** (includes real browser Persian failure display) and Golden accounting/security invariants; PR Security `38219871204` PASS.
596 +- **Same-main-SHA verification:** Quality `38220163720` SUCCESS, Security `38220163569` SUCCESS, Release `38220396895` SUCCESS, gated Pages `38220451051` SUCCESS; duplicate release canceled/skipped not counted. Migration applied through Supabase as **`20261012075507 fix_identity_bootstrap_license_before_membership`**; 82 migrations. Read-only function catalog verifies new 4-step order, original seat trigger count 1, ordinary `'user'` profile, phone support, function ACL `postgres,service_role` execute only. Deployed domain HTML references new versioned admin JS and served bundle contains safe error mapper (remote PC read-only HTTP). No test or real user was created in production; no existing financial postings or Auth account credentials were touched.
597 +- **Parallel Phase 0 continuity:** previously delivered F0-06 dark/light contrast #92, exact-main Quality `38218505600` 85/85, Security `38218505535`, Release `38218679192`, Pages `38218725537` SUCCESS; actual deployed `20261012-phase0-dark-contrast-v1` version confirmed on real domain. F0-06 **targeted controlled QA/release PASS** but owner full visual acceptance OPEN. Also F0-04 watermark print #90 released but owner reprint unverified.
598 +- **Current acceptance:** admin provision blocking defect **FIX_RELEASED / SOURCE+CI+MIGRATION VERIFIED**, actual authenticated admin create/retry **NOT OWNER-VERIFIED**. Owner should first check central users list to avoid duplicate, refresh and retry once with authorized personal identity, then verify ordinary role and trial; NEVER send passwords/tokens in chat. F0-01 affected ISP login, F0-02 tenant catalog, F0-03 safe real server invoice, F0-04 owner physical print, F0-05 real 1200+ catalog, F0-06 all visual controls, F0-07 dual-account RLS, F0-08 final stale PR disposition remain pending. **PHASE 0 IS STILL OPEN.**
599 +- **Rollback:** restore reviewed prior `handle_new_user()` definition in a new controlled migration (but this reintroduces recorded incident; do not undo automatically). Frontend rollback via PR #94 revert/gated Pages. No data rollback necessary. Next independent safe slice: F0-08 stale PR read-only evidence or F0-06 additional visual QA; actual owner E2E tests require an authorized session and controlled scope.
600 +
601 +
602 +- **F0-06 QA suite follow-up (no runtime change):** Documentation PR #95 initial Quality run `38220841194` failed **1/86** in the existing F0-06 light-mode contrast test at `button.contrast=1.56`; Security `38220841248` PASS and all three disposable DB jobs PASS. The isolated test toggled the body class and sampled immediately while the actual `.btn` CSS has a 200ms background-color transition; delayed `finoraApplyTheme` boot can also override the manually toggled class. Patched the fixture to hold the requested theme stable using a test-only `getMySettings` wrapper, use the actual `finoraApplyTheme()` transition, and poll for steady-state light-button contrast >=4.5 before asserting other surfaces. This does **not** waive the contrast threshold or alter live application CSS. Retest entire workflow on final PR head; do not merge on a red CI.
603 +
604 +
605 +## 2026-10-12 Phase 0 F0-08 stale PR disposition — OWNER CONTINUATION / IN PROGRESS
606 +- **Instruction:** Owner requested to advance the approved Phase 0. Accountable: Coordination + QA. Baseline protected main `4595dafcb98185984894faacb97244cec2aa55e4`, last release PR #95 accepted and published. Owner-authenticated F0-01/02/03/04/07 and broad F0-06 remain open; we must not claim phase closure.
607 +- **Selected independent safe scope:** complete `F0-08` disposition of 9 stale open PRs, preserving finance/identity/scroll issues pending separate verification. Re-read current main, inspect each historical diff, pin Supabase migration evidence read-only, correct obsolete historical status documents, then document rationale before any reversible PR closure. Do not merge stale changes, mutate live DB/Auth/RLS/roles, create accounts, change accounting, disclose secrets or reinterpret production migrations as live end-to-end acceptance.
608 +- **Initial finding:** Old PR #28 proposed correcting `docs/REQUEST_WORKFLOW_WAVE4B_VERIFICATION.md` to 'merged CI green / production migration NOT APPLIED'. However **live Supabase currently records** `20261002072526 request_wave4b_scheduler_outbox_delivery`, so blindly cherry-picking #28 would preserve a false production-not-applied claim. Current main document still says 'IMPLEMENTED ON BRANCH / CI PENDING' and requires reconciliation distinguishing *migration recorded* from *full D4c delivery consumers verified*. Audit rest of document and archive precise sources.
609 +- **Candidate superseded PRs to independently confirm:** #28 (Wave4b documentation), #43 (heartbeat already in AGENTS), #49 (outdated live status), #57 (dark contrast delivered by #92), #80 (admin provisioning delivered by #84/#94). Retain #6 (financial), #39/#40 (RTL scroll physical behavior), #58 (multi-change identity/migration archive drift) pending evidence. No partial/automated merging. Classification may change on inspection.
610 +- **Done criteria:** reconciliation doc and PROJECT_STATE change pass Quality/Security PR gates, merge to main, optionally close only fully superseded historical PRs with reference to surviving content and audit decision, verify post-merge CI. Exit F0-08 = disposition recorded, not blanket functional acceptance. Rollback: revert docs-only changes or reopen closed PRs, no DB or finance rollback.
611 +
612 +
613 +### 2026-10-12 F0-08 nine historical PR source audit — VERIFIED READ-ONLY / DOC PR GATES NEXT
614 +- Reconciled PR #6/#28/#39/#40/#43/#49/#57/#58/#80 against protected main `4595dafcb98185984894faacb97244cec2aa55e4`. Read changed filenames, relevant patches and current main. Detailed disposition and explicit risk boundaries in `docs/FINORA_PHASE0_F008_PR_RECONCILIATION_2026-10-12.md`.
615 +- **Important stale-fact correction:** current main `docs/REQUEST_WORKFLOW_WAVE4B_VERIFICATION.md` said `IMPLEMENTED ON BRANCH / CI PENDING`. Historical PR #28 described CI/merged PR #27 but said production migration NOT APPLIED. Independently read 82 Supabase migration rows and confirmed `20261002072526 request_wave4b_scheduler_outbox_delivery` **present**, and read-only pg_proc catalog confirms scheduler/outbox public/private RPCs; the original SQL explicitly says **D4c destination consumers remain disabled**. Corrected current main doc with merged historical CI, live migration presence and unverified real destination delivery, not blindly cherry-picking stale PR #28.
616 +- **Superseded candidates:** #28 historical QA docs (useful evidence now ported with current correction), #43 heartbeat already represented by AGENTS, #49 stale operating snapshot, #57 dark UX delivered better by #92/#95, #80 admin creation already delivered by #84/#94 with production identity bootstrap fix. Close only after this documentation PR is merged and read back; closures retain history and can be reopened. **Retain OPEN** #6 financial posted history; #39/#40 physical RTL wheel/scroll geometry; #58 phone-identity migration archive drift and privileged Auth/SMS issues.
617 +- F0-08 = **PRELIMINARY SOURCE RECONCILED**, final disposition depends on exact-head Quality/Security, merged doc and individually verified closure outcomes. Main runtime code unchanged by this slice; no customer data, ledger, DB, schema/RLS/Auth/roles, edge deployments or production scheduler dispatch mutated. **PHASE 0 OPEN** regardless of F0-08.
618 +
619 +
620 +### 2026-10-12 F0-08 historical PR dispositions — VERIFIED / FIVE CLOSED / FOUR AUDIT BLOCKERS OPEN
621 +- Follow-through on owner's instruction to advance Phase 0: PR [#96](https://github.com/davoodmehraban89/Factor-easy/pull/96) reconciled current source and nine historical open PRs, corrected `docs/REQUEST_WORKFLOW_WAVE4B_VERIFICATION.md` from obsolete "CI pending" to *historical merged CI / current production migration recorded / D4c external consumers NOT VERIFIED*. Read-only Supabase has 82 migrations, including `20261002072526 request_wave4b_scheduler_outbox_delivery`, and live scheduler/outbox RPCs exist. This does **not** certify real scheduler runs/deliveries.
622 +- PR #96 head `08afd9f69ca7af4408b0c5e6ba5c8a31a40adcd2` Quality `38223670528` SUCCESS (static job `114725807951`, **86/86 Playwright PASS**, 3 isolated DB tests + Golden/draft-posted PASS), Security `38223670565` SUCCESS. Docs merged as protected main `2a4d637d0145f333412fbce0e299ab6962f0b262`.
623 +- **PR closure verified in live GitHub:** old #28 (comment 6120641718), #43 (6120644468), #49 (6120646995), #57 (6120649594), #80 (6120652469) all **CLOSED / UNMERGED**, with evidence comment and reversible history. **Exactly four old PRs remain OPEN: #6 finance core, #39/#40 competing physical RTL scroll, #58 privileged identity/phone migration archive drift**. These are deliberate specialist hold items, no authorization to merge old code. Detailed evidence in `docs/FINORA_PHASE0_F008_PR_RECONCILIATION_2026-10-12.md`.
624 +- **F0-08 acceptance:** historical PR register and safe dispositions **COMPLETE/READ-ONLY-RECONCILED**. This is distinct from **PHASE 0 OWNER ACCEPTANCE (STILL OPEN)**: affected ISP login F0-01, real tenant catalog F0-02, isolated real server save F0-03, owner saved-invoice print F0-04, live 1,200+ selector F0-05, full modal/RTL UI F0-06, actual admin retry / two-user RLS F0-07 are not all verified.
625 +- **Changes and rollback:** F0-08 docs and nonmerged PR closure only; no runtime changes, customer accounts, production Supabase schema/data, migrations, invoices/posted ledger, roles/RLS/Auth, secret handling or fee. Docs revert and old PR reopen if later evidence requires. Next authorized task: plan owner-real F0-01/02/04 acceptance from existing browser; separately review #58 migration archive parity read-only without schema writes.
626 +
627 +
628 +## 2026-10-12 Owner Phase 0 continuation — F0-05 account/project/contract selector large-list QA
629 +- **User instruction:** «ادامه بده» — continue verified Phase 0 execution. Baseline latest protected main `c45d849a138370b89e9f251757f229f6b8fa55d8` after PR #97, with Phase 0 OPEN and F0-08 nine-PR audit completed; #6/#39/#40/#58 remain specialist holds. F0-05 currently checks **1,208 products and 1,206 contacts** in synthetic Chromium only; account, project and contract high-volume selectors have no 1,200+ browser coverage. Account journal select `.je-account` is intentionally excluded from general combobox and is NOT a target of this test.
630 +- **Selected independent safe slice (QA/Implementation):** extend `scripts/phase0-selector-stress.spec.js` with controlled tenant-scoped **1,200+** account rules selector (`#af-rule-account`), project selector (`#invoice-project-id`) and generic contract selector using real `finoraRefreshSearchableSelect` from `js/ux-hardening-r2.js`. Include keyboard Enter/Escape/End, Persian label/code/metadata filtering, no-match, no cross-tenant fixture option and explicit no `saveDatastore` / `jePostSourceRecord` / side-effect. Measure synchronous filter cost and use existing **5000ms safety ceiling**, NOT a production hardware SLA. Assert each selected value and no implicit writes.
631 +- **Safeguards:** This is a synthetic DOM fixture with tenant-scoped option construction, NOT a production RLS/security isolation test; do not change runtime UI, auth, accounts, RLS, schema, Supabase, financial posting, user data or invoicing. Keep F0-01..04/07 and physical owner acceptance open. Add only the independent tests to the existing Quality Playwright suite, verify Chromium/Golden/3 disposable DB/Security then gate PR merge and protected-main deployment. Rollback: revert QA-only PR; no data or permissions rollback needed.
632 +- **Accountable:** QA/Verification. **Status:** SCOPE RECORDED / CODE PENDING.
633 +
634 +
635 +### 2026-10-12 F0-05 account/project/contract high-volume selector — CONTROLLED QA PASS / OWNER GATE OPEN
636 +- Branch `qa/phase0-f005-account-project-contract-stress-20261012` extends existing F0-05 synthetic Playwright with **1,206** tenant-scoped entries each for accounting-rule `#af-rule-account`, invoice `#invoice-project-id` and representative generic contract select; using existing `finoraRefreshSearchableSelect` (no runtime changes), metadata/code search, Persian labels, Enter/End/Escape, no-results, excludes foreign-tenant fixture options, checks selected IDs, zero `saveDatastore` and zero accounting post. The journal-special `.je-account` path is excluded by runtime design and **not** tested by this generic selector fixture.
637 +- Exact first-tested PR #98 head `99be1b33ea6b8792f1be85e82a08367352bae223`: Quality **`38225392045` SUCCESS**, static job `114731529004`: **87/87 Chromium PASS (59.7s)** (prior 86 + new F0-05), Golden accounting and draft/posted safety PASS, three disposable PostgreSQL jobs PASS. Security **`38225392014` SUCCESS** (CodeQL/release safety; dependency review skipped when graph disabled). Synchronous filter samples in Chromium CI: **account 108.5ms; project 107.6ms; contract 113.4ms**, under existing 5000ms *safety ceiling*, **not** a performance SLA. No network/client production data in test.
638 +- Acceptance register F0-05 updated to **CONTROLLED-QA-PASSED for products, people, account rule, project and generic contract 1200+ lists**, while authorized tenant/real workstation performance, account-journal `.je-account` and true backend RLS remain **UNVERIFIED**. Full **PHASE 0 OPEN / NOT OWNER ACCEPTED**; no finance, Supabase, Auth/RLS/roles/schema or production data changes.
639 +- Next: check final PR head Quality/Security, merge only if green, verify protected-main Quality/Security/Release/Pages, append final exact-SHA release evidence if available. Rollback QA-only PR; no data rollback.
640 +
641 +
642 +### 2026-10-12 F0-05 account/project/contract selector extension — RELEASED QA GATE / PHASE 0 OPEN
643 +- Owner directed Phase 0 continuation. QA-only [PR #98](https://github.com/davoodmehraban89/Factor-easy/pull/98) extends controlled F0-05 regression to **1,206** tenant-scoped synthetic options each for account-rule, invoice project and generic contract selector, alongside prior 1,208 product and 1,206 contact tests. Tests cover Persian/name/code/floating-code, keyboard Enter/End/Escape, absence/no-match and zero invoice save/ledger posting. This tests the actual existing combobox implementation with synthetic options, **not real Supabase RLS, real company catalogs or accounting journal .je-account selector**.
644 +- Final PR head `dfc4b21d4e7392d188acfc86b6bc2d7cf8394e3c`: Quality **`38225738789` SUCCESS**, static job `114733039452` **87/87 Chromium PASS (59.2s)**; Golden sale/receipt/purchase/payment/expense/reversal/trial/financial reports PASS; draft/posted safety PASS; three disposable DB jobs SUCCESS. Security `38225738773` SUCCESS. Real Chromium CI observed **107.4ms account, 106.3ms project, 112.5ms contract** synthetic filter latency (sample only, 5-second safety cap, NOT a contractual SLA).
645 +- PR #98 squash merged to protected `main` exact SHA **`20cca7e4cf5a411022a30929a513b7cdf2d53779`**. Independent exact-main Quality **`38226518516` SUCCESS**, Security **`38226518662` SUCCESS**, Release Gate **`38226697531` SUCCESS**, gated Pages **`38226717496` SUCCESS**. Duplicate Release `38226696979` cancelled / Pages `38226704861` skipped, correctly not counted.
646 +- **Acceptance state:** F0-05 enlarged **CONTROLLED_QA_PASSED / RELEASED QA GATE**; owner actual-workstation/catalog and journal-account-specific high-volume test **NOT OWNER_VERIFIED**, whole **PHASE 0 OPEN**. F0-01/02/03/04/07 real authorization and live data gates remain open; F0-08 historic PR audit complete and four specialist PRs held. Zero runtime application files changed in PR #98; no Auth/RLS/schema/migrations/production financial or identity data altered. Rollback test-only PR; no customer data rollback required. Next: owner browser/safe-invoice acceptance or separately bounded read-only #58 migration-drift audit; do not begin Phase 1 signoff prematurely.
647 +
648 +
649 +## 2026-10-12 Owner-reported Finora slow startup / Phase 0 loading performance — IN PROGRESS
650 +- **Owner request:** Live Finora takes unacceptably long to open and become usable. Diagnose real startup critical path, implement bounded performance fix, independently QA/ship; continue approved Phase 0 without declaring unfinished user-authenticated gates accepted.
651 +- **Baseline:** protected main `61cbcf3113c598022d6877e447bf8c97b4788a19`. Read AGENTS and complete PROJECT_STATE, `index.html`, `js/bootstrap.js`, `js/core.js` and `js/sync.js`. Current index declares approximately 40 non-deferred app script tags and an **external parser-blocking SheetJS CDN bundle** and external Vazirmatn CSS; `js/bootstrap.js` on DOMContentLoaded **awaits 14 script insertions sequentially** before calling `initAuthSystem()`, so network round trips delay both login panel and session restoration. For logged-in users `enterApp()` additionally awaits `fetchCurrentUser()` and **sequential paginated `pullAll()` of every collection** before rendering; not authorized to change that financial data/consistency path without separate tests.
652 +- **Bounded fix:** preserve exact extension order and Auth timing dependency, use ordered **parallel download** for dynamic extension scripts through `script.async=false` before append, await all settled only after ordered execution, and make optional Excel CDN non-parser-blocking (without breaking export/import or replacing it). Capture read-only site/CDN response timings where available. Add deterministic real Chromium startup network test simulating high-latency extension downloads, proving serial-vs-parallel critical path, exact dependency order, once-only Auth after all scripts and graceful error under blocked CDN. Ensure no actual account/tenant data is read, no altered Auth/RLS/roles, schema/ledger, no test account creation, no unapproved data migration.
653 +- **QA and release:** preserve fallback if an extension asset fails, maintain existing Quality/Golden/Playwright and Security gates, merge reviewed PR only with verified checks, confirm protected-main CI and published assets. Capture cold-start comparative behavior with synthetic throttled requests; no claim of owner ISP metric without actual owner-machine browser timings.
654 +- **Owner-visible progress:** Phase 0 OPEN. F0-01 affected-ISP sign-in, F0-02 real tenant catalog, F0-03 safe persistence, F0-04 physical print, F0-07 two-user access checks remain unverified; do not mark them passed. Rollback: revert this narrowly scoped PR and gated Pages redeploy, no data rollback.
655 +
656 +
657 +### 2026-10-12 Phase 0 startup speed correction — PR controlled browser QA PASS / PRODUCTION RELEASE PENDING
658 +- Investigated owner-reported cold-start delay from actual protected-main sources and authorized remote read-only Windows HTTP probes: `https://factoreasy.ir/` **HTTP 200 ~1.616s**, representative extension **HTTP 200 ~0.477s**, optional CDN SheetJS **HTTP 200 ~2.663s** (one measurement each; not full user-browser timings). Source `js/bootstrap.js` previously waited for **14 individual network-loaded extension modules serially** *before* calling `initAuthSystem`; `index.html` contained parser-blocking third-party XLSX script and CSS. Assets across `js/` total ~0.75 MiB (55 scripts); network round-trip waterfall is a demonstrated structural issue. Authenticated `pullAll()` still uses sequential pages for full tenant data, and its latency on the owner's ISP is **not measured**.
659 +- Fixed in [PR #100](https://github.com/davoodmehraban89/Factor-easy/pull/100): classic extension scripts now append concurrently with `async=false` set before injection (preserves execution/dependencies), wait `Promise.allSettled` before session check; credential-free `window.FinoraStartupStatus` records only extension count/failure count/load time and `authChecked`. Optional Excel CDN loads `async`; external font CSS loads nonblocking with CSP-compatible local listener and Tahoma fallback. `scripts/build-pages.mjs` continues to replace SheetJS with the pre-existing **pinned SRI** cdnjs equivalent and strict CSP, now carrying `async`; no security gate relaxation. Existing admin fake-user browser test now waits for `authChecked` before its fixture, eliminating race from faster real initialization; no user-auth data accessed.
660 +- New `scripts/phase0-startup-performance.spec.js` has two real Chromium cases: artificial **170ms per extension** latency checks all **14 requested in parallel** and ordered bootstrap still shows login; unavailable third-party Excel/font does not prevent auth screen and Excel guard remains. Exact tested PR head `278bda0836aa650d5cf1d96611e4001097433131`: **Quality `38229232737` SUCCESS**, static job **89/89 Playwright Chromium PASS (48.6s)**, extension dispatch spread **5ms** in synthetic slowed network, all 3 disposable DB jobs PASS, Golden accounting and draft/posted safety PASS, 55 JS/52 MJS syntax PASS; **Security `38229232632` SUCCESS**, SRI/CSP release-safety and CodeQL. The earlier initial PR head Security `38228347152` failed on SRI release-builder detection; corrected builder preserved SRI. Initial browser run `38228617932` had exactly one test fixture auth-initialization race (88/89; not published); corrected and rerun fully green.
661 +- **Current classification:** IMPLEMENTED / PR-HEAD_CONTROLLED_QA_PASSED; protected-main merge/Quality/Security/Release/Pages/published-asset verification **PENDING**. F0-01 affected ISP login and owner-specific post-login latency still **UNVERIFIED**, Phase 0 remains OPEN. No Supabase/Auth/RLS/roles/schema, production user, financial ledger, stored records, login permissions or external accounts modified. Rollback PR and gated Pages.
662 +
663 +
664 +### 2026-10-12 Phase 0 startup waterfall optimization — RELEASED VIA GATED PAGES / OWNER LATENCY OPEN
665 +- Owner observed very slow startup. Investigated real main: **14 ordered extension scripts loaded one-by-one** *before* starting login/session restoration; optional third-party XLSX was parser-blocking, remote font CSS also contributed blocking. Read-only authorized Windows probe (one sample each): homepage HTTP 200 ~**1.616s**, extension ~**0.477s**, optional Excel CDN ~**2.663s**. `js/` contains 55 files ~0.75 MiB. Live Supabase `public.records` `pg_stat_user_tables.n_live_tup` **estimated ~441 rows / ~600 kB**, no per-user lookup; this does **not** prove user session/pullAll fast, which remains separately unmeasured.
666 +- **Fix shipped:** [PR #100](https://github.com/davoodmehraban89/Factor-easy/pull/100) merged to protected `main` exact SHA **`a67c07a717bffc2a8ee90c7e3cc9db55c2d05881`**. Startup `js/bootstrap.js` now downloads all 14 extension scripts concurrently with `script.async=false` (execute in original dependency order), awaits all loaded/failed before running real Auth and exposes only credential-free timing/asset count and `authChecked`. `index.html` moves optional XLSX script to async, font stylesheet to nonblocking media with safe local-JS activation, cache-busts bootstrap; build-pages retains pre-approved **pinned SRI** for cdnjs Excel under strict production CSP. Existing fake-admin Playwright test waits `authChecked` to avoid test-only race. No client user data or financial write modified.
667 +- **Exact final PR-head evidence** `c45807d949c36c32b6e00aaef3e8f47fa9f1e833`: Quality **`38230103321` SUCCESS** (static 55 JS / 52 MJS syntax PASS, Golden accounting and draft/posted PASS, 3 disposable PostgreSQL jobs PASS, **89/89 Chromium Playwright PASS**; synthetic network **170ms/extension** and extension request spread **3ms**; third-party CDN abort still shows login); Security **`38230103301` SUCCESS** including CSP/SRI release safety and CodeQL. First dry run exposed SRI build guard and then a mock-admin timing race; both were fixed and fully rerun. Never waived release security.
668 +- **Exact protected-main SHA gate verified:** Quality **`38230349289` SUCCESS**, Security **`38230349290` SUCCESS**, Release Gate **`38230688599` SUCCESS**, gated Pages deployment **`38230726054` SUCCESS**. Earlier duplicate Release `38230517388` was CANCELLED, duplicate Pages `38230704316` SKIPPED; excluded from successes.
669 +- **Honest external check:** The authorized remote Windows machine `DESKTOP-71SJ63M` was **offline** when post-publish HTTP parity check was attempted; alternate public fetch was inaccessible. Therefore GitHub proves SHA-gated Pages deploy but **direct domain HTTP parity and owner's actual observed latency not independently verified in this last check**. Owner should hard-refresh once at `factoreasy.ir`, record approximate time to see login and time after sign-in; no password/session/network token disclosure. A remaining possible factor is `enterApp()` awaiting `fetchCurrentUser()` and serial tenant `pullAll()` after authentication, not changed without data-consistency tests.
670 +- **Acceptance:** Focused Phase-0 startup/performance **FIX_IMPLEMENTED / CONTROLLED_QA_PASSED / PAGES_DEPLOYED**; **OWNER_REAL_ISP_BENCHMARK_OPEN**. F0-01/02/03/04/07 remain unaccepted; Phase 0 **OPEN**. No Auth/RLS/roles, server schema, Supabase data, financial posting or account credentials changed. Rollback: revert PR #100 and rerun guarded Pages; no data rollback.
671 +
672 +### 2026-10-14 Company form action-state / license permission follow-up
673 +- Owner requested autonomous continuation with short summaries after completed work parts.
674 +- Live read-only TinyFish dashboard showed expired organization subscription for an account expected to have lifetime entitlement; license truth is not independently verified against live database. `js/organization-rbac.js` replaces profile subscription with organization license; `js/core.js` `canWrite()` prevents edits when expired. Do not bypass license or change financial data.
675 +- Company editor action state updated in `js/companies.js`: require nonempty name, subsidiary parent, actual edit changes and `canWrite()` before enabling save. Save handler still enforces `requireWrite()`; button tooltip explains blocked license. Source originated PR #140; old branch was behind `main` by one merge and GitHub returned `405` requiring 3 missing status checks despite green Quality/Security workflows. Rebased changes on current `main` in a new PR branch, without bypassing branch protection.
676 +- Verification: previous head `2a8dc526ec4b3eaae077d0614b060e421c081d91` Quality and Security both SUCCESS, but fresh branch CI and production real DOM not yet verified. Next: verify CI and merge gates; test real DOM without modifying production accounting records; investigate organization entitlement only with authorized live DB access.
677 +
678 +
679 +### 2026-10-14 owner-approved card-free offline encrypted database backup — WORK IN PROGRESS
680 +- **User request:** implement a zero-new-subscription, no-card, no-usage-billing backup solution for Finora ERP Production. Cloudflare R2 activation requires a card and was declined; do not attempt to reuse or store any card details.
681 +- **Verified deployment locator:** production Supabase project `hcsixhqbyuhpshfwqpjx` belongs to the newly named `Finora – Production / Finora ERP – Production` organization/project. The authenticated Supabase connection available to this assistant currently lists only other inactive projects; it does **not** provide production admin or DB-password access. Remote Desktop Commander `DESKTOP-71SJ63M` was offline during this slice.
682 +- **Design authority:** implement a client-side PostgreSQL `pg_dump` custom archive streamed directly into `age` encryption without any plaintext dump file, ciphertext hash manifest, read-only validation, and opt-in localhost disposable restore check. Owner retains private age key and two independent offline copies outside the Git repository. No production changes, credential logging, sensitive secrets in repo, automatic data deletion, or billable service activation.
683 +- **Acceptance remains open:** synthetic tests and code review are not a live production backup. Production operation must be run with securely entered database credentials and supported PostgreSQL client on an authorized machine, an off-device second copy must be verified, and an isolated restore test must pass before backup is declared operational.
684 +
685 +- **Implemented scoped deliverables on branch `feat/finora-offline-encrypted-backup-20261014`:** `scripts/finora_local_backup.py` (backup, verify, localhost-only restore-test), `scripts/finora_local_backup_test.py`, `docs/FINORA_OFFLINE_BACKUP_FA.md`, README navigation, Git ignore guards and Quality workflow Python contract step. No R2 subscription, bucket, paid account, GitHub Secrets, Supabase production queries, or backup schedule was created.
686 +- **Independent local verification:** Python 3.13.5 offline unittest **7/7 PASS**, including encrypted-stream contract (with a deliberately fake age executable; real cryptography **not** verified), manifest/hash checks, dump/encryption failure cleanup, blocked remote/ordinary restore targets, local disposable restore process contract and out-of-repository output path. Repeated twice. Exact GitHub blob IDs match locally tested byte content: `scripts/finora_local_backup.py` `f38d6778d355818588e3b59113781bce2d4e6b8e` and `scripts/finora_local_backup_test.py` `edd94ec3fea2678127e9ebba0fbc1e5661cb89ee`.
687 +- **Explicit remaining acceptance:** live Production pg_dump, real age encryption/decryption, verified offline second copy, actual isolated PostgreSQL restore, Supabase Storage and external configuration backup all **NOT TESTED**. Windows owner device `DESKTOP-71SJ63M` was offline (47 hours since last seen); this assistant's connected Supabase projects are not the production project. Need owner to install client tools, locally generate and safeguard age key, obtain production database connection details (do not share password here), run commands on authorized connected host and provide non-sensitive success/failure evidence. Automatic scheduling is NOT configured.
688 +- **Rollback:** revert scoped PR, remove optional Python CLI/tests/docs; since no production DB writes or new subscriptions occurred, no DB rollback is needed. Quality/Security CI and merge **PENDING**.
689 +
690 +- **Safety correction before final CI:** backup process now catches interruption for ciphertext/manifest cleanup and consumes `pg_restore` stderr asynchronously to avoid pipe deadlock during failures. Reverified **7/7 local synthetic tests PASS** on exact new script blob `f38d6778d355818588e3b59113781bce2d4e6b8e`; GitHub quality/security remain PENDING. No real backup or recovery claim.
691 +
692 +
693 +### 2026-10-14 no-card offline backup merged — code/CI VERIFIED; recovery OPEN
694 +- [PR #143](https://github.com/davoodmehraban89/Factor-easy/pull/143), exact feature head `2138dd89a63a25763d1152800107834572b186d4`, Quality `38620402478` SUCCESS (all disposable DB jobs + full static/DOM job; new offline backup test step PASS), Security `38620402571` SUCCESS. Protected `main` squash merge `ae008ee6b27397513a417ed2e130d89b4d7da0f1` confirmed. Only Python backup CLI/test, documentation, .gitignore and CI workflow changed; no web application runtime, schema, Auth, tenant RLS, license, financial records, Cloudflare account billing or Production credentials changed.
695 +- No-card implementation: PostgreSQL `pg_dump -Fc` streams bytes directly to `age` to an OWNER-held offline folder (no plaintext archive persisted); sidecar SHA-256 manifest; `verify` decrypts in memory and lists archive contents; `restore-test` refuses non-localhost database targets and non-disposable database names. Windows/mobile owner should NEVER share real DB password or age private key in chat, GitHub or files.
696 +- **Truthful acceptance:** 7/7 synthetic local tests PASS and matching GitHub CI contract PASS. Genuine age crypto, production pg_dump, second off-device copy and full PostgreSQL/Supabase restore are **UNEXECUTED**. The authorized desktop remains offline; current connected Supabase integration does not expose production admin. Manual first backup only; unattended scheduler and offsite retention are not enabled. Supabase Storage files/Auth external settings are outside this SQL backup.
697 +- Owner environment: Supabase organization now `Finora – Production`, project `Finora ERP – Production`, project ref `hcsixhqbyuhpshfwqpjx` (matches `js/core.js`). Supabase Free scheduled backup unavailable; Cloudflare R2 activation requires a valid card and was not completed, so this solution uses no paid subscription.
698 +- **Exact next work:** owner powers on authorized Windows computer and brings Desktop Commander online; obtain Direct or Session-pooler DB endpoint without disclosing password; locally generate/secure an age identity; install matching PostgreSQL 17 client and age; run first encrypted backup with password entered privately; verify archive, copy to a second device, restore to *empty localhost disposable DB*, independently validate recovered rows/config, then plan time-based Windows Task Scheduler with OS-protected credentials and log rotation. Keep status `PRODUCTION_BACKUP_NOT_RUN / RECOVERY_NOT_VERIFIED` until each test is evidenced.
699 +- Historical continuity from superseded documentation PR #142: [PR #141](https://github.com/davoodmehraban89/Factor-easy/pull/141) head `c33a6a89dccfe2558c4cc77b041ef3910a4e4f77`, Quality `38605198345` SUCCESS, Security `38605198098` SUCCESS, protected main squash `9693b342670915271e3b471cf68da44b2530d99a`. Company-form Save state respects `canWrite()`; lifetime organization license discrepancy still unverified and must not be overridden.
700 +
701 +
702 +### 2026-10-14 test-account lifetime license rendered expired — ORGANIZATION BOOTSTRAP RACE CONFIRMED IN SOURCE / FIX IN PROGRESS
703 +- **Owner-provided READ-ONLY production SQL:** both owner and test account separately have exactly one active organization ownership, with a `public.licenses` organization record `plan=lifetime, status=active, ends_at=2099-01-01`; the test account's organization is `davood_mehraban`. Do not change licenses or confuse the two identities. Screenshots are evidence of DB state; production browser account matching is still an independent acceptance gate.
704 +- **Reproduced source ordering concern:** `js/core.js` calls `initAuthSystem()` while HTML is parsing; a saved session triggers `enterApp()`, which currently starts `fetchCurrentUser()` in parallel with `window.FinoraAppAssetsReady`. The original core `fetchCurrentUser` returns placeholder `type=none,status=unavailable`; `js/organization-rbac.js` arrives later through asynchronous ordered extension loading (`js/bootstrap.js`) and **then** wraps `fetchCurrentUser` to load the real org license. If auth lookup starts earlier, the app retains an unavailable placeholder and `updateLicenseDisplay()` treats missing end date as expired. This is a plausible deterministic race; a mocked Chromium interleaving must be added to prove it.
705 +- **Authorized minimal fix:** signal when organization-context wrapper is installed; gate profile entitlement fetch on that signal while keeping the login form interactive and all existing bounded aborts; retain parallel wait for remaining app assets; distinguish genuinely expired/cancelled subscription from unavailable/unknown in the read-only badge. No Supabase schema, RLS, Auth, role, entitlement, financial data or migration changes. Synthetic Playwright race/regression tests, Quality/Security/Pages gates and real owner/test-account production acceptance are required separately. Rollback: revert scoped PR and guarded redeploy.
706 +- **Status before implementation:** branch `fix/finora-org-license-bootstrap-race-20261014` created from protected `main`; code fix/CI/merge/release all PENDING.
707 +
708 +- **Scoped code/test implemented (CI PENDING):** `js/core.js` now creates `FinoraOrganizationContextReady`, keeps auth controls independent, and waits for organization adapter readiness before starting entitlement/profile fetch; asset loading still runs concurrently and inherits existing abort timeout. `js/organization-rbac.js` signals after its full module/wrapper installation. `updateLicenseDisplay` differentiates unavailable/unknown from truly expired/cancelled without loosening `canWrite()`. `index.html` and `js/bootstrap.js` cache-bust updated core, loader and org adapter for previously cached browser sessions. New synthetic Chromium test in `scripts/phase0-startup-performance.spec.js` delays organization module 1600ms while starting a fake authenticated transition and asserts no premature placeholder fetch, correct lifetime badge, non-expiry for unavailable state and preserved no-write-to-production behavior. No real account credentials or SQL changes.
709 +- **Evidence needed:** exact head static/build/browser + disposable DB and security CI; protected main merge; guarded Pages deploy + owner test-account hard reload should show `وضعیت اشتراک : نامحدود` if same verified organization context. If not, inspect browser account/organization/version rather than changing entitlements.
710 +
711 +### 2026-10-15 test-account license bootstrap fix — MERGED / EXACT-SHA RELEASE VERIFIED / LIVE USER ACCEPTANCE BLOCKED ON SESSION
712 +- **Fix merged in protected main:** [PR #145](https://github.com/davoodmehraban89/Factor-easy/pull/145), squash commit `4288e4a0473f7b58d4e7ac5865d3396825a34d00`. The initial fix attempt exposed a stale-version assertion in `scripts/login-connectivity-check.mjs`, which was corrected. The next run found the pre-existing expired-license DOM fixture now needed to wait for organization readiness; that was corrected without changing genuine expired-license enforcement.
713 +- **Exact PR-head checks at `1c16da89a07409ebd3a2b91e8780a6e30d06bf2c`:** Quality `38632344973` SUCCESS, Security `38632344751` SUCCESS; 119/119 Chromium Playwright PASS, including synthetic delayed organization module and synthetic genuinely expired license; all three disposable DB jobs PASS. No production SQL writes or real account data touched by tests.
714 +- **Exact protected-main SHA release evidence:** Quality [38633048129](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38633048129) SUCCESS; Security [38633048164](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38633048164) SUCCESS; Release gate [38633828981](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38633828981) SUCCESS; Deploy gated Pages [38633933732](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38633933732) SUCCESS. A redundant prior release-gate run was cancelled; the succeeding gate and its Pages deploy are verified on the same main SHA.
715 +- **Actual read-only authenticated acceptance remains OPEN:** TinyFish run `3d97a4ee-e576-4905-b251-fe94a8a26628` reached `https://factoreasy.ir` and reloaded, but showed login only, no signed-in session/dashboard/license badge. TinyFish browser profile `prof_beabc8beb1f04ed4` was independently checked and reports `signed_in_sites=[]`; the prior remembered test-account session is not presently saved/usable. This does NOT establish that the fix failed, nor that the real badge displays unlimited. Production Auth/organization/entitlement cannot be inspected through this run. Do not change production licenses or bypass Auth.
716 +- **Owner action to unblock only if they wish:** reauthenticate the TEST/WORK account using TinyFish profile setup (password entered on official site, never in chat; save signed-in browser context) or personally log into the real site with test account and share the sanitized license badge. Then observe `وضعیت اشتراک : نامحدود` after an authenticated page reload, confirming the visible organization belongs to the correct test account; if still expired, collect redacted UI status and inspect client freshness/network/organization context without license updates. Owner account remains a separate account; don't ask to use it for this test.
717 +- **Other open gates unchanged:** owner affected-network login repeatability (Phase 0), production encrypted SQL backup + off-device copy + isolated restore (`PRODUCTION_BACKUP_NOT_RUN / RECOVERY_NOT_VERIFIED`), migration parity and comprehensive tenant tests. Documentation-only continuation; rollback revert doc PR.
718 +
719 +
720 +### 2026-10-15 LIVE TEST/WORK LICENSE ACCEPTANCE — PASS (READ ONLY)
721 +- **Owner action:** set up and saved a distinct TinyFish Browser Context Profile named `Finora ERP — Test / Work Account`, separate from the original Default/admin profile. Do not interchange those identities; no credentials were supplied in chat, committed to Git, or submitted to a SQL editor.
722 +- **Verified post-deploy real-browser read-only run:** TinyFish [run `f4e14d1a-d144-4172-b43b-15d71b00f976`](https://agent.tinyfish.ai/runs/f4e14d1a-d144-4172-b43b-15d71b00f976), `https://factoreasy.ir`, status COMPLETED, authenticated session resumed automatically without a login form. Actual dashboard rendered; **exact visible subscription badge** `وضعیت اشتراک : نامحدود` (stable). The run reported a visible organization/company label `آرابتن`; do not equate a company selector label with the database `organization_id` absent independent proof.
723 +- **Disposition:** TEST/WORK-account false-`expired` subscription badge **CLOSED for observed production flow**. This is actual read-only browser acceptance of the fix introduced in PR #145 and deployed on protected-main SHA `4288e4a0473f7b58d4e7ac5865d3396825a34d00`, in addition to 119/119 synthetic Playwright and exact-SHA Quality/Security/Release Gate/Pages checks cited in the previous entry. This does not prove every browser/network, refresh duration, role, company or real financial write path.
724 +- **No database mutation:** never changed `public.licenses`, membership, RLS, Auth, role or financial history. No tests submitted forms, switched organizations or changed financial records.
725 +- **Remaining separate deliverables:** unstable initial login on owner's affected network and duration/retry acceptance (Phase 0); no-card production encrypted backup, second-device copy and isolated restore (`PRODUCTION_BACKUP_NOT_RUN / RECOVERY_NOT_VERIFIED`); other roadmap QA/deployment phases. Do not require Desktop Commander for basic GitHub/Supabase workflow.
726 +- **Exact next step:** evaluate Phase 0 repeat-login stability using separate non-destructive browser checks and available evidence, or proceed with next safe backlog slice; do NOT revisit false expiry without regression evidence. Owner can keep the dedicated test profile for later read-only QA.
727 +
728 +
729 +### 2026-10-15 Owner continues Finora / Phase 0 repeated existing-session stability — STARTED (READ ONLY)
730 +- **Latest direction:** owner: «ادامه بده». Choose the highest-value non-destructive open slice: saved Test/Work-account session reload stability and startup/login status following successful real lifetime-license acceptance, while maintaining separate owner/admin identity.
731 +- **Live repository baseline verified:** protected main `a730a9e4a806058ae130b46c4dff92b9312eff04` (PR #147, documentation only). Exact main Quality `38772208876`, Security `38772209272`, Release gate `38772666911`, gated Pages `38772767566`: all SUCCESS. Thus production test now targets that documented release, not an unverified preview.
732 +- **Scope:** with saved `Finora ERP — Test / Work Account` browser profile, run read-only multiple reload/navigation cycles; record login/dashboard access, stable badge `وضعیت اشتراک : نامحدود`, visible organization/company ambiguity, any timeout/blank screen and browser-visible failures. Never post changes, inspect private financial record details, switch org, expose cookies/token or use owner's admin profile.
733 +- **Stop condition / acceptance:** at least 3 independent reload checks and bounded navigation; if any repro failure, diagnose/repair client startup in a branch with synthetic Playwright regression and exact-SHA Quality/Security/Pages. Otherwise document that the single test-browser route passes while affected owner ISP performance and non-saved fresh login remain OPEN. Separately, backup live extraction/restoration still NOT VERIFIED, no desktop subscription required for this read-only smoke.
734 +- **Execution started:** no Supabase/Cloudflare/R2/schema/Auth/licensing/financial writes authorized or planned. Rollback for QA-only notes is doc PR revert. Production rollback only if source fix separately shown necessary.
735 +
736 +- **Phase 0 F0-01 test-profile real-browser QA checkpoint:** TinyFish run [`b92edc28-63ed-40cc-9052-e1b539399738`](https://agent.tinyfish.ai/runs/b92edc28-63ed-40cc-9052-e1b539399738) COMPLETED, four sequential browser navigation/reload cycles on `https://factoreasy.ir` with separate saved test/work session. 4/4 loaded dashboard; no sign-in prompt, blank loading, or transient stuck state; exact license badge `وضعیت اشتراک : نامحدود` each time; no data writes. Browser agent **estimated** initial 2–3s and refresh ~1–2s; these estimates are NOT controlled performance traces and do not verify owner's affected ISP or cold signed-out login.
737 +- **Next scope (owner's ongoing Phase 0 continuation):** safe READ-ONLY `F0-02` catalog/search smoke with test/work session: navigate existing invoice item selector and query known `هارد` / `بلوک`, seller/contact lookup if visible; do NOT save/create/edit/post invoice, switch companies or expose record details. This tests UI/search accessibility only; tenant isolation and actual save cannot be inferred without separate controlled tests.
738 +
739 +- **F0-02 live read-only navigation attempt, NOT VERIFIED product search:** TinyFish [run `3583d6a5-196a-42ed-ba47-727021d9a224`](https://agent.tinyfish.ai/runs/3583d6a5-196a-42ed-ba47-727021d9a224) completed on saved test/work profile. Navigation from Accounting to Commerce was attempted, but the agent could not expose Commerce submenu or reach Sales Invoice. No product/contact selectors were inspected; no invoice created or financial data changed. This is inconclusive between interaction/scroll/navigation misunderstanding and a real UI bug. Mark **F0-02 REAL ACCOUNT PRODUCT/CONTACT LOOKUP NOT VERIFIED** rather than FAIL/PASS.
740 +- **Isolated browser regression added to distinguish source problem from agent limitation:** `scripts/phase0-modal-dashboard.spec.js` now clicks Accounting then Commerce tab and verifies invoice page activation, Commerce sidebar links, absence of Accounting links, and round trip Products → Invoices with synthetic session. CI test still PENDING. Do not patch production navigation or claim source bug unless reproduced and independently validated.
741 +
742 +- **PR #148 first QA checkpoint on exact code head `119093f80b07c27517e2bd857b55f07ce9f4018f`:** Quality [`38774914246`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38774914246) **SUCCESS**, Security [`38774914170`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38774914170) **SUCCESS**. Static job `116559947340` log reports **120/120 Playwright Chromium PASS** (new F0-02 Commerce actual tab-click UI test at sequence [77/120]); D1/C8/identity disposable DB jobs SUCCESS; CodeQL + Release safety SUCCESS. This demonstrates controlled navigation works; no user-session product options inspected. No code change or speculative UI repair is warranted based on this evidence alone.
743 +- **Acceptance verdict by scope:** F0-01 saved test/work session warm-route **4/4 PASS**, but owner affected-network first login and real cold signed-out flow remain NOT VERIFIED. F0-02 Commerce tab rendering in isolated Chromium **PASS**, but real account product/party selector exercise **NOT VERIFIED** due browser-agent navigation blocker. No real invoice or contact data was read or written. Next bounded action: user-authenticated UI walkthrough of sales invoice selector from known menu path or carefully scoped read-only browser replay; preserve company context and do not mutate production records. Await **final head PR #148** Quality/Security before protected merge, then verify exact main deploy.
744 +
745 +
746 +### 2026-10-15 Phase 0 F0-02 published Pages event-wiring differential — STARTED
747 +- **Owner's latest directive:** continue project autonomously. The previous #148 test was the repository's *raw* `index.html` (120/120 Playwright passes) and the read-only production user had 4/4 saved-session page reload successes. Protected main after #148 `e544127a8a4fbc062c1c8d3b4595ef9877793c4a`, exact-SHA Quality `38776168331` SUCCESS, Security `38776168144` SUCCESS, Release gate `38776599946` SUCCESS and Pages `38776694944` SUCCESS.
748 +- **New production browser discrepancy:** TinyFish test/work session [`f95fad51-50a6-41e7-bfd2-338ed706d59a`](https://agent.tinyfish.ai/runs/f95fad51-50a6-41e7-bfd2-338ed706d59a) successfully loaded dashboard and unlimited-license badge but *could not visibly expand* the top-bar `+ ایجاد سریع` menu using click. Together with earlier Commerce tab navigation attempt, this could indicate an actual Pages CSP event-handler binding problem OR browser automation limitations. Neither real product nor contact selector was reached, so F0-02 remains NOT VERIFIED. No production data written.
749 +- **Distinct mechanism to test:** GitHub Pages is built by `scripts/build-pages.mjs` which replaces `index.html` inline onclick attributes with generated CSP-safe listeners. Existing #148 Playwright ran **raw development HTML**, which does not validate actual event binding in generated `_site/index.html`. Extend `scripts/pages-artifact.spec.js` with isolated synthetic (not production financial data) real Chromium clicks on Accounting tab, Commerce tab, top-bar Quick Create and Sales Invoice menu; assert actual content/sidebars and alert-free navigation.
750 +- **Scope/acceptance:** no license/auth/schema/RLS/roles/migration/financial data writes. If artifact test reproduces, implement a scoped CSP wiring fix + regression + exact PR Quality/Security; if PASS, document automation browser limitation versus unresolved real-account manual verification without changing source needlessly. Proceed only on evidence.
751 +
752 +- **Hardened Pages differential COMPLETED and PASS on first test head `3f42dc353eaf4398e2a5dabcfe0cfd0145f36f6c`:** Quality [`38777091455`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38777091455) SUCCESS; Security [`38777091429`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38777091429) SUCCESS. Static Quality job `116567441821` reports **121/121 Playwright Chromium PASS**, specifically `scripts/pages-artifact.spec.js:147` test `Published Pages CSP event bindings open Commerce and the top-bar sales invoice menu` PASS; all three D1/C8/identity disposable DB jobs PASS. Tested generated CSP-safe button handlers in built `_site` with synthetic license, from Accounting through Commerce, then topbar Quick Create > Sales Invoice, including panel, dropdown and aria state, with no real data/production writes.
753 +- **Triage decision:** no confirmed client-side navigation/CSP wiring defect. Both real signed-in TinyFish runs were unable to navigate to invoice form, but the actual hardened artifact demonstrates button handlers and UI change work in isolated Chromium. Distinguish **agent automation interaction blocker** from production end-user behavior. Do **not** loosen CSP, adjust finance modules, or patch navigation without credible real user repro; F0-02 real-account product/contact selectors remain **NOT VERIFIED**. Keep owner-ISP fresh sign-in acceptance and encrypted backup/live isolated restore OPEN. Rollback for this test-only change: revert PR, no DB changes.
754 +- **Release gate:** await exact final PR head checks and protected-main Pages promotion; no product source change means no functional regression introduced, but tests must remain in main.
755 +
756 +
757 +### 2026-10-15 Phase 0 saved-session & hardened Pages navigation QA — FINAL VERIFIED RELEASE
758 +- **Owner requested continued work / task complete for current bounded slice:** Saved test/work account warm-session four-cycle read-only TinyFish [run `b92edc28-63ed-40cc-9052-e1b539399738`](https://agent.tinyfish.ai/runs/b92edc28-63ed-40cc-9052-e1b539399738) 4/4 PASS: dashboard consistently available, no reauthentication, no spinner, badge `وضعیت اشتراک : نامحدود`. Browser-reported approximate 2–3s initial and 1–2s reload are NOT external performance benchmarks, and **affected owner ISP fresh login remains OPEN**.
759 +- **Two separate read-only real-account F0-02 navigations:** test/work TinyFish `3583d6a5-196a-42ed-ba47-727021d9a224` did not reach Sales Invoice through Commerce tab; `f95fad51-50a6-41e7-bfd2-338ed706d59a` saw Quick Create control but did not see its menu expand. Neither reached product/contact selectors; actual real-account search **NOT VERIFIED**. Both runs made no financial writes. Do not interpret browser agent's failure alone as a proven client defect.
760 +- **Development-source test release:** [PR #148](https://github.com/davoodmehraban89/Factor-easy/pull/148), merge SHA `e544127a8a4fbc062c1c8d3b4595ef9877793c4a`, Quality `38776168331` SUCCESS, Security `38776168144` SUCCESS, Release gate `38776599946` SUCCESS, Pages `38776694944` SUCCESS. Synthetic Chromium source navigation from Accounting → Commerce → Products → Invoice passes.
761 +- **Production-hardened Pages differential test released:** [PR #150](https://github.com/davoodmehraban89/Factor-easy/pull/150), merge SHA `928493f695eef8b5b6facbdca85dc96f3c9f67d9`. Added synthetic Chromium test `Published Pages CSP event bindings open Commerce and the top-bar sales invoice menu` against generated `_site` CSP-safe event handlers, with actual button clicks, quick menu aria toggle and invoice-page navigation. 121/121 Chromium tests PASS in QA job `116567441821` at initial test head; final PR head `64eb58adfdcd35f907fd2afe883fd3d4f2c90b98` Quality `38777656678` SUCCESS, Security `38777656686` SUCCESS. Exact protected main merge Quality [`38778221013`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38778221013) SUCCESS, Security [`38778220937`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38778220937) SUCCESS, Release gate [`38778697708`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38778697708) SUCCESS, gated Pages [`38778783998`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38778783998) SUCCESS. A superseded duplicate release-gate job was cancelled; accepted gate and Pages on exact SHA succeeded.
762 +- **Disposition/security:** no further production navigation code change indicated by current tests. No Supabase Auth, license, schema/RLS/role, tenancy, financial records, payments, Stripe, Cloudflare, GitHub credential or paid service touched. Existing validated license fix remains CLOSED for observed test-account flow.
763 +- **Remaining Phase 0 / release blockers:** F0-01 fresh first sign-in and fluctuating load on owner's affected internet/actual device **NOT VERIFIED**; F0-02 sales invoice product/customer search against actual authorized company **NOT VERIFIED**; F0-03 real persistent invoice-safe scope/physical print **NOT VERIFIED**. No-card encrypted production DB backup, independent offline copy and restore **NOT RUN**. Next safe path: owner-supplied read-only screenshot or scoped browser recording showing commerce navigation + existing product search; independent client/network diagnostics before any code change; no live invoice creation without explicit safe test scope.
764 +
765 +
766 +### 2026-10-15 F0-02 production product search PASS / buyer filtering acceptance still open — TEST STARTED
767 +- **Current owner continuation:** test-work account read-only browser [run `43e95484-3ecf-4576-a4b1-528cac50a8eb`](https://agent.tinyfish.ai/runs/43e95484-3ecf-4576-a4b1-528cac50a8eb) reached Commerce/Invoices by clicking visible Persian tab; the agent's claim that DOM `data-module` attributes are absent contradicts canonical source `index.html` and synthetic Chromium, so **do not adopt the unverified explanation as root cause**.
768 +- **Real saved test-work session targeted [run `341e1f6d-a792-4b5e-b0b9-69908056b460`](https://agent.tinyfish.ai/runs/341e1f6d-a792-4b5e-b0b9-69908056b460) COMPLETE:** Commerce Sales Invoice form reached; first existing item product combobox filter `بلوک` returned **three** options; buyer combobox/search input visible. No item selected, no invoice saved, no production data mutated. F0-02 real product lookup **PASS** for this path, but buyer filtering and metadata acceptance were only visually observed (no actual filtered buyer result).
769 +- **Contradictory next agent run [`a31d48d6-34ea-4b6d-91b3-7d28a0c817f5`](https://agent.tinyfish.ai/runs/a31d48d6-34ea-4b6d-91b3-7d28a0c817f5):** could not reach invoice, so buyer-filter and product metadata still **NOT VERIFIED** in that run. Treat intermittent browser agent navigation as a separate reproducibility issue, not proof of failing app; hardened Pages navigation regression #150 PASS 121/121.
770 +- **Planned bounded corrective QA:** extend generated hardened `_site` Pages Playwright with isolated synthetic customer/product records for own and another user; open Commerce, filter product `بلوک`, filter buyer `شرکت` without choosing; assert matching scoped options only and source select values unchanged, expected unit/price metadata on product options, zero calls to `saveDatastore`, no production Supabase write. No production schema/Auth/RLS/financial/data change or external charges.
771 +- **Exact repository baseline:** protected `main` after documentation PR #151 `b7d287ac15f7f7a6e6db1f9bc1b2778afa9193d9`. Required acceptance: new isolated browser test + full quality/security, protected merge, guarded Pages release; real buyer search remains open pending authentic read-only evidence. Rollback: revert test/docs PR; no DB change.
772 +
773 +
774 +- **TEST PASS on exact initial PR code head `f7128b21c3b65e03d1a418e07a1818a8aa98abda`:** [PR #153](https://github.com/davoodmehraban89/Factor-easy/pull/153), Quality [`38784715204`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38784715204) SUCCESS, Security [`38784715247`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38784715247) SUCCESS. Job `116593641627` logs **122/122 Chromium PASS** (new `scripts/pages-artifact.spec.js:185` test at [72/122]), all disposable DB D1, C8, identity jobs SUCCESS. The generated Pages CSP-safe product filter for `بلوک` and buyer filter for `شرکت` each returns only TWO synthetic own-user records, no cross-user options, and product `data-unit`/`data-price` metadata stays available; neither selects a different product/buyer, invokes `saveDatastore` nor creates invoice. This proves **synthetic filter behavior only**, not real buyer search or persisted invoice correctness.
775 +- **Exact next work:** await final PR head Quality/Security checks after appending this evidence, squash merge #153 if green, recheck protected-main Quality/Security/Release Gate/Pages exact SHA. Keep F0-02 real buyer filter NOT VERIFIED, affected owner ISP cold sign-in NOT VERIFIED, production backup+restore NOT RUN. Avoid additional paid-agent browsing absent a reliable way to reach the real buyer dropdown; no financial actions were taken.
776 +
777 +### 2026-10-15 concurrent PR reconciliation and isolated accounting QA bootstrap stabilization — STARTED
778 +- **Owner's ongoing instruction:** continue safe Finora execution, do not overwrite concurrent work. Existing F0-02 real saved TEST/WORK account run `341e1f6d-a792-4b5e-b0b9-69908056b460` reached Sales Invoice and filtered `بلوک` to 3 choices without save. Another TinyFish run `a31d48d6-34ea-4b6d-91b3-7d28a0c817f5` failed to navigate: real buyer filter/owner-ISP login remain NOT VERIFIED. Historical agent claim that Commerce data-module is missing contradicts source and must not be adopted.
779 +- **Concurrent main change:** while PR #152 was green on head `100969c479425151ad98967e25a2b01fe748bfba` (Quality `38785133659` SUCCESS, Security `38785133640` SUCCESS; 122/122 Playwright PASS), another agent/workstream merged equivalent [PR #153](https://github.com/davoodmehraban89/Factor-easy/pull/153) as `700846635d5a6a213885a32bbd9f9164e42c731d`. It already adds the hardened-Pages synthetic product/buyer filter + option metadata + zero-write test, head Quality `38784715204`, Security `38784715247`, 122/122 PASS. PR #152 became conflicting and was **closed without merging** rather than duplicating source or overriding PROJECT_STATE. No live database mutation.
780 +- **Additional independent QA issue from PR #152 CI:** initial Quality attempt `38784436583` had the F0-02 selector test PASS but unrelated existing `scripts/accounting-document-workflow.spec.js` 'seamless sale correction' fixture intermittently failed because `#auth-screen` remained visible. Its `authenticatedMockBrowser` waits for base `enterApp`, `commitSaveInvoice`, `pullAll` function existence but not full delayed organization/ERP bootstrap. It can invoke the mocked login before `organization-rbac.js` installs its wrapper, violating ready-order requirements. Branch `test/finora-accounting-boot-readiness-20261015` will apply a **test-only** readiness wait for `FinoraStartupStatus.extensionsReady`, `failedExtensionCount===0`, `authChecked===true`, without altering production app, finance data or Auth. Exact CI retest and protected merge pending.
781 +- **Separate legitimate side effect confirmed by captured stack:** the previously unexplained synthetic `saveDatastore` call before search was `afMigrateLegacyProjects` one-time compatibility marker when `renderContacts` initialized. PR #153 tests no writes by instrumenting save **after** fixture initialization. Preserve current migration behavior; production migration correctness remains independent open audit, no automatic change.
782 +
783 +
784 +### 2026-10-15 F0-02 selector release and treasury fixture stabilization — EXACT MAIN VERIFIED
785 +- **Real test/work account read-only evidence:** authenticated [TinyFish `341e1f6d-a792-4b5e-b0b9-69908056b460`](https://agent.tinyfish.ai/runs/341e1f6d-a792-4b5e-b0b9-69908056b460) reached Commerce/Sales Invoice and filtered `بلوک` to **3** real options without choosing a product, saving invoice or modifying records. Buyer combobox was visible/interactive but **real buyer-result filtering was NOT performed**. The next run `a31d48d6-34ea-4b6d-91b3-7d28a0c817f5` could not reach the form; intermittent TinyFish navigation is not independently confirmed as an app defect.
786 +- **Synthetic hardened Pages browser acceptance:** [PR #153](https://github.com/davoodmehraban89/Factor-easy/pull/153) merged into protected `main` as `700846635d5a6a213885a32bbd9f9164e42c731d`. Adds Playwright on built `_site` invoice product & buyer dropdowns with fake records owned by the fixture user plus unrelated owner. Product query `بلوک` and buyer query `شرکت` yield 2 own-user options each; never select, save or create. Assert no cross-owner suggestions, unchanged select values, correct underlying unit/price metadata, zero `saveDatastore` calls, zero created invoices; script is test-only. PR-final-head Quality `38785302511` SUCCESS, Security `38785302405` SUCCESS, **122/122** Chromium PASS.
787 +- **Exact-main initial Quality detected intermittent finance-fixture bootstrap issue:** Quality `38785778369` FAILURE, **121/122** Playwright PASS; sole failing treasury test `scripts/accounting-document-workflow.spec.js:499` was still on visible auth screen after mock login, before financial checks. Security `38785778160` SUCCESS; gated Pages intentionally SKIPPED until fixed. This is an actual release blocker, not a verified bug in treasury accounting amounts.
788 +- **Concurrent solution reconciled:** Another workstream merged [PR #154](https://github.com/davoodmehraban89/Factor-easy/pull/154) as protected-main `5f4ca4a6746557edc43a5106500587ad7784beab`. Its fixture-only change waits for `FinoraStartupStatus.extensionsReady===true`, `failedExtensionCount===0`, `authChecked===true` before installing synthetic `fetchCurrentUser`. No production finance/Auth/license/RLS/schema changes. Our equivalent [PR #155](https://github.com/davoodmehraban89/Factor-easy/pull/155) was closed **without merge** due to overlap/conflict; never overwrite concurrent fix.
789 +- **Final exact-main checks on `5f4ca4a6746557edc43a5106500587ad7784beab`:** Quality [`38787027438`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38787027438) SUCCESS, static job `116601549493` **122/122 Chromium PASS**, including previous intermittent treasury scenario; Security [`38787027331`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38787027331) SUCCESS; Release Gate [`38787487143`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38787487143) SUCCESS; gated Deploy Pages [`38787580775`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38787580775) SUCCESS. Superseded duplicate release runs are cancelled/skipped, not missing accepted gates.
790 +- **Current acceptance:** F0-02 real **product** lookup PASS for one authorized account, **synthetic product/buyer** filtered search PASS on production-built artifact; **real buyer filtered results still OPEN**, as are affected-ISP initial sign-in, actual financial write/recovery flows and encrypted production SQL backup+off-device copy+isolated restore (`PRODUCTION_BACKUP_NOT_RUN / RECOVERY_NOT_VERIFIED`). Do not mark full Phase 0 complete. No live Supabase operations, changed entitlements, financial saves or new paid services.
791 +- **Next safe action:** only if needed, owner/test-account read-only in-browser screen recording of buyer dropdown filter `شرکت`; keep no-write protection. Separately prepare on-device owner-held age key and authorized production database connection for first no-card backup/restore—cannot execute securely from expired Desktop Commander access. Rollback: revert test PR #153 / fixture PR #154 separately, each with exact protected-main regression gates.
792 +
793 +
794 +### 2026-10-15 Phase 0 F0-02 REAL test/work buyer search — VERIFIED READ-ONLY
795 +- **Owner asked whether work had stopped:** continued live F0-02 acceptance on saved separate Test/Work TinyFish profile; independent protected-main baseline `ac14127081aae650eeee4b34ff3b571130a39afe` was verified. Exact-main Quality `38788499153`, Security `38788499145`, Release gate `38788990403`, Pages `38789047657`: all SUCCESS. Prior concurrent work already delivered [PR #153](https://github.com/davoodmehraban89/Factor-easy/pull/153) hardened-Pages product/buyer synthetic combobox tests and [PR #154](https://github.com/davoodmehraban89/Factor-easy/pull/154) isolated accounting login test stabilization; do NOT reimplement/revert these.
796 +- **New independent LIVE authenticated acceptance:** TinyFish [run `501d5e90-8394-40d1-b6e7-1661c4233fcf`](https://agent.tinyfish.ai/runs/501d5e90-8394-40d1-b6e7-1661c4233fcf), saved TEST/WORK browser profile `prof_5ea28cf6866d447d`, reached `https://factoreasy.ir`, clicked left rail `بازرگانی` ONCE, invoice form `صدور سند تجاری` became visible. Opened visible buyer combobox corresponding to hidden `#invoice-contact-id`; option count **2 before filter, 1 after input `شرکت`**. `Escape` closed dropdown/restored previous buyer selection; no selection/record change. No save, create, post, edit, delete, or changes to Supabase/financial records. Do not republish real company/customer names in reports.
797 +- **Prior independent LIVE product filter:** TinyFish [run `341e1f6d-a792-4b5e-b0b9-69908056b460`](https://agent.tinyfish.ai/runs/341e1f6d-a792-4b5e-b0b9-69908056b460) with same Test/Work profile reached invoice and filtered `بلوک` to **3 matching product options**, without selecting/saving. Later run `a31d48d6-34ea-4b6d-91b3-7d28a0c817f5` was inconclusive for navigation, but the new run confirms navigation and buyer search in a separate successful session. Generic TinyFish agent claims about absent `data-module=commerce` contradicted source HTML and should not be treated as a root cause.
798 +- **Acceptance:** Phase 0 **F0-02 interactive product and buyer filtering PASS for observed authorized test account**; opening the invoice and reverting transient search state also PASS. Combined with 122/122 synthetic Playwright and protected Pages release, this closes the *two lookup UI acceptance checks only*. It does NOT prove committed invoice persistence, financial posting, cross-company data isolation, cold login performance on owner's affected ISP, or all user devices.
799 +- **Next safe work:** Phase 0 F0-01 affected-network fresh login needs owner-device evidence; F0-03 actual invoice persistence/print cannot be certified by no-write TinyFish test; live backup and isolated restore remain `PRODUCTION_BACKUP_NOT_RUN / RECOVERY_NOT_VERIFIED` due missing secure authorized machine and owner-held age identity. Continue source-side audit/tests without operating on live financial records. This PR updates documentation only; rollback by reverting doc PR.
800 +
801 +### 2026-10-16 Owner continuation — F0-01 delayed Pages dispatcher / legacy-request differential (PLANNED, QA ONLY)
802 +- **Owner direction:** «ادامه بده». Rechecked current protected main `69e0721d7004e8497cf43aaf6ab259b49ac97681`, open login Issue #106 and latest buyer/product acceptance #157. Main Quality `38793466628`, Security `38793466635`, Release `38793944702`, Pages `38794031181` all SUCCESS; 122/122 controlled Chromium PASS, not owner-ISP cold-login acceptance.
803 +- **Evidence and hypothesis:** owner Chrome waterfall on prior affected hotspot had unusually slow `generated-dynamic-handlers.js` (~43s) and accounting Pages group (~15s), plus an unexpected pending standalone `enterprise-iran.js`. Current `scripts/build-pages.mjs` inserts the CSP-safe dynamic dispatcher as a bottom classic blocking script. This can delay `DOMContentLoaded` and therefore extension bootstrap; the network/initiator root cause and live current release remain unproven. Current bundler intentionally consolidates 38 core scripts into three ordered groups and 14 extensions into one bundle.
804 +- **Scoped plan:** add an isolated Playwright regression for generated `_site` Pages, with delayed dynamic dispatcher and a request ledger asserting early credential controls, expected DOM readiness sequencing, no premature workspace, complete later module readiness and no unexpected standalone legacy ERP request. Do not alter runtime/Auth/schema/RLS/roles/financial records/permissions; do not hide missing assets, bypass readiness or assume 304 is a failed response. If test reveals source defect, stop and separately review minimum fix; do not assume this QA proves owner affected-network performance.
805 +- **Acceptance / rollback:** exact PR-head Quality (122+ Chromium, Golden, three disposable DB) and Security PASS; docs and test-only branch, no production writes. Restore by reverting isolated PR. Live first signed-out login on owner's impacted Chrome/ISP remains F0-01 P0 OPEN; no invoice persistence/real backup signoff.
806 +- **First independent CI result on PR #158 head `926a44321daf56f989a595b74048145e155451cc`:** Security `38813224607` SUCCESS; Quality `38813224500` FAIL, **122/123 Chromium PASS**. The one new synthetic hardened-Pages test confirmed early login remains available during deliberately delayed bottom dynamic dispatcher, but detected a standalone `enterprise-iran.js` network request, contrary to expected bundling. Three disposable DB jobs, Golden and other financial invariants passed. Do not merge or deploy this test-only PR while failing. Next: capture request resource type + Chromium Network initiator on this isolated fixture to distinguish duplicate executed script, speculative preload, or diagnostic fetch. This is an actual test failure, not yet proven runtime financial corruption or a confirmed owner-ISP fix.
807 +- **CDP root cause evidence / bounded implementation decision, before code edit:** PR #158 head `6dc91cddf403a2d482c30795f2b32e20cd6b82d2`, Quality `38814011317` 122/123 Chromium with same intentional test FAIL, Security `38814011321` PASS. Chromium `Network.requestWillBeSent` identifies a real **Script** request to `/_site/js/enterprise-iran.js`, initiator `finora-pages-foundation.js` line 565. Source mapping through ordered foundation bundle reveals `js/ui.js` line 218: a `DOMContentLoaded` listener injects a second `<script src=js/enterprise-iran.js>`. This duplicates the same ERP module already in the required accounting Pages bundle; raw development `index.html` also separately includes it statically at line 941. **Authorized narrow fix:** delete ONLY this dynamic redundant script insertion from `js/ui.js`, retain enterprise module in original static index and Pages accounting bundle and preserve module rail rendering; keep strict fail-closed gating and test full Chromium/Golden/DB/Security. Do not combine unrelated CSP handler files in this fix. Rollback by reverting ui.js one-line change.
808 +- **One-line repair controlled CI VERIFIED on PR #158 code HEAD `6dfdf41b7694ef6397c19bce8613f68cd6b724d4`:** [Quality `38814776887`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38814776887) SUCCESS; static job logs **123/123 Chromium PASS**, including the delayed CSP handler + no redundant source-script fetch regression; Golden sale→receipt→purchase→payment→reversal→trial balance→statements and accounting P0 invariants PASS; **three disposable DB jobs SUCCESS**. [Security `38814776751`](https://github.com/davoodmehraban89/Factor-easy/actions/runs/38814776751) SUCCESS. Production source change is only removal of redundant DOMContentLoaded dynamic load in `js/ui.js` (enterprise module remains in built accounting group). **PENDING:** after this evidence-only documentation append, recheck exact final PR head CI before merge; protected-main Release/Pages and actual owner-ISP cold login are NOT VERIFIED at this checkpoint. Phase 0/Issue #106 remain OPEN.