سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 17:00 UTC
docs: record draft-first scope and owner backup waiver
JVK committed
Nov 13, 2026 at 18:57 UTC
1e03964aeeb0714130ca561f424916bd06259a2e
2 files changed
+23
-4
PROJECT_STATE.md
+15
@@ -357,3 +357,18 @@ Owner requests layer-by-layer click/functional testing of all controls and compa
357
- Payment PR198 ce5bf86 exact Quality43086846384/Security43086846388 SUCCESS with242browser/all3DB. Protected merge2e869c1; Quality43399412247/Security43399412532,gate43400042808,Pages43400112210 SUCCESS. Public readback and browser evidence remain in PR198. No backend change.
358
- Root took over contact-summary work after specialist execution limit. Two baseline failures reproduced; code now scopes to active company and effective posted trade sources/settlements, includes unallocated amounts once, retains advances, and explicitly excludes raw/unposted cheques. Real synthetic save/reload plus both directions pass; PR199 final regression/release pending. No independent final review claimed.
359
- Cheque agent persisted no implementation. Exact runtime/source prerequisites and next acceptance contract recorded in docs/wp1/CHEQUE_NEXT.md. Automatic cheque posting and historical reconciliation remain unfinished. No historical data write or production migration; G1 not requested before a concrete proven package. Resume the dimension/source contract, then manual adapter; don't mistake contact-display repair for ledger posting.
360
+
361
+### 2026-11-13 — Owner requires draft-first lifecycle and permanent reference identity
362
+- New instruction supersedes the earlier automatic-final cheque design: every financial operation (sales/purchases/manual/receipts/payments/incoming/outgoing cheques) first creates a temporary journal. Posting is a separate authorized workflow; optional review/referral, explicit report inclusion of temporary documents, per-row status and document/source type, draft edit/delete and direct access to review/post actions are required. Right-click is supplementary to visible accessible controls.
363
+- Three distinct identities: permanent reference never reassigned even after draft deletion; temporary number; definitive number allocated on posting. Fiscal-year-prefixed formats must visibly distinguish draft vs posted and restart the relevant sequence per fiscal year without recycling reference reservations. Preserve historical finalized documents; no retroactive renumbering or automatic posting. Initial spoken numeric fragment is ambiguous; use the clear fiscal-year examples as design basis, not an invented10000 starting value.
364
+- Research official Iranian/international accounting documentation; record sources and uncertainty, then phased implementation. Existing PR199 corrects posted-only operational totals but does not fulfill the new selectable draft-report workflow; extend separately after this safe baseline. G1–G5 remain for concrete production changes, no repeated design approvals under owner's standing autonomy. Current design/plan to be saved under docs/superpowers before implementation.
365
+
366
+### 2026-11-13 — Owner requests all existing documents returned to temporary across all users/companies
367
+- Owner now explicitly requests converting all existing documents for all users and companies so they can personally finalize as needed. Interpret spoken «متوقف» as «موقت» from the preceding detailed lifecycle instruction; retain this interpretation explicitly.
368
+- Begin read-only global aggregate preflight: source/journal states, tenant/company/fiscal scope, locked years, dependent settlements/reversals. Do not run a blind status update or delete posted financial history. Prepare a concrete reversible migration/reconciliation package with verified backup and trial restoration; finalized history must remain traceable through linked corrective drafts/compensating entries. Existing generic client reversal rewrites original status and staged atomic linked correction remains unimplemented, so neither is proof that bulk unposting is safe.
369
+- This is an explicit requested production outcome, not permission to bypass missing transactional contracts, backups or integrity checks. No bulk mutation executed. The prior new-draft workflow and report/numbering requirements remain active; this is additional migration scope, not cancellation of current fixes.
370
+
371
+### 2026-11-13 — External backup prerequisite waived by owner
372
+- Latest explicit owner instruction: cannot configure connection; proceed without backup. This supersedes the preceding G3/connection prerequisite for this operation. Do not request FINORA_BACKUP_DATABASE_URL again. No backup or restore has been performed. Preserve scope, transactional checks and traceable history; no blind bulk status update. Global conversion work continues in hardening/global-draft-conversion-20261113 from main80bef2b.
373
+
374
+- Global conversion checkpoint: owner confirmed original source company for the mismatched journal; no production data changed. Read-only planner/inventory on hardening/global-draft-conversion-20261113 has25Node+1PG17 tests passing;2cancelled chains,6effective events,4initialcandidates,2electronic-metadata source reviews. Draft/source UI compatibility, atomic numbering and conversion executor remain unimplemented. Main contact PR199 deployment and10/10publicreadback verified; no cheque/draft-first completion implied.
docs/wp1/CHEQUE_NEXT.md
+8
-4
@@ -1,6 +1,6 @@
1
# Cheque issuance — source-backed next contract
2
3
-Status 2026-11-13: diagnosis complete; **no implemented/activated server cheque adapter**. Payment formatting PR198 is released. Contact operational summary PR199 is separate. No production financial writes or historical backfill have occurred.
3
+Status 2026-11-13: owner now requires draft-first for every financial operation; this supersedes automatic-final issuance. Diagnosis complete; **no implemented/activated server cheque adapter**. Payment formatting PR198 is released. Contact operational summary PR199 is separate. No production financial writes or historical backfill have occurred.
4
5
## Confirmed runtime gaps
6
@@ -13,13 +13,17 @@ Status 2026-11-13: diagnosis complete; **no implemented/activated server cheque
13
## Implementation order
14
15
1. Prove and implement the entity-dimension contract using the existing `dimensionTypes.sourceEntity`: company-scoped types/rules and organization-visible contact entities, with server permission checks, required/optional/unavailable rules, active/leaf semantics and derived counterparty/project identifiers. Original reversal tags must remain usable if a master record is later disabled. Do not copy or regenerate historical master data to bypass the contract.
16
-2. A dedicated atomic issuance RPC owns new outgoing-cheque + linked settlement + posted voucher. Stable request ID/fingerprint and instrument identity prevent duplicate/replayed issuance. Server selects one valid payable-control account and notes-payable account (`2111`, not `2103`); ambiguity or missing accounts fails without partial rows. No caller-supplied debit/credit lines. Validate company/contact/open fiscal date, positive safe integer IRR, permissions, expected record version for explicit reconciliation and instrument state. Due date is not issuance date.
17
-3. Issuance: Dr trade payable / Cr notes payable. Clearing: Dr notes payable / Cr bank. Bounce/cancellation requires a distinct compensating event; no in-place posted edits/deletions. Model lifecycle transition legality explicitly. Incoming cheques need their own symmetric contract; don't pretend they are covered by outgoing acceptance.
16
+2. A dedicated atomic issuance RPC owns new outgoing-cheque + linked settlement + draft voucher, with explicit authorized finalization as a separate operation. Stable request ID/fingerprint and instrument identity prevent duplicate/replayed issuance. Server selects one valid payable-control account and notes-payable account (`2111`, not `2103`); ambiguity or missing accounts fails without partial rows. No caller-supplied debit/credit lines. Validate company/contact/open fiscal date, positive safe integer IRR, permissions, expected record version for explicit reconciliation and instrument state. Due date is not issuance date.
17
+3. Issuance draft: Dr trade payable / Cr notes payable. Clearing draft: Dr notes payable / Cr bank. Draft-inclusive reports project these effects; posted-only reports include them only after explicit finalization. Bounce/cancellation requires a distinct compensating event; no in-place posted edits/deletions. Model lifecycle transition legality explicitly. Incoming cheques need their own symmetric contract; don't pretend they are covered by outgoing acceptance.
18
4. Both UI entry points share the same instrument and settlement. A cheque-method payment selects/registers an instrument through this contract; it cannot independently credit cash. One register row plus one payment row is one event, not two settlements. Pending/uncertain outcomes retain stable intent and user edits; no blind retry/new ID and no success before server acknowledgement. Publish source+settlement+full graph atomically into the hydrated client snapshot without overwriting unrelated dirty records.
19
5. Historical reconciliation is explicit and read-only first. Identify exact organization/company/contact, sources, vouchers and payments by stable identifiers. Amount/name/reference matches are review candidates only. Existing unlinked cheques are not automatically posted; independent prior payments must be reconciled before producing a concrete repair batch. Preserve old rows and retain compensating history.
20
21
## Acceptance and release
22
23
-Meaningful RED→GREEN for issuance/balance/bank unchanged, replay vs changed payload, concurrent duplicate instrument, cancellation/clearance/bounce, invalid scope/period/amount/accounts/dimensions, revoked/read-only users, uncertain write and company switch. Require rollback with retained history, source-derived SQL + real nonproduction JWT/PostgREST + full UI/Pages regression and independent financial SQL review. G1 migration approval is requested only after the concrete proven package and backup/restore evidence exist. Current work does not satisfy that gate.
23
+Meaningful RED→GREEN for issuance/balance/bank unchanged, replay vs changed payload, concurrent duplicate instrument, cancellation/clearance/bounce, invalid scope/period/amount/accounts/dimensions, revoked/read-only users, uncertain write and company switch. Require rollback with retained history, source-derived SQL + real nonproduction JWT/PostgREST + full UI/Pages regression and independent financial SQL review. The owner explicitly waived the external backup prerequisite for the global return-to-draft operation. Do not repeat the connection request. Transactional/source compatibility and controlled activation still need proof; current work does not satisfy those functional requirements.
24
25
After this urgent source contract, resume MANUAL_RPC_NEXT steps3–4 and the remaining WP1 source coverage/rollout work. Earlier successful WP1 CI does not prove these new workflows.
26
+
27
+## Global conversion checkpoint
28
+
29
+The owner authorized all users/companies and confirmed the original source company for one historic source/journal mismatch. Read-only preflight and draft-first specification are on `hardening/global-draft-conversion-20261113`;25graph tests and1isolatedPG17test pass. No financial conversion has executed. Original reversal history must remain; new source-linked drafts must be usable by the existing finalization UI before activation. The branch includes the exact remaining implementation plan and current execution status.