@davoodmehraban89 / Factor-easy / commits / 4c067c0
Fork 0

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

Reconcile project state after C8 closure

davoodmehraban89 committed Oct 1, 2026 at 22:07 UTC 4c067c08892e23082868d8262180e6fc659f087e
1 file changed +45 -123
PROJECT_STATE.md
+45 -123
@@ -4,145 +4,67 @@
4 >
5 > Repository: `davoodmehraban89/Factor-easy` · Canonical branch: `main` · Product: **Finora 1.0**
6
7 -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.
7 +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.
8
9 ## Protocol / authority
10 -Verify live GitHub + Supabase before acting; implement/test/fix/retest/commit/verify in vertical slices; update this file with durable implementation state; archive exact production SQL; never call unrun work verified. Latest user instruction on 2026-10-01 supersedes repeated approval gates: proceed autonomously using five specialist agents under a coordinator, following the repository roadmap with high-assurance accounting tests and short reports. C8 scope, design and plan are approved. Routine in-scope implementation, tests, commits and C8 additive schema/RLS work need no repeated confirmation. Platform permission blockers, unapproved external costs/actions and destructive financial-history operations remain safety boundaries. Owner explicitly directed that implementation continue autonomously without waiting for routine confirmations; progress messages/questions must not stop executable work unless the owner explicitly says stop or a real safety/tool blocker requires input.
10 +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 if the environment provides them; otherwise execute those responsibilities directly without claiming parallel agents.
11 +
12 +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.
13
14 ## Current change ledger
15 | Date | Request / decision | Status | Evidence / next action |
16 |---|---|---|---|
15 -| 2026-10-01 | Owner reconfirmed full GitHub + Supabase execution authorization and coordinator/five-specialist-agent operating model; continue autonomously within the approved roadmap and safety boundaries. | **EXECUTION IN PROGRESS** | Live reconciliation found main advanced to `f64249a6c84b3c2e12d41eb14ff1c9c92a0c3dbf`; Quality `36843788152`, Security `36843788218`, Pages `36843787512` all succeeded. Quality logs show accounting/Golden gates passed and real-DOM Playwright `16 passed (8.9s)`. Supabase remains ACTIVE_HEALTHY with 53 migrations through `20260930205919`; all 13 public tables report RLS enabled. Manual `.github/workflows/qa.yml` is non-gating because its test step uses `continue-on-error`; do not treat a green manual QA workflow as proof of test success. C8 remains NOT IMPLEMENTED / NOT VERIFIED. |
16 -| 2026-10-01 | Owner explicitly authorized end-to-end autonomous roadmap execution with five real specialist agents; no repeated design/plan/implementation approvals; short reports and high-assurance accounting. | **EXECUTION IN PROGRESS** | C8 plan approved. Five agents: architecture, implementation, UX, QA, security. Coordinator owns shared documentation and remote commits. Baseline and nonproduction verification precede production DDL. |
17 -| 2026-10-01 | Owner replied «ادامه بده» to the C8 written design review request. | **DESIGN APPROVED / IMPLEMENTATION PLAN SAVED FOR REVIEW** | Plan: `docs/superpowers/plans/2026-10-01-office-c8-workflow.md`. Proposed subagent-driven execution; autonomous five-agent execution approved. No C8 runtime or SQL implementation yet. |
18 -| 2026-10-01 | Owner explicitly replied «بله تاییده» to additive C8 workflow schema/stages/rules, immutable transition history and related RLS; no data deletion or auth change. | **SENSITIVE SCOPE + DESIGN APPROVED / PLAN APPROVED** | Design: `docs/superpowers/specs/2026-10-01-office-c8-workflow-design.md`. No product SQL or runtime implemented. Written-design review precedes implementation planning under the design workflow. |
19 -| 2026-10-01 | Owner requested live main/CI/Supabase reconciliation, request recording before implementation, verified vertical slices, same-commit state updates, SQL migration archival, explicit approval before schema/RLS/auth/role/destructive changes; subsequently said «ادامه بده». | **AUDIT RECORDED / C8 SENSITIVE SCOPE NOW APPROVED** | Read AGENTS.md then this file in full. Audited main `63fd08f500f31b41877a50020ce023d6ec46f812`; reviewed actual Quality job logs, migration inventory and public RLS catalog. No product, database, auth or role change performed. Details below. |
20 -| 2026-10-01 | Continue Office Slice C autonomously from the current checkpoint. | **IN PROGRESS** | C1-C7 are closed with evidence; C8 workflow policy is the next slice. |
21 -| 2026-09-30 | Office Slice C4: tenant-safe registration repair + versioned correspondence templates + controlled draft application. | **IMPLEMENTED / PRODUCTION + ADVERSARIAL + REAL-DOM + SECURITY VERIFIED** | Production migrations `20260930202526_office_registration_tenant_repair`, `20260930202701_office_slice_c4_versioned_templates`; verified runtime/test head `481f9fed434f127eaa32ccf8d69c649e783b5cad`; Quality `36773156535` PASS including C4 + Real-DOM; Security `36773156559` CodeQL PASS; Pages `36773155535` PASS. Removed ambiguous legacy registration overload, bound registration to organization, added private append-only template versions, server provenance validation and template UI. Evidence: `docs/OFFICE_SLICE_C4_VERIFICATION.md`. |
22 -| 2026-10-01 | Office Slice C5: internal approval/attestation lifecycle. | **IMPLEMENTED / PRODUCTION + ADVERSARIAL + REAL-DOM + SECURITY VERIFIED** | Production migrations `20260930203456`, `20260930203620`, `20260930203709`; content-bound SHA-256 approval evidence, explicit approver authorization, reject/rework/new-request semantics, stale-content rejection and AAL metadata. Runtime head `02f76f18c7685a4da88de68972113d32b30a21fb`; Quality `36774255459` PASS; Security `36774255463` CodeQL PASS; Pages `36774253349` PASS. Evidence: `docs/OFFICE_SLICE_C5_VERIFICATION.md`. Not a qualified digital signature. |
23 -| 2026-10-01 | Office Slice C6: server-derived SLA reminder/escalation evidence. | **IMPLEMENTED / PRODUCTION + ADVERSARIAL + REAL-DOM + SECURITY VERIFIED** | Production migration `20260930204536_office_slice_c6_sla_reminder_escalation`; daily reminder dedup, 24h escalation threshold, immutable internal-only evidence, requester/admin authorization, stale/terminal work rejection and cross-tenant denial. Runtime head `ba06af2bcaf5b63e37f5421fb49c4246d85ba762`; Quality `36775081078` PASS including C6 + Real-DOM; Security `36775081089` CodeQL PASS; Pages `36775080542` PASS. Evidence: `docs/OFFICE_SLICE_C6_VERIFICATION.md`. No external delivery claim. |
24 -| 2026-10-01 | Office Slice C7: searchable archive + OCR provenance/correction. | **IMPLEMENTED / PRODUCTION + ADVERSARIAL + REAL-DOM + SECURITY VERIFIED** | Production migration chain `20260930205309`, `20260930205325`, `20260930205347`, `20260930205753`, `20260930205919`; canonical C7 uses server full-text search across metadata/body/latest OCR, append-only raw OCR provenance and human correction, bounded query/result size, cross-tenant denial, and server-bound OCR source attachments. Hardened runtime head `b1c800c540e1181ffbe3efc32998c77e0c8f9fd1`; Quality `36776969154` PASS including C7 + Real-DOM; Security `36776969247` CodeQL PASS; Pages `36776967625` PASS. Evidence: `docs/OFFICE_SLICE_C7_VERIFICATION.md`. C7 does not perform OCR and real Persian OCR accuracy remains unverified. |
25 -| 2026-09-30 | Office Slice C3: related-letter graph + structured archive classification/search. | **IMPLEMENTED / PRODUCTION + ADVERSARIAL + REAL-DOM + SECURITY VERIFIED** | Production migrations `20260930154625_office_slice_c3_related_archive`, `20260930154720_office_c3_event_time_ordering`; Quality `36740544828` PASS including C3 + Real-DOM; Security `36740544795` CodeQL PASS; Pages `36740543917` PASS. Transactional tests covered scope/confidentiality isolation, unreadable relation target denial, self/duplicate/cycle denial, latest classification, related graph search and cross-tenant denial; rollback residue zero. Evidence: `docs/OFFICE_SLICE_C3_VERIFICATION.md`. |
26 -| 2026-09-30 | Office Slice C2: actionable referrals, target authorization, append-only actions and SLA work queue. | **IMPLEMENTED / PRODUCTION + ADVERSARIAL + REAL-DOM + SECURITY VERIFIED** | Production migrations `20260930152500_office_slice_c2_actionable_referrals_sla` and `20260930153000_office_evidence_insert_hardening`; Quality `36737229597` PASS including all accounting/Golden/ELI/C1/C2 + Real-DOM; Security `36737229678` CodeQL PASS; Pages `36737229045` PASS. Transactional tests rejected unreadable targets, sender impersonation, completion-before-ack, duplicate ack, cross-tenant queue access and direct referral/audit forgery; rollback restored temporary seat limit/member/fixtures with zero residue. Evidence: `docs/OFFICE_SLICE_C2_VERIFICATION.md`. |
27 -| 2026-09-30 | Office Slice C1: immutable registered correspondence history + server-authoritative read evidence. | **IMPLEMENTED / PRODUCTION + ADVERSARIAL + REAL-DOM + SECURITY VERIFIED** | Production migration `20260930054352_office_registered_history_read_evidence`; runtime head `15b32367ff9a8154729da27cd581930871b5fb5b`; Quality `36674993838` PASS including C1 + Real-DOM; Security `36674993881` CodeQL PASS; Pages `36674993095` PASS. Transactional production verification rejected identity rewrite, backward status, delete, audit mutation/delete and cross-tenant read evidence; rollback residue zero. Evidence: `docs/OFFICE_SLICE_C1_VERIFICATION.md`. |
28 -| 2026-09-30 | Continue autonomously without routine confirmation pauses. | **ACTIVE OPERATING DIRECTIVE** | Applies to reversible in-scope engineering. No claim of background execution. |
29 -| 2026-09-30 | ELI-4 enterprise organization UX: typed hierarchy, consolidated capacity dashboard and organization-admin hardening. | **IMPLEMENTED / PRODUCTION + REAL-DOM + SECURITY VERIFIED; PERSISTENT TWO-USER PROD E2E NOT VERIFIED** | Production migration `20260930053652_enterprise_organization_ux`; unit kinds `region/branch/department/unit/subunit`, same-tenant parent/cycle guard, unit audit, owner/core-admin capacity summary, typed tree UI and company/user/module dashboard. Shell admin button now requires owner or `core/configure`, not arbitrary module configure. Transactional rollback verification PASS for ordinary-user denial, delegated core admin, cross-tenant parent rejection, cycle rejection, invalid kind rejection, capacity summary and unit audit. Product head before evidence commit `e88fab7470bb0697652d347d23ca48332a94c6e4`: Quality `36674128792` PASS including all accounting/Golden/ELI + Real-DOM; Security `36674128874` PASS; Pages `36674128102` PASS. Evidence: `docs/ELI_4_ENTERPRISE_ORGANIZATION_UX_VERIFICATION.md`. Persistent two-real-user production browser E2E remains blocked because production has no legitimate persistent non-owner member. |
30 -| 2026-09-30 | ELI-3 secure invitations for named users, bound to email, roles and seat capacity. | **IMPLEMENTED / PRODUCTION + REAL-DOM + SECURITY VERIFIED** | Production migrations `20260930051849_enterprise_invitations`, `20260930052909_eli3_fk_index_hardening`; hash-only token lifecycle, atomic seat-safe acceptance, role assignment, revoke/expire, audit redaction and UI verified. Evidence: `docs/ELI_3_INVITATIONS_VERIFICATION.md`. External automatic email delivery remains NOT VERIFIED. |
31 -| 2026-09-30 | ELI-2 reusable tenant roles; direct member grants remain explicit overrides. | **IMPLEMENTED / PRODUCTION + REAL-DOM + SECURITY VERIFIED** | Production migrations `20260930050542_enterprise_reusable_roles`, `20260930050904_eli2_role_tenant_hardening`; role catalog/permissions/assignments, direct+role union, tenant integrity, commercial entitlement gate, audit and UI verified. Evidence: `docs/ELI_2_REUSABLE_ROLES_VERIFICATION.md`. |
32 -| 2026-09-30 | ELI-1 named-user seats, company capacity and delegated organization admin. | **IMPLEMENTED / PRODUCTION + REAL-DOM + SECURITY VERIFIED** | Production migration `20260930045827_enterprise_license_seats_delegated_admin`; seat/company limits, delegated `core/configure`, suspend/reactivate, audit and UI verified. Evidence: `docs/ELI_1_ENTERPRISE_LICENSE_VERIFICATION.md`. |
33 -| 2026-09-30 | Slice B organization tenant/RBAC/shared office foundation. | **IMPLEMENTED / VERIFIED** | Tenant/RBAC verification retained. |
34 -| 2026-09-30 | Modular organization-wide ERP + office automation/request foundation. | **SLICE A IMPLEMENTED / VERIFIED** | Product head `df82067ecb1fda9007eb11a30d0a9d7cc1b113cd` passed Quality/Security/Pages. |
17 +| 2026-10-01 | Owner said «ادامه بده» after C8 Task 3 verification. | **EXECUTION IN PROGRESS** | Reconciled live `main` at `398e044eb6570345bff1b34c858d0e6089ab770a`; Quality `36907314330`, Security `36907314457`, Pages `36907313039` all PASS. C8 is now closed for its bounded internal-workflow scope. Next roadmap subsystem is Slice D (requests/BPMS-lite); architectural design approval remains the next product-development gate. |
18 +| 2026-10-01 | Office Slice C8: versioned correspondence workflow policy + runtime. | **IMPLEMENTED / PRODUCTION + ADVERSARIAL + CONCURRENCY + REAL-DOM + SECURITY VERIFIED** | Production migrations `20261001173917`, `20261001180610`, `20261001180949`; immutable workflow evidence, pinned policy versions, capability-gated transitions, optimistic revision checks, idempotent request IDs, private runtime tables, SECURITY INVOKER public wrappers, two-session race test and safe runtime UI. Final main `398e044`; Quality/DB/DOM, CodeQL and Pages PASS. Evidence: `docs/OFFICE_SLICE_C8_WORKFLOW_RUNTIME_VERIFICATION.md` and `docs/OFFICE_SLICE_C8_RUNTIME_UI_VERIFICATION.md`. |
19 +| 2026-10-01 | Owner reconfirmed autonomous GitHub + Supabase execution and five-specialist operating model. | **ACTIVE OPERATING DIRECTIVE** | No repeated routine approval requests. Preserve the safety/cost boundaries above. |
20 +| 2026-10-01 | Free-tier-only development/verification. | **ACTIVE OPERATING DIRECTIVE** | No paid Supabase branch or other billable development resource. |
21 +| 2026-10-01 | Live QA: commerce/tax IDs/request builder/personnel/license/floating-detail coding. | **PARTIALLY IMPLEMENTED / FOLLOW-UPS OPEN** | Kardex/tax-ID/request-draft/profile/license/floating-code work landed before C8. Exact Taxpayer-System print layout still waits for owner reference images. Server-side `requestTypes` configure-only enforcement remains open; UI/nav restriction alone is not a security boundary. |
22 +| 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 below; do not redo completed phases without verified regression evidence. |
23 | 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. |
24
37 -## Live reconciliation — 2026-10-01
38 -- Observed main head: `63fd08f500f31b41877a50020ce023d6ec46f812`. Recent ancestors: `2ba56f885ab7aee4569002f91d7a9e39f0a64ff1`, `3d2938eded49a48aa90f5edb8f1252ff6ee3dc4b`, runtime `b1c800c540e1181ffbe3efc32998c77e0c8f9fd1`.
39 -- Baseline Quality run `36777282033`, Security `36777281994`, Pages `36777282608`: success. Quality job `110098377680` steps and actual logs inspected: accounting/Golden checks succeeded; Chromium real-DOM suite reports `16 passed (11.8s)`. This is inspection of existing execution evidence, NOT a fresh local run, full production E2E, or completion of C8.
40 -- Supabase `hcsixhqbyuhpshfwqpjx`: ACTIVE_HEALTHY; 53 live migrations through `20260930205919`. Repository has 56 SQL files: extra versions `20260929222000`, `20260930222500`, `20260930223000` were read and are comment-only superseded NO-OP placeholders, not pending production DDL. No migration history repair or replay was performed. Full SQL-content equivalence of all 53 migrations remains NOT VERIFIED in this audit.
41 -- Read-only public catalog inspection: all 13 public ordinary/partitioned tables have RLS enabled and at least one policy; FORCE RLS is false. Enabled RLS alone does not prove effective tenant isolation. Fresh adversarial RLS execution and private/storage policy review remain NOT VERIFIED.
42 -- Security advisor still reports 20 authenticated-callable SECURITY DEFINER warnings and disabled leaked-password protection. No security/auth setting was changed. Previous production-membership and performance claims below are historical and were not re-run in this audit.
43 -- No feature is newly marked COMPLETED. Fresh local accounting tests, real-DOM smoke and persistent two-user production E2E: NOT VERIFIED this session. This change only reconciles documentation and records the owner request before implementation.
44 -- Approval boundary: owner approved additive C8 versioned workflow policy/stage/transition storage, immutable transition evidence and tenant-scoped RLS/RPC authorization on 2026-10-01; written design approved; implementation plan approved for autonomous execution. No destructive data operations, commercial-role expansion or auth-provider changes are included in that proposed scope.
45 -
46 -## Live reconciliation — 2026-10-01 (latest, after external QA-workflow commits)
47 -- Observed main head: `f64249a6c84b3c2e12d41eb14ff1c9c92a0c3dbf`. Intervening commits after the C8 authorization checkpoint are `7c0656fe8d3525eef1ffb83113a5d9b1f832468a`, `d0fd15c4d6baa391dd7f0b537672436134007414`, `9d05d56fc2b9898c36da73b7ee229cce9ec8f871`, and `f64249a6c84b3c2e12d41eb14ff1c9c92a0c3dbf`; they added/adjusted the manual QA workflow and did not update this continuity file, so this entry repairs that drift before C8 implementation.
48 -- HEAD CI: Quality `36843788152` success; Security `36843788218` success; Pages `36843787512` success. Quality job `110308938026` logs were inspected: accounting phases 2–6 and Golden journey passed; the repository real-DOM Playwright suite reports `16 passed (8.9s)`.
49 -- The separate manual `.github/workflows/qa.yml` is explicitly non-gating at this checkpoint because its test step has `continue-on-error: true` and logged-in tests skip when `TEST_EMAIL` / `TEST_PASSWORD` are absent. A green run of that workflow must not be cited as proof that its assertions passed.
50 -- Supabase `hcsixhqbyuhpshfwqpjx`: ACTIVE_HEALTHY; 53 live migrations through `20260930205919 office_c7_bind_ocr_source_attachment`; 13 public tables listed and all report RLS enabled. Security advisor: 20 authenticated-callable SECURITY DEFINER warnings plus leaked-password protection disabled. Performance advisor: 11 unused-index informational findings. No database/auth/RLS/role write was made during this reconciliation.
51 -- C8 product/schema/runtime remains NOT IMPLEMENTED / NOT VERIFIED at this checkpoint. The previously approved additive C8 schema/RLS scope remains authorized; destructive financial-history operations and unapproved external-cost actions remain outside autonomous execution.
52 -
53 -## Current production state — 2026-09-30 (historical checkpoint; live checks above)
54 -- Supabase project `hcsixhqbyuhpshfwqpjx`: `ACTIVE_HEALTHY`, PostgreSQL `17.6.1.166`, **53 migrations through `20260930205919 office_c7_bind_ocr_source_attachment`**.
55 -- Continuity repair: live migration `20260930203839 office_c5_content_digest_hardening` was found live but absent from Git; its exact SQL was recovered from Supabase migration history and archived before C6.
56 -- Four organization-linked licenses with server-enforced `max_companies`, `max_users`, modules and future-safe `limits`; no license is below current active seat/company usage.
57 -- Persistent production membership remains four active owners and zero non-owner members. All ELI adversarial multi-user tests used existing legitimate principals inside transactions and rolled back.
58 -- ELI-2 persistent seeded state: 24 system roles across four organizations, 28 starter role-permission rows, zero persistent member-role assignments.
59 -- ELI-3 persistent state after tests: zero invitations, zero invitation-role links, zero non-owner members and zero role assignments.
60 -- ELI-4 persistent organization-unit count remains zero after rollback verification; no test hierarchy residue exists.
61 -- Office C2 persistent state after rollback verification: zero referrals, zero correspondence-audit events and zero non-owner members; temporary license seat expansion returned to `max_users=1` for the exercised organization.
62 -- RLS is enabled on public tenant tables. Security advisor currently reports 20 authenticated-callable public SECURITY DEFINER warnings plus leaked-password protection disabled; C7 public wrappers are SECURITY INVOKER and did not increase this count.
63 -- Performance advisor reports only unused-index informational notices; no unindexed foreign-key findings remain.
64 -- Production invoice history remains unchanged; controlled accounting cutover is not part of ELI work.
25 +## Live reconciliation — 2026-10-01 after C8 closure
26 +- `main`: `398e044eb6570345bff1b34c858d0e6089ab770a` (`C8 workflow runtime UI integration`).
27 +- Quality run `36907314330`: PASS. Static/accounting/Golden/ELI/C1-C8 gates passed; disposable C8 PostgreSQL policy/runtime/security/concurrency job passed; real-DOM suite passed including C8 runtime UI.
28 +- Security run `36907314457`: CodeQL JavaScript PASS; dependency review was skipped because the repository dependency-graph boundary remains unresolved.
29 +- Pages run `36907313039`: PASS.
30 +- Supabase project `hcsixhqbyuhpshfwqpjx`: live migrations now include C8 `20261001173917 office_slice_c8_workflow_policy`, `20261001180610 office_slice_c8_workflow_runtime`, `20261001180949 office_c8_policy_publisher_fk_index`.
31 +- Post-C8 persistent workflow residue: zero workflow instances, zero workflow events and zero workflow policy versions in the checked production state.
32 +- Supabase performance advisor: unused-index informational notices only; no unindexed-FK finding at the C8 closure check.
33 +- Supabase security advisor: three private C8 tables have RLS enabled with no policies because direct client table access is revoked and access is mediated by checked RPCs; 20 pre-existing authenticated-callable public SECURITY DEFINER warnings remain; leaked-password protection remains disabled. These warnings are not silently treated as resolved.
34
35 ## Implemented foundations
36 +- Accounting phases 1–6: accepted high-assurance accounting foundation; posted history remains immutable and balanced.
37 - Slice A: server-enforced commercial module entitlements, module launcher, office registries/correspondence/private scans, configurable request-type foundation.
68 -- Slice B: organizations, hierarchical units, memberships, direct per-member module capabilities, row scopes, confidentiality, organization-aware sync/license context, shared office records/referrals/audit.
69 -- ELI-1: named-user seats, company capacity, delegated customer admin and member lifecycle.
70 -- ELI-2: reusable roles, role permissions, multi-role assignment, direct+role effective authorization and role audit.
71 -- ELI-3: secure hash-only invitations, email binding, role-bound acceptance, atomic seat enforcement, revoke/expire lifecycle, invitation UI and URL acceptance.
72 -- ELI-4: typed organization tree, tenant/cycle integrity, capacity dashboard and strict core-admin shell gating.
73 -- Office C1 runtime/server foundation: registered correspondence identity/history protection, monotonic status, immutable audit evidence, authenticated read-evidence RPC and open-flow integration.
74 -- Office C2: server-authorized referral targets, target-bound immutable referrals, ordered acknowledgement/completion evidence, server-filtered SLA work queue, referral UI/actions, and direct referral/audit forgery prevention.
75 -- Office C3: append-only reply/related-letter graph, cycle/duplicate protection, append-only archive classification, latest-event semantics and server-filtered archive/related search.
76 -- Office C4: tenant-safe atomic registration, private append-only versioned correspondence templates, server-validated template provenance and controlled new-letter template application.
77 -- Office C5: content-bound internal approval/rejection with explicit approver authorization, append-only evidence, AAL metadata, stale-content detection and a strict non-qualified-signature boundary.
78 -- Office C6: server-derived SLA queue, daily reminder deduplication, 24-hour escalation threshold, internal-only immutable evidence, stale/terminal-work rejection and requester/admin authorization.
79 -- Office C7: tenant-safe server full-text archive search across metadata/body/latest OCR, append-only OCR provenance/correction evidence, bounded search inputs, same-letter attachment-bound OCR source provenance and explicit no-real-OCR claim.
80 -- Existing accounting Phases 1–6 and Iran enterprise foundation remain accepted; ELI work must not rewrite posted accounting history.
38 +- Slice B: organizations, hierarchical units, memberships, direct/member-role capabilities, row scopes, confidentiality and shared office records.
39 +- ELI-1–4: named-user/company capacity, delegated organization admin, reusable roles, secure invitations, typed organization tree and capacity UX.
40 +- Office C1: immutable registered correspondence/read evidence.
41 +- Office C2: actionable referrals, target authorization, immutable actions and SLA work queue.
42 +- Office C3: related-letter graph and structured archive classification/search.
43 +- Office C4: tenant-safe registration repair and versioned correspondence templates.
44 +- Office C5: content-bound internal approval/attestation lifecycle.
45 +- Office C6: server-derived SLA reminder/escalation evidence.
46 +- Office C7: tenant-safe full-text archive search with append-only OCR provenance/correction evidence; no real OCR-engine claim.
47 +- Office C8: versioned workflow policies, immutable runtime transition history, idempotent/concurrency-safe server operations and safe correspondence workflow UI. C8 is internal workflow only, not external BPM/provider integration.
48
49 ## Invariants
83 -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 and seat-safe; raw invitation tokens are never persisted or audited; organization-unit parents cannot cross tenants or form cycles; referral targets must already be authorized to read the source correspondence; only the bound target may acknowledge/complete a referral; referral/audit evidence can only be inserted by authorized server operations; OCR provenance must reference a real attachment belonging to the same organization and correspondence.
50 +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; referral targets must already be authorized to read the source correspondence; only the bound target may acknowledge/complete a referral; referral/audit evidence can only be inserted by authorized server operations; OCR provenance must reference a real attachment belonging to the same organization/correspondence; C8 workflow policy is pinned per instance, workflow evidence is append-only, transitions require server-authorized capability and expected revision, and workflow stage never replaces C1 registration status or C5 approval evidence.
51
52 ## Required evidence
86 -`docs/PHASE_1_REDESIGN_VERIFICATION.md` · `docs/PHASE_2_REDESIGN_VERIFICATION.md` · `docs/PHASE_3_REDESIGN_VERIFICATION.md` · `docs/PHASE_4_REDESIGN_VERIFICATION.md` · `docs/PHASE_5_VERIFICATION.md` · `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/superpowers/specs/2026-09-30-enterprise-licensing-organization-identity-design.md` · `docs/ELI_1_ENTERPRISE_LICENSE_VERIFICATION.md` · `docs/ELI_2_REUSABLE_ROLES_VERIFICATION.md` · `docs/ELI_3_INVITATIONS_VERIFICATION.md` · `docs/ELI_4_ENTERPRISE_ORGANIZATION_UX_VERIFICATION.md` · `docs/OFFICE_SLICE_C1_VERIFICATION.md` · `docs/OFFICE_SLICE_C2_VERIFICATION.md` · `docs/OFFICE_SLICE_C3_VERIFICATION.md` · `docs/OFFICE_SLICE_C4_VERIFICATION.md` · `docs/OFFICE_SLICE_C5_VERIFICATION.md` · `docs/OFFICE_SLICE_C6_VERIFICATION.md` · `docs/OFFICE_SLICE_C7_VERIFICATION.md` · `docs/PRODUCTION_RUNBOOK.md` · `supabase/migrations/`.
53 +`docs/PHASE_1_REDESIGN_VERIFICATION.md` · `docs/PHASE_2_REDESIGN_VERIFICATION.md` · `docs/PHASE_3_REDESIGN_VERIFICATION.md` · `docs/PHASE_4_REDESIGN_VERIFICATION.md` · `docs/PHASE_5_VERIFICATION.md` · `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` · `docs/ELI_2_REUSABLE_ROLES_VERIFICATION.md` · `docs/ELI_3_INVITATIONS_VERIFICATION.md` · `docs/ELI_4_ENTERPRISE_ORGANIZATION_UX_VERIFICATION.md` · `docs/OFFICE_SLICE_C1_VERIFICATION.md` through `docs/OFFICE_SLICE_C7_VERIFICATION.md` · `docs/OFFICE_SLICE_C8_WORKFLOW_RUNTIME_VERIFICATION.md` · `docs/OFFICE_SLICE_C8_RUNTIME_UI_VERIFICATION.md` · `docs/PRODUCTION_RUNBOOK.md` · `supabase/migrations/`.
54
55 ## NOT VERIFIED / external boundary
89 -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; qualified digital signature; physical printer; live external adapters; GitHub Dependency graph; leaked-password protection; PostgreSQL 17.11 upgrade; CodeQL v4 migration.
56 +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 17.11 upgrade; CodeQL v4 migration; external BPM/provider integration.
57
58 ## Exact next executable work
92 -1. Execute the approved C8 plan autonomously with five specialist agents; no further routine review/approval gate. Sensitive C8 schema/RLS scope is approved; do not ask for the same scope permission again. Then implement Office Slice C8 as the next bounded internal-office vertical slice: mature correspondence workflow policy (configurable workflow stages, authorized transition rules and immutable transition evidence) without claiming external BPM/provider integration; preserve all C1-C7/accounting/Golden/ELI gates.
93 -2. Keep qualified digital signature and external delivery adapters explicitly outside verified scope until real providers are connected and tested.
94 -3. Authenticated two-real-user production browser verification remains blocked until a legitimate persistent non-owner principal is intentionally available; do not fabricate or permanently cross-add one.
95 -4. External invitation email delivery remains an adapter boundary; do not claim it until a real provider is connected and tested.
96 -5. Continue compliance/accounting roadmap only with sourced legal/tax/accounting evidence and owner-approved destructive cutovers.
97 -
98 -## C8 design checkpoint — 2026-10-01
99 -- Pre-change head `8537d8031be3dea6523c06fa5a41f8ea9c2c00c7`; Quality `36824397610` success, Pages `36824397187` success, Security `36824397695` in progress at observation. These statuses are not new C8 test evidence.
100 -- Read-only Supabase recheck: 53 migrations, latest `20260930205919`, zero public ordinary/partitioned tables without RLS. No database write performed.
101 -- Proposed design self-reviewed for scope, authorization, immutable evidence, concurrency, idempotency, expired-license read-only behavior and non-interference with C1/C5/accounting.
102 -- C8 implementation, migrations, real-DOM, accounting rerun and database adversarial/concurrency tests: NOT VERIFIED / NOT RUN. This commit changes documentation only.
103 -
104 -## C8 task-1 implementation checkpoint — 2026-10-01
105 -- Baseline before C8 code: main `43680ac03434ed1d6f7f18a0177c7be59c87f1d1`; immediately preceding reconciled baseline `f64249a6c84b3c2e12d41eb14ff1c9c92a0c3dbf` had Quality `36843788152` PASS with accounting/Golden checks and real-DOM `16 passed (8.9s)`, Security `36843788218` PASS, Pages `36843787512` PASS.
106 -- Live database review confirmed current RBAC helpers, composite records identity, and C1 canonical correspondence statuses `draft / registered / submitted / closed`; persistent production currently contains no correspondence rows. C8 must therefore treat only `registered` and `submitted` as transitionable and `closed` as terminal.
107 -- Added the pre-deployment C8 policy editor/catalog module plus behavior-level Playwright and static contract tests. The module is intentionally NOT loaded by `js/bootstrap.js` until the approved database RPCs are deployed and verified, preventing a broken production control surface.
108 -- Quality workflow now includes the C8 static contract and mocked real-DOM policy publication test while preserving all prior accounting/Golden/ELI/C1-C7 gates. Independent runtime review caught that the real app exposes Supabase as lexical `const sb` rather than `window.sb`; the C8 transport resolver was corrected before activation to support both the production lexical client and test injection.
109 -- Database migration, SQL behavioral tests, concurrency test, attach/transition/read RPCs and production C8 E2E remain NOT IMPLEMENTED / NOT VERIFIED. Supabase has no development branch. A development branch would cost $0.01344/hour and is an external-cost boundary requiring explicit cost confirmation before creation.
110 -
111 -## C8 implementation-plan checkpoint — 2026-10-01
112 -- Baseline main `53cd24eabdfed3bae162bbc217753824a8cfb3bb`; Quality `36824644380`, Security `36824644419`, Pages `36824643831` observed success. These are prior documentation-head statuses, not C8 verification.
113 -- Read actual runtime loader `js/bootstrap.js`, office modules and C7 tests; plan uses focused `js/office-workflow.js` and behavior-level DOM assertions instead of presence-only checks.
114 -- Read-only live database confirmed `records_pkey PRIMARY KEY (organization_id, collection, id)`; C8 FK plan binds the complete identity.
115 -- Plan self-reviewed for spec coverage, interface consistency and retry/tenant-switch/concurrency/malformed-input/HTML failure modes.
116 -- No product or database changes; fresh C8 accounting/DOM/database/concurrency tests NOT RUN / NOT VERIFIED. Next: owner plan review and execution choice, then implement without repeating the approved scope/design questions.
117 -
118 -## Operating constraint — free-tier only — 2026-10-01
119 -- Owner requires Finora development/verification to use only zero-cost/free-tier services and features; no paid Supabase development branch or other billable resource may be created.
120 -- C8 verification must therefore use a zero-cost path (repository/CI tests plus safe non-destructive verification against already-available infrastructure). Any step that would incur a charge is blocked and must be replaced with a free alternative rather than requesting payment.
121 -
122 -## Live QA change ledger — 2026-10-01 — commerce, tax invoice, coding, requests, licensing
123 -- Product catalog: add Kardex action beside edit/delete; deletion must remain blocked whenever the product/service has operational references.
124 -- Taxpayer electronic invoice: reuse the product master domestic goods/service identifier automatically; add a foreign/official goods-service identifier to product master and require it at invoice time only when absent. Exact official print-layout reproduction is pending the two reference images the owner will provide; do not guess the visual form.
125 -- Floating-detail coding: design deterministic readable 8-digit codes where leading digits identify floating-detail level and bound source/category (branch first by default), while preserving separate account coding logic. Compare against maintainable ERP coding practice before finalizing defaults.
126 -- Request builder: adding fields must never erase previous fields; add guided code/title/category presets with custom values; restrict request-type/form-builder access to system admin or explicitly delegated configure permission.
127 -- Requests: selecting a type must render its configured fields; create as editable draft first, allow editing until explicit submit, then advance state. Support requester/other organization member/companions as form semantics and prefill available user/employee profile data where legitimately present.
128 -- User/personnel profile: plan the minimum identity fields needed by request prefill (name, organization unit, position, mobile, personnel number) without inventing missing personal data.
129 -- Central license admin: owner/admin edit surface must expose both company capacity and named-user capacity; existing server limits remain authoritative.
130 -- Release discipline: after every finalized GitHub change, inspect the relevant GitHub Actions result and also search the connected Gmail inbox for GitHub run-failure notifications; a green-looking UI alone is not release evidence.
131 -- Free-tier-only constraint remains mandatory. No paid service/branch.
132 -
133 -## Live QA implementation checkpoint — 2026-10-01 — wave A
134 -- Product catalog now exposes Edit + Kardex + Delete; delete still fails closed when any datastore record references the product. Product master now stores domestic tax identifier and optional Taxpayer-System/official identifier; electronic-invoice rows reuse the domestic identifier read-only and prefill the official identifier, requiring it only when the master lacks it.
135 -- Request builder was reworked so field additions preserve existing fields; code/title/category now have guided presets plus custom input. Form-builder UI is restricted to system admin, organization owner, or requests_workflow.configure. New requests render configured fields, save as editable draft, and require explicit submit; draft rows expose Edit/Submit. Available employee/user identity is snapshotted for requester semantics without fabricating absent data.
136 -- Central license admin action is relabeled as full license correction; existing max_companies/max_users controls and authoritative server RPCs remain in use.
137 -- Gmail release check found Quality run 36894856577 for baseline 9ce493f FAILED only at C8 real-DOM test: auth-screen intercepted the mocked policy-editor click; all accounting/Golden/static gates passed and 17/18 DOM tests passed. C8 test isolation was corrected at commit 29109c275c1ffacdb370b0744113482bb22fd330 by hiding the auth overlay in the mocked test fixture. Fresh post-fix CI result: NOT VERIFIED yet.
138 -- Exact Taxpayer-System print redesign remains WAITING FOR OWNER REFERENCE IMAGES; no visual form was guessed.
139 -- Floating-detail 8-digit coding model is still IN ANALYSIS / NOT IMPLEMENTED; current foundation has fixed slots BRANCH=1, COUNTERPARTY=2, PROJECT=3, CONTRACT=4 and one sourceEntity per dimension type, so the requested multi-category-per-slot semantics require a deliberate compatibility design rather than silently changing existing codes.
140 -- Server-side enforcement for requestTypes configure-only writes is NOT CHANGED in this wave because that requires an RLS/server authorization change; UI restriction is implemented, server hardening remains a sensitive follow-up.
141 -
142 -## Live QA implementation checkpoint — 2026-10-01 — wave B
143 -- Fixed the product Kardex syntax defect reported by GitHub Quality email for run 36895470489; the failure was at js/products.js nullish/OR expression. Fix commit: 183da9f1e273a06bcec1509f3338108279469b35.
144 -- Product tax identifiers now also flow through quick-product creation and Excel import/template. Request form-builder navigation is hidden when requests_workflow.configure is absent. Employee master now captures position, organization-unit title and mobile in addition to personnel number/name for legitimate request-prefill use.
145 -- Floating-detail default coding implemented for new records as an 8-digit semantic code: digit 1 = floating slot, digit 2 = category ordinal within that slot, digits 3–8 = sequence. Current safe defaults are Branch 11xxxxxx, Counterparty 21xxxxxx, Project 31xxxxxx; existing historical codes are not rewritten. This preserves the market-standard principle of one reusable floating detail across multiple accounts while making the code human-recognizable. Account chart coding remains independent.
146 -- Market comparison reviewed: floating-detail systems commonly keep a single reusable detail identity linked to multiple accounts and expose its activity across accounts; therefore Finora keeps entity identity independent from account code and uses floatingCode as a semantic analytic code rather than embedding the full GL/subsidiary path.
147 -- Latest observed main head before this state write: 602eb1725222795ef124b0ecf57ee06eb2078eaa. No newer GitHub failure notification for commits after the syntax fix was present in connected Gmail at the last check, but absence of failure email is NOT a CI PASS; fresh run/job logs are still NOT VERIFIED.
148 -- Exact Taxpayer-System print layout remains pending the two owner images. Server-side configure-only enforcement for requestTypes remains pending an approved RLS/server authorization change; current UI/nav restriction alone is not treated as a security boundary.
59 +1. Close documentation drift from C8: keep the gap register and continuity evidence aligned with C8 being complete for its bounded internal scope.
60 +2. Next product subsystem is **Slice D — requests/BPMS-lite** from `docs/FINORA_MODULAR_ERP_OFFICE_AUTOMATION_V1.md`: versioned request schemas/forms, visual step definitions, conditions, sequential/parallel approvals, SLA/escalation, delegation/substitution, immutable action history and cross-module actions. This is architectural work; explore the existing request foundation first and produce the design/spec/plan before implementation.
61 +3. Do not duplicate C8 correspondence workflow inside Slice D. Reuse its proven patterns (version pinning, immutable evidence, idempotency, optimistic concurrency, capability checks) while keeping request workflow state separate from correspondence state.
62 +4. Keep qualified digital signature, external delivery/BPM adapters and real OCR provider outside verified scope until real providers are connected and tested.
63 +5. Two-real-user production browser verification remains blocked until a legitimate persistent non-owner principal exists; do not fabricate one.
64 +6. Continue compliance/accounting roadmap only with sourced legal/tax/accounting evidence and controlled cutover safeguards.
65 +
66 +## Live QA open items
67 +- Exact Taxpayer-System print redesign: waiting for the two owner reference images; do not guess the official visual form.
68 +- `requestTypes` configure-only writes: UI/nav restriction exists, but server-side enforcement remains open and must be designed into Slice D authorization rather than treated as already secure.
69 +- Floating-detail defaults for new records: 8-digit semantic codes currently use slot/category/sequence (Branch `11xxxxxx`, Counterparty `21xxxxxx`, Project `31xxxxxx`); historical codes are not rewritten and account-chart coding stays independent.
70 +- Product/service deletion must continue to fail closed whenever operational references exist.