فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

docs(A01): record customer refund permission checks and native CI

davoodmehraban89 committed Oct 20, 2026 at 11:00 UTC dc9b542f6feefbba6933e4de9db332e244675189
2 files changed +25
STATUS.md
+10
@@ -115,3 +115,13 @@ Review CI on latest A03 PR head, fix failing fixtures and ensure restore authori
115 - Formal review record: `reviews/A04-sequential-review-20261020.md` (three sequential assistant review passes, **not** independent agents). No artificial client data were used and no public installer release was created.
116 - **Acceptance boundary**: A04 verification uses synthetic data through an actually installed Windows application. It does **not** approve genuine customer backup recovery on the target device, physical power-loss testing, or independent financial/accountant approval. `DATA_BACKUP` and `INDEPENDENT_QA` remain **false** in the manifest; A01/A02/A05/A06/A07/A08 remain false. SHA-256/backup-internal anchors cannot authenticate an attacker-controlled whole backup; AES-GCM integrity is conditional on password secrecy.
117 - **Next ordered gate: A01** commercial corrections/reversals/refunds. Extract criteria from `docs/PHASE_A_BACKLOG_FA.md` and `docs/PHASE_A_EXIT_RUNBOOK_FA.md`, inspect existing `RetailPostingService` and tests, create a separate tested PR. Do not release publicly or claim Phase A complete.
118 +
119 +## A01 2026-10-20 continuation — scope incomplete / NOT ACCEPTED
120 +
121 +- PR #122 (https://github.com/davoodmehraban89/Factor-easyPro/pull/122) merged in main at caa5995d5b71f1a8c89b07941bcd7f8870a723d8. The RetailPostingService.recordCash transaction now requires Auth.isAdmin() before paying a customer refund linked to an already posted sale_return. The restriction is enforced in the service layer, not only UI.
122 +- A new regression in tests/retail-phase2.test.mjs checks that a clerk refund attempt leaves treasury, invoice paidAmount, journal and audit unchanged, while the manager-authorized refund succeeds and keeps the trial balance balanced.
123 +- Final PR SHA 90558e5247b41c7adf40aeac65b6bdd3470db165: quality run 39385076660 successful with 267/267 Linux and 267/267 Windows tests, frontend/npm audit/Windows build; native installed Windows lab 39385076705 successful.
124 +- Post-merge main SHA caa5995d5b71f1a8c89b07941bcd7f8870a723d8: quality run 39385956523 successful with 267/267 Linux and 267/267 Windows tests, frontend/audit/installer; native Windows VM run 39385956551 successful.
125 +- Three sequential assistant review passes are recorded in reviews/A01-refund-auth-sequential-20261020.md; they are NOT independent agents and do not approve the entire gate.
126 +- A01 remains accepted=false. Open acceptance scope includes representative sales/purchases/corrections, cheque reversals, explicit refund reasons/approval, fiscal-period edge cases, idempotency, reconciliation and independent financial signoff. Client-side IndexedDB controls do not authenticate hostile local storage. INDEPENDENT_QA and DATA_BACKUP remain false. No public release.
127 +- Next actionable work: select and implement the next unverified A01 scenario from docs/PHASE_A_BACKLOG_FA.md and docs/PHASE_A_EXIT_RUNBOOK_FA.md in a separate tested PR.
reviews/A01-refund-auth-sequential-20261020.md new
+15
@@ -0,0 +1,15 @@
1 +# A01 refund authorization — scoped sequential review (2026-10-20)
2 +
3 +This is three sequential assistant passes, not three independent agents and not an accountant signoff. Scope is the narrow PR #122 role-control fix, not full A01.
4 +
5 +## Pass 1: functional
6 +Read src/core/RetailPostingService.js and tests/retail-phase2.test.mjs. Existing tests cover sale-return credit available after payments, negative/refund-overlimit cases, concurrent payout attempts and balanced journal creation. New authorization check covers payment tied to sale_return before journal or treasury writes. Authorized manager payout remains available.
7 +
8 +## Pass 2: security and atomicity
9 +Auth.isAdmin() is checked inside RetailPostingService.recordCash, rather than relying on visible UI. Regression executes a clerk call with access to the company and proves no change to the return invoice, treasury, posted journals or audit count. This is a local application permission boundary; privileged direct IndexedDB modification remains outside its protection.
10 +
11 +## Pass 3: platform, regression and edge scope
12 +PR quality run 39385076660 on SHA 90558e5247b41c7adf40aeac65b6bdd3470db165: 267/267 Linux, 267/267 Windows and build/audit/installer success; installed NSIS/Tauri/WebView2 Windows VM run 39385076705 success. On merged main SHA caa5995d5b71f1a8c89b07941bcd7f8870a723d8: quality run 39385956523 (267/267 Linux and Windows, build/audit/installer) success; native VM run 39385956551 success.
13 +
14 +## Disposition
15 +Narrow A01 manager-refund permission patch is verified. A01 gate remains UNACCEPTED: full sales/purchase and cheque corrections, reason-coded refund workflow, period rules, idempotency, representative-ledger reconciliation and independent accountant review still require separate evidence. No customer backup, independent reviewer agents, real physical power-loss tests or public release are claimed.