Repository navigation
Add opt-in blast-radius mode to detect_changes (#89) - #92
Merged
Merged
Conversation
Reuses GraphStore::trace_calls (the same BFS/provenance machinery
trace_call_path exposes) and the existing clamp_depth/clamp_limit
bounds, rather than a new traversal or bounding scheme.
- nexus-index: detect_changes_direct factors out the existing
git-diff-to-NodeRecord mapping so plain detect_changes and the new
detect_changes_blast_radius(repo_path, depth) share it exactly;
BlastRadiusResult { direct, transitive, files_touched } carries
per-node edge_kind provenance via TracedNode.
- nexusd: detect_changes tool gains blast_radius (bool, default
false), depth/limit (named/clamped identically to trace_call_path).
blast_radius=false takes the untouched pre-existing code path -
same response shape and cost as before.
- Tests: a widely-called function surfaces its real multi-hop caller
set; an isolated leaf function reports an empty transitive set, not
an error; default detect_changes output is proven unchanged.
- Docs: MCP-Tools.md updated; ADR 0016 records the reuse decision.
Closes #89.
Claude-Session: https://claude.ai/code/session_01D6ND42psexN5cWTKewSpBG
This was referenced Aug 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.
What
Adds an opt-in "blast radius" mode to
detect_changes(issue #89): inaddition to the directly-changed symbols, optionally walks inbound callers
(direct and transitive) of each changed function, plus a summary of how
much the change actually touches.
Schema
detect_changesMCP tool gains three new optional parameters, named/clampedidentically to
trace_call_path's own (so an agent that's used oneimmediately understands the other):
blast_radius(boolean, defaultfalse)depth(integer, default3, clamped via the existingclamp_depth/SERVER_MAX_DEPTH)limit(integer, default100, clamped via the existingclamp_limit/SERVER_MAX_LIMIT)When
blast_radius=false(the default): response is the exact same JSONarray of directly-changed symbols the tool has always returned, taking the
exact same code path (
index::detect_changes) it always has.When
blast_radius=true: response becomes{ "direct": [ ...same node shape as before... ], "transitive_total": 7, "transitive_shown": 7, "transitive": [ ...TracedNode-shaped, with provenance/resolution/confidence... ], "summary": { "direct_count": 2, "transitive_count": 7, "files_touched": 4 } }Reuse, not a new subsystem
Per the issue's explicit guidance, this deliberately builds on what already
exists rather than adding a new traversal/bounding scheme:
GraphStore::trace_calls(Inbound direction) is the same BFStrace_call_pathalready runs - blast-radius mode just runs it once perdirectly-changed function and unions/dedupes the results.
edge_kind-derivedprovenance/resolution/confidencefieldstrace_call_pathreturns(issue [Graph] Introduce relationship provenance/confidence and prepare for LSP-based symbol resolution #59/ADR 0013), via the same
TracedNodetype.depth/limitreuse the existingclamp_depth/clamp_limitfunctionsfrom [Architecture/Safety] Make resource usage bounded across indexing, watching, MCP, and query execution #58's work - no new bound was invented.
"leave it out rather than build a new subsystem for it."
See ADR 0016 (
docs/NexusContext-Wiki/ADRs/0016-blast-radius-mode-reuses-trace-calls-not-a-new-subsystem.md)for the full writeup.
Default-behavior-unchanged guarantee
crates/nexus-index/src/queries.rs::detect_changesis now a thin wrapperaround a shared
detect_changes_directhelper that also backs theblast-radius path -
detect_changes's own signature/behavior is otherwiseuntouched. The MCP handler's
blast_radius=falsebranch calls that samedetect_changesand returns immediately, never touching the BFS code atall - so there's no added latency for callers who don't ask for it.
Verified by:
default_detect_changes_output_is_unchanged_by_blast_radius_existing-asserts the plain
detect_changes(&dir)call and the.directhalf ofdetect_changes_blast_radius(&dir, 3)agree exactly on a real indexedrepo.
detect_changes_enforces_allowed_rootsintegration test(
crates/nexus-index/tests/path_security.rs) still passes unmodified.Tests
a_widely_called_function_surfaces_its_multi_hop_caller_set- a change toa function called by two others (one of which is itself called by a
third) surfaces the real 2-hop caller set.
an_isolated_leaf_change_reports_an_empty_transitive_set_not_an_error-a change to a function with no callers returns an empty
transitiveset,not an error.
default_detect_changes_output_is_unchanged_by_blast_radius_existing-regression coverage for the unchanged-default guarantee above.
All three build a real git repo + graph index rather than mocking
trace_calls, so they exercise the actualgit diffparsing,nodes_overlappingmapping, and BFS together.Verification
cargo build --workspace- cleancargo test --workspace- all green (139 tests across nexus-index/nexusd, plus the 3 new ones)cargo fmt --all -- --check- cleancargo clippy --workspace --all-targets -- -D warnings- cleanDocs
docs/NexusContext-Wiki/MCP-Tools.md-detect_changesrow updated withthe new parameter/response shape.
docs/NexusContext-Wiki/ADRs/0016-blast-radius-mode-reuses-trace-calls-not-a-new-subsystem.md-new ADR recording the reuse decision, linked from the ADR index.
Closes #89.
https://claude.ai/code/session_01D6ND42psexN5cWTKewSpBG