confirm dcy-002 and add REQ/BAT evidence add ledger backup/status metadata workflow document restore as runbook/script-only guarded operation add synthetic DB backup/restore smoke tests
6.1 KiB
6.1 KiB
Jarca Ledger MCP Runtime Flows
- Baseline Mode: observed
- Baseline Seed:
.stage-pilot/bootstrap/baseline.yaml - Status: draft
- Owner: Jarca / project maintainer
- Last Updated (KST): 2026-06-27 10:17
- Source Discovery / Batch: bootstrap-baseline
- Primary Runtime: mixed
Project Summary
- Jarca 가계부 전용 MCP 서버와 Streamlit 대시보드로 계좌/카드 거래, 예산, 분류 규칙, import, 현금흐름 분석을 SQLite에 저장하고 운영한다.
Purpose
- This document is the current execution-flow baseline for the project.
- It is a cross-cutting reference document for Discovery, REQ, Batch Design, Batch Verification, and implementation updates.
Scope
- Covers representative command, MCP, dashboard, import, and reconciliation flows.
- Does not duplicate full acceptance criteria or low-level implementation details.
Covered Entry Points
jarca-ledger-mcp:: MCP stdio server for Hermes tool calls.dashboard/app.py:: Streamlit local dashboard.pytest:: regression test runner.
Shared Components
- SQLite database at
~/.local/share/jarca/ledger.sqlite3by default. jarca_ledger_mcp.serviceas the central domain/service layer.- Parser modules for KB/Toss/SeoulPay sources.
- Category and
cashflow_kindsemantics shared by reports and UI.
Flow: MCP server tool call
- Hermes MCP client invokes a tool exposed by
jarca_ledger_mcp.server. server.pyforwards arguments to the matchingservice.pyfunction.service.pyopens the SQLite database path from env/default, validates inputs, and performs the operation.- Service returns a dictionary payload with success data or error information.
- Hermes surfaces the tool result to the user or uses it in a follow-up workflow.
Flow: Streamlit dashboard operation
- Operator starts
streamlit run dashboard/app.py --server.address 0.0.0.0 --server.port 8501. - Dashboard reads the configured/default SQLite database.
- User navigates to 요약, 거래내역, 확인필요 큐, 미분류, 분류 규칙, 카테고리, 계좌, or Import pages.
- UI calls service functions for reads, updates, imports, categorization, and manual linking.
- UI displays success/error status and refreshes visible tables.
Flow: Import preview and import
- Operator chooses or supplies a supported source file: KB Bank PDF, Toss Bank PDF, Toss Securities PDF, SeoulPay XLSX, or CSV.
- Preview function parses the file and reports counts, sample rows, duplicate status, and classification preview.
- On explicit import, service creates/fetches the target account, inserts non-duplicate transactions, writes raw provenance, and records an import batch.
- Reports and dashboard views read the inserted rows using category and cashflow semantics.
- If an import is wrong, rollback uses import batch data and soft-deletes by default.
Flow: Categorization rule lifecycle
- Operator creates or edits a category rule with match field, pattern, target category/subcategory, priority, and optional amount/day constraints.
- Preview categorization shows candidate matches without mutating rows.
- Apply categorization updates matching transactions and preserves audit information.
- Category
cashflow_kindcontrols actual cashflow/report inclusion.
Flow: Cross-account and cancel/original reconciliation
- Preview functions search candidate pairs by amount, date, direction, account/source compatibility, and text similarity.
- Operator reviews candidates in the dashboard or runs the automatic matcher where confidence rules are satisfied.
- Matched self-transfers become
이체 / 본인계좌이동; investment movements become이체 / 투자이동; ambiguous rows remain확인필요. - Cancel/refund rows can be linked to original expense rows; memo tags preserve manual link evidence.
Flow: Operational backup, validation DB, and restore smoke
- Operator captures non-sensitive DB status evidence with
get_ledger_db_status: path, size, mtime, sha256, integrity check, major table row counts, and aggregate totals. - Operator creates a timestamped backup in
/root/.local/share/jarca/backups/ledger/withcreate_ledger_backup; retention keeps the most recent 30 days or newest 20 files. - Risky import, rollback, categorization apply, reconciliation, or migration work is tested first against a synthetic fixture DB or repo-external validation DB copy selected through
JARCA_LEDGER_DB_PATH. - Backup list/status/hash checks use
list_ledger_backupsandget_ledger_backup_status. - Restore execution is not an MCP flow. Restore smoke uses
scripts/ledger_restore_smoke.pyor the runbook and requires explicit approval before overwriting an existing target DB. - Verification evidence must not include full transaction dumps, full merchant/counterparty dumps, account identifiers, raw_payload, original financial file contents, or passwords.
Flow Constraints
- Preview before broad import or categorization mutation where supported.
- Do not include
transfer,investment,exclude, or unresolved rows in actual household spending totals unless a report explicitly asks for account movement. - Preserve raw import evidence for audit and future reclassification.
- Avoid destructive migrations without a backup/approval plan.
- Before broad DB mutation, capture DB status evidence and create or confirm a recent backup.
- Restore execution is script/runbook only and must not be exposed as an MCP tool.
- Sensitive passwords are runtime inputs and must not be committed.
Current Gaps / Planned Changes
- Need final browser-level UX verification for rule delete and cancel/original linking dialogs.
- Need CI/deployment flow if this project will be maintained beyond local operation.
- Need a documented operational process for statement-unavailable accounts.
Update Triggers
- Update this document when a command entry point changes.
- Update this document when a runtime orchestration path changes.
- Update this document when a batch changes the approved flow baseline.
Change Log
- 2026-06-26 22:24 KST: Created by
bootstrap-baselinefrom repository observation. - 2026-06-27 10:17 KST: BAT-002/REQ-002 기준으로 운영 backup/status/list/hash 및 restore 제한 flow 추가.