سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 4, 10:30 UTC
docs(finora): scope cross-company and nondefault warehouse QA evidence
davoodmehraban89 committed
Nov 23, 2026 at 09:15 UTC
6aa5bced69344b0765d9739afaabb8409159171e
1 file changed
+6
PROJECT_STATE.md
+6
@@ -774,3 +774,9 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
774
- Extended existing `scripts/accounting-document-workflow.spec.js` with one actual loaded Phase5 inventory render/read-model Playwright regression on a synthetic authenticated Supabase fixture. Posted credit purchase: QA_CO/QA_WH/QA_PROD 2×50, source-linked POSTED voucher; DRAFT purchase: same scope 3×100, source-linked balanced DRAFT voucher; **no physical receipt/stockMovement**. Both journal lines validated as balanced before test.
775
- Expected current PRODUCT RED: `productMovement`/Kardex see only posted 2 units, but Phase5 operational inventory events include both sources, p5Stock + rendered stock show 5, weighted average + rendered cost show 80. Required effective read-model excludes the draft source: posted 2 and average 50, preserves visible committed purchase, and does not count draft until a separate authorized receipt. Exact wrong fingerprint alone yields `FINORA_ISSUE238_DRAFT_PURCHASE_STOCK_EXPECTED_RED`; unknown third state fails CI before expected failure. Future correct projection is ordinary PASS.
776
- No financial runtime JS, SQL/migrations, schema/permissions/Auth/RLS, posted history, main, prod or merge changes. Final exact-SHA CI must be checked and not confused with product acceptance.
777
+
778
+### 2026-11-23 — FIN-QA-ISSUE238-WAREHOUSE-COMPANY-READMODEL / pre-code decision
779
+- Owner asked to continue. **Live verified baseline** PR240 Draft HEAD `f899b81e937c23da74b5d76ca86536c8de4abfaf`, main `dab1a45fcfc4f12e675cfe055e477138cd3e99fa`; exact-head Quality #45117741580 (266 Chromium/4 Pages), WP1 #45117741432, WP2 #45117741450 and Security #45117741373 all SUCCESS; #216/#223/#229/#238 OPEN. Existing browser expected REDs reproduce known stock draft and count Save defects; not fixed product.
780
+- **New source-verified bugs needing executable evidence:** (1) `js/phase5-enterprise.js::p5OperationalEvents` returns `[]` for **non-default warehouse** before reading any posted purchases, so a valid posted purchase at W2 has no Phase5 stock event. (2) `getMyPurchases()` filters only owner; `p5OperationalEvents` does **not filter company** and falls back to default warehouse when `purchase.warehouseId` is absent; a same-owner *different company* posted purchase with legacy missing warehouse could be wrongly included in active-company stock. (3) `p5AverageCost` ignores purchase company/warehouse in its receipts; foreign-company purchases contaminate active-company valuation. **Read-model only**, not a proven database RLS/authorization leak.
781
+- **QA-only plan in same existing Draft PR240:** append two independent loaded browser tests to `scripts/accounting-document-workflow.spec.js` reusing the authenticated synthetic Supabase server. Test A: QA_CO warehouse QA_WH (default) + QA_WH2 (non-default), source-linked posted purchases 2×50 in WH and 3×100 in WH2; require W1=2, W2=3, posted company-wide movement=5 and correct UI rows; exact current known broken W1=2, W2=0, second warehouse UI=0; don't assume per-warehouse cost allocation because costing policy is not agreed. Test B: same-owner QA_CO (active) and QA_CO_B with explicitly missing historical warehouse field; only current-company posted purchase 2×50, other-company posted 4×200; require active-company Phase5 W1=2, avg=50 and posted-only Kardex/productMovement=2. Exact current broken Phase5 W1=6, avg=150 while Kardex=2. Neither test inserts an independent warehouse receipt/stockMovement; all test-source POSTED vouchers must be source-linked with balanced lines.
782
+- **Acceptance:** exact known broken fingerprint alone emits `FINORA_ISSUE238_OTHER_WAREHOUSE_EXPECTED_RED` or `FINORA_ISSUE238_CROSS_COMPANY_STOCK_EXPECTED_RED` as transparent Playwright expected product RED; unknown/orphan/incorrect tenant/ledger/display third state is ordinary CI FAIL before expected failure; future correct state becomes ordinary PASS. Avoid reclassifying valuation company-vs-warehouse costing policy as decided (only company isolation is mandatory). No changes to app financial JS, migrations, SQL, Auth/RLS/grants, hosted database, main, posted history, PR merge/release; owner-only Codex-main handles actual product repair. Same existing browser test and status docs only. Exact-head Quality/WP1/WP2/Security required.