@davoodmehraban89 / Factor-easy / commits / d987d6b
Fork 0

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

docs(finora): record delegated company-scope JWT proof and tighten POST coverage

davoodmehraban89 committed Nov 23, 2026 at 18:19 UTC d987d6be44fda8534e51fc520cb0d32a6c22d906
1 file changed +8
PROJECT_STATE.md
+8
@@ -857,3 +857,11 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
857 - **Selected non-overlapping QA extension:** extend only `scripts/wp2-stock-tenant-jwt-e2e.mjs` with a third temporary Auth user C, active non-owner membership in disposable organization A, and `inventory:read` permission restricted to `scope_type='company'`, `scope_id=A1`. Raise only A's disposable test-license `max_users` to 2 (A owner + C) while preserving the real seat trigger. Verify C reads A1 `stockMovements` and `inventoryCounts`, cannot read same-org A2 or foreign-org B, and cannot create/edit/delete even A1 with read-only capability. Verify owner A still sees both A1/A2, and all original records remain unchanged.
858 - **Strict interpretation:** this validates server-side *company row scope for a delegated member*, not the UI's active-company selector/Kardex projection, not a general per-user license entitlement, not posting authorization, and not production RLS. A1/A2 owner visibility remains expected. No product JS, SQL/migration/RLS/Auth/grant, Production data, main, PR242, PR218, history or deployment will be changed. Any unexpected status/readback fails closed; no expected-red masking.
859 - **Owner/overlap:** QA-only continuation of PR243 on its existing PR242 child branch; Codex-main remains sole financial integration owner and reviewer. Existing PR240/242 browser defects and Issue229 sale/purchase approval expected-REDs remain untouched. After the note, implement the one test, run exact-SHA WP2/Quality/WP1/Security, and append the actual result before handoff. A90/B50/C20/D55/E53/F10 unchanged.
860 +
861 +
862 +### 2026-11-23 — FIN-QA-223-COMPANY-SCOPE-JWT / exact-head proof and stricter write-scope review
863 +- **Verified exact head before final assertion tightening:** `df143bda067c9b1015b57979038f24402e320cea`, Draft [PR243](https://github.com/davoodmehraban89/Factor-easy/pull/243), base PR242 QA branch @ `af07e7d7888dbb25db257f255579c04aa8c1f189`. All four exact-head workflows completed SUCCESS: Quality [45180259444](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45180259444) 272 Chromium + 4 Pages; WP1 [45180259616](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45180259616); WP2 [45180259682](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45180259682); Security [45180259587](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45180259587).
864 +- **Actual WP2 log:** `WP2_PHASE5_COMPANY_SCOPE_JWT_PASS` proves real Auth-issued non-owner C with `inventory:read` company scope A1 reads A1 `stockMovements` and `inventoryCounts`, not A2 or B; `WP2_PHASE5_READ_ONLY_MEMBER_CAPABILITY_PASS` proves PATCH/DELETE denied for both; original organization JWT isolation and posted immutability markers remain PASS. A owner legitimately reads both A1/A2. Issue229 sale and credit-purchase unauthorized posted-autopost Expected REDs remain in same successful WP2 log.
865 +- **Independent assertion audit found one narrow coverage gap despite green CI:** the read-only member POST assertion at `df143bda...` only attempted `stockMovements`, while its broad success marker referred to both supported collections. Tightened the QA test on new code SHA `0b15eaad209e3c51be7b9823034f14bfbee9c6dc` to attempt unauthorized POST independently for **both** `stockMovements` and `inventoryCounts`, and require HTTP 401/403 plus owner readback empty. No permission, RLS, product code, test expectation or migration changed. This is a QA completeness correction, not a newly discovered product defect.
866 +- **Final acceptance now pending:** all four CI workflows must rerun on the new docs-inclusive final SHA; do not inherit the `df143bda...` results. If a test fails, preserve it as a real failure and repair only the fixture/test logic where justified.
867 +- No application JS, SQL/migration, RLS/Auth/grants, production data, main, history, merge or release changed. Codex-main remains integration owner/reviewer. Six stage estimates remain A90/B50/C20/D55/E53/F10; delegated-scope proof is QA evidence, not product completion.