Mirrored from https://github.com/davoodmehraban89/Aram.git
Synced Dec 4, 15:30 UTC
docs(R4): correct test count to 20 (440 total = 420 + 20)
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
davoodmehraban89 committed
Dec 4, 2026 at 15:16 UTC
51b66add58b6179534dfece76fa79d0722700158
3 files changed
+5
-5
PROJECT_STATUS.md
+3
-3
@@ -96,7 +96,7 @@ Booklet 2 v2.0 («اصلاح مسیر و معماری نهایی Aram», [`docs/
96
| R1 | Real authentication (backend + frontend), backup confinement, desktop launch token, legacy surfaces | **MET** — PR #98 squash-merged 2026-12-04T09:38:06Z → `07a8ae0e` |
97
| R2 | Controls C-05..C-15 wired into `run_controls` + approval | **MET** — PR #100 squash-merged 2026-12-04T10:40:42Z → `a8ba20c1` |
98
| R3 | `build_statements` vs official; (statement, note) aggregation; IS 6/8/9 root cause; EQ/CF parsing | **PARTIAL** (this PR) — BS 16/16 met; IS 6/6 **not met**, blocked by source data (evidence below) |
99
-| R4 | Remove `create_all` from the production path; backup → `alembic upgrade head` → trigger check | **MET** (this PR) — Alembic-only init + restore flow; ADR-035; 22 tests |
99
+| R4 | Remove `create_all` from the production path; backup → `alembic upgrade head` → trigger check | **MET** (this PR) — Alembic-only init + restore flow; ADR-035; 20 tests |
100
| R5 | `docs/c01_exceptions.json` — the six C-01 source rows, unapprovable until resolved | NOT_STARTED |
101
| R6 | Propose marking the `v1.0.0` Release as pre-release; `experiment/browser-edition` = owner action | NOT_STARTED |
102
@@ -159,7 +159,7 @@ non-statement rows (BS 6/16 → 16/16), and per-row note assignment was lost (mi
159
| Backup flow → `alembic upgrade head` → trigger check | `backup.restore_backup` + `POST /backup/restore`; `test_restore_backup_migrates_and_checks_triggers`, `…_upgrades_a_stale_snapshot` | MET |
160
| Restore is fail-safe + confined | overwrite refusal, corruption refusal, path-escape 422, non-admin 403, anonymous 401 | MET |
161
162
-`backend/tests/test_schema_r4.py` **22 passed**; desktop/auth/admin regression **55 passed**; ruff check + format, mypy (domain strict + services) clean. Decisions in **ADR-035**. No new runtime dependency; protected data untouched.
162
+`backend/tests/test_schema_r4.py` **20 passed**; desktop/auth/admin regression **55 passed**; ruff check + format, mypy (domain strict + services) clean. Decisions in **ADR-035**. No new runtime dependency; protected data untouched.
163
164
## Known gaps feeding the C-phases (honest residual risks)
165
@@ -170,7 +170,7 @@ non-statement rows (BS 6/16 → 16/16), and per-row note assignment was lost (mi
170
- **Account natures are not populated** by any import path (`account_versions` is empty on real data), so C-15 reports «اجرا نشد» (WARN, non-blocking). A chart-of-accounts import is still missing.
171
- **CF/EQ are still not rendered** (`RENDERED_STATEMENTS=("BS","IS")`). Their official layouts are parsed (R3) but no built statement exists, so CF is 0/6 and C-07 compares their note totals against nothing → carried forward.
172
- **IS 8/9 need an explicit reclassification decision** (1,111,554 million rial) and **IS 20-3 has no source rows**; both are recorded with cause in `docs/discrepancies.json`.
173
-- ~~Desktop install bypasses Alembic~~ — **CLOSED in R4 (2026-12-04, ADR-035).** `desktop.py initialize_database` now runs `alembic upgrade head` + a D-07 trigger check (no `create_all` in `src/aram_backend/`, guarded by a test); `backup.restore_backup` + `POST /backup/restore` verify → migrate → trigger-check a snapshot. Fresh, versioned, and legacy `create_all` DBs all converge to head (migration 01 is checkfirst `create_all`; 02–09 are guarded) — verified on a populated 131,280-row copy (08→09, rows + 28 triggers preserved) and simulated legacy installs. Evidence: `backend/tests/test_schema_r4.py` (22 tests).
173
+- ~~Desktop install bypasses Alembic~~ — **CLOSED in R4 (2026-12-04, ADR-035).** `desktop.py initialize_database` now runs `alembic upgrade head` + a D-07 trigger check (no `create_all` in `src/aram_backend/`, guarded by a test); `backup.restore_backup` + `POST /backup/restore` verify → migrate → trigger-check a snapshot. Fresh, versioned, and legacy `create_all` DBs all converge to head (migration 01 is checkfirst `create_all`; 02–09 are guarded) — verified on a populated 131,280-row copy (08→09, rows + 28 triggers preserved) and simulated legacy installs. Evidence: `backend/tests/test_schema_r4.py` (20 tests).
174
- ImportRun/CalculationRun/LineageEdge/Adjustment/UnknownAccountQueue/carried_from_year_id/calculation_run_id refs absent; pilot exception queue not persisted in `domain/` (C1/C4).
175
- `note_engine.acct()` is closing-only; statement_balance-only rows evaluate 0 in notes (C1/C3).
176
- No connector framework / Source Adapter / snapshot reconciliation / packs yet; generality grep test pending (C4/C5/C6).
docs/PROJECT_LOG.md
+1
-1
@@ -515,5 +515,5 @@ Each new entry must record: UTC timestamp, actor, task/phase, base branch and SH
515
- **`db_triggers.py`:** `expected_trigger_names()` (the full 28-trigger set, same names on SQLite/PostgreSQL) + `installed_trigger_names(engine)` (dialect-aware).
516
- **`backup.restore_backup` + `POST /api/v1/backup/restore` (admin):** verify (hashes + audit chain) → copy into a confined fresh `target` subdir → `alembic upgrade head` → re-install + verify triggers → report `schema_revision`/`triggers_ok`. Refuses to clobber an existing DB/non-empty store; path-escape confined (R1 discipline).
517
- **Why upgrade head is universally safe (evidence before code):** migration 01 is checkfirst `create_all`; 02–09 are all guarded. Verified: populated copy 08→09 (131,280 rows + 28 triggers preserved); legacy full-schema create_all (no version) → 09; legacy v1.0.0-era (auth_sessions/source_note/password_rounds absent) → 09 with all re-added. No stamping ladder needed.
518
-- Gates: `tests/test_schema_r4.py` **22 passed**; desktop+auth_r1+phase7_admin regression **55 passed**; `ruff check src tests` clean; `ruff format --check` (domain/services/migrations) 36 files clean; mypy domain-strict (6) + services (20) clean. Full suite + coverage floors recorded in the PR.
518
+- Gates: `tests/test_schema_r4.py` **20 passed**; desktop+auth_r1+phase7_admin regression **55 passed**; `ruff check src tests` clean; `ruff format --check` (domain/services/migrations) 36 files clean; mypy domain-strict (6) + services (20) clean. Full suite + coverage floors recorded in the PR.
519
- Protected data: `data/` `2ef8a512…` / `samples/` `00aba54b…` unchanged; no financial value touched; no new runtime dependency (Alembic already required). Tag `v1.0.0` untouched.
docs/adr/ADR-035-alembic-only-production-schema.md
+1
-1
@@ -71,7 +71,7 @@ implementation (ADR evidence, reproducible):
71
72
- Existing desktop installs migrate forward on update; the stale-schema defect
73
(booklet 2.1 R4, was C9) is closed.
74
-- `tests/test_schema_r4.py` (22 tests) covers fresh/idempotent/legacy/versioned
74
+- `tests/test_schema_r4.py` (20 tests) covers fresh/idempotent/legacy/versioned
75
init, the trigger check (positive + negative), restore (roundtrip, overwrite
76
refusal, corruption refusal, stale-snapshot upgrade), the restore API (admin
77
roundtrip, path-escape 422, non-admin 403, anonymous 401), and the