سامانه صدور فاکتور و حسابداری
Test real GitHub Pages CSP event wiring for Commerce and Quick Create (#150)
* docs: record production Pages button discrepancy before hardened-artifact regression * test: verify CSP-safe Pages bundle binds Commerce and Quick Create event handlers * docs: verify hardened Pages Commerce and Quick Create callbacks with 121 of 121 tests
davoodmehraban89 committed
Oct 15, 2026 at 21:02 UTC
928493f695eef8b5b6facbdca85dc96f3c9f67d9
2 files changed
+49
PROJECT_STATE.md
+11
@@ -741,3 +741,14 @@ Owner reports login blocked with generic 'check internet/VPN' network error on l
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.
scripts/pages-artifact.spec.js
+38
@@ -142,3 +142,41 @@ test('A blocked required core Pages group prevents opening partial financial wor
142
expect(output.visible).toBe('flex');
143
expect(output.user).toBe(null);
144
});
145
+
146
+
147
+test('Published Pages CSP event bindings open Commerce and the top-bar sales invoice menu',async({page})=>{
148
+ const pageErrors=[];
149
+ page.on('pageerror',e=>pageErrors.push(e.message));
150
+ await page.goto(base,{waitUntil:'domcontentloaded'});
151
+ await page.waitForFunction(()=>window.FinoraLoginActionsBound===true&&
152
+ typeof window.applyLicensedModuleUI==='function'&&
153
+ window.FinoraStartupStatus?.extensionsReady===true,{timeout:20000});
154
+ // Synthetic local only; no authenticated production session and no financial writes.
155
+ await page.evaluate(()=>{
156
+ currentUser={id:'qa-pages-navigation',role:'accountant',
157
+ modules:['full_suite'],
158
+ subscription:{type:'lifetime',status:'active',endDate:'2099-01-01'}};
159
+ document.querySelector('#auth-screen').style.display='none';
160
+ applyLicensedModuleUI();
161
+ });
162
+ const accounting=page.locator('#module-rail [data-module="accounting"]');
163
+ const commerce=page.locator('#module-rail [data-module="commerce"]');
164
+ await accounting.click();
165
+ await expect(page.locator('#view-accounting-foundation')).toHaveClass(/active/);
166
+ await commerce.click();
167
+ await expect(page.locator('#view-invoices')).toHaveClass(/active/);
168
+ await expect(page.locator('#module-panel-title')).toHaveText('بازرگانی');
169
+ await expect(page.locator('#module-panel-links')).toContainText('فاکتورها');
170
+ await expect(page.locator('#module-panel-links')).toContainText('کالا و خدمات');
171
+ // On the hardened Pages build, onclick was replaced by generated CSP-safe handlers.
172
+ // Testing raw source index.html alone cannot validate this event-wiring path.
173
+ const quick=page.locator('#quick-create-toggle');
174
+ await quick.click();
175
+ await expect(quick).toHaveAttribute('aria-expanded','true');
176
+ await expect(page.locator('#quick-create-menu')).toHaveClass(/open/);
177
+ await page.locator('#quick-create-menu button').filter({hasText:'فاکتور فروش'}).click();
178
+ await expect(page.locator('#view-invoices')).toHaveClass(/active/);
179
+ await expect(page.locator('#quick-create-menu')).not.toHaveClass(/open/);
180
+ await expect(quick).toHaveAttribute('aria-expanded','false');
181
+ expect(pageErrors).toEqual([]);
182
+});