- Replace isinstance(graph_store, ContextGraph) with type() is ContextGraph
in all 12 guards across decision_query.py and decision_recorder.py.
Fixes 2 regressions where Mock(spec=ContextGraph) triggered fallback
paths, causing TypeError on iteration of mock return values.
- Hoist find_edges() calls out of the BFS while-loop in trace_decision_path
so edges are fetched once per call instead of once per visited node,
eliminating O(nodes * total_edges) repeated full-graph fetches.
- Expand test_decision_query_fallback.py: keep the original integration
test and add 13 targeted unit tests covering all 7 DecisionQuery and
4 DecisionRecorder ContextGraph fallback methods, including tz-aware/naive
datetime mixing and Mock guard validation.
Result: 353 passed, 0 failed (was 338 passed, 2 failed on this branch)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>