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
md 4.02 KB

V1 Pilot Workbook Contract v0.1

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.

1. Required Sheet Names and Header Order

The workbook must contain exactly the following sheets, with headers occurring exactly in this order.

Company

  1. company_code (Text, Required)
  2. company_name (Text, Required)
  3. fiscal_year (Integer, Required)
  4. status (Text, Required: Draft, Reviewed, Approved)

Accounts

  1. company_code (Text, Required)
  2. fiscal_year (Integer, Required)
  3. account_code (Text, Required, Unique within company/year)
  4. account_name (Text, Required)
  5. t1_code (Text, Optional)
  6. t2_code (Text, Optional)
  7. t3_code (Text, Optional)
  8. t4_code (Text, Optional)
  9. nature (Text, Optional)
  10. opening (Decimal, Required)
  11. debit (Decimal, Required)
  12. credit (Decimal, Required)
  13. closing (Decimal, Required)

Notes

  1. company_code (Text, Required)
  2. fiscal_year (Integer, Required)
  3. note_number (Text, Required, Unique within company/year)
  4. title (Text, Required)
  5. row_order (Integer, Required)
  6. label (Text, Required)

Mapping

  1. company_code (Text, Required)
  2. fiscal_year (Integer, Required)
  3. mapping_id (Text, Required, Unique within company/year)
  4. account_code (Text, Required)
  5. note_number (Text, Required)
  6. mapping_type (Text, Required)

Test_Log

  1. test_id
  2. description
  3. result

Checks

  1. check_name
  2. status

Guide_FA

Contains instructional text in Persian guiding the user on how to populate the workbook.

Lists

Contains valid dropdown values for fields like status and mapping_type.

2. Constraints and Rules

2.1 Lifecycle/Status Values

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.

2.2 Company/Year Isolation

All cross-sheet lookups and validations are strictly scoped by the composite key of company_code + fiscal_year. - Every row in Accounts, Notes, and Mapping must correspond to a defined company_code + fiscal_year present in the Company sheet.

2.3 Cross-Sheet Keys & Duplicate Rules

  • Accounts: account_code must be unique per company_code + fiscal_year.
  • 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).
  • 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.
  • 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.

2.4 Financial Validation & closing_delta

The validator will compute closing_delta = opening + debit - credit - closing using strict Decimal arithmetic. - A non-zero closing_delta is reported as a validation error. - This calculation is strictly for validation. The system must never mutate source values, force balances, or treat this calculation as a financial statement rollup.

2.5 Validation Error Schema

Errors must be collected deterministically and reported comprehensively (no fail-fast). The error schema is: - Severity: e.g., ERROR, WARNING - Code: e.g., MISSING_FIELD, DUPLICATE_KEY, INVALID_TYPE, UNKNOWN_ACCOUNT, NON_ZERO_DELTA - Sheet: Name of the sheet - Row: 1-indexed Excel row number - Field: The column header name - Message: A descriptive error message

2.6 Immutability and No-Persistence Boundary

  • The preflight validation API is read-only. It operates entirely in memory.
  • It must never write to the database.
  • It must never alter the uploaded workbook bytes.
  • It must never perform automated corrections or silent guessing.