Skip to content

Feat/batch dashboard#53

Merged
btotharye merged 5 commits intomainfrom
feat/batch-dashboard
Mar 22, 2026
Merged

Feat/batch dashboard#53
btotharye merged 5 commits intomainfrom
feat/batch-dashboard

Conversation

@btotharye
Copy link
Copy Markdown
Owner

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Content pack addition/update
  • CI/CD or tooling change

Changes Made

Testing

  • Tests pass locally (make test)
  • Linting passes (make lint)
  • Formatting is correct (make format-check)
  • Tested manually with:

Related Issues

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes

Additional Notes

Greybeard Agent added 2 commits March 21, 2026 23:53
Implements comprehensive batch analysis feature for aggregating multiple code reviews.

## Features

### 1. BatchAnalyzer (greybeard/batch_analyzer.py)
- Collects and analyzes multiple review files
- Extracts findings using pattern matching (Critical/High/Medium/Low/Info)
- Deduplicates similar findings with fuzzy matching (Jaccard similarity)
- Calculates risk metrics and aggregated scores
- Detects trends and patterns across reviews
- Supports JSON and Markdown export

Key classes:
- Finding: Individual finding with risk level and frequency
- ReviewSummary: Single review analysis results
- AggregatedFindings: Cross-review aggregation
- BatchAnalyzer: Main analysis engine

### 2. DashboardReporter (greybeard/reporters/dashboard.py)
- Generates interactive HTML dashboard with D3.js visualizations
- Risk distribution pie chart
- Risk heatmap by category
- Responsive design with dark/light mode support
- Tabs for all findings vs. recurring findings
- ~20KB minified HTML output

### 3. CLI Integration (greybeard/cli.py)
New command: greybeard batch-analyze
- Accepts multiple review files as arguments
- Supports three output formats:
  - HTML (interactive dashboard, default)
  - Markdown (summary report)
  - JSON (raw data for processing)
- Example: greybeard batch-analyze *.txt --format html --output report.html

### 4. Comprehensive Test Suite
- 48 tests total (26 for analyzer, 22 for dashboard)
- 86-98% code coverage
- Tests cover:
  - Finding extraction and risk metric calculation
  - Deduplication and fuzzy matching
  - Aggregation and trend detection
  - HTML rendering and escaping
  - Export formats (JSON, Markdown)
  - Real-world scenarios

### 5. Documentation
- Complete guide in docs/batch-analysis.md
- API documentation with examples
- CLI usage examples
- Risk level definitions
- Troubleshooting guide

## Risk Aggregation Logic

- Pattern-based extraction: Supports keywords like 'Critical:', 'High risk:', etc.
- Fuzzy deduplication: Jaccard similarity (0.5 threshold)
- Frequency tracking: Recurring findings marked when appearing in 2+ reviews
- Risk weighting:
  - Critical: 10 points
  - High: 5 points
  - Medium: 2 points
  - Low: 1 point
  - Info: 0 points
- Trend detection: Consensus (50%+), concentration, categories

## Export Formats

### HTML Dashboard
- Interactive D3.js charts
- Styled summary cards
- Risk visualization
- Tab interface for findings
- Mobile responsive
- Dark mode support

### Markdown
- Executive summary
- Detected trends
- Recurring findings
- All findings with frequency

### JSON
- Machine-readable data
- Metadata and timestamps
- All findings with context
- Full review data for analysis

## Example Usage

## Python API

## Code Quality

- Clean linting: passes ruff E, F, I, UP checks
- Type hints throughout
- Comprehensive docstrings
- No external dependencies beyond existing greybeard stack
- Error handling for missing/invalid files
- HTML escaping for XSS prevention

## Testing

Run tests:

Coverage:
- batch_analyzer.py: 86-88% coverage
- reporters/dashboard.py: 98%+ coverage
- CLI integration tested with real files

## Breaking Changes

None. Feature is purely additive.

## Future Enhancements

Potential improvements (for future PRs):
- Custom finding extraction plugins
- Risk weight customization
- Machine learning-based deduplication
- Integration with issue tracking (Jira, GitHub)
- Email/Slack report delivery
- Historical trend analysis
- Configurable risk thresholds
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 21, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.67%. Comparing base (f455ce5) to head (2dbf691).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
greybeard/cli.py 15.15% 28 Missing ⚠️
greybeard/batch_analyzer.py 98.55% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #53      +/-   ##
==========================================
- Coverage   92.93%   92.67%   -0.27%     
==========================================
  Files          29       31       +2     
  Lines        3129     3438     +309     
==========================================
+ Hits         2908     3186     +278     
- Misses        221      252      +31     
Flag Coverage Δ
unittests 92.67% <90.00%> (-0.27%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Greybeard Agent added 3 commits March 21, 2026 23:59
- Fix long line issues in batch_analyzer.py regex patterns
- Break up long lines in batch_analyzer.py trends logic
- Fix long lines in dashboard.py CSS and HTML generation
- Remove unused pytest imports in test files
- Fix broken doc links in batch-analysis.md guide
- Add batch-analysis guide to mkdocs.yml navigation
- Format all changes with ruff format
- All linting checks now pass
- mkdocs build --strict now passes
- Add 67 new tests covering edge cases, error paths, and untested code paths
- batch_analyzer.py: 87.50% -> 98.56% coverage (11 lines remaining)
- dashboard.py: 98.53% -> 100.00% coverage (perfect)
- Both files exceed 85% coverage target
- Tests cover:
  - Finding extraction with various risk levels and formats
  - Deduplication with edge cases (empty, single, identical findings)
  - Fuzzy matching with different thresholds
  - Risk calculation and heatmap building
  - Trend detection scenarios
  - Export formats (JSON and Markdown)
  - HTML rendering with all details
  - Integration workflows
  - Risk scoring and weights
- Remove unused imports (MagicMock, patch, pytest, ReviewSummary)
- Fix line length violations in test assertions
- Remove unused variable assignments
- Fix trailing whitespace
- Update test assertion to use actual content variable

All checks now pass with 'ruff check .'
@btotharye btotharye merged commit 95adb0f into main Mar 22, 2026
5 checks passed
@btotharye btotharye deleted the feat/batch-dashboard branch March 22, 2026 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant