feat(bridge): PreToolUse decision file warning (GH-333)#339
Merged
Conversation
Add decision_warning.rs with glob-matching engine that checks if an edited file is governed by active decisions. Integrates into dispatch_pre_tool_use as a fourth additionalContext source (Edit tool only). Session-scoped cache with 120s TTL meets PERF-01 (<100ms). Boundary compliance: - BOUNDARY-01: no DecisionRow import - BOUNDARY-02: reads via query_active_with_paths (to_view) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
decision_warning.rswith glob-matching engine that checks whether an edited file is governed by active decisionsdispatch_pre_tool_useas a fourthadditionalContextsource, triggered only onEdittool callsDECISION_CACHEwith 120s TTL ensures repeated PreToolUse calls avoid re-querying SQLite (PERF-01 < 100ms)Boundary Compliance
DecisionRowimport inedda-bridge-claude— onlyDecisionViewquery_active_with_paths()which usesto_view()internallytracing::debug!("decision_warning_ms=...")Test plan
test_no_decisions_returns_none— empty ledger returnsNonetest_no_matching_paths_returns_none— non-matching glob returnsNonetest_matching_glob_returns_warning— matching glob returns formatted warningtest_multiple_matches— two matching decisions both appear in warningtest_matches_any_path_normalization— backslash paths match forward-slash globstest_format_warning_empty_reason— empty reason omits trailing separatorcargo clippy -p edda-bridge-claude --all-targets— zero warningsgrep -rn "DecisionRow" crates/edda-bridge-claude/— 0 code results (only comment)Closes #333
🤖 Generated with Claude Code