feat(edda-ledger): add error context enrichment across ledger, serve, and CLI#381
Merged
feat(edda-ledger): add error context enrichment across ledger, serve, and CLI#381
Conversation
… and CLI (GH-377) Add .context() / .with_context() to ~80 bare `?` propagation sites across three layers for better error diagnostics: - Layer 1 (ledger.rs): All 45+ Ledger public methods now include method name and key parameters in error context - Layer 2 (serve lib.rs): All 33 handler open_ledger() calls now include the HTTP route in error context - Layer 3 (CLI): cmd_draft, cmd_bridge, cmd_pair Ledger::open() calls now include command name in error context Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
Author
Code Review: PR #381 (Round 1) — LGTM 🎉All P0 and P1 issues have been resolved. SummaryThis PR adds systematic
Quality Checks
Verdict: LGTM ✅No critical or high-priority issues remaining. This PR is ready for merge. Completed after 1 round(s) of automated review-fix loop |
This was referenced Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #377
Layer 1 (edda-ledger
ledger.rs): Added.context()/.with_context()to all 45+Ledgerpublic methods that delegate toSqliteStore. Each context string includes the method name and key identifying parameters (e.g.,Ledger::active_decisions(domain=Some("db"))). This enriches errors for ALL callers (serve, CLI, MCP, bridge).Layer 2 (edda-serve
lib.rs): Added.context()to all 33 handleropen_ledger()calls with the HTTP route name (e.g.,GET /api/decisions). This creates a two-layer error chain:GET /api/decisions > Ledger::active_decisions > sqlite error.Layer 3 (CLI): Added
.context()toLedger::open()calls incmd_draft.rs(8 functions),cmd_bridge.rs(2 functions), andcmd_pair.rs(4 functions) with command name context.Changes
crates/edda-ledger/src/ledger.rsuse anyhow::Context+.context()on 45+ delegation methodscrates/edda-serve/src/lib.rsuse anyhow::Context+.context()on 33 handleropen_ledger()callscrates/edda-cli/src/cmd_draft.rs.context()on 8Ledger::open()callscrates/edda-cli/src/cmd_bridge.rsuse anyhow::Context+.context()on 2Ledger::open()callscrates/edda-cli/src/cmd_pair.rsuse anyhow::Context+.context()on 4Ledger::open()callsTest plan
cargo fmt --checkpassescargo clippy -p edda-ledger -p edda-serve -p edda -- -D warningspasses with zero warningscargo test --workspacepasses (all 1400+ tests, 0 failures)anyhow::Result<T>🤖 Generated with Claude Code