Add code coverage tools (get_coverage_report, get_file_coverage)#240
Merged
cameroncooke merged 14 commits intogetsentry:mainfrom Mar 3, 2026
Merged
Conversation
fd7cb36 to
208c45a
Compare
Contributor
Author
|
Hey @cameroncooke, this is for review. |
Collaborator
|
Amazing, on it! |
Collaborator
|
@irangareddy so PR is failing on typechecking, can you run |
Contributor
Author
|
hopefully this is ready now, @cameroncooke |
commit: |
Use createMockCommandResponse in get_file_coverage tests so inline mock executors return the required process field from CommandResponse.
When showLines is true the archive command only runs for the first matched file entry. The uncovered-ranges block now includes the file path so readers know which file the ranges belong to.
Add isValidCoverageTarget type guard to filter out malformed objects from xccov JSON output, preventing runtime crashes on missing properties.
8dc3ac2 to
9372c33
Compare
Add validateFileExists check for xcresultPath in both get_coverage_report and get_file_coverage, consistent with other tools that validate file paths (install_app_sim, launch_mac_app).
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Use createTypedToolWithContext so coverage handlers receive both command and filesystem executors. This keeps handler execution aligned with dependency injection instead of falling back to direct fs checks. Update coverage tests to use context-based logic signatures and add handler-path DI assertions for both tools.
Filter out null/non-object elements in the targets array before accessing properties, preventing TypeError on malformed xccov output. Consistent with the isValidCoverageTarget guard in get_coverage_report.
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
Closes #227
get_coverage_reporttool: shows per-target code coverage from xcresult bundles with optional per-file breakdown (showFiles) and target filteringget_file_coveragetool: shows function-level coverage and optionally uncovered line ranges (showLines) for a specific filecoverageworkflow and included both tools in simulator, device, macos, and swift-package workflowsreadOnlyHint: true) and usecreateTypedTool(no session defaults needed).gitignorecoverage/rule to/coverage/so it no longer ignoressrc/mcp/tools/coverage/Test plan
get_coverage_reportreturns per-target coverage sorted by lowest firstget_coverage_report --target <name>filters by substring matchget_coverage_report --show-filesincludes per-file breakdown under each targetget_file_coverage --file <name>returns function-level coverage with[NOT COVERED]markersget_file_coverage --show-linesappends uncovered line ranges from the archivenpm run buildpassesnpm testpasses (1320 tests, 118 test files)npm run docs:updateregenerates TOOLS.md and TOOLS-CLI.md