@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / ea8c77e
Fork 0

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

Mirrored from https://github.com/davoodmehraban89/Factor-easy.git

Synced Dec 4, 10:30 UTC

docs(finora): scope Issue238 draft purchase inventory projection proof

davoodmehraban89 committed Nov 23, 2026 at 08:54 UTC ea8c77ef0da3a6f4ab48e83152ce157fd7ac989f
1 file changed +7
PROJECT_STATE.md
+7
@@ -762,3 +762,10 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
762 - Inherited the actual Playwright authenticated synthetic Supabase harness rather than creating a parallel ledger. Added one genuine loaded-DOM `p5SaveCount` browser test: seeded **two opening units @ 25** in one tenant/company, physical count 5 (variance +3, valuation +75), with exact inventory and adjustment accounts. The opening movement is a fixture prerequisite because weighted-average cost is otherwise zero.
763 - Asserts persisted **inventoryCount -> stockMovement -> journalVoucher -> two balanced journalLines** graph; exact current posted stock/journal fingerprint (stock 2→5, posted valuation +75) vs required pending linked balanced DRAFT (stock stays 2, posted ledger unchanged). Verifies source company/qty/valuation and 1:1 graph; unknown/orphan/duplicate/unbalanced/partial states throw `FINORA_ISSUE238_INVENTORY_COUNT_THIRD_STATE` **before** any expected-RED masking. `FINORA_ISSUE238_INVENTORY_COUNT_EXPECTED_RED` emitted only for the exact current defect; a corrected source-linked draft would be normal PASS.
764 - Source limitation: this browser test uses synthetic sync and checks client lifecycle, NOT real-JWT authorization, server transaction boundaries, or accounting finalization. Codex-main owns a single authoritative implementation. **Final exact-SHA CI not yet verified**. No financial app JS, SQL/migration, schema/RLS/Auth/grants, protected main, hosted DB, production, release or merge.
765 +
766 +### 2026-11-23 — FIN-QA-ISSUE238-DRAFT-PURCHASE-STOCK / pre-code decision
767 +- **Owner request:** continue real QA after PR240 exact head `5bdfe03dc0141e10ec1bdcb613f547a60fb7903f` completed **Quality, WP1, WP2, Security SUCCESS**. PR240 is Draft, and `main` remains `dab1a45fcfc4f12e675cfe055e477138cd3e99fa`. Preserve owner-only product/SQL/Auth/merge/Production boundaries.
768 +- **New distinct code-verified read-model conflict:** `js/phase5-enterprise.js::p5OperationalEvents` counts **every purchase** as stock, `p5AverageCost` includes **every purchase** in weighted-average receipts, whereas `js/accounting.js::productMovement` and `js/products.js::productKardexRows` count only posted/legacy_review purchases. `purchaseDocumentStatus` derives effective status from the linked journal. A **DRAFT purchase with no separately committed physical receipt** must not affect effective stock or weighted-average valuation merely by Save.
769 +- **Implementation scope:** amend **existing Draft PR240** (no new QA PR) on branch `qa/finora-issue238-inventory-count-browser-red-20261123`. Extend only the current `scripts/accounting-document-workflow.spec.js` + append-only `PROJECT_STATE.md` and `docs/EXECUTION_STATUS.md` with one loaded-browser deterministic read-model test. Seed the existing authenticated synthetic Supabase fixture with one posted linked purchase (2 units @ 50) and one linked DRAFT purchase (3 units @ 100), both same company/warehouse/product, with balanced synthetic voucher lines and no posted warehouse receipt for draft. Verify both purchase status resolution and that `productMovement`/Kardex consistently project **2** while current Phase5 stock incorrectly projects **5**, current Phase5 average cost **80**, and its rendered inventory table reflects the wrong numbers. Desired Phase5: stock **2**, average cost **50**, excluding the DRAFT from effective operational purchase events and read model. This is a stated acceptance policy *only where no independent physical receipt/commit exists*; if physical receipt is a separate event, product owner must define its recognition contract.
770 +- **Fail-closed sentinel:** exact known defect fingerprint -> transparent `FINORA_ISSUE238_DRAFT_PURCHASE_STOCK_EXPECTED_RED` and Playwright expected-failure; corrected consistent status-aware stock/average/Kardex -> regular PASS; all third states, missing linked vouchers, wrong source status, company/warehouse, unbalanced seeded graph or mismatched display -> **real CI failure before xfail**.
771 +- **Boundary:** synthetic authenticated browser test, NOT a real-JWT inventory permission exploit or production proof. No production JS, SQL/migrations, RLS/Auth/grants, ledger history, main/merge/hosted database or release changed. Run exact successor head Quality/WP1/WP2/Security; verify specific browser marker, not only green CI. Phase completion estimates unchanged.