سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 4, 09:15 UTC
docs(finora): record bounded Issue248 trigger-order and rollback diagnosis before test edit
davoodmehraban89 committed
Nov 24, 2026 at 10:10 UTC
d970bef69d45664f08f94cdd12eaf1617d30cb17
1 file changed
+6
PROJECT_STATE.md
+6
@@ -481,3 +481,9 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
481
- **Likely mechanism (not separately instrumented trigger order):** PR219 `20261118100000_journal_document_lifecycle.sql` BEFORE DELETE source trigger first removes linked draft voucher; prior `20261117120000_wp1_stage3_canonical_source_link_projection.sql` public posted-source guard then `SELECT INTO voucher_status` finds no linked row (NULL), `source_locked` becomes NULL due SQL OR tri-state, and `IF NOT source_locked` does not return, thus falls through to posted-history immutable error. Confirm trigger order in separate disposable SQL instrumentation before selecting corrective design; never disable posted immutability.
482
- **Tracking:** opened [Issue248 P1](https://github.com/davoodmehraban89/Factor-easy/issues/248) with exact evidence/acceptance. Notified Codex-main via [PR219 owner handoff](https://github.com/davoodmehraban89/Factor-easy/pull/219#issuecomment-7112139779). Required product repair: authenticated authorized draft source↔voucher deletion both directions atomic, tombstone/ATF nonreuse, correct tenant/company/fiscal scope, absolutely no posted/reversed history mutation; preserve direct/real-JWT negative cases and ensure positive draft case. Test stays **failing** to prevent misleading release gate. Financial migration, JS and tenant guards remain Codex-main exclusive.
483
- **Current QA SHA gate separation:** for the tested `65e667b9...`, Security #45252233657 FAILED and Quality #45252233620 FAILED (parent PR219 JS SyntaxError), WP2 #45252233673 FAILED (parent Auth-fixture guard), local WP1 SQL job FAILED (real new P1; entire WP1 still in_progress last checked). These are **not** fixed by QA-only PR247. Protected `main` still `dab1a45fcfc4f12e675cfe055e477138cd3e99fa`, PR219/247 Draft. No production data/permissions/migration/merge/deploy touched. This docs append creates a new SHA **without new business or test code changes**; exact new SHA workflow results must not be claimed inherited. Stage A90/B50/C20/D55/E53/F10 unchanged.
484
+
485
+
486
+### 2026-11-24 — FIN-QA-248-TRIGGER-TRACE / diagnostic decision before implementation
487
+- Verified current main `dab1a45fcfc4f12e675cfe055e477138cd3e99fa`, Draft PR219 `ab14e46abec4b8ef1f36c4f219d9a9ba6d99bc6d`, Draft PR247 `898b1f89265533edf9a5e5bcfb5a89cedeaa957e`. Issue248 remains OPEN. All four exact-head CI workflows FAILED (WP1 #45252929212, WP2 #45252929036, Quality #45252929173, Security #45252929167). In WP1 ledger-negative-and-behavior completed SUCCESS; local stack FAILED. Actual latest SQL log again confirms manual lifecycle PASS, tombstone/nonreuse PASS, persisted linked draft precondition PASS, followed by false posted-history error in finora_guard_posted_source_records.
488
+- **One bounded QA diagnostic only:** instrument disposable test SQL within its existing BEGIN/ROLLBACK, with a unique observational BEFORE DELETE trigger ordered lexically between the candidate lifecycle trigger and existing posted-source guard. Its function must be read-only, return OLD unchanged, target only the synthetic WP4_INV_B invoice, print catalog order and persisted linked voucher presence/status/registry state and reconstructed nullable guard predicate; no change to business SQL, permissions, existing guard definitions or production. Use a test-only exception subtransaction around the actual source DELETE; on refusal verify exact before/after source, voucher and registry row snapshots and audit rows, then rethrow original error so CI still fails. A repaired product must not be rejected merely because observed order/state changes: trace is diagnostic, not a new release gate. Positive source-delete completion must still verify no source, no voucher, and registry tombstone. All instrumentation stays inside disposable fixture rollback, not migrations or deployable product.
489
+- Scope child Draft PR247: `supabase/tests/wp4_journal_document_lifecycle.sql` and append-only continuity. Do not touch PR219 product implementation or main; no production DB access. Codex-main owns correction. No repeated fixture churn beyond this diagnostic; stop with actual available evidence or explicit CI pending, then hand off. A90/B50/C20/D55/E53/F10 unchanged.