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

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

docs: record Kardex root cause, RED evidence and scoped repair (#216)

davoodmehraban89 committed Nov 22, 2026 at 01:28 UTC a36c2ebd6783e6b59c278a72ec0751a5f5ca5a5d
1 file changed +2
PROJECT_STATE.md
+2
@@ -447,3 +447,5 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
447 - **Independent exact-head log triage:** (a) `accounting-document-workflow.spec.js:485`: `productMovement('QA_PROD').available === 2` but `productKardexRows('QA_PROD').reduce(qty) === 0`; mismatch is real in this test, root cause **not yet isolated**. (b) `commerce-route-types.spec.js` and multiple `ux-hardening-r2.spec.js` tests: `#finora-membership-lock.modal-backdrop.active` intercepts click; distinguish fixture membership readiness from a product authorization defect before touching guards. (c) `phase0-invoice-persistence.spec.js`: expected product option `QA_PROD` count 1, got 0; investigate account/tenant data hydration and timing, not just selectors. Thirteen failures are **not** thirteen proven application defects. Preserve all assertions.
448 - **Selected independent work:** evidence-only diagnosis, non-overlapping documentation and handoff in branch `docs/qa-ci-triage-218-20261122` based on PR218 head. PR220 owns the audit overview; this worker appends only exact-run diagnostic evidence and acceptance matrix. Potential overlap in canonical documentation with PR220 must be resolved by main Codex through selective integration, not auto-merge.
449 - **Next verification:** collect isolated browser traces for the three failure clusters at PR218 exact SHA, with matching organization membership fixture; compare current main/PR212 to classify regressions; then targeted RED/GREEN changes by designated implementation owner, followed by same-SHA Quality, Security, WP1, WP2 and independent review. No such rerun or green repair is claimed here.
450 +
451 +- **2026-11-22 continuation / verified source-level root cause FIN-QA-218-01:** `js/accounting.js` declares `purchaseAffectsBalance` inside an IIFE, not on `window`. `js/products.js::productKardexRows` previously guarded its purchase loop with `typeof purchaseAffectsBalance==='function'`, always false in the independent module; therefore purchase Kardex=0 even when `productMovement` includes posted purchases (observed exact-head RED in Quality `44949211793`, 236 pass/13 fail). The original Kardex also omitted active-company filtering present in inventory movement. Scoped correction commit `91221fa4ca4abc98bedb6d9c074dfae4494c8cb3` uses `purchaseDocumentStatus` with posted/legacy_review and the same active-company/legacy-company rules as `productMovement` for purchase and sale lines. Existing `scripts/accounting-document-workflow.spec.js:485` and subsequent reversal/repost assertions are unchanged. **Post-fix CI and independent review must be inspected before acceptance**. The other 12 old failures are not attributed to this change. No SQL, source financial data, production changes or owner-occupied files changed.