Mirrored from https://github.com/davoodmehraban89/Aram.git
Synced Dec 3, 20:45 UTC
source-data-cleanup
ADR-019 — Mapping Excel I/O, unknown queue, and approval gate (Phase 2)
- Status: Accepted (Phase 2)
- Date: 2026-12-03
- Booklet: §15 Phase 2, D1/D4, P-09
Context
Phase 1 built statements from mappings, but mappings could only be created one at a time. V1 requires comprehensive mapping Excel import/export, an unknown-account queue, carry-forward between years, and an approval gate that refuses to approve while any blocking control fails.
Decision
Mapping workbook contract
A single Mappings sheet with columns:
account_code, account_name, target_note_number, statement, section, mapping_type.
Codes are text (leading zeros preserved). Import is fail-closed per row: invalid
rows are collected in errors and skipped; valid rows create the note (if new)
and the mapping. Export joins mappings with note metadata and imported account
names. Re-import is idempotent (existing account→note pairs are not duplicated).
Unknown-account queue (C-04)
unknown_accounts lists active accounts (any non-zero opening/debit/credit/
closing) with no mapping, sorted by code, with name/closing/source_row. Resolving
the queue is mandatory before approval.
Approval gate (P-09)
approve_year runs C-01..C-04 over the latest import + active mappings. Any
blocking ERROR refuses Draft→Approved and returns the failing controls. A clean
pass transitions the year and appends a hash-chained audit entry. Only Draft
years may be approved.
Carry-forward (D1)
carry_forward_mappings(from_year, to_year) copies notes (by note_number) and
mappings into a Draft target year, idempotently, so 1403→1404 continuity reuses
prior mappings instead of starting from scratch.
Consequences
- Mappings are portable through a governed, auditable workbook.
- Approval is impossible while controls fail; the audit chain records each pass.
- Year continuity is supported without re-keying mappings.
Rejected alternatives
- Auto-creating mappings for unmapped accounts: would invent financial mappings (forbidden by §19); the queue forces explicit human resolution.