@davoodmehraban89 / Factor-easy / commits / b1ef86b
Fork 0

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

docs(finora): diagnose active-company foreign voucher review fixture

davoodmehraban89 committed Nov 23, 2026 at 09:25 UTC b1ef86bc3483c1f66db6b246e0e52135eb3dfc61
1 file changed +6
PROJECT_STATE.md
+6
@@ -786,3 +786,9 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
786 - Other warehouse scenario: same company, WH1 posted 2×50 and WH2 posted 3×100. Current `p5OperationalEvents` first-line default-only guard projects 2 into WH1 but **0** into WH2; required per-warehouse stock 2/3 and both Phase5 rendered rows correct. Cost-method per warehouse is NOT asserted because no product-owner valuation policy chosen.
787 - Cross-company scenario: same owner, active company QA_CO WH1 posted 2×50; QA_CO_B posted 4×200 purchase with **legacy absent warehouseId**. Company-scoped `productMovement`/Kardex correctly show active 2; Phase5 currently maps foreign legacy purchase to current default warehouse (6 units) and average cost 150, while correct active-company projection is 2 units/avg 50. This is owner-level read-model scoping, **not** evidence of foreign-owner SQL RLS bypass.
788 - Tests are **fail-closed**: only exact POSTED known-broken fingerprint prints `FINORA_ISSUE238_OTHER_WAREHOUSE_EXPECTED_RED` / `FINORA_ISSUE238_CROSS_COMPANY_STOCK_EXPECTED_RED` and xfails; correct future projections pass normally and third/partial status/linked/UI states throw ordinary Playwright errors. New exact commit CI not yet verified. QA/docs only; no financial runtime, SQL, Auth/RLS/grants, main, Production, hosted DB, posted history or release changes.
789 +
790 +### 2026-11-23 — FIN-QA-ISSUE238-WAREHOUSE-COMPANY-READMODEL / first CI fail-closed repair decision
791 +- Exact SHA `f1c80fd2043461eb6b1bec163898570d2a55e646` [Quality #45120021818](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45120021818) **FAILED: 1 failed / 267 passed**. The new **other-warehouse** test printed exact marker `FINORA_ISSUE238_OTHER_WAREHOUSE_EXPECTED_RED` (known product failure confirmed). The new **cross-company** test correctly FAILED CLOSED with `FINORA_ISSUE238_WAREHOUSE_THIRD_STATE`, but its observed source-state field was `QA_PUR_FOREIGN:legacy_review` whereas test fixture assumed `posted`. Every actual stock/valuation/display measure matched known product defect: company A Kardex/productMovement 2, Phase5 A stock 6/average 150, foreign posted source counted.
792 +- **Verified cause:** `purchaseDocumentStatus` resolves journal via active-company scoped `getMyJournalVouchers`/source accessor, so from QA_CO an actual source-linked POSTED QA_CO_B voucher is not visible; foreign purchase is conservatively tagged `legacy_review`. The synthetic server still proves the source+foreign-company voucher POSTED and balanced in test setup. This **does not** prove a database tenant/JWT bypass; `getMyPurchases` is same-owner across companies, and Phase5 ignores its company scope.
793 +- **Narrow QA assertion repair authorized in the same existing PR240:** change only the **observed, shared active-company foreign-source effective-status expectation** from `posted` to `legacy_review` for both exact-known-broken and required scopes. Continue asserting actual foreign-company source-linked voucher is POSTED/balanced before starting browser, active company and warehouse unchanged, its receipt/valuation excluded from company A, and exact 6/150 vs 2/50 read-model divergence. Preserve strict third-state failure (no generic xfail, no weakening of isolation acceptance). Other-warehouse test must remain unchanged.
794 +- No app financial JS, SQL/migrations/Auth/RLS, hosted DB, main, posted history, merge or deploy changed. New exact-SHA 4-gate Quality/WP1/WP2/Security rerun required. Prior WP2/Security SUCCESS and WP1 status belong only to `f1c80fd2043461eb6b1bec163898570d2a55e646`.