سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 20:45 UTC
docs: record proven Issue229 JWT authorization RED with exact QA evidence
davoodmehraban89 committed
Nov 22, 2026 at 13:52 UTC
822fd87969b66f9f1347dca44a3f9d375c8ec39f
3 files changed
+23
PROJECT_STATE.md
+9
@@ -565,3 +565,12 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
565
- **Interpretation:** the script deliberately returns `FINORA_ISSUE229_APPROVAL_EXPECTED_RED` only after *persisted posting* is observed by a real restricted JWT. If permission isolation, Auth, PostgREST, or fixture fails, the script fails rather than treating a setup error as proof. Existing product SQL/JS remains untouched; this is **a defect reproduction, not a repair**.
566
- **Unverified:** local E2E could not execute in this worker's runtime (no Postgres/Supabase CLI or local stack); exact-head GitHub WP2/Quality/WP1/Security have not been checked yet; independent owner review is outstanding. Commit IDs and PR link must be copied from verified remote state after PR creation.
567
- **Next exact work:** inspect workflow `.github/workflows/free-supabase-local-e2e.yml::local-supabase` step `Reproduce Issue229 missing independent approval with real non-owner JWT`; if WP2 fails, inspect job/step log to distinguish fixture failure, legitimate permission-denial (owner code changed), and actual product contract RED; correct QA fixture only without bypassing guards. Then check Quality/WP1/Security on identical HEAD, report precise tests and owner handoff. No merge, deploy or production SQL.
568
+
569
+
570
+### 2026-11-22 — FIN-P0-229-AUTHZ verified real-JWT contract RED; PR231 code checkpoint
571
+- **PR/base/code SHA:** [Draft PR231](https://github.com/davoodmehraban89/Factor-easy/pull/231), base PR230 `3cdbfd5a213098f59518fb1b5757c4c16ddeed03`, verified **code** `7d1e580ce04f232fb7bccb9306fe87ed87d33e24`. This checkpoint follows the earlier PRE-CI plan; it supersedes that checkpoint's unverified CI fields without erasing history.
572
+- **Actual work:** added a locally constrained, real Auth-issued non-owner JWT probe using `commerce:read/create`, NO `accounting:approve`, and no assigned reusable roles. The permission matrix was checked against the live database predicate. On the staged source autopost path, the restricted user **successfully POSTED** a sale journal despite missing independent approval; PostgreSQL read-back proved linked source `posted`, journal `posted`, two balanced lines, Auth-user audit, and consumed final-number counter. Evidence marker: `FINORA_ISSUE229_APPROVAL_EXPECTED_RED`.
573
+- **Real CI on exact code SHA:** [WP2 45011087900](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45011087900) **SUCCESS**, including this explicit *expected product RED* and existing real-JWT sale/purchase atomicity and immutable posted-source tests; [Quality 45011087889](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45011087889) **SUCCESS** (253/253 Playwright including TWO `test.fail` expected-product-RED cases, 4/4 Pages, all 4 Quality jobs); [Security 45011087929](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45011087929) **SUCCESS**, conditional Dependency Review SKIPPED. [WP1 45011087895](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45011087895) was **IN PROGRESS** when this checkpoint was written; local-stack job SUCCESS, `ledger-negative-and-behavior` running. Do not infer WP1 PASS before completion.
574
+- **Fixture corrections, not product defects:** First WP2 failed setting up second synthetic organization member due to one-seat license; corrected fixture `max_users=2` without changing a guard. Second WP2 reached real-JWT POSTED response but failed at SQL JSON extraction precedence during read-back; parentheses corrected. Earlier RED runs were not product acceptance evidence. Third run verified persistent ledger evidence.
575
+- **No overlap or release:** no change to financial JS, SQL migrations, RLS/permissions, posted history, Codex-main-owned source files, main or hosted DB. Independent Codex-main review and issue acceptance remain PENDING; PR231 stays Draft. Green WP2 means an authorization **defect was reproduced**, not repaired.
576
+- **Precise next task:** check WP1 `45011087895` final state, then inspect `PR231` diff and CI for this docs-only successor SHA; pass the verified proof from `scripts/wp2-source-approval-boundary-jwt-e2e.mjs` to Codex main. Owner must provide one transactional source-linked draft CRUD and distinct approve-authorized finalize, block legacy autopost bypass, then flip this expected-RED proof to a proper deny/allow test on an approved final SHA. No merge/deploy.
docs/ACCOUNTING_CORE_ROADMAP_V1.md
+6
@@ -456,3 +456,9 @@ This register maps execution stages A/B to the **existing** accounting Phase 6 (
456
| شناسه | هدف | مسئول | وابستگی | وضعیت | معیار پذیرش | PR/SHA | شاهد | اقدام بعدی |
457
|---|---|---|---|---|---|---|---|---|
458
| FIN-P0-229-AUTHZ | اثبات عملی جدانبودن مجوز ثبت منبع و قطعیسازی در autopost موجود | QA مستقل؛ بازبین/مالک کد مالی Codex اصلی | PR230→PR228→PR218/PR212، Issue229 و ADR0216 | در پیادهسازی (CI دقیق لازم است) | تست JWT غیرمالک فقط commerce:create و بدون accounting:approve از سرویس واقعی؛ تأیید source+posted voucher+خطوط+audit+counter؛ گزارش صریح expected-RED، بدون اعلام رفع نقص | شاخه qa/issue229-approval-boundary-jwt-20261122، SHA نهایی پس از CI | `scripts/wp2-source-approval-boundary-jwt-e2e.mjs` و `.github/workflows/free-supabase-local-e2e.yml` (نتیجه CI هنوز بررسی نشده) | اجرای واقعی WP2 و سایر گیتها روی SHA نهایی؛ کد مالی/ادغام/انتشار فقط با مالک |
459
+
460
+
461
+### ۲۰۲۶-۱۱-۲۲ — FIN-P0-229-AUTHZ checkpoint تصحیح پس از آزمون واقعی (Phase 6/8)
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 واقعی. هیچ ادغام، انتشار یا تبدیل تاریخچه مجاز نیست.
docs/EXECUTION_STATUS.md
+8
@@ -170,3 +170,11 @@
170
- **محدوده:** `scripts/wp2-source-approval-boundary-jwt-e2e.mjs` و Workflow WP2، ثبت وضعیت در اسناد. هیچ تغییر در کد مالی، SQL migration، Auth/RLS، `main`، Production یا فایلهای تحت مالکیت Codex اصلی. guard مقصد محلی قبل از هر درخواست مالی برقرار است.
171
- **تفسیر:** موفقیت احتمالی این آزمون، **اثبات نقص فعلی** (قطعیکردن با مجوز صرفاً ایجاد منبع) است، نه برطرفشدن Issue229؛ شکست قبل از احراز نقش یا خطای fixture نیز نباید «محصول RED» گزارش شود. پس از اصلاح مالک، آزمون باید قرارداد نهایی «Save مجاز، Finalize غیرمجاز با نقش محدود، Finalize موفق با تأییدکننده» را بهصورت PASS واقعی کنترل کند.
172
- **اقدام بعدی:** ساخت Draft PR با base شاخه PR230، بررسی دقیق CI روی SHA همان PR (WP2، Quality، WP1، Security)، ثبت لاگ و بازبینی مستقل Codex اصلی؛ بدون merge/deploy.
173
+
174
+
175
+### ۲۰۲۶-۱۱-۲۲ — FIN-P0-229-AUTHZ؛ ثبت نتیجه CI واقعی و نواقص باقیمانده
176
+- **انجامشده با شاهد:** [PR231](https://github.com/davoodmehraban89/Factor-easy/pull/231) در کد SHA `7d1e580ce04f232fb7bccb9306fe87ed87d33e24` آزمون JWT غیرمالک با `commerce:create` و بدون `accounting:approve` را در Supabase آزمایشی اجرا کرد؛ مسیر فعلی `finora_journal_autopost` سند فروش را قطعی کرد؛ اتصال منبع، سطرهای متوازن، حسابرسی و شماره سروری از DB بازخوانی شد. برچسب `FINORA_ISSUE229_APPROVAL_EXPECTED_RED` **اثبات نقص محصول** است، نه قبولی قرارداد قطعیسازی.
177
+- **گیتها روی SHA کد:** [WP2 45011087900](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45011087900) موفق؛ [Quality 45011087889](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45011087889) موفق (۲۵۳ مرورگر شامل ۲ مورد xfail شناختهشده، ۴ Pages و چهار Job)؛ [Security 45011087929](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45011087929) موفق (Dependency Review = skipped)؛ [WP1 45011087895](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45011087895) هنگام ثبت در حال اجرا، Job local-stack موفق و Job دفترکل ادامه دارد. نتیجه WP1 روی SHA جدید تا مشاهده نهایی باز است.
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 عادی برساند.