سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 17:00 UTC
QA: stabilize mock accounting login after asynchronous organization bootstrap (#154)
* docs: reconcile concurrent F0-02 PR and record isolated accounting fixture bootstrap stabilization * test: avoid accounting mock auth race with delayed organization bootstrap
davoodmehraban89 committed
Oct 15, 2026 at 22:06 UTC
5f4ca4a6746557edc43a5106500587ad7784beab
2 files changed
+12
-1
PROJECT_STATE.md
+6
@@ -773,3 +773,9 @@ Owner reports login blocked with generic 'check internet/VPN' network error on l
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.
scripts/accounting-document-workflow.spec.js
+6
-1
@@ -35,7 +35,12 @@ async function installHarness(page,server){
35
}
36
async function authenticatedMockBrowser(page){
37
await page.goto(BASE,{waitUntil:'domcontentloaded'});
38
- await page.waitForFunction(()=>typeof enterApp==='function'&&typeof commitSaveInvoice==='function'&&typeof pullAll==='function');
38
+ // The synthetic account must not race the organization entitlement wrapper.
39
+ // Function availability precedes completion of asynchronously loaded ERP modules.
40
+ await page.waitForFunction(()=>typeof enterApp==='function'&&typeof commitSaveInvoice==='function'&&
41
+ typeof pullAll==='function'&&window.FinoraStartupStatus?.extensionsReady===true&&
42
+ window.FinoraStartupStatus?.failedExtensionCount===0&&
43
+ window.FinoraStartupStatus?.authChecked===true,{timeout:20000});
44
await page.evaluate(async()=>{
45
window.__FINORA_PRINT_TEST_MODE=true;
46
window.__f0Alerts=[];