feat: semantic code impact analysis and change propagation engine#1298
Open
kashviporwal-byte wants to merge 1 commit into
Open
feat: semantic code impact analysis and change propagation engine#1298kashviporwal-byte wants to merge 1 commit into
kashviporwal-byte wants to merge 1 commit into
Conversation
|
@kashviporwal-byte is attempting to deploy a commit to the shashankss1205's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Resolves #1164
Overview
This PR implements the Semantic Code Impact Analysis & Change Propagation Engine. It enables developers to predict the blast radius of modifying a code symbol or file before merging changes, reducing the risk of regressions and speeding up code review.
It leverages the repository knowledge graph to traverse upstream dependencies (like callers, subclasses, decorator modifications, and injected classes), calculates a custom risk score, and displays propagation paths and testing recommendations.
Detailed Changes
1. Backend Engine & Graph Traversal (
src/codegraphcontext/)tool_definitions.py): Defined theanalyze_impacttool accepting arguments:target(required),target_type,repo_path, anddepth.tools/handlers/analysis_handlers.py&server.py): Connected the tool call through the FastAPI REST server/api/tools/call.tools/code_finder.py): Implemented the core logic for the change propagation analyzer:CALLS,INHERITS,IMPLEMENTS,INJECTS,DECORATED_BY, andIMPORTSrelationships backward up to a configurabledepth.nodes(p)andrelationships(p)mapping), making it fully compatible with Neo4j, FalkorDB, and KuzuDB.git rev-list --count) to retrieve file modification counts, integrating historical churn into the risk calculations.2. Risk Scoring System
Computes a normalized risk score out of
10.0based on:5.0): Distance of the propagation path.5.0): Count of distinct files affected.5.0): In-degree centrality (incoming links to target).5.0): How often the target files are modified in git history.3. Visual Dependency Explorer (
website/)CodeGraphViewer.tsx):Verification & Testing
Automated Tests
Created unit test suite
tests/unit/tools/test_impact_analysis.pycovering target symbol resolution, file-level containment queries, risk scoring heuristics, empty states, and local Git command fallbacks.Run commands:
Status: All 3 tests passed successfully.
Manual Verification
/tools/callendpoint returns exact propagation paths.Checklist