@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / a7da659
Fork 0

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

Mirrored from https://github.com/davoodmehraban89/Factor-easy.git

Synced Dec 3, 14:30 UTC

docs: record bounded C01 D01 financial lifecycle design handoff

davoodmehraban89 committed Nov 24, 2026 at 11:42 UTC a7da659efd12e1b5112f54fa6b5e41989f451dd4
3 files changed +33
PROJECT_STATE.md
+4
@@ -729,3 +729,7 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
729 - Exact PR254 8d05ff6 Quality 45353129104: targeted 90/90 PASS and ACK atomicity PASS; Login connectivity diagnostics failed at the literal previous bootstrap version. WP2 45353129119 and Security 45353129204 PASS; WP1 pending. Update cache contract to the actual new version and explicitly assert sync.js and organization-rbac.js share it; preserve every other diagnostic assertion. No product permission or accounting change. Reverify full CI, then prepare C01 design without accepting B prematurely.
730
731 - B03-R1 candidate: exact current bootstrap, sync and organization adapter version assertions, with all other connectivity diagnostic checks preserved. No runtime or SQL change; exact new CI pending.
732 +
733 +
734 +### 2026-11-24 — FIN-C01/D01 design handoff
735 +- Parent B03-R1 99dae75b4b4f7a85ecbccacb5cafc4c2f7aac230. Reconciled #229, ADR216, PR234 and diverged PR249. Design in docs/agent-workflow/FIN_C01_D01_HANDOFF_2026-11-24.md. Canonical source-draft transaction plus separate current approval; no competing engine, no historical conversion. Preserve 3 browser sentinels and real-JWT tests. Design only; implementation and disposable SQL proof pending. Parent login connectivity check PASS and DB jobs PASS at observation, full browser/WP1 pending. No SQL or production changes.
docs/EXECUTION_STATUS.md
+2
@@ -208,3 +208,5 @@
208 - Staged deliberate conflict review/discard, guarded fresh identity/membership, strict scoped snapshot, explicit consent, no server mutation. Cancel/failure preserves pending graph; ordinary reads remain blocked during pause. VM and browser regression cases added; CI pending, no acceptance or release.
209
210 - B03-R1: 90/90 targeted and ACK atomicity PASS; original Quality blocked by stale bootstrap version assertion. Updated three exact version contracts, no runtime change. Recheck final SHA before acceptance.
211 +
212 +- C01/D01 design handoff recorded separately from B03 CI; #229 remains open. No implementation or acceptance claimed.
docs/agent-workflow/FIN_C01_D01_HANDOFF_2026-11-24.md new
+27
@@ -0,0 +1,27 @@
1 +# FIN-C01 / D01 — source-linked draft and independent finalization
2 +
3 +Status: design handoff only. Parent candidate PR254 99dae75b4b4f7a85ecbccacb5cafc4c2f7aac230; B not accepted. Implementation owner: authorized Finora financial-core workstream; Codex-main reviews integration. Issue #229 / ADR216. No production change.
4 +
5 +## Evidence and inclusion decision
6 +- PR234 bc4f2a8 provides source status UI, three strict expected product REDs and real-JWT acceptance coverage; retain those tests.
7 +- PR249 90172b8 diverges from PR234 (53 ahead, 130 behind at observed comparison). Do not merge wholesale. Its serialized first-save and guarded deletion ideas require independent verification; exclude blanket historical conversion and unreviewed identity changes.
8 +- Current journal-rpc.js has manual draft/post adapters, but no source-draft adapter. Existing atomic source-link posting migration 20261117110000 is not a draft-save contract. Retain canonical ledger engine and use one shared source transaction, not another posting engine.
9 +- Current main dab1a45 remains unchanged. No claim of deployed repair.
10 +
11 +## Transaction boundary and sequencing
12 +1. C01/D01 must be reviewed together: implement server-owned source-linked draft creation and independent authorized finalization before switching sale/purchase adapters. Do not ship a partial permission change that makes legitimate draft creation unusable.
13 +2. Preserve existing organization/company/year authorization, current revisions and ledger rules; explicit current approval authority at finalization, server-derived actor, fail-closed access checks on all supported mutation paths. No new trusted client identity or revision fallback.
14 +3. Source + linked voucher + balanced lines/dimensions + audit + reference reservation commit or roll back as a unit. Ordinary save never allocates final number or posts. Corrective draft is not finalized by editing.
15 +4. Stable operation identity across retries; distinguish verified outcome and pending refresh. Preserve B01–B03 protections. Draft deletion, numbering and history require their own reviewed dependencies; no migration of existing posted history in this package.
16 +5. Before any SQL change, inventory effective function definitions and grants in exact candidate; use disposable local DB and collision-free migration from CLI. Review rollback and preserve existing tests. No hosted migration.
17 +
18 +## Acceptance gates
19 +| Area | Required proof | Existing evidence to reuse |
20 +|---|---|---|
21 +| Server authority | Authorized draft creation; independent approval denied without current capability; tenant/company isolation; unchanged data on denial | WP2 authorized journal and source approval boundary suites |
22 +| Lifecycle | Cash/credit sale and purchase save/reload/edit linked draft; explicit finalization; balanced entries, no orphan; protected posted history | accounting-document-workflow.spec.js strict #229 sentinels |
23 +| Transaction | Atomic failure, retry, concurrent first save, stale revision; linked graph and audit consistency | WP1 ledger, correction, manual guards, NULL revision and attachment concurrency suites |
24 +| Compatibility | Existing positive manual/source cases retained, old autopost expectations converted only where intentional product contract changes | journal-rpc-adapter.test.mjs, wp3 financial tenant suite |
25 +| Release | All required gates pass at same SHA; independent review; no main merge or production changes | Quality/WP1/WP2/Security |
26 +
27 +Do not count expected RED as fixed. Convert sentinels to normal positive tests only when implementation passes the desired contract. #245/#246/#248/#238/#223 remain open, and the historical conversion is explicitly excluded. Next action: once dependency gate is sufficiently verified, inspect effective SQL and choose a bounded migration + rollback with no historical DML. This document does not authorize deployment.