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

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

docs(finora): record Issue248 guarded delete migration decision before implementation

davoodmehraban89 committed Nov 24, 2026 at 10:53 UTC e18d56ec3c3f9bc4bf3ad8688c7b4fe3a08c1de2
1 file changed +6
PROJECT_STATE.md
+6
@@ -499,3 +499,9 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
499 - Owner expressly confirmed in chat "تاییده استارت بزن" after proposal to transfer responsibility for financial core implementation to this conversation. Prior QA-only division superseded for scoped development on a separate review branch; do not concurrently edit the existing owner/QA heads. Main/Production, destructive history conversions, merge/release remain prohibited without separate safeguards/approval. No hosted DB access.
500 - New branch `fix/financial-lifecycle-recovery-20261124` created from QA PR247 exact `eaa873c3c22d43d5c5a8e1c8e98ec46ff3c9abae` (PR219 parent `ab14e46abec4b8ef1f36c4f219d9a9ba6d99bc6d`; protected main `dab1a45fcfc4f12e675cfe055e477138cd3e99fa`). WP2 real signed JWT draft/tenant isolation passed; overall WP2 4/22 adapter tests passed due syntax and obsolete purchase Save expectation. WP1 local RED Issue248; ledger negative PASS. Prior isolated first-save reproduction in PR219 comment 7124650687 showed syntax error and, after in-memory newline correction, TypeError assignment to constant variable for both sale/purchase, persistence stub once/RPC zero. No product fix previously.
501 - First bounded implementation: repair source-draft adapter parsing and refreshed context/version checks after persistence; prevent concurrent draft creation, preserve canonical server RPC and readback. Add behavior tests for sale/purchase first Save (draft only, no post), refreshed source fields, changed context and failed persistence. Replace only stale purchase Save autopost static expectation with draft-only requirement and separate explicit finalizer. Existing legacy autopost behavioral assertions must be reviewed against current explicit finalize contract; do not silently green them or bypass independent approval. Validate exact changed code in isolated JavaScript and GitHub CI, keep known P0/P1 release gates red until fixed. Issue248 trigger-order repair and P0 approval/RBAC are next separate bounded changes, not claimed complete. Existing mass history conversion/identity exposure are release blockers; no production conversion. Progress unchanged A90/B50/C20/D55/E53/F10 until verified.
502 +
503 +
504 +### 2026-11-24 — FIN-CORE-RECOVERY-02 / Issue248 correction decision
505 +- Recovery PR249 exact `0bc8e86a23263602663476ce30a6814afdfcc3cd`: Security #45346161597 SUCCESS; WP2 #45346161495 actual signed JWT owner/foreign tenant controls PASS, adapter 23/29 PASS including seven new first-save tests (six legacy finalize-contract failures). Quality #45346161469 FAILURE outdated static purchase-autopost expectation, three database jobs SUCCESS. WP1 #45346161527 still running when checked. Previous 7/7 in-memory proof is now corroborated by Node CI. Main unchanged. Do not label whole candidate green.
506 +- Authorized independent product recovery, next bounded migration for Issue248: split existing lifecycle INSERT/UPDATE trigger from DELETE; run DELETE-only lifecycle trigger lexically **after all existing BEFORE DELETE guards** so both draft rows remain visible during guard validation. Do not alter posted-source guard or coalesce missing status to draft. New private delete trigger must explicitly validate draft source/voucher states, same org/company/owner, reverse linkage, fiscal period and registry identity, delete authorization on both records, lock related row before cascade, remove journal children while draft parent still present, keep single ATF tombstone via existing function. Reject missing/mismatched link rather than bypass guards. Use existing trigger-depth recursion boundary for paired deletion; transaction abort on errors/deadlock; concurrent/race proof still required. Unrelated source types remain outside new cascade scope. No destructive data migration; separate rollback restoring prior trigger topology. Existing public identity RPC exposure and original history-conversion migration are still blockers. No hosted DB, merge, release, or modification of PR219/247.
507 +- Add strict regression for linked draft deletion, missing/reverse-mismatched link denial, children cleanup and tombstone; existing positive/posted tests retained. CI disposable DB only, exact SHA. A90/B50/C20/D55/E53/F10 unchanged pending full proof.