-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Add test coverage visualization #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mentatbot
wants to merge
12
commits into
main
Choose a base branch
from
mentat-63
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
This commit introduces test coverage visualization for both Python and JavaScript files. - Updates the build process to generate coverage reports for both Python (`pytest-cov`) and frontend (`vitest`) tests. - The repository analyzer now processes these reports and embeds coverage data into the `repo_data.json` file. - The frontend is updated to display a pie chart visualizing the test coverage for each file in the details panel. Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/b9053414-c08f-4f34-998c-87c959baadb8 Co-authored-by: jakethekoenig <[email protected]>
This commit addresses issues identified in the initial implementation of the test coverage feature. - Removes old, conflicting coverage calculation logic from the analyzer. - Corrects the parsing of Python and JavaScript coverage reports to handle absolute paths and the correct JSON structure. - Fixes the order of operations in `start_project.sh` to ensure coverage data is generated before the analysis is run. Mentat precommit script failed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/d6d3561c-ec51-4b5b-8ea2-e0cb570b0da6 Co-authored-by: jakethekoenig <[email protected]>
This commit fixes several issues in the test coverage feature: - Resolves an `UnboundLocalError` by correctly handling the `metrics` dictionary. - Corrects the path resolution for frontend coverage reports to handle relative paths. - Replaces bare `except` clauses with specific exceptions. Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/98963178-8829-464e-be81-222145622271 Co-authored-by: jakethekoenig <[email protected]>
This commit refactors the test coverage feature to improve its robustness and correctness. - Updates the analyzer to correctly handle both absolute and relative paths in Python coverage reports. - Modifies the coverage loading logic to merge metrics from Python and frontend reports for files present in both, preventing data loss. - Refactors the file analysis loop to load coverage data only once, improving efficiency. - Removes dead code related to the old coverage implementation from the frontend. Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/7beb5634-e12a-488e-906b-6e6809499572 Co-authored-by: jakethekoenig <[email protected]>
This commit removes the remaining dead code related to the old test coverage visualization. The pie chart logic is now self-contained within the `FileDetails` component, so the corresponding data source and helper functions in `visualization.ts` and `visualizationUtils.ts` are no longer needed. This change resolves a TypeScript error and cleans up the codebase. Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/f9253ff9-0916-45e1-b27a-c6de87c91c72 Co-authored-by: jakethekoenig <[email protected]>
This commit removes the remaining dead code related to the old test coverage visualization from the main graph component. The pie chart logic is now self-contained within the `FileDetails` component, so all related code in `RepositoryGraph.tsx` was obsolete. This change resolves a TypeScript error and cleans up the codebase. Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/44652021-97f7-48ab-91d2-353e6633ea3e Co-authored-by: jakethekoenig <[email protected]>
This commit addresses two issues identified in the auto-review: 1. **Restore Node Expansion**: The `dblclick` handler for node expansion was accidentally removed in a previous refactor. This commit restores the handler, allowing users to expand and collapse nodes in the graph again. 2. **Improve Coverage Merging**: The coverage data loading logic has been updated to use `setdefault` to merge coverage metrics from Python and JavaScript reports. This prevents data from being overwritten if a file is present in both reports. Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/c17a4bab-a81e-49a8-b508-94657565fbeb Co-authored-by: jakethekoenig <[email protected]>
This commit addresses several issues identified in the auto-review: 1. **Restore Missing Functions**: The `analyze_repository` and `save_to_file` functions have been restored to `analyzer.py` to fix the CLI. 2. **Use Relative Paths for Component IDs**: Component IDs are now created using relative paths, ensuring consistency with the rest of the data. 3. **Preserve Relationship Direction**: The relationship key now preserves directionality, preventing imports from being collapsed into undirected edges. Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/f62063d5-b451-419e-aa2e-6e362a7784f4 Co-authored-by: jakethekoenig <[email protected]>
This commit addresses the remaining issues identified in the auto-review: 1. **Fix Recency Metric**: The frontend now calculates the recency score based on the `lastModified` timestamp, and the schema has been updated to reflect this change. 2. **Add Dummy Line Numbers**: The backend now includes `lineStart` and `lineEnd` fields in the `Component` objects to satisfy the frontend's schema. 3. **Preserve Relationship Direction**: The relationship key logic has been corrected to preserve directionality for directed relationships. Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/05e57782-78ad-4722-9e04-c3eb77f69289 Co-authored-by: jakethekoenig <[email protected]>
This commit addresses the remaining issues identified in the auto-review: 1. **Fix `FileDetails` Component**: The `FileDetails` component now uses `lastModified` instead of `lastCommitDaysAgo`. 2. **Fix Relationship Type Mismatch**: The relationship type for imports is now correctly set to "import". 3. **Restore "contains" Relationships**: The logic for creating "contains" relationships has been restored. Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/9fbc8fbc-fb7b-4a5d-b561-a1019f2d1920 Co-authored-by: jakethekoenig <[email protected]>
This commit addresses the remaining issues identified in the auto-review: 1. **Fix Depth Calculation**: The depth calculation for files and directories has been corrected to be consistent with the old logic. 2. **Improve `CoveragePieChart` Guard**: The guard in the `CoveragePieChart` component has been improved to prevent rendering a "0%" chart when all coverage metrics are zero. Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/52b03810-56e6-44f6-831d-92760aa2f730 Co-authored-by: jakethekoenig <[email protected]>
This commit addresses a few minor issues identified in the auto-review: 1. **Remove Unused Variable**: The unused `parts[0]` variable has been removed from `_analyze_history`. 2. **Add Type Casting**: The `pct` values in `_load_coverage_data` are now cast to `float` to prevent potential type errors. Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/14e2357d-37af-48ca-8445-2c4f68adcd52 Co-authored-by: jakethekoenig <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
None yet
0 participants
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.
This PR adds test coverage visualization to the repository visualizer. It introduces the following changes:
RepositoryAnalyzer
now processes Python and JavaScript coverage reports and includes the data in the generated JSON.FileDetails
component to visualize test coverage for the selected file.recency
metric is now calculated based on thelastModified
timestamp.This change addresses the user's request to add test coverage visualization and resolves several issues identified during development.
🤖 This PR was created with Mentat. See my steps and cost here ✨