@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / 94b294e
Fork 0

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

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

Synced Dec 3, 20:45 UTC

docs: record purchase Auth/JWT parity QA scope before implementation

davoodmehraban89 committed Nov 22, 2026 at 08:15 UTC 94b294e65415c3d1901fb5a40365f3318bd6cfa8
1 file changed +7
PROJECT_STATE.md
+7
@@ -507,3 +507,10 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
507
508
509 - **2026-11-22 actual WP2 RED on first SHA:** PR227 `21709742c51a296b0d6044dc5125374c017de3aa`, [WP2 44985153735](https://github.com/davoodmehraban89/Factor-easy/actions/runs/44985153735) failed **after** `FINORA_SOURCE_JWT_ATOMIC_PASS`. Auth JWT source commercial-field PATCH, forged source-link PATCH and source DELETE had all returned expected explicit financial guard denials. JWT posted journal-line PATCH was ALSO rejected by financial guard SQLSTATE `P0001` with exact message `posted/reversed journal lines are immutable`. Narrow test regex erroneously expected only `FINORA_POSTED_JOURNAL_CHILD_IMMUTABLE`; this is a QA assertion mismatch, not a server-accepted mutation. Widen the assertion solely to these two exact known guard messages. Subsequent linked draft-delete and readback checks had not been executed due to early assertion; rerun entire WP2/Quality/WP1/Security on new SHA. Never weaken production guard or claim fully green until exact-head success.
510 +
511 +
512 +### 2026-11-22 — FIN-QA-PURCHASE-JWT (decision recorded before code)
513 +- **Exact-head Stage C acceptance:** Draft PR227 SHA `9c66f0d872c3b14c6fb3a7e0d600477adf2755fe` [Quality 44985352819](https://github.com/davoodmehraban89/Factor-easy/actions/runs/44985352819) SUCCESS (251/251 browser + 4/4 auxiliary, all DB jobs), [WP1 44985352864](https://github.com/davoodmehraban89/Factor-easy/actions/runs/44985352864) SUCCESS, [WP2 44985352836](https://github.com/davoodmehraban89/Factor-easy/actions/runs/44985352836) SUCCESS (sale JWT atomicity/replay and posted-source PATCH/DELETE/line/RPC protections), [Security 44985352817](https://github.com/davoodmehraban89/Factor-easy/actions/runs/44985352817) SUCCESS (CodeQL+safety; Dependency review SKIPPED). All exactly same SHA. PR227 comment records final results; main unchanged, Codex-main review pending.
514 +- **Coverage gap and reuse:** Effective `supabase/migrations/20261117110000_wp1_autopost_source_link_atomic.sql` handles both `sale/invoices` and `purchase/purchases`. Existing `supabase/tests/wp1_phase1a_stage1_sale_purchase_negatives.sql` executes purchase positive plus invalid accounts using SQL role simulation, but `scripts/wp2-source-autopost-jwt-e2e.mjs` proves **only sale** using a genuine Auth-issued user token over HTTP and never validates the matching **purchase** path, audited replay or posted-source guard as JWT owner. This is specific unverified behavior, not a reason to reimplement existing purchase code or add another engine.
515 +- **QA-only scope:** new branch `qa/purchase-source-jwt-20261122` from green PR227 HEAD; extend same existing WP2 script and synthetic approved account role snapshot to include legitimate `purchase_default` expense and `payable_control` liability. Test persisted **credit purchase** source → real JWT `finora_journal_autopost`, debit purchase expense and credit accounts payable, source links/status/counter/audit, replay with different caller voucher ID, and authenticated posted purchase data/link tamper rejection; assert unchanged persisted records, audit and counter. Keep existing sale/Auth/tenant tests unchanged. Only existing PROJECT_STATE, docs/EXECUTION_STATUS and docs/ACCOUNTING_CORE_ROADMAP_V1, and WP2 script may change; current WP2 path filter already covers this file. No SQL migration, financial JS, RLS, production settings, deployed data or main change.
516 +- **Acceptance:** exact SHA WP2 real Auth/JWT local Supabase test, Quality/WP1/Security gates, preserve RED and remedy only a proven test/setup mismatch. Detect actual accepted invalid purchase edit as a product defect for Codex main. Any status short of completed SUCCESS must remain pending. Passing does **not** mean draft-first source linkage/ATF permanent numbering/cheque/history/production acceptance. Keep parent PR227 GREEN head unchanged, child PR Draft for independent Codex review.