Refactor import and workflow services plus adapter seams
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# BAT-012 Design
|
||||
|
||||
## Architecture summary
|
||||
- Introduce `jarca_ledger_mcp/application/imports_service.py` as the single application-layer home for import preview/import/rollback orchestration.
|
||||
- Introduce `jarca_ledger_mcp/infrastructure/parsers/` as the parser seam so application code no longer imports top-level parser implementations directly.
|
||||
- Keep current top-level parser modules for compatibility if needed, but route application/shared usage through the infrastructure seam.
|
||||
- Preserve `application/import_transfer_services.py` as the advanced workflow home; import-facing public functions become delegations into `imports_service.py`.
|
||||
|
||||
## Changed areas
|
||||
- application import orchestration
|
||||
- infrastructure parser seam
|
||||
- service export surface / compatibility proxy
|
||||
- import regression verification docs
|
||||
|
||||
## Key decisions
|
||||
1. Parser relocation is seam-first, not algorithm rewrite.
|
||||
2. Import account auto-linking/classification stays in the application layer, not in parser modules.
|
||||
3. Public API/tool names remain unchanged.
|
||||
|
||||
## Verification focus
|
||||
- Import preview/import/rollback regression
|
||||
- Evidence field preservation
|
||||
- No breakage in MCP discovery and public exports
|
||||
@@ -0,0 +1,46 @@
|
||||
# BAT-012 Implementation
|
||||
|
||||
## Plan summary
|
||||
|
||||
BAT-012 implements dcy-011 Phase 5 by extracting import preview/import/rollback orchestration into `application/imports_service.py`, introducing an `infrastructure/parsers/*` seam, and shrinking `application/import_transfer_services.py` toward advanced workflow ownership while preserving public contracts.
|
||||
|
||||
## Changed files
|
||||
|
||||
- `jarca_ledger_mcp/application/imports_service.py`
|
||||
- `jarca_ledger_mcp/application/import_transfer_services.py`
|
||||
- `jarca_ledger_mcp/application/shared.py`
|
||||
- `jarca_ledger_mcp/application/__init__.py`
|
||||
- `jarca_ledger_mcp/infrastructure/parsers/__init__.py`
|
||||
- `jarca_ledger_mcp/infrastructure/parsers/kb_bank_pdf.py`
|
||||
- `jarca_ledger_mcp/infrastructure/parsers/toss_bank_pdf.py`
|
||||
- `jarca_ledger_mcp/infrastructure/parsers/toss_securities_pdf.py`
|
||||
- `jarca_ledger_mcp/infrastructure/parsers/seoulpay_xlsx.py`
|
||||
- `jarca_ledger_mcp/service.py`
|
||||
- `docs/srs/index.md`
|
||||
- `docs/srs/Non-Functional/req-016_import-pipeline-application-infrastructure-split.md`
|
||||
- `docs/batches/index.md`
|
||||
- `docs/batches/bat-012_20260703_import-pipeline-split/*`
|
||||
- `docs/discovery/dcy-011_20260703_backend-refactor-phase4-write-import-workflow-adapter-narrowing.md`
|
||||
|
||||
## Execution log
|
||||
|
||||
- 2026-07-03 07:49 KST: dcy-011 Phase 5 범위로 `REQ-016`/`BAT-012`를 생성하고 승인 상태를 정리했다.
|
||||
- 2026-07-03 07:50 KST: `application/import_transfer_services.py`의 AST function ranges를 추출해 import-owned 함수와 advanced workflow 함수를 기계적으로 분리할 준비를 했다.
|
||||
- 2026-07-03 07:51 KST: `application/imports_service.py`를 생성하고 import preview/import/rollback + import-specific account/classification helpers를 이동했다.
|
||||
- 2026-07-03 07:51 KST: `application/import_transfer_services.py`를 advanced workflow 중심 모듈로 축소하고 import-facing public functions는 compatibility delegation으로 전환했다.
|
||||
- 2026-07-03 07:51 KST: `infrastructure/parsers/*` seam을 추가하고 `application/shared.py`가 top-level parser 구현 대신 infrastructure seam을 통해 parser를 가져오도록 정렬했다.
|
||||
- 2026-07-03 07:52~07:53 KST: targeted import regression, full pytest, MCP discovery, export provenance를 검증했고 모두 PASS했다.
|
||||
|
||||
## Validation
|
||||
|
||||
- `python3 -m py_compile jarca_ledger_mcp/application/*.py jarca_ledger_mcp/infrastructure/parsers/*.py jarca_ledger_mcp/service.py` → PASS
|
||||
- `pytest -q tests/test_kb_bank_pdf.py tests/test_seoulpay_xlsx.py tests/test_toss_securities_pdf.py tests/test_service.py` → PASS (`12 passed, 4 skipped`)
|
||||
- `pytest -q` → PASS (`42 passed, 4 skipped`)
|
||||
- `hermes mcp test jarca-ledger` → PASS (`Connected`, `Tools discovered: 56`)
|
||||
- `python3` provenance check → PASS (all import preview/import/rollback exports resolve to `jarca_ledger_mcp.application.imports_service`)
|
||||
|
||||
## Remaining risks / follow-up notes
|
||||
|
||||
- `application/import_transfer_services.py`에는 cross-transfer review/matching advanced workflow가 아직 남아 있으며 Phase 6 배치에서 별도 분리해야 한다.
|
||||
- parser relocation은 seam-first 방식이므로 top-level parser implementation files는 아직 compatibility/implementation 위치로 남아 있다. 필요 시 후속 cleanup은 adapter/baseline 갱신과 함께 진행한다.
|
||||
- UI/adapter 표면 축소와 baseline 문서 갱신은 BAT-012 범위 밖이다.
|
||||
@@ -0,0 +1,21 @@
|
||||
# BAT-012 Import pipeline split
|
||||
|
||||
- Profile: standard
|
||||
- Status: release-candidate
|
||||
- Included REQ: REQ-016
|
||||
- Discovery: dcy-011
|
||||
- Owner: 렛저장인
|
||||
- Date (KST): 2026-07-03
|
||||
|
||||
## 목표
|
||||
|
||||
REQ-016에 따라 import preview/import/rollback 경로를 `application/imports_service.py`와 `infrastructure/parsers/*` 중심으로 재배치하고, `application/import_transfer_services.py`는 advanced workflow 중심 모듈로 축소한다.
|
||||
|
||||
## Delivery checklist
|
||||
|
||||
- [ ] planning complete
|
||||
- [ ] design complete
|
||||
- [ ] implementation complete
|
||||
- [ ] verification complete
|
||||
- [ ] release-candidate promoted
|
||||
- [ ] REQ sync complete
|
||||
@@ -0,0 +1,28 @@
|
||||
# BAT-012 Planning
|
||||
|
||||
## Scope
|
||||
- Implement REQ-016 import pipeline split.
|
||||
- Keep import contract/evidence fields stable while relocating parser access under `infrastructure/parsers/*`.
|
||||
- Leave cross-transfer/reconciliation/advanced workflows in follow-up batches.
|
||||
|
||||
## Dependencies
|
||||
- dcy-011 confirmed Discovery.
|
||||
- REQ-016 Approved.
|
||||
- BAT-011 write-service split baseline.
|
||||
- Existing import regression tests and MCP discovery.
|
||||
|
||||
## Work plan
|
||||
1. Create `application/imports_service.py` and move import preview/import/rollback + import-specific helpers there.
|
||||
2. Create `infrastructure/parsers/*` wrappers or relocated parser modules and point application/shared imports to the infrastructure seam.
|
||||
3. Shrink `application/import_transfer_services.py` to advanced workflow + compatibility delegation for import functions.
|
||||
4. Run focused import regression, then full pytest and MCP discovery.
|
||||
5. Update batch evidence and promote REQ/BAT if ACs pass.
|
||||
|
||||
## Design Gate
|
||||
- Result: standard batch 유지.
|
||||
- Reason: application/infrastructure seam 변경과 compatibility delegation, import evidence preservation, parser path relocation 검증이 함께 필요하다.
|
||||
|
||||
## Risks and mitigations
|
||||
- Import evidence drift: preserve existing payload fields and run import-specific regression.
|
||||
- Hidden helper coupling between import and advanced workflows: move only import-facing helpers in this batch and leave advanced helpers in place when not import-owned.
|
||||
- Parser path breakage: add infrastructure parser wrappers first, then re-point shared/application imports.
|
||||
@@ -0,0 +1,37 @@
|
||||
# BAT-012 Verification
|
||||
|
||||
## Verification summary
|
||||
|
||||
Status: PASS
|
||||
|
||||
Evidence was collected against synthetic/temp data only. No production ledger DB mutation or real financial files were used.
|
||||
|
||||
## Acceptance criteria mapping
|
||||
|
||||
### REQ-016
|
||||
- AC-1: PASS — `application/imports_service.py`와 `infrastructure/parsers/*`가 생성됐고 import preview/import/rollback 구현이 이동했다.
|
||||
- AC-2: PASS — public API/MCP tools/import response envelope and evidence fields remained stable; MCP discovery still reports 56 tools.
|
||||
- AC-3: PASS — import-focused regression and full pytest PASS.
|
||||
- AC-4: PASS — BAT-012 implementation/verification docs record actual changed files, commands, and outcomes.
|
||||
|
||||
## Requirement state decision
|
||||
|
||||
- REQ-016: Implemented.
|
||||
|
||||
## Validation evidence
|
||||
|
||||
- `python3 -m py_compile jarca_ledger_mcp/application/*.py jarca_ledger_mcp/infrastructure/parsers/*.py jarca_ledger_mcp/service.py` → PASS
|
||||
- `pytest -q tests/test_kb_bank_pdf.py tests/test_seoulpay_xlsx.py tests/test_toss_securities_pdf.py tests/test_service.py` → PASS (`12 passed, 4 skipped`)
|
||||
- `pytest -q` → PASS (`42 passed, 4 skipped`)
|
||||
- `hermes mcp test jarca-ledger` → PASS (`Connected`, `Tools discovered: 56`)
|
||||
- Python provenance check on import-facing exports → PASS
|
||||
- preview/import/rollback APIs all resolve to `jarca_ledger_mcp.application.imports_service`
|
||||
|
||||
## Remaining issues
|
||||
|
||||
### Hard blockers
|
||||
- None.
|
||||
|
||||
### Non-blocking follow-up
|
||||
- cross-transfer / reconciliation / asset / workbench advanced workflow split
|
||||
- MCP/Streamlit adapter surface narrowing and baseline docs update
|
||||
Reference in New Issue
Block a user