-
Notifications
You must be signed in to change notification settings - Fork 0
Add interactive TUI for real-time node monitoring #301
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
Conversation
|
useful ascii art for the tui: Fukuii logo: Ethereum Classic: |
Co-authored-by: realcodywburns <13103499+realcodywburns@users.noreply.github.com>
Co-authored-by: realcodywburns <13103499+realcodywburns@users.noreply.github.com>
Co-authored-by: realcodywburns <13103499+realcodywburns@users.noreply.github.com>
Co-authored-by: realcodywburns <13103499+realcodywburns@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an enhanced Terminal User Interface (TUI) for real-time monitoring of the Fukuii Ethereum client. The console UI is enabled by default and provides visual feedback on node status, peer connections, blockchain sync progress, and runtime information.
- Implements a singleton-based ConsoleUI using JLine 3 for terminal control
- Adds ConsoleUIUpdater for periodic status polling and keyboard command handling
- Integrates with node lifecycle through StdNode and Fukuii.scala with
--no-tuiflag support
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ConsoleUI.scala | Core UI rendering class with terminal management, keyboard input, and display sections |
| ConsoleUIUpdater.scala | Background updater thread for polling status and rendering UI |
| StdNode.scala | Integration point for starting/stopping ConsoleUIUpdater in node lifecycle |
| Fukuii.scala | Command-line flag parsing and ConsoleUI initialization |
| App.scala | Help text updated with --no-tui flag documentation |
| console-ui.md | Comprehensive user documentation for the Console UI feature |
| console-ui-mockup.txt | Visual mockups showing different UI states |
| 008-console-ui.md | Architecture Decision Record documenting design choices |
| README.md | Updated with Console UI usage information |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import cats.effect.IO | ||
| import cats.effect.unsafe.implicits.global |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cats.effect imports (IO and unsafe.implicits.global) are not used anywhere in the file. These imports should be removed to avoid unnecessary dependencies.
| import cats.effect.IO | |
| import cats.effect.unsafe.implicits.global |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e196247 - removed unused cats.effect imports
| @@ -0,0 +1,121 @@ | |||
| package com.chipprbots.ethereum.console | |||
|
|
|||
| import scala.concurrent.duration._ | |||
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scala.concurrent.duration._ import is not used in this file. This import should be removed.
| import scala.concurrent.duration._ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e196247 - removed unused scala.concurrent.duration import
| } | ||
| } | ||
| } finally { | ||
| consoleUI.shutdown() |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ConsoleUI is shutdown in the finally block of updateLoop(), but it's also shutdown in StdNode.shutdown() (line 145) and in Fukuii.scala's shutdown hook (line 58). This creates a triple shutdown scenario that could cause issues. The ConsoleUI.shutdown() should only be called once. Consider removing it from the finally block since StdNode.shutdown() already calls consoleUIUpdater.stop() before calling ConsoleUI.getInstance().shutdown().
| consoleUI.shutdown() | |
| // Shutdown is handled elsewhere (StdNode.shutdown and shutdown hook) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e196247 - removed shutdown call from finally block, shutdown is now only handled by StdNode.shutdown() and the shutdown hook in Fukuii.scala
| } | ||
|
|
||
| tryAndLogFailure(() => consoleUIUpdater.foreach(_.stop())) | ||
| tryAndLogFailure(() => ConsoleUI.getInstance().shutdown()) |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a potential race condition: consoleUIUpdater.stop() interrupts the update thread which has ConsoleUI.shutdown() in its finally block, while line 145 also calls ConsoleUI.getInstance().shutdown(). If both execute simultaneously, the singleton's shutdown method could be invoked concurrently. Consider either removing the shutdown() call from ConsoleUIUpdater's finally block or adding synchronization to ConsoleUI.shutdown().
| tryAndLogFailure(() => ConsoleUI.getInstance().shutdown()) | |
| tryAndLogFailure(() => ConsoleUI.synchronized { ConsoleUI.getInstance().shutdown() }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e196247 - added synchronization to ConsoleUI.shutdown() method to prevent concurrent invocations
| case 'd' => | ||
| shutdown() | ||
| log.info("Console UI disabled, switching to standard logging") | ||
| true |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the 'd' command is pressed, shutdown() is called which sets enabled=false and closes the terminal, but the method returns true indicating the loop should continue. This will cause the updateLoop() to check consoleUI.isEnabled on the next iteration and exit. However, the finally block will then call shutdown() again on an already-shutdown ConsoleUI. Consider returning false here or handling the disabled state differently.
| true | |
| false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e196247 - changed return value to false so the update loop exits cleanly when 'd' command is pressed
|
@copilot apply changes based on the comments in this thread |
…dition Co-authored-by: realcodywburns <13103499+realcodywburns@users.noreply.github.com>
Implementing improved console UX for fukuii-launcher
Status: Ready for Review ✅
Completed Tasks
Recent Fixes (Latest Commit)
Implementation Summary
Files Created (3)
src/main/scala/com/chipprbots/ethereum/console/ConsoleUI.scala(487 lines)src/main/scala/com/chipprbots/ethereum/console/ConsoleUIUpdater.scala(115 lines)Files Modified (3)
Fukuii.scala- CLI flag handling and initializationStdNode.scala- Lifecycle integrationApp.scala- Help text updateDocumentation Created (4)
docs/console-ui.md- User guidedocs/adr/008-console-ui.md- Architecture decision recorddocs/console-ui-mockup.txt- Visual mockupsREADME.md- Updated with console UI sectionKey Features
✅ Terminal UI with real-time node monitoring
✅ Grid-based non-scrolling layout
✅ Peer connection status with visual indicators
✅ Blockchain sync progress with progress bars
✅ Keyboard commands (Q/R/D)
✅ Color-coded health status (Green/Yellow/Red)
✅ Ethereum Classic ASCII art
✅ Graceful fallback to standard logging
✅
--no-tuiflag for headless modeQuality Assurance
✅ Code review completed and all feedback addressed
✅ Removed unused imports
✅ Fixed shutdown race conditions with synchronization
✅ Proper shutdown coordination (single-point responsibility)
✅ Comprehensive error handling
✅ Cross-platform compatibility
✅ Thread-safe state management
✅ Proper documentation (ADR + User Guide)
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.