-
Notifications
You must be signed in to change notification settings - Fork 433
TUI mode #2060
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
base: main
Are you sure you want to change the base?
TUI mode #2060
Conversation
|
Claude finished @domenkozar's task —— View job Reviewing TUI Mode PRI've completed a comprehensive review of this large PR that adds TUI functionality to devenv. Here are my findings: Review Todo List
🔴 Critical Issues Found:1. Unsafe Mutex Usage Pattern (app.rs:79-87)if let Ok(model_guard) = model_clone.lock() {
// render logic
} else {
element!(View(width: terminal_width))
}Problem: Lock poisoning causes silent fallback to empty view, making failures invisible 2. Resource Management Concerns (model.rs:6-9)const MAX_LOG_MESSAGES: usize = 1000;
const MAX_LOG_LINES_PER_BUILD: usize = 1000;Problem: No bounds on activity count growth; could exhaust memory during long operations 3. Race Condition in Spinner Updates (app.rs:48-74)tokio::time::sleep(Duration::from_millis(50)).await;
if let Ok(mut model_guard) = model.lock() {
model_guard.ui.spinner_frame = (model_guard.ui.spinner_frame + 1) % 10;
// triggers re-render
}Problem: Aggressive polling with shared state mutation creates race conditions 🟡 Medium Priority Issues:4. Error Recovery Gaps (tracing_layer.rs:33-36)fn update_model<F>(&self, f: F) {
if let Ok(mut model) = self.model.lock() {
f(&mut model);
}
// Silent failure - lost events
}Problem: Silent failures could hide critical errors and lose logging events 5. Performance Bottlenecks
Recommendations:
6. Integration ComplexityThe 🟢 Positive Aspects:Good Design Decisions:
Code Quality:
🛡️ Security Assessment:Dependencies:
Input Handling:
📊 Test Coverage Issues:Missing Tests:
Recommendation: Add comprehensive test suite before merging, especially for:
🚀 Performance Considerations:Memory Usage:
CPU Usage:
📝 Final Recommendations:Before Merging:
Future Improvements:
Architecture Concerns:The TUI integration is well-architected but adds significant complexity to the codebase. Consider if the improved UX justifies the maintenance overhead. Overall Assessment: This is a substantial feature addition with good architectural design, but contains several critical issues that should be addressed before merging. The TUI functionality works well in happy-path scenarios but lacks robustness for production use. |
🔍 Suggested ReviewersBased on git blame analysis of the changed lines, the following contributors have significant experience with the modified code:
Please consider reviewing this PR as you have authored significant portions of the code being modified. Your expertise would be valuable! 🙏 This comment was automatically generated by git-blame-auto-reviewer Last updated: 2025-10-24T15:59:34.546Z |
Deploying devenv with
|
| Latest commit: |
9304e35
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f35aec58.devenv.pages.dev |
| Branch Preview URL: | https://tui.devenv.pages.dev |
|
Looks like we might use https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Settings.html to get system colors on Linux at least |
|
this would be nice! I just wanted to write that the output is not friendly towards beginners, it gives the impression of being "stuck". |
Co-authored-by: Domen Kožar <[email protected]>
Rewrites tui-replay to consume JSON traces directly instead of parsing Nix's internal log format, building on bc7113c. Key changes: - Replace manual Nix internal log parsing with serde JSON deserialization - Introduce FieldExtractor helper to eliminate field access boilerplate - Simplify control flow from nested conditionals to pattern matching - Remove unnecessary Arc<Mutex> wrappers and manual ID generation - Update documentation with new usage examples This reduces the code from 501 to 255 lines (49% reduction) while maintaining the same functionality and improving maintainability. All tests pass (128/128). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Reorganize the tracing interface to distinguish between core operation identity and supplementary display metadata, making it clearer what's shown in each part of the TUI. - Split operation_fields into core identity (TYPE, NAME, SHORT_NAME) and details_fields for display metadata (PHASE, MACHINE, DERIVATION, etc.) - Convert user messages from special field to regular operation type (DEVENV) - Rename build_log_events → log_fields with devenv.ui.log.* namespace - Update all field names to use devenv.ui.* namespace consistently - Update tracing_layer to parse new field structure and handle DEVENV type 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Store parent span in NixLogBridge for proper nesting of Nix operations
under devenv operations (e.g., builds/downloads under "Building shell")
- Simplify span management by using Span::none() as default instead of Option<Span>
- Add helper methods (insert_activity, extract_string_field) to eliminate
duplicate code across activity handlers
- Combine extract_derivation_name and extract_package_name into shared
extract_nix_name function
- Fix inconsistent lock error handling with .expect("Lock poisoned")
- Remove unused parameter from handle_file_evaluation
Reduces code by ~45 lines while maintaining all functionality.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
- Update devenv operation spans to use standardized tracing interface (operation_fields::TYPE and operation_fields::NAME instead of devenv.user_message) - Traverse full span ancestry to find parent operations instead of checking only immediate parent, allowing operations to nest through intermediate spans - Always set operation ID in Nix bridge regardless of verbose mode, enabling consistent operation correlation This allows Nix operations (builds, downloads, queries) to properly nest under parent devenv operations like "Building shell" in the TUI, providing a clear operational hierarchy. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Fixes #2042
Fixes #1848
Evaluating