Mirrored from https://github.com/davoodmehraban89/Aram.git
Synced Dec 4, 08:00 UTC
codex/gate-2a-pilot-workbook-6864754244772568979
add-index-html-10623938925177053894
arena/094f314c-aram
chatgpt-phase1b2-autopilot
codex/adr-future-connectors-pi-v1
codex/aram-account-note-source-trace-20261031
codex/aram-actions-node24-maintenance-20261031
codex/aram-analyst-review-workbook-20261031
codex/aram-bs-candidate-statement-20261031
codex/aram-cash-flow-direct-candidate-20261031
codex/aram-clean-reference-year-integrity-20261030
codex/aram-cross-statement-controls-20261031
codex/aram-equity-changes-candidate-20261031
codex/aram-five-statement-cli-20261031
codex/aram-five-statement-integration-20261031
codex/aram-five-statement-orchestrator-20261031
codex/aram-gate3-coverage-target-guard-20261030
codex/aram-gate3-hidden-xlsx-guard-20261030
codex/aram-gate3-integration-validation-20261030
codex/aram-gate3-mapping-change-preview-20261030
codex/aram-gate3-stale-note-guard-20261030
codex/aram-income-statement-candidate-20261031
codex/aram-manifest-referential-integrity-20261031
codex/aram-mapping-source-parser-20261101
codex/aram-multidimensional-mapping-20261101
codex/aram-multistatement-mapping-20261031
codex/aram-pipeline-manifest-schema-20261031
codex/aram-readonly-mapping-coverage-20261031
codex/aram-reconciliation-review-gate-20261031
codex/aram-same-flush-fiscal-lock-20261030
codex/aram-synthetic-windows-demo-20261031
codex/aram-trial-balance-diagnostic-20261031
codex/aram-windows-background-detail-search-20261031
codex/aram-windows-detail-review-20261031
codex/aram-windows-five-statement-pilot-20261031
codex/aram-windows-statement-figures-20261031
codex/gate-2a-pilot-workbook
codex/gate-2a-pilot-workbook-6864754244772568979
codex/gate3-authenticated-principal-boundary-20261030
codex/gate3-authored-draft-staging-20261030
codex/gate3-carry-forward-preview-20261023
codex/gate3-draft-staging-audit-20261030
codex/gate3-mapping-batch-freshness-20261030
codex/gate3-mapping-batch-review-20261030
codex/gate3-mapping-core
codex/gate3-mapping-coverage-20261023
codex/gate3-mapping-excel-20261023
codex/gate3-note-mapping-review-20261023
codex/gate3-signed-year-scope-20261030
codex/gate3-unapproved-proposal-storage-20261030
codex/payvast-mapping-discovery-20261023
codex/phase-2a-backend-foundation
codex/phase-2b-post-merge-record
codex/phase-2b-source-registration
codex/phase-2b-source-registration-12955190277775369594
codex/post-gate2a-control-reconciliation
codex/post-pr18-acceptance-record
codex/project-control-foundation
codex/t1-repo-hygiene-20261023
codex/t2-ci-hardening-20261023
codex/t3-explicit-migrations-20261023
codex/t6a-readonly-diagnostics-20261023
codex/v1-01-safety-gate-hardening
codex/v1-year-isolation-followup-20261023
codex/windows-native-pilot-shell-20261030
docs/aram-master-control-plan-20261111
docs/aram-roadmap-dashboard-20261030
docs/financial-statement-reconciliation-1402-1404-20261110
feat/gate3-governed-mapping-20261101
feat/gate3-package9-1-security-20261103
feat/gate3-package9-isolated-20261103
fix/password-unicode-validation-20261111
governance/aram-5-1-3-controls-20261030
governance/role-based-operating-model
jules-1168663913887856558-73b8a885
jules-gate-2b-mapping-workflow-foundation-4137724387867065330
phase-1b1-audit-report-7365389436990903239
phase-2a-backend-foundation-10237597358138521261
phase1b2-postmerge-metadata-fix
refactor/drg-parent-year-id-15088443704684163304
source-data-cleanup
| 1 | # V1 Pilot Workbook Contract v0.1 |
| 2 | |
| 3 | This document governs the strictly structured V1 Pilot workbook format. It outlines the schema, validation rules, and cross-sheet relationships to ensure audit-safe processing and strict determinism. |
| 4 | |
| 5 | ## 1. Required Sheet Names and Header Order |
| 6 | |
| 7 | The workbook must contain exactly the following sheets, with headers occurring exactly in this order. |
| 8 | |
| 9 | ### `Company` |
| 10 | 1. `company_code` (Text, Required) |
| 11 | 2. `company_name` (Text, Required) |
| 12 | 3. `fiscal_year` (Integer, Required) |
| 13 | 4. `status` (Text, Required: Draft, Reviewed, Approved) |
| 14 | |
| 15 | ### `Accounts` |
| 16 | 1. `company_code` (Text, Required) |
| 17 | 2. `fiscal_year` (Integer, Required) |
| 18 | 3. `account_code` (Text, Required, Unique within company/year) |
| 19 | 4. `account_name` (Text, Required) |
| 20 | 5. `t1_code` (Text, Optional) |
| 21 | 6. `t2_code` (Text, Optional) |
| 22 | 7. `t3_code` (Text, Optional) |
| 23 | 8. `t4_code` (Text, Optional) |
| 24 | 9. `nature` (Text, Optional) |
| 25 | 10. `opening` (Decimal, Required) |
| 26 | 11. `debit` (Decimal, Required) |
| 27 | 12. `credit` (Decimal, Required) |
| 28 | 13. `closing` (Decimal, Required) |
| 29 | |
| 30 | ### `Notes` |
| 31 | 1. `company_code` (Text, Required) |
| 32 | 2. `fiscal_year` (Integer, Required) |
| 33 | 3. `note_number` (Text, Required, Unique within company/year) |
| 34 | 4. `title` (Text, Required) |
| 35 | 5. `row_order` (Integer, Required) |
| 36 | 6. `label` (Text, Required) |
| 37 | |
| 38 | ### `Mapping` |
| 39 | 1. `company_code` (Text, Required) |
| 40 | 2. `fiscal_year` (Integer, Required) |
| 41 | 3. `mapping_id` (Text, Required, Unique within company/year) |
| 42 | 4. `account_code` (Text, Required) |
| 43 | 5. `note_number` (Text, Required) |
| 44 | 6. `mapping_type` (Text, Required) |
| 45 | |
| 46 | ### `Test_Log` |
| 47 | 1. `test_id` |
| 48 | 2. `description` |
| 49 | 3. `result` |
| 50 | |
| 51 | ### `Checks` |
| 52 | 1. `check_name` |
| 53 | 2. `status` |
| 54 | |
| 55 | ### `Guide_FA` |
| 56 | Contains instructional text in Persian guiding the user on how to populate the workbook. |
| 57 | |
| 58 | ### `Lists` |
| 59 | Contains valid dropdown values for fields like `status` and `mapping_type`. |
| 60 | |
| 61 | ## 2. Constraints and Rules |
| 62 | |
| 63 | ### 2.1 Lifecycle/Status Values |
| 64 | The `status` field in the `Company` sheet must be exactly one of: `Draft`, `Reviewed`, `Approved`. The validation engine checks this value but never advances or mutates it. |
| 65 | |
| 66 | ### 2.2 Company/Year Isolation |
| 67 | All cross-sheet lookups and validations are strictly scoped by the composite key of `company_code` + `fiscal_year`. |
| 68 | - Every row in `Accounts`, `Notes`, and `Mapping` must correspond to a defined `company_code` + `fiscal_year` present in the `Company` sheet. |
| 69 | |
| 70 | ### 2.3 Cross-Sheet Keys & Duplicate Rules |
| 71 | - **Accounts:** `account_code` must be unique per `company_code` + `fiscal_year`. |
| 72 | - **Notes:** `note_number` must be unique per `company_code` + `fiscal_year`. (Duplicate rows for the same note are allowed if `row_order` varies, representing note lines). |
| 73 | - **Mapping:** `mapping_id` must be unique per `company_code` + `fiscal_year`. `account_code` referenced here must exist in the `Accounts` sheet for the same company/year. |
| 74 | - **Unknown Accounts:** Any mapping row referencing an `account_code` not found in `Accounts` will be reported as an error. The system will *never* silently ignore them or guess values. |
| 75 | |
| 76 | ### 2.4 Financial Validation & `closing_delta` |
| 77 | The validator will compute `closing_delta = opening + debit - credit - closing` using strict Decimal arithmetic. |
| 78 | - A non-zero `closing_delta` is reported as a validation error. |
| 79 | - This calculation is strictly for validation. The system must *never* mutate source values, force balances, or treat this calculation as a financial statement rollup. |
| 80 | |
| 81 | ### 2.5 Validation Error Schema |
| 82 | Errors must be collected deterministically and reported comprehensively (no fail-fast). The error schema is: |
| 83 | - **Severity**: e.g., `ERROR`, `WARNING` |
| 84 | - **Code**: e.g., `MISSING_FIELD`, `DUPLICATE_KEY`, `INVALID_TYPE`, `UNKNOWN_ACCOUNT`, `NON_ZERO_DELTA` |
| 85 | - **Sheet**: Name of the sheet |
| 86 | - **Row**: 1-indexed Excel row number |
| 87 | - **Field**: The column header name |
| 88 | - **Message**: A descriptive error message |
| 89 | |
| 90 | ### 2.6 Immutability and No-Persistence Boundary |
| 91 | - The preflight validation API is read-only. It operates entirely in memory. |
| 92 | - It must *never* write to the database. |
| 93 | - It must *never* alter the uploaded workbook bytes. |
| 94 | - It must *never* perform automated corrections or silent guessing. |