refactor: Address codebase audit findings#32
Conversation
- Update README.md with all 27 MCP tools and CLI commands - Consolidate fragmented imports in cli.py (8 statements → 3) - Add get_cutoff() helper to reduce datetime boilerplate - Remove do_* import aliases from cli.py - Export build_where_clause and get_cutoff from __init__.py 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review: refactor: Address codebase audit findingsOverall, this is a solid cleanup PR that addresses documentation staleness and improves code consistency. Here's my detailed feedback: ✅ What's Good1. Import Consolidation (cli.py) from session_analytics.ingest import (
correlate_git_with_sessions as do_correlate_git,
)was unnecessarily verbose. Using the original function names directly is cleaner and reduces cognitive overhead. 2.
3. README Updates 4. Public API Exports (init.py)
|
…owns Add four new CLI/MCP commands for richer analytics: - file-activity: Track reads/edits/writes per file with worktree collapse - languages: Language distribution from file extensions - projects: Activity across all projects - mcp-usage: MCP server and tool usage breakdown Add expand flags for drilling into aggregated tools: - frequency --no-expand: Hide Bash/Skill/Task breakdowns (default shows them) - sequences --expand: Show command/skill/agent level patterns Other improvements: - Add make reinstall target for pyproject.toml changes - Improve CLI output with descriptions and better formatting - Document when restarts are needed vs automatic 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review: PR #32 - refactor: Address codebase audit findingsThis is a well-organized cleanup PR that addresses several audit findings. Here's my detailed review: ✅ Strengths1. Documentation Updates (README.md)
2. Import Cleanup (cli.py)
3. DRY Improvement:
4. Public API Export (init.py)
|
Add 5 tests covering the public API function: - Days-only parameter - Hours-only parameter - Combined days and hours - Fractional days - Default values Addresses reviewer feedback on PR #32. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Feedback Addressed (Remote Review)Implemented
Skipped
|
PR Review: refactor: Address codebase audit findingsThis is a well-structured cleanup PR that addresses real technical debt. Here's my detailed feedback: ✅ What's Good1. Import Organization (cli.py) # Before: 8 separate import statements with do_* aliases
from session_analytics.ingest import correlate_git_with_sessions as do_correlate_git
from session_analytics.ingest import ingest_git_history as do_ingest_git
# ...
# After: 3 clean import blocks grouped by module
from session_analytics.ingest import (
correlate_git_with_sessions,
ingest_git_history,
ingest_logs,
)This improves readability and removes the unnecessary 2. DRY: def get_cutoff(days: int | float = 7, hours: float = 0) -> datetime:
total_hours = (days * 24) + hours
return datetime.now() - timedelta(hours=total_hours)
3. README Updates
4. Test Coverage
🔶 Suggestions for Consideration1. Public API Surface Expansion 2. Minor: Guide.md Self-Reference > **Tip:** Read this guide via the MCP resource `session-analytics://guide`...This creates a slightly circular reference (reading the guide to learn you can read it via MCP). Consider moving this to README.md instead or rephrasing as a reminder for LLM consumers. 3. Type Consistency in def get_cutoff(days: int | float = 7, hours: float = 0) -> datetime:The ✅ SummaryApprove — This PR makes the codebase cleaner and more maintainable:
The changes follow the project's conventions (formatter registry pattern, module imports in server.py, etc.) and the README updates ensure CLI/MCP parity in documentation. 🤖 Generated with Claude Code |
- Consolidate shared fixtures into conftest.py (storage, populated_storage, pattern_storage) - Add 16 new MCP server tests covering all 27 tools - Add 16 new CLI command tests for previously untested commands - Add 11 error path tests for empty database scenarios (TestCLIErrorPaths) - Fix _format_signals predicate crash when sessions list is empty - Remove duplicate fixtures from individual test files - Test count: 209 → 251 passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code ReviewSummaryThis PR addresses codebase audit findings: updates README documentation with all 27 MCP tools, consolidates fragmented imports in cli.py, adds a Issues FoundCriticalNone ImportantNone SuggestionsNone VerdictAPPROVE - Code looks good, no issues found. The changes are well-organized and address each audit finding systematically:
Previous review suggestions have been addressed appropriately in the "Feedback Addressed" comment. Automated review by Claude Code |
Code ReviewSummaryThis PR addresses codebase audit findings: updates README with all 27 MCP tools, consolidates fragmented imports in cli.py, adds a Issues FoundCriticalNone ImportantNone SuggestionsNone VerdictAPPROVE - Code looks good, no issues found. The changes are well-organized and systematically address each audit finding:
Previous review suggestions have been appropriately addressed per the "Feedback Addressed" comment. Automated review by Claude Code |
Summary
Addresses findings from
/audit-codebase:P1: Documentation Staleness (README.md)
P2: Import Organization (cli.py)
P3: Duplicated Cutoff Calculation
get_cutoff(days, hours)helper in queries.pyP4: Inconsistent Aliasing (cli.py)
do_*import aliasesP5: Public API Surface (init.py)
build_where_clauseandget_cutoffhelpersTest plan
🤖 Generated with Claude Code