سامانه صدور فاکتور و حسابداری
test(finora): fail CI when expected-RED retry identity unexpectedly turns green
davoodmehraban89 committed
Nov 22, 2026 at 20:30 UTC
19a0e1dba4040266f811bad056ad1e5ed7daa1c9
4 files changed
+22
PROJECT_STATE.md
+5
@@ -689,3 +689,8 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
689
- [WP2 45045339689](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45045339689) **SUCCESS** with live disposable real-JWT manual positive proof AND still-**unfixed** `FINORA_ISSUE229_APPROVAL_EXPECTED_RED` / `FINORA_ISSUE229_PURCHASE_APPROVAL_EXPECTED_RED`: non-owner commerce:create-only seller actually POSTs sale and credit purchase. [Security 45045339639](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45045339639) **SUCCESS** (Dependency review SKIPPED). [WP1 45045339727](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45045339727) was **IN PROGRESS** on the exact code/docs head at this checkpoint; local Supabase job SUCCESS, ledger job ongoing. A completed verdict cannot be claimed from this checkpoint.
690
- Source-grounded root: `js/journal-rpc.js::jeRpcAutoPostOnce` allocates `p_voucher_id:afId('JV')` anew at each invocation, whereas manual `jeRpcCreateDraft` has an existing `jeRpcPendingCreate` reuse mechanism. Effective server `20261117110000_wp1_autopost_source_link_atomic.sql` currently replays a prior committed source/version and may avoid duplicates, but the client still violates ADR216's stable idempotency identity and loses its identity after ambiguous response/reload. **Do not build a second server autopost engine**. Codex-main should design a stable org/company/source/version-scoped request identity, safe on ambiguous response, rejection, account switch and reload; then turn both TODOs into normal PASS with real DB/PostgREST proof.
691
- This follow-up updates the existing roadmap and execution-status files **in one docs-only commit** after the QA-code SHA. Its newly triggered CI must be verified on the new final SHA separately; previous CI success must not be reattributed. No financial source, SQL migration, Auth/RLS, production data, protected main, merge or deployment was changed. Issue216/229 remain open, six-phase estimates A90/B50/C20/D55/E53/F10 unchanged.
692
+
693
+### 2026-11-22 — FIN-QA-RETRY-ID / fail-on-unexpected-fix TODO sentinel
694
+- **QA correctness correction in the same Draft PR236:** Node v22.16.0 `node:test` was independently probed: a **passing** `test.todo` callback still reports `TODO` with exit code 0, just as a failing callback does. Therefore the earlier pair of executed TODO callbacks alone does not force review if the product later fixes its retry identity. This is a real test-contract blind spot, not a new product defect.
695
+- Added two **ordinary PASS, clearly named QA fingerprint sentinels** in `scripts/journal-rpc-adapter.test.mjs`, one for sale and one for purchase. Each independently runs the ambiguous-response/one-voucher replay harness and asserts the *currently known divergence only as a defect fingerprint*; if stable identity is ever observed, the normal PASS sentinel **fails CI** with the explicit demand to **remove the TODO and make equality an ordinary PASS assertion**. The TODO contract still asserts the actual desired stable ID and still records the known RED. This pattern is for safe xfail triage only; it must never be counted as product acceptance.
696
+- This one small test-only change and append-only status documents form a **new SHA**: earlier Quality/WP1/WP2/Security on `1d5adf7...` belong only to the previous state. Validate all triggered final-HEAD workflows before claiming any new result; no finance runtime, SQL/RPC, permissions, main or production changes.
docs/ACCOUNTING_CORE_ROADMAP_V1.md
+4
@@ -477,3 +477,7 @@ This register maps execution stages A/B to the **existing** accounting Phase 6 (
477
| FIN-P0-RETRY-ID | رفع نقص تولید `p_voucher_id` جدید در هر فراخوانی پس از نتیجهٔ نامطمئن | Codex اصلی (مالک کد مالی) | FIN-QA-RETRY-ID، پایان کار مالی فعال، Issue216 و طرح idempotency | مسدود در محصول | همان شناسه در retry و بعد از reload؛ رد تغییر سازمان/نسخه؛ عدم ثبت دوباره و تراکنش rollback؛ بررسی مستقل | PR محصول هنوز ایجاد نشده | `js/journal-rpc.js::jeRpcAutoPostOnce` اکنون `afId('JV')` داخل هر درخواست اجرا میکند؛ تست متضاد قدیمی اصلاح شد | انتخاب کوچکترین اصلاح توسط مالک؛ هیچ موتور موازی یا تغییر تاریخی اجرا نشود |
478
479
**حد و مرز:** موفقیت QA در کشف خطا به معنی پذیرش محصول نیست. P0 مجوز مستقل قطعیسازی Issue229 نیز همچنان باز است. نسبت پیشرفت فازها از این ثبت افزایش نمییابد.
480
+
481
+### ۲۰۲۶-۱۱-۲۲ — FIN-QA-RETRY-ID: شرط fail-on-unexpected-fix برای TODO
482
+- **تصحیح معیار پذیرش QA:** `node:test.todo` در صورت PASS ناخواستهٔ callback نیز TODO/exit0 میدهد؛ دو تست `QA fingerprint` عادی فروش/خرید در [PR236](https://github.com/davoodmehraban89/Factor-easy/pull/236) اضافه شدند تا رفع نقص بدون حذف TODO و تبدیل آن به PASS عادی، CI را متوقف کند. این PASS صرفاً **نگهبان triage نقص شناختهشده** است و به معنی صحت شناسههای درخواست نیست.
483
+- **خروج صحیح:** Codex اصلی شناسهٔ پایدار را پیاده کند، دو `test.todo` و دو نگهبان موقت «نقص وجود دارد» را حذف/تبدیل کند، تست `assert.equal` عادی را برای فروش و خرید فعال کند و real JWT/DB/rollback مجدد بگذرد. CI commit جدید باید جداگانه تأیید شود؛ SQL مالی، Production، `main` و PRهای مالک بدون مجوز تغییر نمیکنند.
docs/EXECUTION_STATUS.md
+5
@@ -1,5 +1,10 @@
1
# وضعیت اجرای فینورا
2
3
+### ۲۰۲۶-۱۱-۲۲ — اصلاح صحت QA برای Issue216؛ جلوگیری از پنهانشدن رفع نقص
4
+- آزمایش مستقل در Node 22 نشان داد `test.todo` حتی اگر assertion موفق شود، بهعنوان TODO و exit=0 شمرده میشود؛ بنابراین **صرف وجود دو TODO شکست موردانتظار، آیندهٔ اصلاح محصول را تضمین نمیکند**. به [PR236](https://github.com/davoodmehraban89/Factor-easy/pull/236) دو تست عادی با عنوان صریح «QA fingerprint» اضافه شد: در صورت ثابتشدن شناسه، آنها CI را **شکست میدهند** تا TODO مربوط حذف و assertion مطلوب `assert.equal` به PASS عادی تبدیل شود.
5
+- این کنترل **وجود نقص فعلی را برای مدیریت xfail** پایش میکند، نه اینکه نقص محصول را تأیید یا مجاز کند. آخرین اجرای کامل قبلی `1d5adf7da159e997f3541eba0dc80263bceace0f` با Quality/WP2/Security موفق ثبت شده، اما اصلاح QA در commit جدید نیازمند بررسی گیتهای همان SHA تازه است؛ WP1 قبلی نیز هنوز باید بررسی شود. تغییر محصول/SQL/مجوز یا merge انجام نشده است.
6
+
7
+
8
### ۲۰۲۶-۱۱-۲۲ — FIN-QA-RETRY-ID؛ نقص واقعی شناسهٔ ثابت درخواست پس از قطع پاسخ
9
- **هدف جاری:** تثبیت و تحویل QA مستقل برای قرارداد replay در فروش/خرید؛ مالک اصلاح کلاینت و هسته مالی **Codex اصلی** است، بدون تغییر موازی `js/journal-rpc.js` و RPC/SQL.
10
- **انجامشده و شواهد:** در [PR236 Draft](https://github.com/davoodmehraban89/Factor-easy/pull/236)، تست گمشدن پاسخ پس از commit، برای فروش و خرید با سناریوی مستقل اجرا شد. [Quality 45045339870](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45045339870) **SUCCESS** روی SHA `e72b92844695897457020e68ef4bd0918eb4c432`: مجموعه RPC **۲۵ PASS، ۲ TODO واقعی و ناموفق، ۰ FAIL خارج از TODO، ۰ SKIP**. لاگ واقعی هر دو `JV_2 !== JV_1` و نشانگرهای `FINORA_ISSUE216_RETRY_ID_EXPECTED_RED sale/purchase` را نشان میدهد؛ مرورگر ۲۵۸ PASS، Pages چهار PASS. QA روی **نقص جاری** موفق است، نه محصول.
scripts/journal-rpc-adapter.test.mjs
+8
@@ -265,6 +265,14 @@ for(const kind of ['sale','purchase']){
265
test('ambiguous '+kind+' auto-post keeps tenant/source/version and replays only one linked voucher',async()=>{
266
await observeAmbiguousAutoPostReplay(kind);
267
});
268
+ // Node test.todo counts even an unexpectedly passing callback as TODO/exit 0.
269
+ // Ordinary PASS fingerprint must fail as soon as the known request-ID defect
270
+ // disappears, forcing review and conversion of the TODO to a real PASS.
271
+ test('QA fingerprint for #216: '+kind+' request ID still changes on uncertain retry',async()=>{
272
+ const {calls}=await observeAmbiguousAutoPostReplay(kind);
273
+ assert.notEqual(calls[1].args.p_voucher_id,calls[0].args.p_voucher_id,
274
+ '#216 retry request identity now stable; remove expected-RED TODO and enforce stable identity as normal PASS');
275
+ });
276
test('P0 expected RED: ambiguous '+kind+' auto-post must reuse exact voucher request ID',{
277
todo:'#216: current jeRpcAutoPostOnce generates a NEW p_voucher_id on retry; TODO executes the required equality assertion'
278
},async()=>{