fix(dashboard): performance improvements and layout fixes #7

Merged
rcsheets merged 2 commits from fix/dashboard-performance into main 2026-03-20 21:58:39 +00:00
Owner
No description provided.
- Add indexes on review_events (repo, pr_number, timestamp) and (timestamp)
- Cache computed settle time for 5 minutes
- Default dashboard to last 24 hours of events instead of all time
- Remove duplicate request_id column that caused misaligned table

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fixed header with title, version, and stats pinned to viewport
- Table scrolls independently beneath the header with sticky column headers
- Removed duplicate request_id column causing misalignment
- Stats label updated to "Total (24h)" to reflect time window
- Dashboard reads APP_VERSION from config

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator

Automated review by pr-reviewer v0.9.0 | Safety Check | anthropic | tracking id r-bdc28c-70d0ef

Status: Completed


Looking at this pull request, I can see it's focused on dashboard performance improvements and layout fixes. Let me check for any obvious safety issues:

Changes reviewed:

  • Added database indexes for performance optimization
  • Added caching to the settle time computation (5-minute TTL)
  • Modified dashboard to show only last 24 hours of data instead of all events
  • UI layout improvements with sticky headers and better styling
  • Removed request_id column from the table display
  • Added version display to the dashboard

Security/Safety considerations:

  • The database query changes look safe - using parameterized queries
  • Caching implementation uses appropriate global variables with TTL
  • No exposed secrets or credentials
  • No obvious SQL injection vulnerabilities
  • Index creation is safe and beneficial for performance
  • Time-based filtering reduces data exposure appropriately

The changes appear to be legitimate performance and UI improvements without any obvious security vulnerabilities or breaking changes.

Verdict: LGTM

*Automated review by [pr-reviewer](https://git.brooktrails.org/brooktrails/pr-reviewer) v0.9.0 | Safety Check | anthropic | tracking id `r-bdc28c-70d0ef`* **Status:** ✅ Completed --- Looking at this pull request, I can see it's focused on dashboard performance improvements and layout fixes. Let me check for any obvious safety issues: **Changes reviewed:** - Added database indexes for performance optimization - Added caching to the settle time computation (5-minute TTL) - Modified dashboard to show only last 24 hours of data instead of all events - UI layout improvements with sticky headers and better styling - Removed request_id column from the table display - Added version display to the dashboard **Security/Safety considerations:** - The database query changes look safe - using parameterized queries - Caching implementation uses appropriate global variables with TTL - No exposed secrets or credentials - No obvious SQL injection vulnerabilities - Index creation is safe and beneficial for performance - Time-based filtering reduces data exposure appropriately The changes appear to be legitimate performance and UI improvements without any obvious security vulnerabilities or breaking changes. **Verdict: LGTM**
Collaborator

Automated review by pr-reviewer v0.9.0 | Full Review | anthropic | tracking id r-bdc29f-0fcd7f

Status: Completed


Review of PR #7: fix(dashboard): performance improvements and layout fixes

Performance Improvements

The changes include several meaningful performance optimizations:

  1. Database Query Optimization (tracker.py:449-465): The get_events() function now accepts a since_seconds parameter (defaulting to 24h) and filters events at the database level using WHERE timestamp >= %s. This is a significant improvement that prevents loading all historical events.

  2. Database Indexing (tracker.py:70-71): Added two strategic indexes:

    • idx_review_events_repo_pr_ts on (repo, pr_number, timestamp) - supports PR-specific queries
    • idx_review_events_timestamp on (timestamp) - supports the new time-filtered queries
  3. Caching for Settle Time (tracker.py:335-351): Added a 5-minute cache for compute_settle_seconds() to avoid repeated database queries and calculations. This is well-implemented with proper cache invalidation.

  4. Memory Management: The get_events() function now also filters in-memory ignored events by the same time window, preventing unbounded memory growth.

Layout and UI Improvements

The dashboard layout changes significantly improve usability:

  1. Fixed Header: The stats section is now fixed at the top, allowing users to see key metrics while scrolling through events.

  2. Sticky Table Headers: Table headers stick below the fixed stats section (top: 140px), maintaining context during scrolling.

  3. Better Spacing and Typography: More compact design with improved visual hierarchy.

  4. Version Display: Added version information to the header for better operational visibility.

Code Quality and Structure

  1. Clean Refactoring: Removed the request_id column from the table display while preserving it as a tooltip on the backend field - good compromise between information density and accessibility.

  2. Proper HTML Structure: Added proper <thead> and <tbody> tags for better semantic markup.

  3. Configuration Import: Added missing from config import settings import in dashboard.py.

Minor Issues Found

  1. Label Consistency (dashboard.py:52-53): Changed "Quick scans" to "Safety checks" and "Total events" to "Total (24h)". While these improve clarity, ensure the terminology aligns with user documentation.

  2. Default Parameter: The since_seconds=86400 parameter is hardcoded. Consider making this configurable if different time windows might be needed.

Edge Cases Handled Well

  1. Database Connection Handling: All database operations maintain proper connection management with try/except/finally blocks.

  2. Cache Initialization: The settle time cache properly handles the None case for first access.

  3. Backwards Compatibility: The changes maintain API compatibility - get_events() can be called without parameters.

Security Considerations

No security issues identified. The changes don't introduce new attack vectors and maintain existing security practices.

Performance Impact Assessment

These changes should provide substantial performance improvements:

  • Dashboard load time will be much faster with 24h filtering vs. all-time data
  • Database query performance improved with proper indexing
  • Reduced memory usage from filtering ignored events
  • Cached settle time calculations reduce computational overhead

Test Coverage

While I can't see the test files, the changes involve several areas that should have test coverage:

  • Time-based filtering logic in get_events()
  • Cache behavior in compute_settle_seconds()
  • Dashboard rendering with the new layout

The changes are well-structured and appear to be backwards compatible. The performance improvements are meaningful and the UI enhancements improve usability without breaking existing functionality.

Verdict: Approve

*Automated review by [pr-reviewer](https://git.brooktrails.org/brooktrails/pr-reviewer) v0.9.0 | Full Review | anthropic | tracking id `r-bdc29f-0fcd7f`* **Status:** ✅ Completed --- ## Review of PR #7: fix(dashboard): performance improvements and layout fixes ### Performance Improvements ✅ The changes include several meaningful performance optimizations: 1. **Database Query Optimization (tracker.py:449-465)**: The `get_events()` function now accepts a `since_seconds` parameter (defaulting to 24h) and filters events at the database level using `WHERE timestamp >= %s`. This is a significant improvement that prevents loading all historical events. 2. **Database Indexing (tracker.py:70-71)**: Added two strategic indexes: - `idx_review_events_repo_pr_ts` on `(repo, pr_number, timestamp)` - supports PR-specific queries - `idx_review_events_timestamp` on `(timestamp)` - supports the new time-filtered queries 3. **Caching for Settle Time (tracker.py:335-351)**: Added a 5-minute cache for `compute_settle_seconds()` to avoid repeated database queries and calculations. This is well-implemented with proper cache invalidation. 4. **Memory Management**: The `get_events()` function now also filters in-memory ignored events by the same time window, preventing unbounded memory growth. ### Layout and UI Improvements ✅ The dashboard layout changes significantly improve usability: 1. **Fixed Header**: The stats section is now fixed at the top, allowing users to see key metrics while scrolling through events. 2. **Sticky Table Headers**: Table headers stick below the fixed stats section (`top: 140px`), maintaining context during scrolling. 3. **Better Spacing and Typography**: More compact design with improved visual hierarchy. 4. **Version Display**: Added version information to the header for better operational visibility. ### Code Quality and Structure ✅ 1. **Clean Refactoring**: Removed the request_id column from the table display while preserving it as a tooltip on the backend field - good compromise between information density and accessibility. 2. **Proper HTML Structure**: Added proper `<thead>` and `<tbody>` tags for better semantic markup. 3. **Configuration Import**: Added missing `from config import settings` import in dashboard.py. ### Minor Issues Found 1. **Label Consistency (dashboard.py:52-53)**: Changed "Quick scans" to "Safety checks" and "Total events" to "Total (24h)". While these improve clarity, ensure the terminology aligns with user documentation. 2. **Default Parameter**: The `since_seconds=86400` parameter is hardcoded. Consider making this configurable if different time windows might be needed. ### Edge Cases Handled Well ✅ 1. **Database Connection Handling**: All database operations maintain proper connection management with try/except/finally blocks. 2. **Cache Initialization**: The settle time cache properly handles the `None` case for first access. 3. **Backwards Compatibility**: The changes maintain API compatibility - `get_events()` can be called without parameters. ### Security Considerations ✅ No security issues identified. The changes don't introduce new attack vectors and maintain existing security practices. ### Performance Impact Assessment ✅ These changes should provide substantial performance improvements: - Dashboard load time will be much faster with 24h filtering vs. all-time data - Database query performance improved with proper indexing - Reduced memory usage from filtering ignored events - Cached settle time calculations reduce computational overhead ### Test Coverage While I can't see the test files, the changes involve several areas that should have test coverage: - Time-based filtering logic in `get_events()` - Cache behavior in `compute_settle_seconds()` - Dashboard rendering with the new layout The changes are well-structured and appear to be backwards compatible. The performance improvements are meaningful and the UI enhancements improve usability without breaking existing functionality. **Verdict: Approve**
rcsheets deleted branch fix/dashboard-performance 2026-03-20 21:58:40 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
brooktrails/pr-reviewer!7
No description provided.