Mirrored from https://github.com/davoodmehraban89/Aram.git
Synced Dec 4, 01:45 UTC
docs: finalize PR 12 candidate documentation and conflict regression tests
Co-authored-by: davoodmehraban89 <57283229+davoodmehraban89@users.noreply.github.com>
google-labs-jules[bot] committed
Aug 24, 2026 at 07:58 UTC
9e90533658e400a51402db673efae9cbd0aa37d1
5 files changed
+55
-4
PROJECT_STATUS.md
+5
-4
@@ -6,7 +6,7 @@
6
7
- Repository: [davoodmehraban89/Aram](https://github.com/davoodmehraban89/Aram)
8
- Accepted branch: `source-data-cleanup`
9
-- Accepted baseline commit: [`5122fd052ebe0ffe0e07dbb8153a872a4f047355`](https://github.com/davoodmehraban89/Aram/commit/5122fd052ebe0ffe0e07dbb8153a872a4f047355)
9
+- Accepted baseline commit: [`a41b07d7a7dd192c3ae4a277eb4903327883456f`](https://github.com/davoodmehraban89/Aram/commit/a41b07d7a7dd192c3ae4a277eb4903327883456f)
10
- Product objective: a controlled, auditable accounting and financial-statement workflow that preserves canonical source data.
11
12
## Status vocabulary
@@ -28,8 +28,9 @@
28
| Phase 1B-1 source inventory | `VERIFIED_AND_MERGED` | [PR #1](https://github.com/davoodmehraban89/Aram/pull/1) |
29
| Phase 1B-2 audit corrections | `VERIFIED_AND_MERGED` | [PR #4](https://github.com/davoodmehraban89/Aram/pull/4) |
30
| Phase 2A backend foundation | `VERIFIED_AND_MERGED` | [PR #6](https://github.com/davoodmehraban89/Aram/pull/6) |
31
+| Project control refactor | `VERIFIED_AND_MERGED` | [PR #10](https://github.com/davoodmehraban89/Aram/pull/10) |
32
| One-file model refactor | `VERIFIED_AND_MERGED` | [PR #8](https://github.com/davoodmehraban89/Aram/pull/8) |
32
-| Phase 2B ingestion foundation | `IN_PROGRESS` | Draft [PR #9](https://github.com/davoodmehraban89/Aram/pull/9); not merged |
33
+| Phase 2B ingestion foundation | `IN_PROGRESS` | Draft [PR #12](https://github.com/davoodmehraban89/Aram/pull/12) replacement candidate (PR #9 superseded) |
34
| Parallel V1 prototype | `VERIFIED_BUT_UNMERGED` | Closed, unmerged [PR #7](https://github.com/davoodmehraban89/Aram/pull/7); reference/recovery source only |
35
| PR #7 test/release claims | `CLAIMED_BUT_NOT_PROVEN` | No independent acceptance evidence recorded |
36
| Official V1 release | `NOT_IMPLEMENTED` | No accepted user-ready release |
@@ -42,14 +43,14 @@ The accepted branch does not include PR #7's `desktop/`, `dist/`, ZIP/EXE, or V1
43
44
- Agent reports have previously diverged from the remote repository.
45
- PR #7 is large, unmerged, and cannot be accepted as a single unit.
45
-- PR #9 is draft work and must not be treated as accepted.
46
+- PR #12 is the current replacement candidate; PR #9 is superseded but open.
47
- Binary execution on a clean Windows environment has not been independently proven.
48
- Mapping, notes, and sub-notes are incomplete for V1.
49
50
## Next approved action
51
52
1. Review and merge this documentation-control PR only after confirming its nine-file documentation and handoff scope.
52
-2. Independently review PR #9 and accept, correct, or close it.
53
+2. Independently review PR #12 and accept, correct, or close it.
54
3. Audit PR #7 feature-by-feature; recover useful work through small PRs only.
55
4. Build the mandatory Mapping Excel and note/sub-note workflow before V1 acceptance.
56
backend/README.md
+11
@@ -29,3 +29,14 @@ 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.
backend/tests/test_ingestion.py
+25
@@ -165,3 +165,28 @@ def test_duplicate_registration_different_filename_rejected(session):
165
existing = session.query(SourceDocument).first()
166
assert existing.document_type == "trial_balance"
167
assert existing.filename == "trial-balance.xlsx"
168
+
169
+def test_duplicate_registration_different_both_rejected(session):
170
+ year = make_year(session)
171
+ arguments = {
172
+ "year_id": year.id,
173
+ "filename": "trial-balance.xlsx",
174
+ "document_type": "trial_balance",
175
+ "content": b"safe-test-bytes-conflict-3",
176
+ }
177
+
178
+ first = register_source_document(session, **arguments)
179
+ session.commit()
180
+
181
+ conflict_arguments = arguments.copy()
182
+ conflict_arguments["document_type"] = "general_ledger"
183
+ conflict_arguments["filename"] = "other.xlsx"
184
+
185
+ with pytest.raises(SourceRegistrationError, match="document type and filename mismatch for existing content hash"):
186
+ register_source_document(session, **conflict_arguments)
187
+
188
+ session.rollback()
189
+ assert session.query(SourceDocument).count() == 1
190
+ existing = session.query(SourceDocument).first()
191
+ assert existing.document_type == "trial_balance"
192
+ assert existing.filename == "trial-balance.xlsx"
docs/PROJECT_LOG.md
+8
@@ -103,3 +103,11 @@ Each new entry must record: UTC timestamp, actor, task/phase, base branch and SH
103
- Reviewer: pending independent review
104
- Remaining risk: evidence and diff review incomplete
105
- Next action: review before any acceptance
106
+
107
+### [2026-08-24] Phase 2B Replacement Candidate (PR #12)
108
+- Recorded PR #10 governance merge in PROJECT_STATUS.md.
109
+- Created and recorded PR #12 as the replacement candidate for Phase 2B, superseding PR #9.
110
+- Current active branch: `codex/phase-2b-source-registration-12955190277775369594`
111
+- Base SHA: `a41b07d7a7dd192c3ae4a277eb4903327883456f`
112
+- Verified CI evidence: GitHub Backend CI run #16 successful on PR #12.
113
+- Updated docs to ensure Phase 2B metadata-registration conflict rejection is thoroughly tested and verified.
docs/handoff/LATEST_HANDOFF.md
+6
@@ -104,3 +104,9 @@ Send Jules the focused corrective task for PR #9: fix the same-hash semantic ide
104
Report whether GitHub access succeeded, then compare this handoff with current GitHub evidence. Do not ask Davood to retell the history and do not start new implementation work before the comparison is complete.
105
106
## END COPY
107
+
108
+## PR #12 Candidate
109
+- PR #12 is the current Phase 2B review candidate.
110
+- PR #9 is an older candidate that must not be merged while PR #12 is under review.
111
+- PR #12 remains Draft and unmerged.
112
+- The single next action is independent review of PR #12.