Skip to content

feat(ev-dev): part 5 – add interactive TUI dashboard#184

Open
randygrok wants to merge 8 commits intoev-deployer-part4-ev-dev-integrationfrom
feat/ev-dev-part5-tui
Open

feat(ev-dev): part 5 – add interactive TUI dashboard#184
randygrok wants to merge 8 commits intoev-deployer-part4-ev-dev-integrationfrom
feat/ev-dev-part5-tui

Conversation

@randygrok
Copy link
Contributor

Description

Adds an interactive terminal UI dashboard to ev-dev with the --tui flag. The TUI displays real-time blocks, logs, and accounts panels using ratatui, with a custom tracing layer that captures log events in real-time. Plain log output remains the default behavior.

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

  • TUI renders blocks, logs, and accounts panels
  • Keyboard navigation works (Tab, arrows, q to quit)
  • Terminal properly restored on exit or panic
  • Plain log output mode (--tui off) unchanged

- Integrate ratatui for terminal UI with blocks, logs, and accounts panels
- Implement custom tracing layer to capture real-time log events
- Add keyboard navigation (Tab for panel switch, arrows for scroll, q to quit)
- Support coexistence of TUI and plain log output modes
- Add crossterm for terminal event handling
@randygrok randygrok requested a review from a team as a code owner March 20, 2026 08:33
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4c0a78d8-a9dc-42a2-866c-db491f2cffb8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ev-dev-part5-tui

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude
Copy link

claude bot commented Mar 20, 2026

Claude finished @randygrok's task —— View job


PR Review: Interactive TUI Dashboard

🎯 Overview

This PR successfully adds a well-architected interactive TUI dashboard to ev-dev using the --tui flag. The implementation follows solid design patterns and integrates cleanly with the existing codebase.

✅ Strengths

Architecture & Design

  • Clean separation of concerns across 5 focused modules
  • Proper resource management with TerminalGuard for cleanup on panic
  • Non-blocking async design with channels for real-time data flow
  • Backward compatibility - plain logs remain default, TUI is opt-in

Code Quality

  • Consistent error handling patterns with appropriate fallbacks
  • Memory management with bounded collections (MAX_LOGS: 1000, MAX_BLOCKS: 200)
  • Efficient rendering with selective updates and scrolling optimization
  • User experience features like clipboard integration and keyboard shortcuts

Integration

  • Smart tracing integration - hijacks subscriber before reth's init to capture all logs
  • Reuses existing RPC infrastructure for balance polling and block details
  • Minimal main.rs changes - clean separation between TUI and non-TUI paths

⚠️ Areas for Improvement

Error Handling

Severity: Medium

Multiple expect() calls could cause panics in edge cases:

// bin/ev-dev/src/main.rs:227
.unwrap_or_else(|e| panic!("failed to load deploy config: {e}"));

// bin/ev-dev/src/tui/app.rs:246, 339  
rpc_url.parse().expect("valid RPC URL")

Recommendation: Replace panics with graceful degradation or user-friendly error messages.

Resource Management

Severity: Low

Some considerations:

  • No explicit channel cleanup when TUI exits, but tokio handles this gracefully
  • Balance polling continues indefinitely - consider adding cancellation token
  • Block detail fetching could accumulate if user rapidly presses Enter

Performance

Severity: Low

  • Log parsing on every drain could be optimized with lazy parsing
  • String truncation happens in multiple places - could be centralized
  • RPC calls for balance polling every 2s might be aggressive for some setups

Security

Severity: Low

  • Clipboard access gracefully handles failures but doesn't verify clipboard security
  • RPC URL parsing relies on user input - current validation is appropriate

📚 Test Coverage

Issue: No unit tests found for TUI components.

Recommendations:

  • Add unit tests for App state transitions and log parsing
  • Add integration tests for key event handling
  • Consider mocking RPC calls for deterministic testing
  • Test terminal restoration on various exit scenarios

🚀 Performance Considerations

Positive:

  • Efficient bounded collections prevent memory leaks
  • Non-blocking async design maintains UI responsiveness
  • Smart scroll calculations for large datasets

Minor Optimizations:

  • Consider debouncing balance updates when accounts are idle
  • Cache formatted strings where appropriate
  • Batch RPC calls for multiple balance queries

🔒 Security Assessment

Overall: Good

  • No sensitive data logging detected
  • Proper error boundary handling
  • Safe clipboard operations with fallback
  • RPC calls use standard alloy providers

📋 Final Recommendations

Must Fix

  • Replace panic-prone expect() calls with graceful error handling
  • Add basic unit tests for core TUI logic

Should Fix

  • Add cancellation for long-running background tasks
  • Centralize string truncation logic
  • Consider making balance polling interval configurable

Nice to Have

  • Add integration tests with mocked RPC
  • Optimize log parsing performance
  • Add configuration for UI refresh rates

✅ Conclusion

This is a well-executed feature that adds significant value to the development experience. The code demonstrates good Rust practices and thoughtful UX design. With the error handling improvements, this will be a solid addition to ev-dev.

Recommendation: Approve with minor fixes

@randygrok randygrok changed the title feat(ev-dev): add interactive TUI dashboard feat(ev-dev): part 5 – add interactive TUI dashboard Mar 20, 2026
@randygrok randygrok marked this pull request as draft March 20, 2026 14:33
@randygrok randygrok marked this pull request as ready for review March 25, 2026 10:07
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.

2 participants