[UPDATE PRIMITIVE] Phase 3(B): Code Scanning lifecycle, SARIF enhancements, gh extension packaging#234
Conversation
…h extension packaging Add Code Scanning subcommands (list-analyses, list-alerts, download-analysis) and SARIF parent subcommand to gh-ql-mcp-client. Add GitHub REST API client using go-gh for Code Scanning endpoints. Enhance SARIF tools with fingerprint overlap mode, sarif_store for session cache ingest, and sarif_deduplicate_rules for cross-file rule deduplication. Add comprehensive tests for all new functionality. Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/3c78cc29-8614-47cd-ad94-534e60fd6ab1 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
gh extension packaging
data-douser
left a comment
There was a problem hiding this comment.
Review of Phase 3(B): Code Scanning lifecycle, SARIF enhancements, gh extension packaging
Windows stdio transport hang (blocking)
The client-integration-tests workflow hangs on windows-latest + stdio mode because the Go client never drains the Node.js server's stderr pipe. The mcp-go Stdio transport creates a stderr pipe via cmd.StderrPipe() but never reads from it — it exposes Stderr() for callers to optionally consume. On Windows, pipe buffers are ~4 KB (vs 64 KB on Linux). Once the server's log output exceeds the buffer, process.stderr.write() blocks the entire Node.js event loop, halting all JSON-RPC responses. This causes every subsequent tool call to timeout.
Fix (applied locally): In connectStdio(), after creating the client, drain stderr in a background goroutine:
if stderr, ok := mcpclient.GetStderr(client); ok {
go func() { _, _ = io.Copy(io.Discard, stderr) }()
}This is the only change needed to unblock the CI job. The fix is already committed to the branch.
Go client issues
-
client/internal/github/client.go:43-50—sarifClient()has a data race: concurrent goroutines can both pass the nil check and create independent HTTP clients, with the second silently overwriting the first. Guard withsync.Onceorsync.Mutex. -
client/cmd/use_tool.go:71—outputToolResult()prints tool content to stdout then returns a genericfmt.Errorf("tool returned error"). The content is printed, so it's not lost, but the generic error message propagated to cobra is uninformative. Consider including a summary fromresult.Contentin the error. -
client/cmd/list.go:90,120— String truncationdesc[:77]operates on byte offsets, which can split multi-byte UTF-8 sequences (emoji, CJK, etc.) producing invalid output. Use[]runeconversion.
Server-side notes
-
server/src/tools/sarif-tools.ts~L508-516 — The overlap score formula insarif_deduplicate_rulesusesMath.max(overlaps.length, matchedAIndices.size)asmatchedAlerts, which conflates two different matching metrics. The intent appears to be a Jaccard-like similarity but the numerator/denominator don't consistently represent the same sets. Worth adding a comment or test clarifying the expected behavior for asymmetric result counts. -
sarif_deduplicate_ruleshandler — No handler-level tests exist insarif-tools.test.ts. ThecomputeFingerprintOverlapunit tests cover the utility, but there are no tests exercising the full deduplication workflow (multi-rule SARIF → pairwise comparison → grouped output).
VS Code extension test coverage regression
- The PR deletes
cli-resolver.test.tsandpack-installer.test.tswithout replacement tests.CliResolverhas complex multi-strategy resolution logic (CODEQL_PATH, PATH lookup, vscode-codeql distribution.json parsing with version folding) andPackInstallerhas CLI-version-to-pack-version mapping logic. Both are critical paths that should retain unit test coverage.
…t, handler tests 1. Fix data race in sarifClient() by replacing nil-check with sync.Once 2. Add clarifying comment on overlap scoring formula in sarif_deduplicate_rules 3. Add 3 handler-level tests for sarif_deduplicate_rules (overlap detection, no-overlap, missing input error) Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/7aefb02d-b415-49ed-87da-f03d9f4a2b3d Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Addressed items 1, 4, and 5 in #1 — #4 — Overlap score formula: Added a 5-line comment block explaining the scoring strategy: it takes the higher of location-based and fingerprint-based matching counts, then applies a Jaccard-like formula with capping to prevent negative unmatched counts. #5 — Items 2, 3, and 6 are in pre-existing code not modified by this PR ( |
There was a problem hiding this comment.
Pull request overview
This PR extends the MCP server’s SARIF tooling to support fingerprint-based overlap and session-cache SARIF ingestion, and expands the Go gh-ql-mcp-client with GitHub Code Scanning REST API subcommands for alert lifecycle workflows.
Changes:
- Add
fingerprintoverlap support (viapartialFingerprints) and new SARIF tools:sarif_storeandsarif_deduplicate_rules. - Add Go GitHub API client/types for Code Scanning plus new
code-scanningandsarifCLI command groups. - Update tests, changelog, and generated server dist artifact to reflect new functionality.
Show a summary per file
| File | Description |
|---|---|
| server/src/lib/sarif-utils.ts | Adds fingerprint overlap computation and extends overlap modes/results. |
| server/src/tools/sarif-tools.ts | Registers new SARIF tools, refactors SARIF loading, and adds new tool handlers. |
| server/test/src/lib/sarif-utils.test.ts | Adds unit tests for fingerprint overlap and fingerprint mode behavior. |
| server/test/src/tools/sarif-tools.test.ts | Updates tool-registration count and adds handler-level tests for sarif_store/sarif_deduplicate_rules. |
| server/dist/codeql-development-mcp-server.js | Updates bundled output to include new SARIF tool functionality. |
| client/internal/mcp/client.go | Prevents stdio subprocess hangs by draining server stderr in background. |
| client/internal/github/client.go | Adds typed Code Scanning REST API wrapper using go-gh auth. |
| client/internal/github/types.go | Introduces Go types for analyses/alerts/instances payloads. |
| client/internal/github/client_test.go | Adds JSON round-trip and small helper tests for the GitHub client/types. |
| client/go.mod / client/go.sum | Adds github.com/cli/go-gh/v2 and related indirect deps. |
| client/cmd/root.go | Updates CLI description to focus on Code Scanning lifecycle management. |
| client/cmd/code_scanning*.go | Adds code-scanning subcommands: list analyses/alerts and download analysis SARIF. |
| client/cmd/sarif.go | Adds sarif parent command group for future SARIF delegation workflows. |
| CHANGELOG.md | Documents new Code Scanning CLI features and SARIF tool enhancements. |
Copilot's findings
Comments suppressed due to low confidence (2)
CHANGELOG.md:40
- The new tools row is missing the required PR link (entries in the tools table should link the introducing PR). Also consider describing the enhancement to
sarif_compare_alertsas “fingerprintoverlap mode usingpartialFingerprints” to match the actual parameter name.
| `query_results_cache_lookup`, `query_results_cache_retrieve`, `query_results_cache_clear`, `query_results_cache_compare` | Query result cache tools for lookup, subset retrieval, cache clearing, and cross-database comparison. ([#169](https://github.com/advanced-security/codeql-development-mcp-server/pull/169)) |
| `sarif_list_rules`, `sarif_extract_rule`, `sarif_rule_to_markdown`, `sarif_compare_alerts`, `sarif_diff_runs` | SARIF analysis tools for rule discovery, per-rule extraction, Mermaid dataflow visualization, alert overlap comparison, and cross-run behavioral diffing. ([#204](https://github.com/advanced-security/codeql-development-mcp-server/pull/204)) |
| `sarif_store`, `sarif_deduplicate_rules` | SARIF session cache ingest and cross-file rule deduplication tools. `sarif_compare_alerts` enhanced with `partialFingerprints` overlap mode with automatic fallback to full-path comparison. |
CHANGELOG.md:64
- These new Infrastructure & CI/CD bullets are missing the required PR links. Please append
([#NNN](...))for this PR to each new bullet (and avoid leaving changelog entries unlinked).
- Added Rust coverage to CI and release workflows, including query unit tests and VSIX bundling. ([#195](https://github.com/advanced-security/codeql-development-mcp-server/pull/195))
- Added client integration tests for the new Rust queries and for the annotation, audit, and cache tool suites, including an MRVA triage workflow end-to-end test. ([#169](https://github.com/advanced-security/codeql-development-mcp-server/pull/169), [#195](https://github.com/advanced-security/codeql-development-mcp-server/pull/195))
- Added `code-scanning` and `sarif` subcommand groups to `gh-ql-mcp-client` with GitHub REST API client integration via `go-gh` for Code Scanning alert lifecycle management.
- Added `gh` extension packaging support with cross-compilation targets for `darwin/amd64`, `darwin/arm64`, `linux/amd64`, `linux/arm64`, `windows/amd64`.
- Files reviewed: 16/19 changed files
- Comments generated: 4
|
@copilot apply changes based on the comments in this thread |
…esponse, dedup perf, changelog links 1. loadSarif error message updated to source-agnostic "No SARIF source provided" 2. sarif_compare_alerts response now includes fingerprintMatch/matchedFingerprints in fingerprint mode 3. sarif_deduplicate_rules precomputes per-rule extracted results before pairwise loop 4. CHANGELOG entries corrected: partialFingerprints → fingerprint, added PR #234 links Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/85233122-a70c-49a6-a247-fb01f4da6946 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Applied all 4 changes from the review thread in
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Adds Code Scanning lifecycle commands to the Go-based gh-ql-mcp-client and expands the MCP server’s SARIF tooling to support fingerprint-based overlap detection, SARIF ingestion into the session cache, and cross-file rule deduplication.
Changes:
- Added
sarif_storeandsarif_deduplicate_rulesMCP tools, and introducedfingerprintas a newsarif_compare_alertsoverlap mode. - Added
code-scanningsubcommands (list-analyses,list-alerts,download-analysis) plus asarifcommand group to the Go CLI, backed by a typed GitHub Code Scanning REST client (go-gh). - Updated unit tests and
CHANGELOG.md, and regenerated the bundled serverdistoutput.
Show a summary per file
| File | Description |
|---|---|
| server/src/lib/sarif-utils.ts | Adds fingerprint overlap support and extends overlap mode/type definitions. |
| server/src/tools/sarif-tools.ts | Registers new SARIF tools (sarif_store, sarif_deduplicate_rules), refactors SARIF loading, and surfaces fingerprint fields in responses. |
| server/test/src/lib/sarif-utils.test.ts | Adds unit tests for fingerprint overlap and fingerprint-mode behavior. |
| server/test/src/tools/sarif-tools.test.ts | Updates tool registration expectations and adds handler tests for sarif_store / sarif_deduplicate_rules. |
| server/dist/codeql-development-mcp-server.js | Regenerated build artifact reflecting the server-side changes. |
| client/internal/mcp/client.go | Prevents stdio server hangs by draining server stderr in the background. |
| client/internal/github/client.go | Introduces typed GitHub Code Scanning REST API client (analyses, alerts, SARIF download, update). |
| client/internal/github/types.go | Adds Go structs for Code Scanning API payloads. |
| client/internal/github/client_test.go | Adds JSON round-trip and helper tests for the GitHub client/types. |
| client/go.mod | Adds github.com/cli/go-gh/v2 dependency for GitHub API auth/client. |
| client/go.sum | Updates sums for newly added Go dependencies. |
| client/cmd/root.go | Updates CLI messaging to focus on Code Scanning lifecycle management. |
| client/cmd/sarif.go | Adds sarif parent command group for future SARIF workflows. |
| client/cmd/code_scanning.go | Adds code-scanning parent command group (with cs alias). |
| client/cmd/code_scanning_list_analyses.go | Implements code-scanning list-analyses. |
| client/cmd/code_scanning_list_alerts.go | Implements code-scanning list-alerts. |
| client/cmd/code_scanning_download_analysis.go | Implements code-scanning download-analysis (writes SARIF to disk). |
| CHANGELOG.md | Documents the new CLI subcommands and SARIF tool enhancements under [Unreleased]. |
Copilot's findings
- Files reviewed: 16/19 changed files
- Comments generated: 2
… sarif_store Stores the actual SARIF file path (or 'inline') in databasePath and uses a stable 'sarif_store' as queryName, instead of overloading both with the user-provided label. Rebuilt server dist. Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/81b6fb38-6dd7-45f0-ac7f-d8b5e1625eb9 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
…ault with `.dil` file persistence (#235) * Initial plan * feat: enable --dump-dil by default for codeql_query_compile tool Add dump-dil parameter to the codeql_query_compile tool inputSchema and inject --dump-dil by default in registerCLITool handler unless explicitly disabled via dump-dil: false or --no-dump-dil in additionalArgs. Includes server unit tests and client integration test improvements. Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/7a489b70-8f73-406f-9a75-e8a15951cde2 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> * feat: persist DIL output to a .dil file for codeql_query_compile After successful compilation with --dump-dil, extract the DIL content from stdout and save it to a dedicated .dil file in a log directory. The file path is appended to the tool response. - Add logDir parameter to codeql_query_compile tool - Create log directory and write .dil file post-execution - Add server unit tests for DIL file persistence - Update integration test assertions to verify DIL file output Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/7ba868e5-1215-4130-bc06-10dfb15ebf14 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> * Address PR #234 review feedback * Fix compile_query client integration test * Address PR #235 review feedback Address PR #235 review comments for codeql_query_compile DIL persistence: - Reorder path imports alphabetically (basename, delimiter, dirname, ...) - Update logDir description to match pattern used by query-run, test-run, and database-analyze (mentions CODEQL_QUERY_LOG_DIR and default path) - Defer compile log directory creation to post-execution so failed compilations do not leave empty directories behind - Make DIL file test hermetic by controlling CODEQL_QUERY_LOG_DIR via a test-scoped temp directory and restoring it in a finally block - Add test verifying no empty log directory on compilation failure - Add test verifying logDir description matches other CLI tools * Regenerate package-lock.json after rebase --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> Co-authored-by: Nathan Randall <data-douser@github.com>
Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
…ments, `gh` extension packaging (#234) * Initial plan * feat: Phase 3(B) — Code Scanning lifecycle, SARIF enhancements, and gh extension packaging Add Code Scanning subcommands (list-analyses, list-alerts, download-analysis) and SARIF parent subcommand to gh-ql-mcp-client. Add GitHub REST API client using go-gh for Code Scanning endpoints. Enhance SARIF tools with fingerprint overlap mode, sarif_store for session cache ingest, and sarif_deduplicate_rules for cross-file rule deduplication. Add comprehensive tests for all new functionality. Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/3c78cc29-8614-47cd-ad94-534e60fd6ab1 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> * Fix hanging client int test for windows stdio * fix: address review feedback — sarifClient race, dedup formula comment, handler tests 1. Fix data race in sarifClient() by replacing nil-check with sync.Once 2. Add clarifying comment on overlap scoring formula in sarif_deduplicate_rules 3. Add 3 handler-level tests for sarif_deduplicate_rules (overlap detection, no-overlap, missing input error) Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/7aefb02d-b415-49ed-87da-f03d9f4a2b3d Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> * fix: address automated review feedback — error message, fingerprint response, dedup perf, changelog links 1. loadSarif error message updated to source-agnostic "No SARIF source provided" 2. sarif_compare_alerts response now includes fingerprintMatch/matchedFingerprints in fingerprint mode 3. sarif_deduplicate_rules precomputes per-rule extracted results before pairwise loop 4. CHANGELOG entries corrected: partialFingerprints → fingerprint, added PR #234 links Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/85233122-a70c-49a6-a247-fb01f4da6946 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> * fix: use actual sarifPath in cache databasePath, stable queryName for sarif_store Stores the actual SARIF file path (or 'inline') in databasePath and uses a stable 'sarif_store' as queryName, instead of overloading both with the user-provided label. Rebuilt server dist. Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/81b6fb38-6dd7-45f0-ac7f-d8b5e1625eb9 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> Co-authored-by: Nathan Randall <data-douser@github.com>
…ault with `.dil` file persistence (#235) * Initial plan * feat: enable --dump-dil by default for codeql_query_compile tool Add dump-dil parameter to the codeql_query_compile tool inputSchema and inject --dump-dil by default in registerCLITool handler unless explicitly disabled via dump-dil: false or --no-dump-dil in additionalArgs. Includes server unit tests and client integration test improvements. Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/7a489b70-8f73-406f-9a75-e8a15951cde2 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> * feat: persist DIL output to a .dil file for codeql_query_compile After successful compilation with --dump-dil, extract the DIL content from stdout and save it to a dedicated .dil file in a log directory. The file path is appended to the tool response. - Add logDir parameter to codeql_query_compile tool - Create log directory and write .dil file post-execution - Add server unit tests for DIL file persistence - Update integration test assertions to verify DIL file output Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/7ba868e5-1215-4130-bc06-10dfb15ebf14 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> * Address PR #234 review feedback * Fix compile_query client integration test * Address PR #235 review feedback Address PR #235 review comments for codeql_query_compile DIL persistence: - Reorder path imports alphabetically (basename, delimiter, dirname, ...) - Update logDir description to match pattern used by query-run, test-run, and database-analyze (mentions CODEQL_QUERY_LOG_DIR and default path) - Defer compile log directory creation to post-execution so failed compilations do not leave empty directories behind - Make DIL file test hermetic by controlling CODEQL_QUERY_LOG_DIR via a test-scoped temp directory and restoring it in a finally block - Add test verifying no empty log directory on compilation failure - Add test verifying logDir description matches other CLI tools * Regenerate package-lock.json after rebase --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> Co-authored-by: Nathan Randall <data-douser@github.com>
📝 Update Information
Primitive Details
sarif_compare_alerts,sarif_store,sarif_deduplicate_rules,gh-ql-mcp-clientUpdate Metadata
sarif_deduplicate_rulesnow precomputes per-rule data before pairwise comparison🎯 Changes Description
Adds Code Scanning alert lifecycle management to
gh-ql-mcp-clientvia GitHub REST API (go-gh), and enhances server-side SARIF tools with fingerprint-based overlap analysis, session cache ingest, and cross-file rule deduplication.Current Behavior
gh-ql-mcp-clienthad no Code Scanning API integrationsarif_compare_alertssupported 4 overlap modes:sink,source,any-location,full-pathloadSarifonly accepted positionalsarifPath/cacheKeyargsUpdated Behavior
gh-ql-mcp-client code-scanning list-analyses|list-alerts|download-analysis— full Code Scanning REST API integration viago-ghauthsarif_compare_alertsgainsfingerprintmode usingpartialFingerprintswith automatic fallback tofull-path; response now includesfingerprintMatchandmatchedFingerprintsfields when presentsarif_store— ingest SARIF into session cache with accurate cache metadata (databasePathstores the actual SARIF file path or'inline',queryNameuses stable'sarif_store'), returns deterministiccacheKeysarif_deduplicate_rules— pairwise rule comparison across two SARIF files using fingerprint + full-path overlap, with precomputed per-rule extraction for performanceloadSarifrefactored to options object withinlineContentsupport and source-agnostic error messagingMotivation
Required by the Code Scanning alert lifecycle workflow: download existing analyses → compare against new
codeql_database_analyzeresults → identify churn/duplication before replacement.🔄 Before vs. After Comparison
API Changes
New Tools
CLI Additions
gh-ql-mcp-client code-scanning list-analyses --repo owner/repo gh-ql-mcp-client code-scanning list-alerts --repo owner/repo --state open gh-ql-mcp-client code-scanning download-analysis --repo owner/repo --analysis-id 201 gh-ql-mcp-client sarif # parent for future SARIF delegation subcommands🧪 Testing & Validation
Test Coverage Updates
computeFingerprintOverlap(5 cases), fingerprint mode overlap (2 cases),sarif_store(5 cases),sarif_deduplicate_ruleshandler (3 cases), GitHub API types (JSON round-trip,buildQuery,intToStr)Test Results
parallel_validationcould not run due to known SIGPIPE with ~10MB dist files in diff📋 Implementation Details
Files Modified
server/src/tools/sarif-tools.ts— 2 new tools, fingerprint mode,loadSarifrefactor, fingerprint response fields, dedup precomputation,sarif_storecache metadata fixserver/src/lib/sarif-utils.ts—computeFingerprintOverlap,OverlapMode/OverlapResultupdatesserver/test/src/lib/sarif-utils.test.ts,server/test/src/tools/sarif-tools.test.tsclient/cmd/code_scanning*.go,client/cmd/sarif.go,client/internal/github/*CHANGELOG.mdserver/dist/*Code Changes Summary
sarif_deduplicate_ruleswith documented formulasarif_deduplicate_rulesprecomputes per-rule extracted results intoMap<string, RuleData>before the pairwise loop, eliminating redundantextractRuleFromSarifcalls in the O(rulesA × rulesB) comparisonloadSariferror message updated to source-agnostic "No SARIF source provided" (was "Either sarifPath or cacheKey is required") to correctly reflect all three input sources (sarifPath,cacheKey,inlineContent)OverlapModeunion type extended with'fingerprint',OverlapResultinterface extendedsarif_storevalidates SARIF structure before cachingsarif_storenow storessarifPath ?? 'inline'indatabasePathand uses stable'sarif_store'forqueryName, instead of overloading both with the user-provided labelsarifClient()usessync.Onceto prevent data races from concurrent goroutinessarif_compare_alertsresponse now includesfingerprintMatchandmatchedFingerprintsfields when present in the overlap result (fingerprint mode), so callers can see which fingerprints matchedDependencies
github.com/cli/go-gh/v2v2.13.0 (Go client — GitHub REST API auth). No advisories.🔗 References
Related Issues/PRs
ql-mcp-clientin Go as aghCLI extension for Code Scanning SARIF management #207 (parent),ql-mcp-clientPhase 2: Replace JavaScript client with Go binary and integration test runner #217 (Phase 2), MCP tool usability improvements: validation errors, parameter naming, and SARIF enhancements #208 (SARIF improvements),sarif_list_rules: add per-ruleresultCountfield #214 (sarif_list_rulesresultCount)origin/dd/ql-mcp-client/1🚀 Compatibility & Migration
Backward Compatibility
API Evolution
fingerprintoverlap mode added tosarif_compare_alertsOverlapResultgainsfingerprintMatch/matchedFingerprints;sarif_compare_alertsresponse now surfaces these fields👥 Review Guidelines
For Reviewers
Testing Instructions
📊 Impact Assessment
Server Impact
sarifClient()usessync.Oncefor thread-safe lazy initializationReview Feedback Addressed
sarifClient()data race (comment Extended support for CodeQL Language Server (LSP) features #1): Replaced nil-check withsync.Onceto guarantee thread-safe lazy initialization of the SARIF REST client.FindRelatedPrimitivestool queries for all languages #4): Added a 5-line comment block explaining the Jaccard-like scoring strategy: takes the higher of location-based and fingerprint-based matching counts, then appliesmatchedAlerts / (totalA + totalB - matchedAlerts)with capping to prevent negative unmatched counts.sarif_deduplicate_ruleshandler tests (comment Validate MCP server compatibility across CodeQL CLI versions #5): Added 3 handler-level tests exercising the full deduplication workflow: overlap detection with matching codeFlow locations, empty groups when no rules overlap, and error handling for missing input.loadSariferror message (automated review): Updated to source-agnostic "No SARIF source provided" sinceinlineContentis now also a valid input source.sarif_compare_alertsresponse now includesfingerprintMatchandmatchedFingerprintswhen those fields are present in the overlap result.sarif_deduplicate_rulesperformance (automated review): Precomputes per-rule extracted results intoMap<string, RuleData>before the pairwise comparison loop, eliminating redundantextractRuleFromSarifcalls.partialFingerprintstofingerprintand added([#234](...))PR links to all entries missing them.sarif_storecache metadata (automated review):databasePathnow storessarifPath ?? 'inline'andqueryNameuses stable'sarif_store', instead of overloading both fields with the user-provided label. Server dist rebuilt.