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

docs(finora): record confirmed Issue248 trace and authentic WP2 fixture correction decision

davoodmehraban89 committed Nov 24, 2026 at 10:14 UTC 74238fe343fa0854613e701bd6381444a6629db7
1 file changed +6
PROJECT_STATE.md
+6
@@ -487,3 +487,9 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
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.
490 +
491 +
492 +### 2026-11-24 — FIN-QA-219-WP2-AUTHENTIC-FIXTURE / bounded decision before edit
493 +- Previous Issue248 diagnostic is COMPLETE: exact test SHA `38a20bda7654b7ce637844d6a25fc829045b3a95`, WP1 #45342205391 local job 138268270627 proved ordered lifecycle trigger→observational trigger→posted-source guard, inter-trigger voucher absent/status NULL, registry deleted, nullable guard predicate NULL while source draft; original false immutable error rethrown after exact source/voucher/registry/audit snapshots rolled back. See Issue248 comment #7124218555. No further similar probes. Product fix still owner-only. Main `dab1a45fcfc4f12e675cfe055e477138cd3e99fa` and PR219 `ab14e46abec4b8ef1f36c4f219d9a9ba6d99bc6d` unchanged. Issues229/245/246/248 open.
494 +- Independent current WP2 #45342205332 local job 138268380959 failed `FINORA_ORG_FORBIDDEN` when existing WP3 fixture inserts journal directly via SQL at scripts/wp3-financial-tenant-e2e.mjs:46. Auth users and org setup already run. Do not weaken authorize or change actual product.
495 +- **Scope**: on same Draft PR247 edit only existing `scripts/wp3-financial-tenant-e2e.mjs` plus append-only PROJECT_STATE. Explicit fail-closed loopback API/DB URL guard before setup. Seed two synthetic manual-posting accounts/company/open fiscal year via existing isolated psql fixture, then call existing `finora_journal_create_draft` with actual signed owner A JWT, valid balanced lines and header (no status). Require 200 and exact persisted draft/lines/version/actor readback; verify owner A positive before testing cross-tenant B; use actual revision/valid lines in foreign RPC attempts. Preserve all existing REST and five RPC denials, add exact owner readback before/after and no foreign-created row; do not use service role for journal operations. Do not relax denial codes or swallow unexpected errors; no actual production, financial migration, app JS, roles/grants/RLS/trigger changes. WP1 Issue248 strict RED unchanged. Retest exact new QA head and report available evidence, no claim of completed CI if still pending. A90/B50/C20/D55/E53/F10 unchanged.