feat(fixer): add opt-in LSP graph backend with Pyright/gopls support - #28
Open
yourspraveen wants to merge 2 commits into
Open
feat(fixer): add opt-in LSP graph backend with Pyright/gopls support#28yourspraveen wants to merge 2 commits into
yourspraveen wants to merge 2 commits into
Conversation
- Implement GraphBackend protocol & LSPGraphQuery (stdio JSON-RPC client). - Add VULNFIX_GRAPH_BACKEND=lsp configuration in build_graph.py. - Wire reachable_from_entry processing and fallback/downgrade on query errors. - Update triage-schema.json to accept graph_backend lsp with confidence high. - Include hermetic tests with mock stdio LSP server.
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
Adds an opt-in Language Server Protocol (LSP) backend (
VULNFIX_GRAPH_BACKEND=lsp) tovulnhunter-fix's code-graph substrate (vulnhunter_fix/graph/).It connects via stdio JSON-RPC to host language servers (
pyrightfor Python,goplsfor Go) to resolve symbol call hierarchies semantically, eliminating text-match comment noise.Key Changes
protocol.py): Defined structuralGraphBackendprotocol satisfied byGraphQueryandLSPGraphQuery.lsp_backend.py): Implemented eagerworkspace/symbolnode indexing and lazycallHierarchyedge resolution (prepareCallHierarchy+incomingCalls/outgoingCalls) with per-query caching and stdio communication.build_graph.py): Configured viaVULNFIX_GRAPH_BACKEND=lsp. Populatesreachable_from_entryand gracefully degrades to baseline Grep (confidence: low) on server errors/timeouts.triage-schema.json): Updated JSON schema to acceptgraph_backend: "lsp"withconfidence: "high".README.mdandvulnhunter-fix/README.mdwith installation, CLI configuration, and backend options (auto,lsp,ast,grep).Empirical Proof of Benefit (
fastapi/fastapi)We tested
build_graph.pyonfastapi/fastapicomparing baseline (grep) vslsp(Pyright):grep)lsp)fastapi/applications.py:setupgrep(low)lsp(high)fastapi/security/oauth2.py:OAuth2grep(low)lsp(high)fastapi/dependencies/utils.py:solve_dependenciesgrep(low)lsp(high)Grep matched text words inside comments, docstrings, and Pydantic type annotations. Pyright correctly eliminated all 8 false caller paths.
Testing
tests/mock_lsp_server.py).pytest).