سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 4, 08:00 UTC
docs(finora): record real JWT generic-sync P0, create-only P1 and approval evidence correction
davoodmehraban89 committed
Nov 23, 2026 at 22:19 UTC
47a360b29e988f14545754ad03cbca38c7b57704
1 file changed
+8
PROJECT_STATE.md
+8
@@ -907,3 +907,11 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
907
- First actual sync-RPC QA code SHA `f9255e2153b10b3dcf272e2478f0086bc94c6382`, [WP2 #45240907560](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45240907560) **COMPLETED SUCCESS with expected PRODUCT RED** for authenticated generic sync draft→posted: non-owner company A1 `inventory:read/create/edit` without `inventory:approve` directly upserted both stockMovements/inventoryCounts from draft to POSTED, RPC HTTP204/204, independent real owner JWT readback exact persisted state. Existing direct PostgREST INSERT201/201 and draft→posted PATCH204/204 P0 RED remain.
908
- **Important potential false-positive correction:** the same run returned RPC HTTP403/403 for *posted create* by a separate `inventory:create`-only actor with no persisted rows. It emitted `FINORA_PHASE5_SYNC_RPC_POSTED_INSERT_APPROVAL_PASS`, BUT that marker is not yet a proven status-specific approval enforcement: SQL `finora_sync_records` uses `INSERT ... ON CONFLICT DO UPDATE`, which may be blocked for any create-only actor because of UPDATE RLS, even for a legitimate draft. Thus do **NOT** claim the RPC insert approval boundary is repaired or safe until a **positive-control draft create via the same real creator-only JWT, same RPC, same collections** is proved. If generic sync denies both lawful drafts, report a distinct known-product-RED/capability failure (not permission security PASS) with safe error code only and no secrets, and retain the confirmed separate UPDATE P0. Preserve all prior RED/PASS assertions and fail closed on partial or third states.
909
- Scope remains a narrow existing QA test script plus append-only canonical docs/Issue245 handoff, no product SQL/RLS/JS/Auth changes or protected main/Production writes. Commit/retest on exact SHA. Phase A90/B50/C20/D55/E53/F10 unchanged.
910
+
911
+
912
+### 2026-11-23 — FIN-QA-245-SYNC-RPC-PROOF / actual user-JWT verdict & Issue246
913
+- **Independent executed code SHA `0bd0b7b83b097154575e5c855a4b25468fb7e876`**, [WP2 #45241591795](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45241591795) COMPLETED SUCCESS in *disposable local Supabase*: genuine A1-scoped owner/creator/editor Auth JWTs, three real license seats, owner-independent exact readback. Existing PostgREST **P0 RED** persisted: both stock/count posted INSERT HTTP201/201 by creator without inventory:approve, and both draft→posted PATCH HTTP204/204 by editor without inventory:approve.
914
+- **New actual generic-sync vulnerability:** `FINORA_PHASE5_SYNC_RPC_POSTED_UPDATE_WITHOUT_APPROVE_EXPECTED_RED`: a different company-scoped non-owner `inventory:read/create/edit` member *without* approve successfully saves real DRAFT stock/count via `finora_sync_records` then directly upserts both to POSTED through SAME RPC (HTTP **204/204**); owner-JWT readback confirms exact posted records. This is the actual UI sync API, not just direct REST.
915
+- **Mandatory positive-control correction** to avoid falsely claiming approval safety: same true A1 creator-only user can directly HTTP201 POST records, but `finora_sync_records` returns HTTP**403** PG code `42501` for **BOTH legitimate DRAFT stock/count creates** (no owner-visible persisted rows). This is separate **P1 delegated creation defect** tracked [Issue246](https://github.com/davoodmehraban89/Factor-easy/issues/246). The same creator-only RPC returns HTTP403 for POSTED creates; it is **INCONCLUSIVE** as evidence of proper approval because lawful drafts were equally denied. Original pre-positive-control marker `FINORA_PHASE5_SYNC_RPC_POSTED_INSERT_APPROVAL_PASS` from earlier run #45240907560 must NOT be cited as status-specific authorization acceptance. Corrected code #45241591795 emits `FINORA_PHASE5_SYNC_RPC_POSTED_INSERT_DENIED_INCONCLUSIVE`. Later QA log-evidence struct value is refined to `denied_like_lawful_draft_inconclusive` for integrity; only the final exact-head CI validates that refinement. Why generic RPC denies create-only is under investigation; SQL `INSERT ON CONFLICT DO UPDATE` vs create/edit RLS is a hypothesis, not proven exact source.
916
+- **Handoff links:** [Issue245 combined proof and caveat](https://github.com/davoodmehraban89/Factor-easy/issues/245#issuecomment-7110676210), [Issue246 create-only draft functional regression](https://github.com/davoodmehraban89/Factor-easy/issues/246), Draft [PR244](https://github.com/davoodmehraban89/Factor-easy/pull/244). Do not “repair” capability by granting inventory:edit or owner power to all create-only users. Codex-main must implement genuine create-only DRAFT sync positive path AND unauthorized posted source negative boundaries across direct REST and sync, independently approved server FINALIZE, atomic audit/journal/fiscal/tenant guards. Issue229 sale/purchase unauthorized approval P0s still known RED, not fixed.
917
+- **Implementation scope:** QA script + accurate existing WP2 step label; append-only canonical PROJECT_STATE/docs status; PR stays Draft. No product JS, SQL/migrations/RLS/Auth/grants, historical financial rows, Supabase Production, main, merge/release/deploy touched. Four final-code+docs SHA Quality/WP1/WP2/Security still required and must not inherit the previous WP2 PASS. Progress A90/B50/C20/D55/E53/F10 unchanged: this is evidence, not financial core completion.