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

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

docs: record operator CLI audit completion requirement before implementation

davoodmehraban89 committed Nov 22, 2026 at 09:43 UTC be2caa761c09c8f08459ab3051ad0882a143ca3d
1 file changed +2
PROJECT_STATE.md
+2
@@ -533,3 +533,5 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
533 - **New specifically proven PRE-MIGRATION coverage hole, not another posting engine:** Existing read-only `scripts/sql/draft-conversion-inventory.sql` + isolated PostgreSQL test cover voucher graph but not source-only `invoices`/`purchases`, stale forged source links, source-linked draft status disagreement, duplicated generated draft identities (currently posted-only uniqueness), or generated vouchers with missing sources. The existing inventory's source join and child joins also correlate some records by `owner_id` alone without `organization_id` — a potential cross-org audit mismatch if one owner belongs to two orgs. No production defect or production-row counts claimed.
534 - **Bounded implementation:** extend only the EXISTING read-only inventory SELECT to include **aggregate-only** `sourceIdentityAudit` counts for the two supported financial source kinds, and scope all source/child matches by organization, owner and source identity. Extend the EXISTING isolated PostgreSQL inventory test with synthetic source-only, dangling/wrong-link, duplicate draft, orphan journal and multi-org same-owner collision cases. Keep existing `journals` item shape, opaque keys and `financialFingerprint` stable for private compatibility; never emit source IDs, owner IDs or commercial payload in the additional aggregate. No schema migration, DDL/DML in application, Auth/RLS/grants, production reads/writes, or owner-held JS changes.
535 - **Acceptance:** exact saved SELECT executes on disposable PostgreSQL; original journal-graph cases retain PASS, new synthetic counters detect missing/orphan/duplicate and ignore cross-org lookalikes, financial fingerprints/read-only behavior unchanged. Require a new exact-head Quality + WP1 + Security verdict (WP2 only if genuinely triggered). A safe preflight is NOT authorization to backfill, convert historical posted records, integrate ATF or declare Issue229 fixed. Maintain PR230 Draft and parent SHA immutable.
536 +
537 +- **2026-11-22 pre-implementation integration refinement:** The first SELECT+isolated test candidate `717b0ebbf71fd76813e3bfb1724c567f3dcc950c` passed the real GitHub Quality step `Draft conversion inventory on isolated PostgreSQL` (Quality run 44992593097; full suite still running at this checkpoint). The existing operator CLI `scripts/draft-conversion-preflight.mjs` currently prints only journal aggregates and its scope text falsely says no source-only coverage. Complete this SAME narrow preflight task by adding a strictly allowlisted aggregate-only sourceIdentityAudit projection to that existing CLI, fail closed with exit=2 for absent/unsafe/problematic source-audit metrics (never mark cutover executable), and test those exits in the existing inventory test. Historical private snapshot compatibility: missing new source counts must be flagged as requiring a refreshed snapshot, not silently called ready. Do not introduce alternate auditor, product SQL migration, production connection, financial code or source data.