Skip to content

feat(ledgerr-mcp): PRD-10 financial pipeline + MCP gaps #24 #25 #26#89

Merged
elasticdotventures merged 12 commits into
mainfrom
feat/prd10-financial-pipeline
May 12, 2026
Merged

feat(ledgerr-mcp): PRD-10 financial pipeline + MCP gaps #24 #25 #26#89
elasticdotventures merged 12 commits into
mainfrom
feat/prd10-financial-pipeline

Conversation

@promptexecutionerr
Copy link
Copy Markdown
Collaborator

Summary

Safety notes

  • amount_range filter bounds (user input) → ToolError::InvalidInput on bad parse
  • Stored tx amounts → unwrap_or(Decimal::ZERO) (internal invariant, not user input)
  • fetch_work_queue uses lock-then-drop pattern — never holds classification + event locks simultaneously

Test plan

  • cargo check -p ledgerr-mcp — zero warnings, zero errors
  • tests/query_transactions_tests.rs — filter, sort, pagination, MCP advertise
  • tests/batch_operations.rs — classify, resolve flags, apply mapping bulk
  • tests/unified_queue.rs — all types, filter by type/status, pagination, ordering, provenance, manual change ref

🤖 Generated with Claude Code

Claude Sonnet (coordinator) and others added 10 commits May 9, 2026 14:25
- Add target/, target-windows/, _b00t_/ runtime dirs, .b00t/datums/*.toml
- Add .gap*-review.md / .gap*-verdict.md bouncer artifact patterns
- Commit .claude/settings.json: project-level read-only tool allowlist
  (codebase-memory MCP, cargo query tools, rustup queries)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… wiring

Specifies the three load-bearing gaps to close:
- PdfIngestOp: reqif-opa-mcp subprocess → classify_waterfall → workbook
- WorkbookWriter: ClassificationOutcome rows, mutation history, Excel validation
- LedgrrAgtGateway wired into ledgerr-mcp gate.rs dispatch

Plus: Cedar/AGT gate replacing OpaGateOp stub, notify watcher for hot-reload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add Arc<LedgrrAgtGateway> field to gate actor to enable
ring-based policy enforcement and arc-kit-au provenance tracking.

- Wrap each tool dispatch with gw.check_tool_call(agent_id, tool_name, input_json)?
- Map PolicyDecision::Deny → ToolError::PolicyDenied(reason)
- Map RateLimited → ToolError::RateLimited { retry_after_secs }
- After successful dispatch, emit arc-kit-au provenance edge with ExecutedBy type

Ring enforcement implemented per PRD-10 AC 226-230:
- ingest_pdf: Standard (agents denied at Sandboxed)
- classify_transaction: Standard (agents denied at Sandboxed)
- edit_rhai_rule: Admin (agents denied at Standard/Restricted)
- commit_workbook: Standard (no GateMessage variant yet)
- promote_agent: Admin (no GateMessage variant yet)

Added 5 integration tests for governance behavior verification.
All tests pass (35/35).

Related PRD-10: lines 74-97 (AGT governance wiring)
…tection

- Add PipelineWatcher struct with rule_dir, ingest_dir, registry, ingest_tx
- Implement spawn() method using notify crate for filesystem monitoring
- On .rhai ModifyKind::Data changes: reload RuleRegistry within 600ms
- On .pdf create events: send path to ingest channel within 600ms
- Debounce: 500ms default, configurable
- Add comprehensive tests for all acceptance criteria:
  * Rule reload timing (AC 237)
  * PDF create detection (AC 238)
  * Metadata-only change ignored (AC 239)
- Add filetime dev-dependency for metadata touch tests

Closes Gap 5: notify watcher for rule hot-reload
…iter, PdfIngestOp, CedarGateOp, notify watcher
Agent-Logs-Url: https://github.com/PromptExecution/ledgrrr/sessions/e328de4e-0ed2-442f-bc13-43b0e8a23c4a

Co-authored-by: elasticdotventures <35611074+elasticdotventures@users.noreply.github.com>
Agent-Logs-Url: https://github.com/PromptExecution/ledgrrr/sessions/e328de4e-0ed2-442f-bc13-43b0e8a23c4a

Co-authored-by: elasticdotventures <35611074+elasticdotventures@users.noreply.github.com>
Agent-Logs-Url: https://github.com/PromptExecution/ledgrrr/sessions/e328de4e-0ed2-442f-bc13-43b0e8a23c4a

Co-authored-by: elasticdotventures <35611074+elasticdotventures@users.noreply.github.com>
… queue (#24 #25 #26)

Close three MCP exposure gaps identified in phase6_mcp_exposure_gaps:

**Issue #26 — query_transactions**
- Paginated, filterable, sortable transaction query over classification state
- Filters: account_id, date_range, amount_range (Decimal strings), category,
  source_ref, description_contains
- Sort by date/amount/description + asc/desc; pagination with 1000-item cap
- Amount filter boundary validated as ToolError::InvalidInput on bad parse;
  stored tx amounts fall back to Decimal::ZERO (invariant, not user input)

**Issue #25 — batch_classify, bulk_resolve_flags, apply_mapping_bulk**
- Stateless BatchExecutor (batch_executor.rs) — testable without full service init
- Per-call BatchMode: AllOrNothing | ContinueOnError
- FlagResolution enum: Approve | Reject | Escalate | Dismiss | Defer
- apply_mapping_bulk: exact → substring → prefix priority matching order
- Per-item BatchItemResult with audit entries on every successful operation

**Issue #24 — fetch_work_queue**
- Unified QueueItem[] aggregator across flags, audit log, and stub types
- QueueItemType: Flag | Ambiguity | Blocker | DocumentIssue | ManualChange
- Lock-then-drop pattern: classification lock released before event log acquired
- Provenance field on every item (TaxTool | EventLog | Classification | DocumentRegistry)
- Updated_after / status / item_type filters + created_at-desc sort + pagination

**Fixes (warnings → zero)**
- apply_transaction_filters/sort: removed unsafe unwrap on Decimal::from_str
- Removed dead code: ambiguity_to_queue_item, now_timestamp_iso8601, emit_provenance_edge
- Fixed unused confidence variable, removed unused imports
- Wired missing ReviewArgs::FetchQueue dispatch arm and PUBLISHED_TOOLS entry
- Deleted .backup and test artifact files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Brian Horakh <35611074+elasticdotventures@users.noreply.github.com>
@elasticdotventures
Copy link
Copy Markdown
Member

@copilot critically review in good faith the changes; fix minor issues; propose solutions for larger issues

Copilot AI and others added 2 commits May 11, 2026 21:54
…vior

Agent-Logs-Url: https://github.com/PromptExecution/ledgrrr/sessions/3a8fa5a5-7a06-4409-ab1d-55a6751c62a4

Co-authored-by: elasticdotventures <35611074+elasticdotventures@users.noreply.github.com>
Agent-Logs-Url: https://github.com/PromptExecution/ledgrrr/sessions/3a8fa5a5-7a06-4409-ab1d-55a6751c62a4

Co-authored-by: elasticdotventures <35611074+elasticdotventures@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 11, 2026

@copilot critically review in good faith the changes; fix minor issues; propose solutions for larger issues

Addressed in 48ff684 (plus 117a8c0): fixed the CI-blocking agentmesh path dependency issue, tightened fetch_work_queue year handling, and fixed/validated the unified queue tests. Targeted checks now pass (cargo check -p ledgerr-mcp and the PRD-10 test set). Larger follow-up I recommend: implement real data sources for Ambiguity/Blocker/DocumentIssue queue items (currently TODO stubs) behind a deterministic query path so fetch_work_queue can return complete cross-type work queues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants