Mirrored from https://github.com/davoodmehraban89/Aram.git
Synced Dec 4, 01:45 UTC
docs(backend): finalize Phase 2B behavior documentation
davoodmehraban89 committed
Aug 24, 2026 at 11:48 UTC
4dbe2e9873606529299b449d977de08eac76ab87
1 file changed
+19
-11
backend/README.md
+19
-11
@@ -29,14 +29,22 @@ pytest
29
Tests use an isolated temporary SQLite database with foreign-key enforcement.
30
Runtime SQLite files are ignored by Git.
31
32
-
33
-## Phase 2B: Source Registration and Inspection
34
-
35
-Phase 2B introduces metadata-only source registration and read-only source inspection:
36
-
37
-* **Metadata-only registration**: Registers exact file hashes and metadata for canonical fiscal documents.
38
-* **Idempotency & Rejection**: Exact-duplicate registrations (same hash, year, filename, and document type) are strictly idempotent. Semantic conflicts (differing filename or document type for an existing hash) are aggressively rejected via `SourceRegistrationError`.
39
-* **No Payload Persistence**: Source file bytes (e.g. XLSX/CSV payloads) are never persisted to the database.
40
-* **Supported Types**: Only `.xlsx` and `.csv` files representing `financial_statement`, `general_ledger`, `mapping`, or `trial_balance` are permitted.
41
-* **Read-only Inspection**: Safely inspects raw XLSX structural boundaries and parse general-ledger streams purely in-memory without modification of canonical data.
42
-* **Financial Safety**: Financial values, data cells, and mapping behaviors remain completely untouched.
32
+## Phase 2B: Source registration and inspection
33
+
34
+Phase 2B adds metadata-only registration plus read-only inspection of supported
35
+source documents.
36
+
37
+- Supported file suffixes: `.xlsx` and `.csv`.
38
+- Supported document types: `financial_statement`, `general_ledger`,
39
+ `mapping`, and `trial_balance`.
40
+- Registration stores the fiscal year, safe filename, document type, and SHA-256
41
+ content hash. It does not persist source payload bytes.
42
+- An exact duplicate—same fiscal year, content hash, safe filename, and document
43
+ type—is idempotent and returns the existing `SourceDocument`.
44
+- Reusing the same fiscal year and content hash with a different safe filename,
45
+ document type, or both raises `SourceRegistrationError`. The existing record
46
+ remains unchanged and no second record is created.
47
+- XLSX structural inspection is read-only. General-ledger rows are parsed as
48
+ typed in-memory records without changing the workbook.
49
+- Phase 2B does not persist financial values, execute mappings, calculate
50
+ balances, or modify canonical source files.