feat: stabilize category rule operations
approve dcy-001 and add REQ/BAT evidence pass selected DB path through Streamlit rule actions expose delete_category_rule MCP tool add category rule deletion regression
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
# REQ-001: 분류 규칙 운영 액션의 DB 경로 일관성 및 삭제 노출
|
||||
|
||||
## 0. 문서 상태
|
||||
- ID: REQ-001
|
||||
- Status: Implemented
|
||||
- Type: Interface
|
||||
- Priority: High
|
||||
- Owner: 렛저장인
|
||||
- Source Discovery: dcy-001_20260626_streamlit-ux-e2e-categorization-refund-workflows
|
||||
- Created At (KST): 2026-06-26 23:31
|
||||
- Last Updated (KST): 2026-06-26 23:41
|
||||
|
||||
## 1. Intent
|
||||
Discovery dcy-001의 첫 구현 범위로, Streamlit `분류 규칙` 화면의 가장 작은 운영 lifecycle인 목록/삭제/preview/apply가 선택된 검증 DB에만 작동하도록 안정화한다. 동시에 이미 존재하는 service-layer 규칙 삭제 기능을 MCP tool surface에도 노출해 UI와 MCP contract가 어긋나지 않게 한다.
|
||||
|
||||
## 2. Requirement
|
||||
- Streamlit `분류 규칙` 페이지에서 기본 규칙 seed/update, 규칙 preview, 규칙 적용 액션은 현재 UI가 사용하는 `db_path`를 명시적으로 전달해야 한다.
|
||||
- 규칙 삭제는 service layer와 Streamlit UI뿐 아니라 MCP tool surface에서도 사용할 수 있어야 한다.
|
||||
- 기존 `create_category_rule`, `update_category_rule`, `list_category_rules`, `preview_categorization`, `apply_categorization_rules` 성공 응답 shape는 유지한다.
|
||||
- 원본 운영 DB 직접 mutation, 파괴적 SQLite migration, 민감 금융 원본/비밀번호 fixture 저장은 금지한다.
|
||||
|
||||
## 3. Acceptance Criteria
|
||||
- AC-1: `dashboard/app.py`의 분류 규칙 seed/update, preview, apply 버튼이 모두 page-level `db_path`를 전달한다.
|
||||
- AC-2: `server.py`가 `delete_category_rule(rule_id: str)` MCP tool을 제공하고, service의 기존 삭제 성공 payload(`success`, `deleted_rule_id`)를 유지한다.
|
||||
- AC-3: fixture DB에서 규칙 생성 후 삭제하면 active/all rule list에서 해당 규칙이 제거되고, 없는 rule 삭제는 `not_found` 실패를 반환한다.
|
||||
- AC-4: 변경 후 다음 검증이 통과한다: `python -m py_compile jarca_ledger_mcp/*.py dashboard/app.py`, 관련 pytest, 전체 pytest, `hermes mcp test jarca-ledger`.
|
||||
- AC-5: Streamlit smoke 검증은 synthetic fixture DB 또는 사본 DB를 사용하며, 원본 운영 DB를 직접 변경하지 않았다는 증거를 batch verification에 남긴다.
|
||||
|
||||
## 4. Impacted Area
|
||||
- `dashboard/app.py`: 분류 규칙 페이지 액션의 DB path 전달.
|
||||
- `jarca_ledger_mcp/server.py`: delete category rule MCP tool 등록.
|
||||
- `tests/`: category rule deletion regression.
|
||||
- `docs/interface-contract.md`: 필요 시 MCP rule CRUD contract 갱신.
|
||||
|
||||
## 5. Compatibility / Safety Notes
|
||||
- SQLite schema 변경 없음.
|
||||
- MCP 기존 tool signature 변경 없음. 신규 tool은 additive change다.
|
||||
- 기존 service success response shape는 변경하지 않는다.
|
||||
- 검증 fixture에는 synthetic merchant/category만 사용한다.
|
||||
|
||||
## 6. Change Log
|
||||
- 2026-06-26 23:31 KST: REQ 생성 및 구현 기준 Approved 상태로 등록.
|
||||
- 2026-06-26 23:41 KST: BAT-001 구현/검증 및 검수관 PASS_WITH_NOTES 근거로 Implemented 전환.
|
||||
|
||||
## 7. Implementation Evidence
|
||||
- Batch: [BAT-001 Category Rule Ops Safety](../../batches/bat-001_20260626_category-rule-ops/)
|
||||
- Code evidence:
|
||||
- `dashboard/app.py`: 분류 규칙 seed/preview/apply 호출에 `db_path=db_path` 전달.
|
||||
- `jarca_ledger_mcp/server.py`: `delete_category_rule(rule_id)` MCP tool additive 등록.
|
||||
- `tests/test_category_rule_filters.py`: category rule 삭제 regression 추가.
|
||||
- Verification evidence:
|
||||
- `python -m py_compile jarca_ledger_mcp/*.py dashboard/app.py`: pass.
|
||||
- `pytest tests/test_category_rule_filters.py`: 3 passed.
|
||||
- `pytest tests/test_cross_account_transfer_matching.py`: 3 passed.
|
||||
- `pytest`: 17 passed, 4 skipped.
|
||||
- `hermes mcp test jarca-ledger`: connected, 41 tools discovered including `delete_category_rule`.
|
||||
- Streamlit substitute smoke: synthetic DB `/tmp/jarca-ledger-bat-001-smoke.sqlite3`, HTTP 200, AppTest exceptions 0, 분류 규칙 page and preview/apply buttons verified; default 운영 DB mtime unchanged.
|
||||
- QC gate: `jarcaledgerqc chat -q ...` returned `PASS_WITH_NOTES`; blocker 없음. Notes: browser screenshot unavailable due Chromium snap absence; future batches should restore real browser/screenshot evidence.
|
||||
Reference in New Issue
Block a user