fix(mcp): weight hotspots by file churn - #3070
Open
devin-ai-integration[bot] wants to merge 3 commits into
Open
devin-ai-integration[bot] wants to merge 3 commits into
devin-ai-integration[bot] wants to merge 3 commits into
Conversation
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
tracedecay_hotspots documented a churn-weighted ranking but sorted by edge count only. Rank by score = total * (churn + 1), where churn is the 90-day commit count from file_churn, and report churn and score per row. Fixes #3011 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration
Bot
force-pushed
the
devin/1791125982-hotspots-churn
branch
from
October 4, 2026 16:00
ee118ff to
1f0b113
Compare
This branch has not been deployed
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
tracedecay_hotspotsnow ranks byscore = total * (churn + 1).churnis the 90-day commit count for the symbol's file, read from the existingfile_churnminer thattest_riskalready uses. Ties fall back tototal, then to id.HotspotV1row now includeschurnandscore, so callers can see both factors.Fixes #3011
Motivation
The module doc said "churn-weighted complexity ranking", but the sort used only incoming plus outgoing edge counts and never read git history. A heavily connected symbol that never changes outranked a moderately connected one that changes every week. The second case is the usual meaning of a hotspot.
Changes
crates/tracedecay-mcp/src/handlers/analysis/hotspots.rs: build the rows withchurn/score, then sort and truncate them.file_churnerrors propagate the same way they do intest_risk; a project that is not a repo, or has no commits yet, getschurn = 0, soscoreequalstotalthere.HotspotV1contract: addedchurnandscore. Regeneratedsdks/typescript/src/operations.tswithsdks/codegen.docs/USER-GUIDE.mdto describe the churn-weighted ranking.Test plan
mcp_handler_test::graph_analysis_test::hotspots_weights_connectivity_by_file_churn:stable.ts(committed once) holdshubwith 3 edges, andchurned.ts(committed 3 times) holdsmidwith 2 edges. Through production MCPtools/call,mid(churn3,score8) ranks abovehub(churn1,score6).hubis ranked first and the rows have nochurn/scorefields.bash scripts/require-exact-test.sh cargo test -p tracedecay --features test-transport --test mcp_suite mcp_handler_test::graph_analysis_test::hotspots_weights_connectivity_by_file_churn -- --exact(1 passed).hotspots_ranks_symbols_by_edge_degree_and_clamps_limitto the new literalchurn/scorevalues (single-commit fixtures, sochurnis 1) and the new markdown field order. Passes underrequire-exact-test.sh.cargo clippy -p tracedecay-mcp -p tracedecay-contracts -p tracedecay-mcp-catalog --all-targets -- -D warningsandcargo clippy -p tracedecay --features test-transport --test mcp_suite -- -D warningsare clean.cargo test -p tracedecay-contracts -p tracedecay-mcp-catalogpasses, and so doescargo testinsdks/codegen(codegen parity).cargo fmt --all -- --checkandnode scripts/lint-commit-range.mjs --repository . origin/master HEADboth pass.Checklist
CHANGELOG.mdupdated (under[Unreleased]if no version bump).envfiles includedHotspotV1gains two required output fields (additive for readers)Link to Devin session: https://app.devin.ai/sessions/78b7824a1ea149d1986e4c22568e80e1
Open in Devin Desktop: https://app.devin.ai/desktop/session/78b7824a1ea149d1986e4c22568e80e1?variant=devin
Requested by: @ScriptedAlchemy