سامانه صدور فاکتور و حسابداری
test(phase0): stress 1200+ account, project and contract selectors (#98)
* docs(phase0): register F0-05 large account/project/contract QA slice before implementation * test(phase0): stress >1200 account, project and contract selector options safely in Chromium * docs(phase0): record five-selector 1200+ stress results without owner-acceptance claim * docs(phase0): log tested 1200+ account/project/contract selector metrics and remaining gates
davoodmehraban89 committed
Oct 12, 2026 at 12:22 UTC
20cca7e4cf5a411022a30929a513b7cdf2d53779
3 files changed
+88
-1
PROJECT_STATE.md
+14
@@ -370,3 +370,17 @@ Owner reports login blocked with generic 'check internet/VPN' network error on l
370
- **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`.
371
- **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.
372
- **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.
373
+
374
+
375
+## 2026-10-12 Owner Phase 0 continuation — F0-05 account/project/contract selector large-list QA
376
+- **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.
377
+- **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.
378
+- **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.
379
+- **Accountable:** QA/Verification. **Status:** SCOPE RECORDED / CODE PENDING.
380
+
381
+
382
+### 2026-10-12 F0-05 account/project/contract high-volume selector — CONTROLLED QA PASS / OWNER GATE OPEN
383
+- 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.
384
+- 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.
385
+- 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.
386
+- 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.
docs/FINORA_PHASE0_ACCEPTANCE_REGISTER_2026-10-12.md
+1
-1
@@ -23,7 +23,7 @@ Status definitions: **CONTROLLED QA PASS** = actual Chromium or isolated tests w
23
| **F0-02** · Real product & person selection | PR #83 merged; keyboard/F2 and synthetic matching in Chromium | **CONTROLLED QA PASS; live tenant UNVERIFIED** / P0 open | Select existing `هارد` or `بلوک` and person in authorized tenant; correct unit/price/company boundary; no cross-tenant leak. UX/Data. |
24
| **F0-03** · Invoice lifecycle | `scripts/phase0-invoice-persistence.spec.js` passes **2/2** on mock RPC: save→reload→edit→print, retry without duplication; no ledger posting | **CONTROLLED QA PASS; real persistence UNVERIFIED** / P0 open | Only separately approved isolated account/test scope: actual server save/reload/edit/print and reconcile duplicate count; never post fake accounting in production. Commerce/QA. |
25
| **F0-04** · Print | Owner hardcopy/photo reproduced pale diagonal `پیشنویس — غیرقطعی` overlay on existing goods/services invoice; narrowly removed in PR #90; draft and pro-forma Chromium checks added, accounting state unchanged | **FIX RELEASED + CONTROLLED QA PASS; OWNER REPRINT UNVERIFIED** / P0 open | On the deployed PR #90 code, owner still checks a saved draft/ordinary sale invoice and purchase/pro-forma print: watermark absent, all rows/totals/dates visible; real printer/PDF and taxpayer-specific semantics are separate. Print QA. |
26
-| **F0-05** · Large selectors | `scripts/phase0-selector-stress.spec.js`, **1,208 synthetic products + 1,206 persons** passed 2/2; keyboard/Persian/metadata covered | **CONTROLLED QA PASS for products/persons; real catalog and other high-volume selectors UNVERIFIED** / P1 open | Owner tenant/real workstation test plus assess account/project/contract selectors where applicable; measure interactive latency. UX/Perf. |
26
+| **F0-05** · Large selectors | Synthetic product **1,208** and people **1,206** Chromium tests previously PASS. [PR #98](https://github.com/davoodmehraban89/Factor-easy/pull/98) additionally validates **1,206** tenant-scoped synthetic options for each of account rule, invoice project and generic contract selects: code/metadata/Persian label, keyboard Enter/End/Escape, no-match, no foreign-tenant fixture entries and **zero writes/postings**. PR head Quality `38225392045` **87/87 Chromium PASS** plus three disposable DB and accounting invariants, Security `38225392014` SUCCESS. CI measured filter time **108.5 ms account / 107.6 ms project / 113.4 ms contract** with 5000ms safety ceiling, **not an SLA**. | **CONTROLLED QA PASS for five 1200+ selector types; owner-large-tenant and journal-specific selector UNVERIFIED** / P1 owner gate open | Owner checks real company catalog, multiple projects/contracts/accounts and scroll/performance on own workstation; independent accounting journal `.je-account` handling is not covered by generic combo test and requires separate journey. No real RLS isolation proven. UX/Perf. |
27
| **F0-06** · Modal, keyboard, RTL, themes | Targeted dark contrast PR **#92** released to protected main `745bdc847a3c2db22048d1d545da0fad0ae5cc67`; exact SHA Quality **38218505600** (**85/85 Chromium**, including two dark/light contrast tests, 3 disposable DB), Security **38218505535**, Release **38218679192**, Pages **38218725537** all SUCCESS. Remote read-only HTTP confirms updated live JS theme bundle. | **DARK/LIGHT CONTRAST RELEASED + CONTROLLED QA PASS; broader UI and owner visual acceptance UNVERIFIED** / P1 open | Owner dark/light screen review in authenticated session, keyboard/modal/RTL scroll ownership and critical save/delete/import/export negative-path tests. UI/QA. |
28
| **F0-07** · Access and release safety | Security checks remain green. **Owner-reported central admin user creation HTTP 400** traced to real Auth HTTP 500 `organization license not found` (23503): live signup trigger inserted owner membership before required trial license. Controlled fix **PR #94** deployed: protected `main` `e664e8fdbc77b660dfc1fedff580b206279899f3`, Quality **38220163720** (**86/86 Chromium**, 3 disposable DB), Security **38220163569**, Release **38220396895**, Pages **38220451051** all SUCCESS. Supabase `fix_identity_bootstrap_license_before_membership` migration **20261012075507** applied successfully (total 82); independent read-only verification confirmed `profiles → organizations → licenses → membership`, original seat trigger retained, ordinary role and email/phone support preserved. Live admin JS version `20261012-provision-error-v1` reachable. | **ADMIN PROVISIONING ROOT-CAUSE FIX RELEASED + CONTROLLED QA PASS; actual owner retry and dual-user isolation E2E UNVERIFIED** / P0 still open | Owner rechecks central Users list (avoid duplicate account), refreshes and attempts authorized creation once without sharing credentials; verify created account has ordinary role and expected trial, then license assignment separately. Formal RLS/cross-tenant two-account negative E2E, Auth-advisor security audit and full F0-07 signoff remain pending. Security/QA. |
29
| **F0-08** · Stale PR reconciliation | Audit in `docs/FINORA_PHASE0_F008_PR_RECONCILIATION_2026-10-12.md`; #96 merged to main `2a4d637d0145f333412fbce0e299ab6962f0b262`, PR-head Quality **38223670528** (**86/86 Chromium**, 3 disposable DB and Golden accounting) and Security **38223670565** successful. Recorded live Supabase Wave4b migration and corrected prior stale statement. **Five superseded PRs #28/#43/#49/#57/#80 closed without merge with review comments; GitHub verifies four remaining open: #6/#39/#40/#58.** | **F0-08 RECONCILED / CLOSURE VERIFIED; four high-risk PRs retained for separate specialty review** | No stale PR integrated; investigate #6 accounting, #39/#40 physical RTL scroll and #58 identity/phone migration source drift under their separate safeguards. Phase 0 P0 authenticated acceptance still pending. Coordination/QA. |
scripts/phase0-selector-stress.spec.js
+73
@@ -60,3 +60,76 @@ test('F0-05 people: 1206 choices and 11-digit metadata filter with no implicit w
60
await expect(page.locator('#invoice-contact-id')).toHaveValue('C1199');
61
expect(await page.evaluate(()=>[window.__saves,window.__posted])).toEqual([0,0]);
62
});
63
+
64
+
65
+test('F0-05 1200+ account, project and contract comboboxes: scoped metadata, keyboard, no writes',async({page})=>{
66
+ await fixture(page);
67
+ await page.evaluate(()=>{
68
+ // All records are disposable fixture records. Ownership is resolved BEFORE
69
+ // option construction; this is not a substitute for real Supabase RLS.
70
+ const own=(prefix,label,codefield,number)=>Array.from({length:number},(_,i)=>({
71
+ id:prefix+i,ownerUserId:'QA',companyId:'ORG',name:label+' '+String(i).padStart(4,'0'),
72
+ code:prefix+'-'+String(i).padStart(5,'0'),
73
+ title:label+' '+String(i).padStart(4,'0')
74
+ }));
75
+ datastore.accounts=own('A','حساب آزمایشی','code',1205);
76
+ datastore.accounts.push({id:'AX',ownerUserId:'QA',companyId:'ORG',code:'442201',title:'حساب کنترل بانک',name:'حساب کنترل بانک'});
77
+ datastore.accounts.push({id:'HIDDEN_ACCOUNT',ownerUserId:'OTHER',companyId:'OTHER',code:'999999',title:'حساب شرکت محرمانه'});
78
+ datastore.projects=own('J','پروژه آزمایشی','code',1205);
79
+ datastore.projects.push({id:'JX',ownerUserId:'QA',companyId:'ORG',code:'PRJ-SPEC-44',floatingCode:'F-4444',name:'پروژه سیمانی ویژه'});
80
+ datastore.projects.push({id:'HIDDEN_PROJECT',ownerUserId:'OTHER',companyId:'OTHER',code:'OTHER-PRJ',name:'پروژه شرکت محرمانه'});
81
+ datastore.contracts=own('T','پیمان آزمایشی','code',1205);
82
+ datastore.contracts.push({id:'TX',ownerUserId:'QA',companyId:'ORG',code:'CNT-XL-2026',name:'پیمان خاص آبان'});
83
+ datastore.contracts.push({id:'HIDDEN_CONTRACT',ownerUserId:'OTHER',companyId:'OTHER',code:'OTHER-CNT',name:'پیمان شرکت محرمانه'});
84
+ const targets=[
85
+ {id:'af-rule-account',rows:datastore.accounts,heading:'انتخاب حساب'},
86
+ {id:'invoice-project-id',rows:datastore.projects,heading:'انتخاب پروژه'},
87
+ {id:'f0-contract-synthetic',rows:datastore.contracts,heading:'انتخاب پیمان'}
88
+ ];
89
+ for(const target of targets){
90
+ let s=document.getElementById(target.id);
91
+ if(!s){s=document.createElement('select');s.id=target.id;document.getElementById('view-invoices').appendChild(s)}
92
+ s.replaceChildren(new Option(target.heading,''));
93
+ target.rows.filter(x=>x.ownerUserId==='QA'&&x.companyId==='ORG').forEach(x=>{
94
+ const o=new Option(x.title||x.name,x.id);
95
+ o.dataset.search=[x.code,x.floatingCode].filter(Boolean).join(' ');
96
+ s.appendChild(o);
97
+ });
98
+ finoraRefreshSearchableSelect(s);
99
+ }
100
+ });
101
+ const listFor=id=>page.locator('#'+id).locator('xpath=..').locator('.finora-combobox-list');
102
+ const inputFor=id=>page.locator('#'+id).locator('xpath=..').locator('.finora-combobox-input');
103
+ const specs=[
104
+ {id:'af-rule-account',special:'442201',selected:'AX',other:'HIDDEN_ACCOUNT',name:'account',ordinary:'حساب آزمایشی 1199'},
105
+ {id:'invoice-project-id',special:'F-4444',selected:'JX',other:'HIDDEN_PROJECT',name:'project',ordinary:'پروژه آزمایشی 1199'},
106
+ {id:'f0-contract-synthetic',special:'CNT-XL-2026',selected:'TX',other:'HIDDEN_CONTRACT',name:'contract',ordinary:'پیمان آزمایشی 1199'}
107
+ ];
108
+ for(const spec of specs){
109
+ const input=inputFor(spec.id),list=listFor(spec.id),select=page.locator('#'+spec.id);
110
+ await input.click();
111
+ await expect(list.locator('[role="option"]')).toHaveCount(1206);
112
+ await expect(list.locator('[data-value="'+spec.other+'"]')).toHaveCount(0);
113
+ const elapsed=await page.evaluate(({id,q})=>{
114
+ const e=document.getElementById(id).parentElement.querySelector('.finora-combobox-input');
115
+ const t=performance.now();e.value=q;e.dispatchEvent(new Event('input',{bubbles:true}));return performance.now()-t;
116
+ },{id:spec.id,q:spec.special});
117
+ console.info('F0-05 '+spec.name+' filter browser ms:',elapsed.toFixed(1));
118
+ expect(elapsed,spec.name+' synthetic filter latency').toBeLessThan(5000);
119
+ await expect(list.locator('[role="option"]')).toHaveCount(1);
120
+ await input.press('Enter');
121
+ await expect(select).toHaveValue(spec.selected);
122
+ await input.click();
123
+ await input.fill('عبارت ناموجود');
124
+ await expect(list.locator('.finora-combobox-empty')).toContainText('موردی پیدا نشد');
125
+ await input.press('Escape');
126
+ await expect(select).toHaveValue(spec.selected);
127
+ await input.click();
128
+ await input.fill(spec.ordinary);
129
+ await expect(list.locator('[role="option"]')).toHaveCount(1);
130
+ await input.press('End');
131
+ await input.press('Enter');
132
+ await expect(select).not.toHaveValue(spec.selected);
133
+ expect(await page.evaluate(()=>[window.__saves,window.__posted])).toEqual([0,0]);
134
+ }
135
+});