سامانه صدور فاکتور و حسابداری
docs(finora): log source-side lifecycle test missing linked voucher reference before patch
davoodmehraban89 committed
Nov 23, 2026 at 23:04 UTC
934129c95536c38c496b60cf5c9d156184f5c7e6
1 file changed
+6
PROJECT_STATE.md
+6
@@ -461,3 +461,9 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
461
### 2026-11-23 — FIN-QA-219-WP4-DENIAL-ASSERTION / observed database test and scoped assertion decision
462
- **Actual WP1 local stack on test fixture SHA `a61d7393efcdc2ba333a52c14f1e5e61b2fa74c3`**, [#45249182243](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45249182243) reached a real posted journal and the forbidden posted-delete check. It **FAILED** at `supabase/tests/wp4_journal_document_lifecycle.sql:108` with **`FINORA_DRAFT_DELETE_FORBIDDEN`**, a check violation (`23514`), not the fixture's exact expected `FINORA_POSTED_DOCUMENT_NOT_DELETABLE`. The base `public.finora_journal_delete_draft` in `20261016102000_phase1a_journal_rpc_surface.sql` intentionally rejects any non-draft or nonmanual voucher with that exact `FINORA_DRAFT_DELETE_FORBIDDEN` exception. This is a **verified fail-closed denial**, not evidence that posted delete succeeded; SQL fixture's exact error-message expectation is incompatible with the existing authoritative RPC. No change to product code/migration.
463
- Before changing the QA assertion, require `23514` check_violation *and* recognize only either of the two explicit known posted-delete denial codes, with **independent readbacks verifying the journal voucher remains `posted` and registry remains `posted`**. Unknown messages/SQLSTATE or modified posted state must fail. Keep all other lifecycle tests intact; rerun exact SHA WP1, do not claim lifecycle PASS until all SQL tests complete. Other parent PR219 blockers still open; A90/B50/C20/D55/E53/F10 unchanged.
464
+
465
+
466
+### 2026-11-23 — FIN-QA-219-WP4-SOURCE-LINK / observed RED before test-only link correction
467
+- **Actual WP1 local SQL on QA SHA `72cd4df6d1608b9be297e9bd1de24cd73fcccbac`**, [WP1 #45249837607](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45249837607): `WP4_MANUAL_LIFECYCLE_PASS` and `WP4_TOMBSTONE_AND_NONREUSE_PASS` logged in real disposable PostgreSQL. This proves staged manual draft/post, fail-closed posted-delete and unchanged voucher/registry/2 lines, and draft delete tombstone/ATF nonreuse within test limits. However SQL then FAILED at `wp4_journal_document_lifecycle.sql:210` with `WP4_SOURCE_DELETE_DID_NOT_DELETE_VOUCHER`; **full WP1 test is NOT PASS**.
468
+- **Source-level root cause found in QA fixture:** candidate `finora_journal_document_lifecycle_trigger` in `20261118100000_journal_document_lifecycle.sql` source-delete branch (lines ~644–656) looks up `OLD.data->>'journalVoucherId'` to find and delete the linked draft voucher. The SQL fixture manually inserted both synthetic `invoices` rows with `documentStatus/accountingStatus=draft` but **omitted the required `journalVoucherId` pointer**, then independently inserted vouchers with reverse `sourceId`. Consequently voucher→source delete positive path passed (uses sourceId), but source→voucher deletion test attempted deletion of an **unlinked fixture**. This is not evidence of real linked-delete failure.
469
+- **Pre-implementation decision:** on QA Draft PR247 correct only the two synthetic invoice fixture JSON objects to reference their corresponding `WP4_SOURCE_V_A` and `WP4_SOURCE_V_B` via `journalVoucherId`. Keep reverse `sourceType/sourceId` parity and all existing source↔voucher/tombstone assertions, no migration/product/permissions/security changes. Rerun exact-head WP1 and examine actual final outcome; fail closed on any new issue. Parent PR219 Quality/Security JS and WP2 auth fixture remain independent blockers. Stage progress A90/B50/C20/D55/E53/F10 unchanged.