سامانه صدور فاکتور و حسابداری
docs/d4a-verified
PROJECT STATE — FINORA / FACTOR-EASY
MANDATORY CONTINUITY FILE — READ THIS FIRST
Repository:
davoodmehraban89/Factor-easy· Canonical branch:main· Product: Finora 1.0
Read AGENTS.md first, then this file. Latest user chat is the only source of new instructions; repo files are continuity/context. Detailed older history remains available in Git history and the verification documents listed below.
Protocol / authority
Verify live GitHub + Supabase before acting; implement/test/fix/retest/commit/verify in bounded vertical slices; archive exact production SQL; never call unrun work verified. The owner has repeatedly directed autonomous roadmap execution without routine confirmation pauses and has authorized normal in-scope GitHub/Supabase work. Keep five specialist workstreams under one coordinator: Architecture & Requirements, Implementation, UX/UI, QA & Verification, Security & Release. Use real subagents only when the environment provides them; otherwise execute those responsibilities directly without claiming parallel agents.
This is high-assurance accounting/ERP software. Posted financial history, tenant isolation, migration safety, traceability, reconciliation and rollback are mandatory. Do not create billable resources; development/verification must stay on zero-cost/free-tier paths. Destructive financial-history changes, unapproved external costs, public/external messaging and sensitive access changes remain safety boundaries.
Current change ledger
| Date | Request / decision | Status | Evidence / next action |
|---|---|---|---|
| 2026-10-02 | Owner directed immediate continuation after observing execution delay. | D4A IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + ACCOUNTING + SECURITY VERIFIED | PR #21 merged as 4583703396a7ddb00bdad76b52c22932d634cbef. Main Quality 36961361891 SUCCESS (38/38 real-DOM, accounting phases 2–6 + Golden, D1/C8 DB); Security 36961361897 SUCCESS; Release gate 36961459328 SUCCESS; gated Pages 36961492170 SUCCESS. Production migration 20261002034311 request_workflow_d4a_work_queue reconciled. Evidence: docs/REQUEST_WORKFLOW_D4A_VERIFICATION.md. |
| 2026-10-02 | Wave 2 request integrity remediation F-411/F-413/F-414/F-417/F-418. | IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + ACCOUNTING + SECURITY VERIFIED | Squash merge 7346910638b6ef9555d4adb5952dd62c8f4c130d from PR #19. PR Quality 36937247798: DB jobs SUCCESS and 37/37 real-DOM tests passed; accounting phases + Golden journey passed. PR Security 36937247803: required Release/QA invariants + CodeQL SUCCESS (Dependency review remains the documented external graph boundary). Main Quality 36937448157 SUCCESS; Security 36937448101 SUCCESS; exact-SHA Release gate 36937598497 SUCCESS; gated Pages 36937616201 SUCCESS. Production migration recorded as 20261001225044 request_wave2_integrity_hardening; live validator negative controls and function-contract checks passed. |
| 2026-10-02 | Live Supabase target hcsixhqbyuhpshfwqpjx became available to the connector; owner directed immediate continuation. |
WAVE 1 PRODUCTION RECONCILED / WAVE 2 STARTED | Production migration history and live request_transition_instance definitions were inspected read-only. F-409/F-410 guard is present in production; next slice is F-411/F-413/F-414/F-417/F-418 with server validation, form-runtime fidelity, idempotency binding, active/latest-version enforcement and schema-bound conditions. |
| 2026-10-02 | Owner completed the GitHub Protect main ruleset and directed autonomous continuation to fully remediate the audited defects. |
ACTIVE — REMEDIATION CONTINUATION | Ruleset 24334764 verified ACTIVE on default branch with deletion + non-fast-forward protection, PR-only updates, strict required checks static-quality, Release and QA safety invariants, and CodeQL JavaScript; bypass list empty. Continue Wave 1/2 request integrity work. |
| 2026-10-01 | Owner authorized starting the canonical remediation pack after external full-system audit. | WAVE 0 CLOSED | Release/QA fail-open paths, exact-SHA promotion and Pages deployment ordering are now verified by positive and negative controls above. |
| 2026-10-01 | Owner said «ادامه بده» after D3a handoff. | D3B + D3C VERIFIED | D3b visual editor/conditions/timeline and D3c SLA/delegation/outbox are production + disposable-DB + real-DOM verified. Remediation audit supersedes roadmap ordering. |
| 2026-10-01 | Slice D3c — SLA/escalation, delegation/substitution, transactional outbox. | IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + CI VERIFIED | js/request-workflow-d3c.js; migrations 20261001235500, 20261002000500, 20261002001000; Quality run 36917772952 all three jobs SUCCESS. Evidence: docs/REQUEST_WORKFLOW_D3C_VERIFICATION.md. |
| 2026-10-01 | Slice D3b — visual workflow editor + conditions + timeline. | IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + CI VERIFIED | js/request-workflow-d3b.js; migration 20261001233000; bounded predicate DSL, skipped-step evidence and authorized timeline RPC. Quality run 36915696611 all three jobs SUCCESS. Evidence: docs/REQUEST_WORKFLOW_D3B_VERIFICATION.md. |
| 2026-10-01 | Slice D3a — sequential/parallel request workflow runtime. | IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + CI VERIFIED | Migrations 20261001230000, 20261001230500; private step/vote runtime, quorum semantics, capability checks, idempotent decisions and immutable evidence. Quality run 36913565943 all three jobs SUCCESS. |
| 2026-10-01 | Slice D2 — request UI/read-model + legacy cutover. | IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + REAL-DOM + CI VERIFIED | js/request-workflow-d2.js; migrations 20261001223500, 20261001224500; Quality run 36912668369 all three jobs SUCCESS. Legacy source records remain preserved and imported rows traceable. |
| 2026-10-01 | Slice D1 — requests/BPMS-lite server foundation. | IMPLEMENTED / PRODUCTION + DISPOSABLE-DB + CI VERIFIED | Migrations 20261001204500, 20261001205500, 20261001210500, 20261001211500; Quality run 36910187257 all three jobs SUCCESS. |
| 2026-10-01 | Office Slice C8 workflow policy/runtime. | IMPLEMENTED / PRODUCTION + ADVERSARIAL + CONCURRENCY + REAL-DOM + SECURITY VERIFIED | Immutable workflow evidence, pinned policy versions, capability-gated transitions, optimistic revision checks, idempotency, private runtime tables and SECURITY INVOKER public wrappers. |
| 2026-10-01 | Owner reconfirmed autonomous GitHub + Supabase execution and free-tier-only development. | ACTIVE OPERATING DIRECTIVE | No repeated routine approval requests; no paid development resource. Preserve safety/cost boundaries. |
| 2026-10-01 | Live QA: commerce/tax IDs/request builder/personnel/license/floating-detail coding. | PARTIALLY IMPLEMENTED / FOLLOW-UPS OPEN | Kardex/tax-ID/request/profile/license/floating-code work landed. Exact Taxpayer-System print layout owner reference is now available and has regression coverage. |
| 2026-09-30—2026-10-01 | Office C1–C7, ELI-1–ELI-4, Slice A/B and accounting phases 1–6. | VERIFIED WITH DOCUMENTED BOUNDARIES | See required evidence; do not redo completed phases without verified regression evidence. |
| 2026-09-30 | Iran-first high-assurance ERP expansion. | IN PROGRESS — BROADER ROADMAP | docs/IRAN_COMPLIANCE_MATRIX_V1.md; do not claim statutory consolidation/full tax submission/full HR/CRM until lifecycle/accounting/permissions/tests exist. |
Wave 0 checkpoint — CLOSED 2026-10-02
- Manual QA no longer uses
continue-on-error; live/all require credentials; live credential-bearing runs reject non-allowlisted origins before secrets are injected into the test step; authenticated browser origin is rechecked before/after login/navigation; menu click errors are no longer swallowed and each navigated item must change observable UI state. - QA evidence retention reduced to 3 days and screenshots changed to failure-only.
- Security dependency review no longer uses
continue-on-error. Security runsscripts/release-safety-check.mjsto prevent regression of Wave 0 code contracts. - Exact-SHA
Release gaterequires successful Quality + Security for the same SHA and explicitly checksstatic-quality,c8-policy-database, andd1-request-databasebefore promotion. - Historical reproduction: Pages run
36922017645for SHA6b529647...completed before Quality/Security, proving the old branch-deploy path was unsafe. - Negative control after
Protect main+ Pages source change: failing SHA03561a33...on PR #15 failedstatic-quality; merge was rejected; no Release gate or gated Pages deployment existed for that SHA. - Positive control on protected main SHA
150ff54d938a45b9a9b476f3a4a8fdabbb45d065: Quality36932956964SUCCESS; Security36932956877SUCCESS; Release gate36933115365SUCCESS;Deploy gated Pages36933151878SUCCESS. The earlier Pages trigger36933134567was skipped, as designed, and no legacy dynamic branch deployment ran. - Wave 0 findings F-402/F-403/F-406/F-407/F-423/F-424 are closed at the verified GitHub/repository boundary.
Implemented foundations
- Accounting phases 1–6: accepted high-assurance accounting foundation; posted history remains immutable and balanced.
- Slice A/B + ELI-1–4: modular entitlements, tenant/RBAC, seats, delegated admin, reusable roles, secure invitations and organization UX.
- Office C1–C8: registration/read evidence, referrals, archive/classification, numbering/templates, approvals/SLA, OCR provenance boundary and versioned correspondence workflow runtime.
- Requests D1/D2: independent versioned request definitions/forms/workflows, pinned versions, idempotent create/transition, immutable evidence, server authorization, server-backed UI/read model and non-destructive legacy cutover.
- Requests D3a: ordered sequential/parallel approval steps, quorum voting, per-step capability authorization and private runtime state.
- Requests D3b: visual ordered-step editor, bounded server condition predicates, skipped-step evidence and authorized runtime timeline.
- Requests D3c: step SLA/deadline/escalation evidence, explicit time-bounded delegation with provenance, and transactional approved-request outbox intents.
Invariants
Posted accounting history is immutable and balanced; tenant isolation is enforced at the data boundary; commercial entitlement and member authorization are independent; UI hiding is never security; expired licenses are read-only; office numbering is server-atomic; private scans remain private; seat/company limits are server-enforced; delegated customer admins cannot mutate commercial license entitlements; invitation acceptance is authenticated/email-bound/seat-safe; raw invitation tokens are never persisted or audited; organization-unit parents cannot cross tenants or form cycles. Request type/workflow versions are immutable snapshots; request instances pin both versions; runtime mutation is server-authorized, idempotency/revision guarded and append-only evidence is retained. D2 legacy import is non-destructive/idempotent/traceable. D3a votes require distinct actors for parallel quorum. D3b conditions are bounded server-validated predicates and skipped results remain evidence. D3c delegation never impersonates the source actor, source capability is revalidated, SLA escalation appends evidence, and approved cross-module effects are queued transactionally rather than directly executed. Request workflow state never replaces C1 registration or C5 correspondence approval evidence.
Required evidence
docs/PHASE_1_REDESIGN_VERIFICATION.md through docs/PHASE_6_VERIFICATION.md · docs/PHASE_6_CUTOVER_MANIFEST.md · docs/PRODUCTION_ACCOUNTING_CUTOVER_READINESS_2026-09-30.md · docs/IRAN_COMPLIANCE_MATRIX_V1.md · docs/FINORA_ERP_EXPANSION_ROADMAP_V4.md · docs/FINORA_UX_ACCOUNTING_BENCHMARK_V3.md · docs/FINORA_MODULAR_ERP_OFFICE_AUTOMATION_V1.md · docs/SLICE_B_TENANT_RBAC_VERIFICATION.md · docs/SECURITY_DEFINER_HARDENING_2026-09-30.md · docs/CURRENT_STAGE_GAP_REGISTER_2026-09-30.md · docs/ELI_1_ENTERPRISE_LICENSE_VERIFICATION.md through docs/ELI_4_ENTERPRISE_ORGANIZATION_UX_VERIFICATION.md · docs/OFFICE_SLICE_C1_VERIFICATION.md through docs/OFFICE_SLICE_C8_RUNTIME_UI_VERIFICATION.md · docs/REQUEST_WORKFLOW_D2_CUTOVER_VERIFICATION.md · docs/REQUEST_WORKFLOW_D3A_VERIFICATION.md · docs/REQUEST_WORKFLOW_D3B_VERIFICATION.md · docs/REQUEST_WORKFLOW_D3C_VERIFICATION.md · docs/REQUEST_WORKFLOW_D4A_VERIFICATION.md · docs/PRODUCTION_RUNBOOK.md · supabase/migrations/ · supabase/tests/request_d1_behavior.sql · supabase/tests/request_d2_legacy_behavior.sql · supabase/tests/request_d3a_workflow_behavior.sql · supabase/tests/request_d3b_condition_timeline.sql · supabase/tests/request_d3c_operations.sql.
NOT VERIFIED / external boundary
Automatic background scheduling for SLA scans; delivery/dispatch consumers for D3c outbox intents; authenticated two-real-user production browser E2E with a persistent legitimate non-owner member; automatic external invitation email delivery; owner-approved accounting cutover; real Persian OCR accuracy/provider; qualified digital signature; physical printer; live external adapters; GitHub Dependency graph/enforceable dependency review; leaked-password protection; PostgreSQL upgrade; CodeQL v4 migration; external BPM/provider integration remain outside verified scope.
The connected Supabase tool now exposes the owner-specified production target hcsixhqbyuhpshfwqpjx (Finora, ACTIVE_HEALTHY, PostgreSQL 17.6.1). Live migration history includes the C8/D1/D2/D3 and Wave 1 request migrations through two recorded request_wave1_legacy_transition_guard applications. Read-only production inspection confirmed the current private legacy transition implementation authorizes tenant/module/capability before replay, rejects D3 step-runtime bypass, binds replay to actor+action, and the public wrapper is SECURITY INVOKER. No production DDL was required for this reconciliation.
Exact next executable work
- Resume D4 approver/delegate work queue and bounded outbox-consumer contracts now that Wave 2 request-integrity gates are closed.
- Keep D4c external/destination consumers disabled until their own destination-idempotency, retry/dead-letter and authorization contracts are implemented and adversarially verified.
- Continue compliance/accounting roadmap only with sourced legal/tax/accounting evidence and controlled cutover safeguards.
Live QA open items
- Exact Taxpayer-System print redesign: owner reference images were received in chat and implementation was reported complete; retain regression coverage and do not silently redesign away from the approved reference.
- Legacy request records are preserved for rollback/audit after D2; new request configuration/runtime must not be routed back through record-store writes.
- Floating-detail defaults for new records: 8-digit semantic codes currently use slot/category/sequence (Branch
11xxxxxx, Counterparty21xxxxxx, Project31xxxxxx); historical codes are not rewritten and account-chart coding stays independent. - Product/service deletion must continue to fail closed whenever operational references exist.