docs: add mandatory Aram master control plan
davoodmehraban89 committed
Nov 11, 2026 at 13:05 UTC
7a77674ffa6097913b9ac7c3125020940bb5b81e
1 file changed
+359
docs/ARAM_MASTER_CONTROL_PLAN.md
new
+359
@@ -0,0 +1,359 @@
1
+# Aram — Master Project Control Plan
2
+
3
+**Document status:** Active control baseline (documentation-only candidate)
4
+**Prepared:** 2026-11-11
5
+**Repository:** `davoodmehraban89/Aram`
6
+**Accepted baseline branch:** `source-data-cleanup`
7
+**Accepted baseline SHA:** `7dc864fd032f0c4ae4d650d89304a01286a6d914`
8
+**Control branch:** `docs/aram-master-control-plan-20261111`
9
+**Decision:** Continue controlled engineering; **NO-GO for production, merge of gated candidates, or release until the relevant acceptance gates pass.**
10
+
11
+> This document is the mandatory starting point for every developer, reviewer, automation agent, and future work session on Aram. It is a control register, not evidence that unfinished work has been accepted.
12
+
13
+---
14
+
15
+## 1. Mission and product boundary
16
+
17
+Aram is intended to be a controlled financial-statement preparation and reconciliation application. Its target workflow is:
18
+
19
+1. Register an entity and fiscal year.
20
+2. Import approved trial-balance / general-ledger and supporting workbook sources.
21
+3. Inspect and validate source structure and provenance.
22
+4. Map accounts and dimensions to statement lines and note disclosures.
23
+5. Resolve unmatched and ambiguous mappings through an auditable workflow.
24
+6. Generate the five financial statements and related notes.
25
+7. Reconcile statements, notes, comparative periods, and source ledger.
26
+8. Route work through maker / reviewer / approver controls.
27
+9. Export controlled Excel / PDF outputs with traceability.
28
+10. Preserve immutable audit evidence and prove backup / restore.
29
+11. Package, install, operate, and support the Windows application.
30
+
31
+A feature is **not complete** merely because source code exists or unit tests pass. Acceptance requires implementation, tests, integration, operational evidence where relevant, documentation, and an explicit reviewer decision.
32
+
33
+## 2. Executive status
34
+
35
+| Area | Evidence observed | Status |
36
+|---|---|---|
37
+| Accepted backend foundation | Existing accepted branch and prior merged phases | Baseline exists |
38
+| Financial ingestion / workbook inspection | Backend modules and regression history | Implemented foundation; end-to-end acceptance still required |
39
+| Mapping lifecycle / access / audit | Gate 3 candidate and synthetic tests | Candidate; not production accepted |
40
+| Financial statement arithmetic | 69 arithmetic / cross-statement checks recorded for FY1402–FY1404 | Read-only checks pass; not an audit opinion |
41
+| Account 8161 | 110 unmapped rows; 24 non-zero rows; net exposure IRR 196,907,918,801 | Open finance disposition |
42
+| FY1403 equity rollforward | Difference IRR 43,241,509 million Rial in reported analysis | Open finance-owner disposition |
43
+| Identity / authentication | Package 9.1 single-local-identity hardening; G2.1 multi-user foundation local only | Partial / NO-GO |
44
+| Audit evidence anchor | Local receipt / hash-chain tests | Independent immutable anchor not proven |
45
+| Backup / disaster recovery | Synthetic tests and recovery primitives | Operational DR not proven |
46
+| Desktop UI / installer | No live application process observed during 2026-11-11 inspection | End-to-end UI / install acceptance not proven |
47
+| Production release | No accepted release evidence | NOT READY |
48
+
49
+### 2.1 Current governing decision
50
+
51
+**NO-GO for production and release.** Keep the accepted baseline stable. Work may continue on isolated branches and disposable synthetic data. Do not merge a candidate, deploy, alter canonical financial source files, or claim independent approval without the evidence specified in this plan.
52
+
53
+## 3. Repository and branch control
54
+
55
+### 3.1 Accepted base
56
+
57
+- Branch: `source-data-cleanup`
58
+- SHA: `7dc864fd032f0c4ae4d650d89304a01286a6d914`
59
+- This is the reference baseline used for the control review.
60
+- Do not assume the repository's latest activity or a PR head is already part of this baseline.
61
+
62
+### 3.2 Relevant pull requests observed on 2026-11-11
63
+
64
+| PR | Scope | Observed state | Control instruction |
65
+|---|---|---|---|
66
+| [#82](https://github.com/davoodmehraban89/Aram/pull/82) | Gate 3 governed mapping | Draft / open / NO-GO | Do not merge; external acceptance blockers remain |
67
+| [#88](https://github.com/davoodmehraban89/Aram/pull/88) | Package 9 isolated hardening | Draft / open | Candidate only; independent and operational evidence missing |
68
+| [#89](https://github.com/davoodmehraban89/Aram/pull/89) | Package 9.1 security implementation | Draft / open | Single local identity; not a multi-user production IdP |
69
+| [#90](https://github.com/davoodmehraban89/Aram/pull/90) | FY1402–FY1404 financial reconciliation documentation | Draft / open; 11 commits ahead of accepted base at inspected head | Preserve separately; accounting owner and independent review required |
70
+
71
+PR metadata and head SHAs must be re-read before any action. The table is a dated snapshot, not a live status feed.
72
+
73
+### 3.3 Known local Windows worktrees
74
+
75
+Device inspected: **Aram** (Windows), 2026-11-11.
76
+
77
+| Local path | Branch / HEAD observed | Working-tree condition observed |
78
+|---|---|---|
79
+| `C:\Users\Davood\Documents\Aram-Engineering-Review` | `local-gate3-verification-20261101` / `da06ab3c37d789e565245f2f6ee38183a6f66fb6` | Untracked `backend/src/aram_backend.egg-info/` |
80
+| `C:\Users\Davood\Documents\Aram-G1-Isolated` | `feat/aram-g1-architecture-20261103` / `18d6aa122d9486116c08d6e66b22675e0ebb1792` | 3 tracked modified files plus untracked report / egg-info |
81
+| `C:\Users\Davood\Documents\Aram-G2.1-Isolated` | `feat/aram-g2-1-identity-20261103` / same HEAD | 4 tracked modified files plus untracked identity code, migration, tests and reports |
82
+| `C:\Users\Davood\Documents\Aram-Gate3-Implementation` | `feat/gate3-governed-mapping-20261101` / `9d346f098a0a2159d96080715322879b08d9a1f8` | Numerous tracked modifications and untracked files; preserve |
83
+| `C:\Users\Davood\Documents\Aram-Gate3-Package9-Isolated` | `feat/gate3-package9-isolated-20261103` / `a0b72be87720b1ff08361298b903ba57dd4fb408` | One untracked integration test |
84
+| `C:\Users\Davood\Documents\Aram-Gate3-Package9-1-Security` | `feat/gate3-package9-1-security-20261103` / `18d6aa122d9486116c08d6e66b22675e0ebb1792` | Clean at inspection |
85
+
86
+**Critical preservation rule:** never run `git reset`, `git clean`, force checkout, force push, delete a worktree, overwrite a dirty file, or copy changes between these worktrees without first making and verifying a full-file, hash-verified backup and documenting the exact source/destination file list. The dirty Gate3 implementation worktree is particularly sensitive.
87
+
88
+### 3.4 Single-source-of-truth policy
89
+
90
+- Accepted base remains `source-data-cleanup` until a reviewed and explicitly accepted successor is designated.
91
+- Each work package uses one isolated branch and one focused PR.
92
+- No direct feature development on the accepted base.
93
+- Do not create another parallel implementation of a capability already under review.
94
+- Before coding, inspect this plan, current PRs, branch head, local worktree status, and latest handoff.
95
+- After coding, update this document and the project log with exact SHAs, files, tests, decisions, blockers, and next action.
96
+
97
+## 4. Evidence and findings register
98
+
99
+### 4.1 Financial statements — FY1402 to FY1404
100
+
101
+The read-only reconciliation report records 69 checks: 24 income-statement arithmetic checks, 12 statement-of-financial-position checks, 30 cash-flow checks, and 3 closing-cash cross-statement checks. All were reported PASS.
102
+
103
+This is **not** a transaction-level General Ledger reconciliation, an audit opinion, or signed finance acceptance.
104
+
105
+Open financial issues:
106
+
107
+| ID | Finding | Required disposition |
108
+|---|---|---|
109
+| FS-1403-EQ-01 | FY1403 equity rollforward appears inconsistent by IRR 43,241,509 million Rial | Accounting owner decides the correct presentation; no silent workbook repair |
110
+| MAP-8161-01 | 110 unmapped rows across FY1403/FY1404; 24 non-zero; net IRR 196,907,918,801 | Approve exact seven missing mapping keys and rerun reconciliation; preserve all source rows |
111
+| FS-1403/1404-NOTE-REF-01 | Balance-sheet note references drift from printed note headings | Accounting owner confirms presentation references |
112
+| FS-1402/1403-CF-FX-REF-01 | FY1403 FX cash-flow note reference differs from printed sub-note; FY1402 sub-note identifier unresolved | Confirm references with accounting owner |
113
+| FS-1404-CF-01 | IRR 12,556 million FX effect ties cash bridge and is described in Note 9-3; detailed rate schedule not independently reperformed | Obtain / inspect supporting calculation if required |
114
+| FS-1404-CF-02 | +1 / -1 million Rial comparative cash-flow presentation differences offset | Confirm rounding / presentation treatment |
115
+| AUDIT-PDF-01 | Full auditor opinion wording not verified for all scanned PDFs | OCR / visually inspect every page and record exact opinion and emphasis paragraphs |
116
+| BUDGET-1403/1404-N36-37-APPROVED-01 | Original approved budget cells include #REF! | Finance/budget owner determines authoritative source and treatment |
117
+| BUDGET-1404-N39-UNIT-01 | Original-budget column mixes Rial and million-Rial scales and contains #REF! cells | Finance/budget owner approves corrected presentation; do not edit source without authorization |
118
+
119
+Source workbooks and PDFs are canonical evidence. Keep them byte-identical unless a separately authorized and versioned correction is approved. Never suppress an error merely because it is inconvenient. Exclude only demonstrably unused auxiliary cells and zero-balance / approved control-pair effects under the documented accounting rule, while preserving every source row.
120
+
121
+Detailed evidence: [Financial Statement Reconciliation FY1402–FY1404](docs/FINANCIAL_STATEMENT_RECONCILIATION_1402_1404.md) on PR #90.
122
+
123
+### 4.2 Security and identity
124
+
125
+Package 9.1 execution report records 136 local backend tests passing on the Windows host, plus Ruff, compileall, pip check, and diff checks. A fresh rerun from the Package 9.1 worktree completed with exit code 0 on 2026-11-11; the report's recorded count is 136. A Starlette/httpx TestClient deprecation warning remains.
126
+
127
+Known limitations:
128
+- Package 9.1 supports one local credential identity; it is not a multi-user identity service.
129
+- PBKDF2-to-Argon2id upgrade persistence is not fully wired to the DPAPI vault.
130
+- Session and lockout state is process-memory based.
131
+- Independent recovery copy / second-device restore is not proven.
132
+- No independent security reviewer approval exists.
133
+- G2.1 database-backed identity provider is not wired into HTTP authentication.
134
+- G2.1 lacks durable throttling, persistent sessions/revocation, canonical company foreign-key enforcement, and identity lifecycle audit.
135
+- Malformed Unicode handling and must-change-password enforcement were identified as defects/follow-ups.
136
+
137
+The G2.1 report records 142 tests passing for that isolated snapshot, but the worktree contains uncommitted changes and is not a published or production-ready candidate.
138
+
139
+### 4.3 Mapping, audit, backup and operations
140
+
141
+Synthetic tests are useful but cannot substitute for:
142
+- independently administered append-only / WORM audit receipt anchoring;
143
+- protected production key custody and rotation;
144
+- scheduled encrypted backups and independent off-device copies;
145
+- witnessed restore drills on a separate environment;
146
+- measured RPO / RTO and alerting;
147
+- authorized financial owner sign-off;
148
+- exact-head CI and independent code review.
149
+
150
+## 5. Ordered execution roadmap
151
+
152
+Work proceeds in the following order. A later phase may be prepared in parallel only when it does not modify shared files, operational data, or depend on an unaccepted predecessor.
153
+
154
+### Phase 0 — Freeze, inventory, and establish the control baseline
155
+**Priority:** P0
156
+**Goal:** one authoritative, recoverable engineering baseline.
157
+
158
+Tasks:
159
+1. Publish this plan and make it mandatory for contributors.
160
+2. Inventory all local worktrees, branches, PRs, dirty files and exact SHAs.
161
+3. Create hash-verified snapshots of dirty worktrees before any consolidation.
162
+4. Identify duplicate / superseded branches and map their unique changes.
163
+5. Compare every candidate against its declared parent and accepted base.
164
+6. Reconcile PROJECT_STATUS, PROJECT_LOG, and LATEST_HANDOFF with live GitHub state.
165
+7. Define one candidate integration branch; do not merge automatically.
166
+
167
+Acceptance:
168
+- Every worktree has an owner, purpose, SHA, dirty-file manifest, and recovery reference.
169
+- No unexplained dirty files or untracked artifacts remain unclassified.
170
+- The accepted base is unchanged.
171
+- One integration plan and one next action are recorded.
172
+
173
+### Phase 1 — Financial exception closure
174
+**Priority:** P0
175
+**Goal:** convert read-only findings into approved financial dispositions.
176
+
177
+Tasks:
178
+1. Obtain accounting-owner decisions for FS-1403-EQ-01 and MAP-8161-01.
179
+2. Verify all seven missing Mapping keys against source-ledger dimensions and note content.
180
+3. Re-run year-separated mapping and note tie-outs after approval, using copies / synthetic fixtures first.
181
+4. Complete note-reference reconciliation for FY1402–FY1404.
182
+5. OCR and inspect full auditor reports and record exact opinion wording.
183
+6. Resolve budget source-cell and unit anomalies with budget owner.
184
+7. Obtain signed finance disposition; keep source files unchanged until separately authorized.
185
+
186
+Acceptance:
187
+- Every material exception is CLOSED or explicitly accepted with signed owner rationale.
188
+- Reconciliation is reproducible from hashed source inputs.
189
+- No unexplained non-zero unmapped exposure remains.
190
+- Source integrity hashes match the authorized baseline.
191
+
192
+### Phase 2 — Mapping workflow completion
193
+**Priority:** P0
194
+**Goal:** deterministic, explainable, reversible mapping workflow.
195
+
196
+Tasks:
197
+1. Verify account / company / year / dimension key semantics.
198
+2. Enforce deterministic match, ambiguity queue, unmatched queue and explicit review.
199
+3. Preserve mapping provenance, version, actor, timestamp and source hash.
200
+4. Complete bulk import/export, validation and round-trip tests.
201
+5. Verify lifecycle transitions, stale-write handling and concurrent edits.
202
+6. Add drill-down from statement line to note, mapping rule, ledger row and source workbook cell.
203
+7. Add regression fixtures for zero-balance exclusions and approved control pairs without deleting ledger rows.
204
+
205
+Acceptance:
206
+- 100% of statement-impacting rows are mapped or explicitly dispositioned.
207
+- Ambiguous matches never silently resolve.
208
+- Re-import / export round-trip preserves values and provenance.
209
+- Company and fiscal-year boundaries are enforced server-side.
210
+
211
+### Phase 3 — Identity, authorization and segregation of duties
212
+**Priority:** P0
213
+**Goal:** secure multi-user operation.
214
+
215
+Tasks:
216
+1. Choose and document the identity architecture (trusted enterprise IdP or approved multi-user local authority).
217
+2. Wire one composition root into login, token resolution and every protected API.
218
+3. Persist only token hashes; implement expiry, rotation, revoke-one, revoke-all and disable-user enforcement.
219
+4. Implement persistent atomic throttling / lockout with multi-worker tests.
220
+5. Enforce canonical company and fiscal-year membership using database constraints.
221
+6. Implement maker / reviewer / approver roles and separation-of-duties checks.
222
+7. Enforce must-change-password and account lifecycle.
223
+8. Add durable security audit events and adversarial tests.
224
+
225
+Acceptance:
226
+- Multi-user API integration tests pass on the exact candidate SHA.
227
+- Disabled / revoked users lose access immediately.
228
+- Cross-company and cross-year negative tests pass.
229
+- Concurrent workers and restart behavior are verified.
230
+- Independent security review signs off.
231
+
232
+### Phase 4 — Audit evidence, backup and disaster recovery
233
+**Priority:** P0
234
+**Goal:** prove integrity and recoverability.
235
+
236
+Tasks:
237
+1. Select an independently administered immutable / append-only audit anchor.
238
+2. Separate application and audit administration credentials.
239
+3. Define key generation, storage, rotation, escrow and recovery ownership.
240
+4. Implement scheduled encrypted backup, retention, monitoring and alerting.
241
+5. Restore to a separate clean Windows host/profile or disposable environment.
242
+6. Run tamper, corruption, missing-receipt and partial-failure drills.
243
+7. Record measured RPO / RTO and independent witness evidence.
244
+
245
+Acceptance:
246
+- External audit anchor cannot be silently rewritten by the application administrator.
247
+- Restore succeeds from an off-device backup with documented key recovery.
248
+- Hashes and record counts reconcile after restore.
249
+- RPO / RTO targets are met and independently witnessed.
250
+
251
+### Phase 5 — Financial statement engine and reporting
252
+**Priority:** P1
253
+**Goal:** reproducible five-statement and note generation.
254
+
255
+Tasks:
256
+1. Finalize statement line definitions and account/note mapping contracts.
257
+2. Generate all five statements from approved source and mappings.
258
+3. Reconcile cross-statement links, comparative periods, notes and cash.
259
+4. Support approved adjustments with maker/checker/approver evidence.
260
+5. Add explainability from every reported amount to source ledger and rule.
261
+6. Add budget / actual / variance analysis without mixing units or bases.
262
+7. Build regression packs from approved, anonymized or synthetic data.
263
+
264
+Acceptance:
265
+- All five statements and notes reconcile under approved accounting rules.
266
+- Every reported figure is traceable.
267
+- No unexplained difference or silent fallback remains.
268
+- Finance owner signs the output.
269
+
270
+### Phase 6 — User interface and workflow integration
271
+**Priority:** P1
272
+**Goal:** complete Persian-first user workflow.
273
+
274
+Tasks:
275
+1. Inventory existing UI and identify what is real versus placeholder.
276
+2. Define Persian RTL design system, navigation and error patterns.
277
+3. Implement entity/year selection, import wizard, Mapping workbench, exception queue, statement preview and approval inbox.
278
+4. Add audit history, role-aware actions and accessible validation.
279
+5. Integrate UI with the same authenticated backend APIs.
280
+6. Test real user journeys at normal and failure boundaries.
281
+
282
+Acceptance:
283
+- A finance user can complete the end-to-end workflow without direct database or command-line intervention.
284
+- Unauthorized actions are hidden and rejected server-side.
285
+- RTL, Persian digits / formatting, export and accessibility checks pass.
286
+
287
+### Phase 7 — Windows packaging, installation and release
288
+**Priority:** P1
289
+**Goal:** supported, reproducible V1 release.
290
+
291
+Tasks:
292
+1. Build reproducible signed installer.
293
+2. Test clean installation, upgrade, uninstall and rollback.
294
+3. Verify runtime dependencies, DPAPI behavior, file permissions and local database paths.
295
+4. Run end-to-end tests on a clean Windows machine.
296
+5. Produce operator, administrator, backup, recovery and troubleshooting manuals.
297
+6. Tag release only after independent approvals.
298
+
299
+Acceptance:
300
+- Clean-machine installation and upgrade succeed.
301
+- No secrets or production data are embedded in package/logs.
302
+- Security, finance, operations and product acceptance are recorded.
303
+- Release artifact hash and source commit are published.
304
+
305
+## 6. Definition of Done for every work package
306
+
307
+Every PR must include:
308
+- problem statement and explicit scope;
309
+- base branch and exact base SHA;
310
+- changed-file list and reason for each file;
311
+- data classification and confirmation that canonical data was not altered;
312
+- migration / rollback plan where applicable;
313
+- tests added and exact commands/results;
314
+- lint, type / compile, dependency and diff checks where applicable;
315
+- CI result on exact final head SHA;
316
+- security and financial-control impact;
317
+- screenshots / logs / evidence for UI or operational work;
318
+- known limitations and owner dependencies;
319
+- reviewer decision and next action.
320
+
321
+No author may describe their own self-review as an independent approval. No test result may be claimed for a different SHA.
322
+
323
+## 7. Non-negotiable safety rules
324
+
325
+1. Never edit canonical financial XLSX/PDF, source ledgers, mapping workbooks, or operational databases without a separately scoped explicit authorization.
326
+2. Never delete, net, suppress, or discard source ledger rows to make totals reconcile.
327
+3. Never infer a control-account offset from equal amounts alone; require accounting classification and evidence.
328
+4. Never merge, release, deploy, force-push, reset, or clean a dirty worktree as part of routine autonomous work.
329
+5. Never store credentials, tokens, recovery passphrases, or private keys in Git, logs, test artifacts, or ordinary backups.
330
+6. Use synthetic or anonymized fixtures for development and destructive tests.
331
+7. Fail closed when identity, tenant scope, audit anchor, or recovery configuration is missing.
332
+8. Distinguish code-complete, locally-tested, CI-verified, independently-reviewed, finance-approved, operationally-accepted, and released states.
333
+9. A green unit-test suite does not prove financial correctness, security readiness, or disaster recovery.
334
+10. Update this control plan and handoff after every accepted work package.
335
+
336
+## 8. Immediate next actions (ordered)
337
+
338
+1. Treat this plan as the mandatory control document for all future work.
339
+2. Preserve and hash-inventory every dirty local worktree before consolidation.
340
+3. Re-read live PR #82, #88, #89, and #90 metadata and exact head SHAs.
341
+4. Create a file-level change ownership matrix to identify duplicated and unique changes.
342
+5. Reconcile the repository's status and handoff documents on a dedicated documentation branch.
343
+6. Obtain accounting-owner disposition for FS-1403-EQ-01 and MAP-8161-01.
344
+7. Do not start another overlapping Gate 3 / identity implementation branch.
345
+8. After Phase 0 is accepted, select one smallest safe code correction with a regression test and submit a focused Draft PR.
346
+
347
+## 9. Change log
348
+
349
+| Date | Change |
350
+|---|---|
351
+| 2026-11-11 | Initial master control plan created from read-only GitHub and Aram Windows host inspection. No canonical data, local worktree, merge, release or deployment changed. |
352
+
353
+## 10. Latest handoff
354
+
355
+**Current control branch:** `docs/aram-master-control-plan-20261111`
356
+**Accepted base:** `source-data-cleanup@7dc864fd032f0c4ae4d650d89304a01286a6d914`
357
+**Current decision:** NO-GO for production.
358
+**Next executable task:** Phase 0 file-level inventory and preservation of all local dirty worktrees.
359
+**Do not:** merge existing Draft PRs, modify canonical financial data, reset/clean local worktrees, or start a duplicate implementation.