سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 18:15 UTC
test(finora): assert persisted payment reversal graph not RPC counter
davoodmehraban89 committed
Nov 22, 2026 at 23:51 UTC
47f482f389f955824f653942cd14754c376eae50
3 files changed
+16
-3
PROJECT_STATE.md
+6
@@ -743,3 +743,9 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
743
- Replaced the misleading normal-PASS treasury correction test that celebrated immediate reposting. Retained its independent UI normal-PASS coverage for opening/cancelling the edit form without ledger writes and without mutating the original source/lines.
744
- Added two actual DOM Save expected-RED tests: inbound receipt correction and outbound payment correction. They seed a real posted source+voucher through the existing browser harness, invoke the loaded edit→Save path, and inspect synchronized source/voucher/lines. Exact current fingerprint requires original source and original journal lines unchanged, original reversal retained, correction source+linked voucher both POSTED, balanced lines, one correction link, three total vouchers and effective balance incorrectly includes the new correction. Required future state keeps the reversal/history, leaves the new source+linked balanced voucher DRAFT, creates no posted correction, and excludes the unapproved draft from effective posted balance.
745
- Strict `assertKnownRedOrFixed` rejects any unknown/orphan/unbalanced/partial state before xfail; a corrected state is a normal unexpected PASS that requires removal of `test.fail`. Marker: `FINORA_ISSUE238_PAYMENT_CORRECTION_EXPECTED_RED`. QA-only; no runtime, SQL/RPC/schema/RLS/Auth/grants, main, production or historical data touched. Final code SHA must rerun exact-head CI.
746
+
747
+### 2026-11-22 — FIN-QA-ISSUE238-PAYMENT-CORRECTION / first CI diagnosis and fixture repair
748
+- Exact SHA `3c9906b872656d33fe7389b02cfce6d4fc9454ed` Quality browser job found **two failures only** in the new inbound/outbound correction tests. Both observed the known persisted product defect (original voucher reversed, three vouchers, new correction posted and balanced) but the test expected `server.reverseCount===1`.
749
+- **Root cause:** the actual loaded `jeReverse` implementation creates and syncs a reversal voucher locally; it does not call the fixture's `qaF0Reverse` RPC counter. The counter is therefore not an authoritative source of truth. This is a QA assertion/fixture mismatch, not evidence of a different product state.
750
+- **Correction:** replace the mock RPC counter with a direct persisted graph assertion: exactly one `voucherType='reversal'`, `sourceType='reversal'`, `sourceId=original journal voucher` and status `posted`. Keep every desired product assertion unchanged: original immutable source/lines and reversal retained; new correction source and linked voucher must be DRAFT; no posted correction; balanced lines; draft excluded from effective posted balance. Any missing/duplicate/unposted reversal remains an unexpected CI failure. No product behavior or expected state weakened.
751
+- Re-run Quality/WP1/WP2/Security on the successor exact code SHA before accepting this QA checkpoint.
docs/EXECUTION_STATUS.md
+6
@@ -225,3 +225,9 @@
225
- آزمون قبلی که قطعیسازی فوری اصلاح خزانه را PASS میدانست، حذف و به دو بخش تفکیک شد: آزمون عادی عدم ایجاد ثبت هنگام بازکردن/لغو فرم؛ دو آزمون expected-RED برای اصلاح دریافت و پرداخت با مسیر واقعی Save.
226
- آزمونها اصل سند و آرتیکلهای تاریخی را حفظ میکنند و بررسی میکنند سند اصلاحی جدید با آرتیکل متوازن بهصورت DRAFT متصل بماند، تا قبل از تأیید وارد ماندهٔ قطعی نشود. رفتار فعلی که سند اصلاحی را همان لحظه قطعی میکند با نشانگر `FINORA_ISSUE238_PAYMENT_CORRECTION_EXPECTED_RED` ثبت میشود. هر حالت سوم یا ناقص، شکست واقعی CI است.
227
- تغییر فقط در مجموعه آزمون مرورگر و اسناد وضعیت است؛ هیچ کد مالی اجرایی، SQL/RPC، مجوز، اسکیما یا دادهای تغییر نکرده است.
228
+
229
+
230
+### ۲۰۲۶/۱۱/۲۲ — اصلاح شاخص آزمون اصلاح خزانه پس از شکست CI
231
+- Quality روی SHA `3c9906b8` دو آزمون جدید اصلاح دریافت/پرداخت را بهدلیل شمارندهٔ مصنوعی `server.reverseCount` رد کرد؛ اما خود لاگ، برگشت سند اصلی و سه سند ذخیرهشده را نشان داد.
232
+- مسیر واقعی برنامه برگشت را با ایجاد و همگامسازی سند برگشت محلی انجام میدهد و شمارندهٔ RPC آزمایشی را افزایش نمیدهد. معیار بهدرستی از شمارنده به گراف ذخیرهشده تغییر کرد: دقیقاً یک سند reversal متصل به سند اصلی و با وضعیت posted.
233
+- معیار محصول تغییر نکرد: سند اصلاحی جدید همچنان باید DRAFT و متوازن باشد و تا قطعیسازی مستقل در ماندهٔ قطعی محاسبه نشود. اجرای CI روی SHA بعدی لازم است.
scripts/accounting-document-workflow.spec.js
+4
-3
@@ -734,7 +734,8 @@ for(const direction of ['inbound','outbound'])test('P0 #238 expected RED: '+dire
734
correctionHasReversalLink:!!amended.correctionReversalId,
735
balancedCorrectionLines:lines.length>=2&&debit===credit&&debit===1250,
736
correctionAlreadyPosted:vouchers.some(x=>x.data.status==='posted'&&x.data.sourceType===sourceType&&x.data.sourceId===amended.id),
737
- originalReversalCount:server.reverseCount,
737
+ originalReversalVoucherCount:vouchers.filter(x=>x.data.voucherType==='reversal'&&x.data.sourceType==='reversal'&&x.data.sourceId===first.journalVoucherId).length,
738
+ reversalVoucherPosted:vouchers.filter(x=>x.data.voucherType==='reversal'&&x.data.sourceType==='reversal'&&x.data.sourceId===first.journalVoucherId).every(x=>x.data.status==='posted'),
739
voucherCount:vouchers.length,
740
effectiveAmounts:await page.evaluate(()=>paymentEffectiveRecords().map(x=>x.amount))
741
};
@@ -742,13 +743,13 @@ for(const direction of ['inbound','outbound'])test('P0 #238 expected RED: '+dire
743
originalSourceUnchanged:true,originalVoucherStatus:'reversed',originalLinesUnchanged:true,
744
correctionSourceStatus:'posted',correctionVoucherStatus:'posted',correctionLinkedToSource:true,
745
correctionHasReversalLink:true,balancedCorrectionLines:true,correctionAlreadyPosted:true,
745
- originalReversalCount:1,voucherCount:3,effectiveAmounts:[1250]
746
+ originalReversalVoucherCount:1,reversalVoucherPosted:true,voucherCount:3,effectiveAmounts:[1250]
747
};
748
const required={
749
originalSourceUnchanged:true,originalVoucherStatus:'reversed',originalLinesUnchanged:true,
750
correctionSourceStatus:'draft',correctionVoucherStatus:'draft',correctionLinkedToSource:true,
751
correctionHasReversalLink:true,balancedCorrectionLines:true,correctionAlreadyPosted:false,
751
- originalReversalCount:1,voucherCount:3,effectiveAmounts:[]
752
+ originalReversalVoucherCount:1,reversalVoucherPosted:true,voucherCount:3,effectiveAmounts:[]
753
};
754
assertKnownRedOrFixed(observed,knownBroken,required,'treasury-correction-'+direction);
755
if(isDeepStrictEqual(observed,knownBroken))