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

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

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

Synced Dec 3, 20:45 UTC

docs: verify Issue229 purchase and sale real-JWT P0 RED across four CI gates

davoodmehraban89 committed Nov 22, 2026 at 15:43 UTC 3e10e8c24892b36cc52dbaf4ad2e484793cc077e
3 files changed +21
PROJECT_STATE.md
+8
@@ -582,3 +582,11 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
582 - **Bounded QA change:** append a credit-purchase case in `scripts/wp2-source-approval-boundary-jwt-e2e.mjs`, reusing the same non-owner JWT (`commerce:create` true, `accounting:approve` false). Prepare two legitimate purchase ledger accounts plus an immutable approved role snapshot version 2, exactly as the existing `scripts/wp2-source-autopost-jwt-e2e.mjs` fixture already does. Verify real PostgREST `finora_journal_autopost` response and persisted purchased source, unique posted voucher, payable/expense debit-credit entries, actor audit and final-number sequence; mark result `FINORA_ISSUE229_PURCHASE_APPROVAL_EXPECTED_RED` only when both the unauthorized posting and durable journal graph are proven.
583 - **Owner/source boundaries:** This is *defect reproducibility* (test-accepted RED), not product acceptance. Codex main retains the transactional draft-first source/voucher lifecycle and distinct approval authorization remediation. A legitimate product fix may cause the expected-RED probe to fail; do not weaken permission checks to keep it green. Preserve both Issue216/229 OPEN.
584 - **Acceptance / next work:** node syntax parse; exact-head WP2, Quality, WP1, Security on a new commit; inspect proof marker in WP2 log; update execution status/roadmap and handoff PR/Issue with verified SHA. No merge/release.
585 +
586 +
587 +### 2026-11-22 — FIN-P0-229-PURCHASE-JWT verified completion and owner handoff
588 +- **Verified test code SHA:** `bd244962915824d0ad825e99b5cda4d530f18402` in [Draft PR231](https://github.com/davoodmehraban89/Factor-easy/pull/231), stacked on Draft PR230/PR228. **ALL FOUR exact-SHA workflows completed SUCCESS:** [Quality 45019982985](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45019982985), [WP1 45019983033](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45019983033), [WP2 45019982974](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45019982974), [Security 45019982983](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45019982983). Dependency Review conditional SKIPPED (not a PASS). Quality contains 253/253 browser and 4/4 Pages passes, including TWO known Issue229 `test.fail` expected-product-RED cases; successful CI is not product acceptance.
589 +- **New real-JWT purchase evidence (Issue229-specific):** The same Auth-issued **non-owner** JWT was confirmed `commerce:create` authorized, `accounting:approve` unauthorized and held no reusable assigned role. Server still permitted `finora_journal_autopost` for **credit purchase**; the test verified persisted source `posted`, ONE linked posted journal, exactly two balanced entries (expense debit 170, payable credit 170), matching Auth actor audit and next server final-number counter. Exact WP2 log marker: `FINORA_ISSUE229_PURCHASE_APPROVAL_EXPECTED_RED`. Existing sale bypass marker `FINORA_ISSUE229_APPROVAL_EXPECTED_RED` also fired in the SAME successful WP2 run, proving both source types. Source positive/rollback/replay and posted source immutability tests remain separately green.
590 +- **Code and boundary:** Only `scripts/wp2-source-approval-boundary-jwt-e2e.mjs` was extended; reuse of approved role-snapshot v2 purchase QA pattern, no SQL schema/migration or product financial JavaScript/RBAC/Auth changes; no mutation of main, hosted DB or historical posted data. Last independently rechecked protected main SHA `dab1a45fcfc4f12e675cfe055e477138cd3e99fa`. PR231 remains Draft, unmerged, unpublished; Issues216 and 229 OPEN. This is a **verified product authorization defect** despite all-green QA.
591 +- **Next owner action:** Codex-main independently reviews and implements the existing ADR216 source + linked draft atomic create/update/delete lifecycle and separate `accounting:approve`-authorized Finalize; explicitly deny or remove the legacy `autopost` bypass for create-only users. Then convert both expected-RED real-JWT probes to normal denied-seller/allowed-approver PASS with DB state, rollback, idempotency, concurrency, historical posting invariants and purchase Save browser test; remove two `test.fail` only when truly fixed. No parallel replacement engine or PR217/PR219 destructive posted→draft migration.
592 +- **Documentation SHA note:** This entry is a subsequent **documentation-only** commit; all four proven CI verdicts above refer to immutable CODE SHA `bd244962...`, NOT automatically to the new documentation HEAD. Check any newly triggered checks separately; do not merge or release.
docs/ACCOUNTING_CORE_ROADMAP_V1.md
+6
@@ -462,3 +462,9 @@ This register maps execution stages A/B to the **existing** accounting Phase 6 (
462 - وضعیت ردیف `FIN-P0-229-AUTHZ` از «در پیاده‌سازی / بدون شاهد» به **«پذیرفته‌شده در آزمون کشف نقص؛ منتشرنشده»** تغییر مفهومی می‌کند؛ به معنی پذیرش قابلیت یا رفع Issue229 نیست. کد PR231 `7d1e580ce04f232fb7bccb9306fe87ed87d33e24` در [WP2 45011087900](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45011087900) شواهد واقعی Auth/JWT و DB readback دارد: غیرمالک دارای commerce:create اما فاقد accounting:approve توانسته autopost سند فروش را posted کند. مبنای قرارداد ADR216 صریحاً این رفتار را ممنوع می‌داند.
463 - Quality [45011087889](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45011087889) و Security [45011087929](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45011087929) موفق روی SHA کد؛ دو تست مرورگر Issue229 همچنان `test.fail` و از نظر محصول RED هستند. WP1 [45011087895](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45011087895) هنگام نوشتن این یادداشت در حال اجراست. PR231 Draft و Codex اصلی بازبین نهایی است.
464 - معیار خروج برای **محصول** تغییر نکرد: source+linked draft create/update/delete تراکنشی، پایداربودن ATF و tombstone، Finalize مستقل با accounting:approve، رد legacy autopost bypass برای کاربر فقط دارای مجوز create، JWT مثبت/منفی و rollback/replay/هم‌زمانی؛ سپس حذف xfail و تأیید PASS واقعی. هیچ ادغام، انتشار یا تبدیل تاریخچه مجاز نیست.
465 +
466 +
467 +### FIN-P0-229-PURCHASE-JWT — Phase 6/8 evidence and product-blocker clarification (2026-11-22)
468 +- **QA accepted as an Issue229 purchase+sale defect reproducer only:** Draft [PR231](https://github.com/davoodmehraban89/Factor-easy/pull/231), code SHA `bd244962915824d0ad825e99b5cda4d530f18402`. Exact-head [Quality 45019982985](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45019982985), [WP1 45019983033](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45019983033), [WP2 45019982974](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45019982974) and [Security 45019982983](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45019982983) ALL SUCCESS (Dependency Review conditional skipped). QA contained 253 browser passes with two issue229 `test.fail` known RED cases.
469 +- **Live JWT evidence:** The restricted non-owner seller with `commerce:create` but no `accounting:approve` can post BOTH sale and credit-purchase source through existing `finora_journal_autopost`. The purchase probe checks durable single linked voucher, balanced expense/payable 170/170, audit attribution and number allocation. Both `FINORA_ISSUE229_APPROVAL_EXPECTED_RED` and `FINORA_ISSUE229_PURCHASE_APPROVAL_EXPECTED_RED` markers were observed in one successful WP2 run. This means **authorization lifecycle NOT accepted**, not a financial-system fix.
470 +- **Exit criteria unchanged:** preserve posted history/ATF/tombstones; transactionally create/edit/delete source+linked draft; disallow create-only user Finalize including old RPC; independent approver JWT must Finalize once with versions and audit; then ordinary browser/JWT tests PASS without `test.fail`, plus rollback/replay/concurrency/tenant checks. Codex-main owns code/integration; no main merge, release or Production changes. Follow-on documentation commit head must have its own exact-SHA check status; do not transfer code SHA check conclusions.
docs/EXECUTION_STATUS.md
+7
@@ -178,3 +178,10 @@
178 - **شکست‌ها و اصلاح‌های fixture:** اجرای اول WP2 قبل از RPC مالی به محدودیت یک صندلی مصنوعی رسید؛ max_users=2 در داده موقت آزمون اصلاح شد. اجرای دوم، پاسخ posted واقعی گرفت اما کوئری بازخوانی SQL به‌دلیل تقدم عملگر خطا داشت؛ عبارت اصلاح و اجرای سوم کامل موفق شد. هیچ‌کدام به‌عنوان رفع نقص محصول گزارش نشده است.
179 - **مرز:** بدون تغییر SQL مالی/مجوز عملیاتی، main، سایت، داده واقعی یا migration؛ PR Draft و بازبینی مستقل Codex اصلی باز. Issue229/216 باز می‌مانند.
180 - **نقطه ادامه:** `.github/workflows/free-supabase-local-e2e.yml::Reproduce Issue229 missing independent approval with real non-owner JWT` و `scripts/wp2-source-approval-boundary-jwt-e2e.mjs`؛ نتیجه WP1 را تکمیل و کد نهایی جدا از commit مستندات بازبینی کن. سپس مالک باید آزمون منفی نقش ثبت‌کننده و آزمون مثبت تأییدکننده را با قابلیت draft-first واقعی به PASS عادی برساند.
181 +
182 +
183 +### ۲۰۲۶-۱۱-۲۲ — تکمیل آزمایش مستقل P0: جدانبودن مجوز قطعی‌سازی خرید و فروش
184 +- **کد آزموده‌شده:** `bd244962915824d0ad825e99b5cda4d530f18402` در [PR231 Draft](https://github.com/davoodmehraban89/Factor-easy/pull/231). **چهار گیت همان SHA موفق:** [Quality 45019982985](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45019982985) شامل ۲۵۳ آزمون مرورگر و ۴ Pages، [WP1 45019983033](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45019983033)، [WP2 45019982974](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45019982974)، [Security 45019982983](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45019982983). Dependency Review به‌صورت مشروط skipped بوده و دو تست مرورگر Issue229 همچنان `test.fail` هستند.
185 +- **شاهد مالی واقعی (محیط disposable):** کاربر غیرمالک با JWT واقعی دارای `commerce:create` و فاقد `accounting:approve` با RPC موجود `finora_journal_autopost` هم **فروش** و هم **خرید اعتباری** را posted کرد؛ بازخوانی PostgreSQL برای خرید: منبع و یک سند مرتبط posted، بدهکار هزینه ۱۷۰ و بستانکار پرداختنی ۱۷۰، audit با همان actor و شماره قطعی دوم. نشانگرهای `FINORA_ISSUE229_APPROVAL_EXPECTED_RED` و `FINORA_ISSUE229_PURCHASE_APPROVAL_EXPECTED_RED` هر دو در همان WP2 موفق ثبت شدند.
186 +- **طبقه‌بندی:** گیت‌ها PASS آزمون شناسایی نقص، **قرارداد محصول FAIL/P0**؛ این اجرا به معنی رفع مشکل یا قابل انتشار شدن محصول نیست. PR231 ادغام‌نشده، Issue216/229 باز؛ main، داده واقعی، migration مالی، Auth/RBAC و تاریخچه قطعی تغییر نکرده است.
187 +- **مالک و نقطه ادامه:** Codex اصلی یک مسیر تراکنشی یکپارچه source+linked-draft برای Save/Update/Delete و قطعی‌سازی مستقل با مجوز `accounting:approve` ارائه کند؛ مسیر old autopost نباید دورزننده مجوز باشد. پس از اصلاح، دو تست expected-RED مرورگر و هر دو تست JWT باید به آزمون عادی رد نقش ثبت‌کننده/موفقیت تأییدکننده تبدیل شوند و Quality/WP1/WP2/Security روی کد نهایی و بررسی تاریخچه موفق شوند. شماره گیت‌های بالا مربوط به SHA کد است؛ Commit مستنداتی بعدی نیازمند بررسی جداگانه است.