Skip to content

feat(setup): implement tui for mithril setup signer command - #3732

Merged
damrobi merged 23 commits into
mainfrom
damrobi/3699-implement-tui-mithril-setup-signer
Dec 3, 2026
Merged

damrobi merged 23 commits into
mainfrom
damrobi/3699-implement-tui-mithril-setup-signer

Conversation

@damrobi

@damrobi damrobi commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Content

This PR implements more features for the terminal user interface of the mithril-setup signer command.

It includes:

  • Review screen:
    • Abort and Continue buttons
    • Mouse wheel scrolling, and text paste in the edited value
    • Values checked when the screen opens, errors of the selected row in the footer, and a popup listing the fields in error on Continue
    • Status column, long values cut with …, footer wrapped on narrow terminals
  • Result screen with the command to run the setup script and an Exit button
  • User interactions of the orchestrator (review and result screen) in a UserInterface trait, apart from the setup work of the EffectHandler
  • More signer fields and their rules (endpoints checked with the url crate), with hardcoded values until the discovery and the guessing are wired

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • CHANGELOG file is updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • All check jobs of the CI have succeeded
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • Update README file (if relevant)
    • No new TODOs introduced

Comments

The file tui/setup_result/view.rs is modified several times, mostly for adding parts of the display, so it might be worth it to review only its final state.

Issue(s)

Closes #3699

@damrobi damrobi self-assigned this Nov 26, 2026
@damrobi damrobi added the feature 🚀 New implemented feature label Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Test Results

     5 files  ±  0     211 suites  ±0   56m 37s ⏱️ + 4m 6s
 4 849 tests + 74   4 849 ✅ + 74  0 💤 ±0  0 ❌ ±0 
16 021 runs  +296  16 021 ✅ +296  0 💤 ±0  0 ❌ ±0 

Results for commit 89e7f48. ± Comparison against base commit e0537cb.

This pull request removes 11 and adds 85 tests. Note that renamed tests count towards both.
mithril-setup ‑ config::rules::tests::integer_between::rejects_integers_out_of_bounds
mithril-setup ‑ config::rules::tests::integer_between::rejects_non_integers
mithril-setup ‑ config::rules::tests::valid_path::rejects_empty_path
mithril-setup ‑ config::rules::tests::valid_path::rejects_path_with_nul_byte
mithril-setup ‑ orchestrator::state_machine::tests::guessing_guessed_ok_goes_to_reviewing_and_requests_review_without_errors
mithril-setup ‑ orchestrator::state_machine::tests::saving_saved_ok_goes_to_done
mithril-setup ‑ setups::signer::effect_handler::tests::discover_returns_values_following_the_signer_schema
mithril-setup ‑ setups::signer::effect_handler::tests::guess_returns_the_given_store
mithril-setup ‑ setups::signer::effect_handler::tests::validate_accepts_the_discovered_store
mithril-setup ‑ tui::review::model::tests::navigation::down_on_the_last_row_keeps_it_selected
…
mithril-setup ‑ config::rules::tests::absolute_path::accepts_absolute_paths_even_if_they_do_not_exist
mithril-setup ‑ config::rules::tests::absolute_path::rejects_relative_empty_and_windows_paths
mithril-setup ‑ config::rules::tests::http_url::accepts_http_and_https_urls
mithril-setup ‑ config::rules::tests::http_url::rejects_other_schemes_and_urls_without_host
mithril-setup ‑ config::rules::tests::integer_between::rejects_integers_out_of_bounds_and_non_integers
mithril-setup ‑ config::rules::tests::ip_address::accepts_ipv4_and_ipv6_addresses
mithril-setup ‑ config::rules::tests::ip_address::rejects_host_names_invalid_addresses_and_addresses_with_a_port
mithril-setup ‑ config::rules::tests::json_object::accepts_json_objects
mithril-setup ‑ config::rules::tests::json_object::rejects_invalid_json
mithril-setup ‑ config::rules::tests::json_object::rejects_other_json_values
…

♻️ This comment has been updated with latest results.

@damrobi
damrobi force-pushed the damrobi/3699-implement-tui-mithril-setup-signer branch from f746e74 to 8626979 Compare November 26, 2026 17:51
@damrobi
damrobi temporarily deployed to testing-2-preview November 26, 2026 18:04 — with GitHub Actions Inactive
@damrobi
damrobi marked this pull request as ready for review November 26, 2026 18:16
@jpraynaud
jpraynaud requested a lite review from Copilot November 27, 2026 11:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Active moderate and critical findings remain for incomplete endpoint validation, inconsistent preview/mainnet defaults, and missing private-network magic enforcement.

3 open issues
What changed in this PR

This pull request expands the mithril-setup signer command into an interactive terminal workflow with review, validation, result, and failure screens connected through the orchestrator.

Changes:

  • Added reusable TUI widgets, review-table navigation, editing, paste support, mouse-wheel handling, status indicators, validation feedback, and error popups.
  • Added success and failure result screens with Back and Exit navigation.
  • Expanded signer configuration fields and validation rules, added hardcoded discovery and guessing values, and documented the workflow.
File Description
mithril-setup/​src/​tui/​widgets/​wrapped_text.rs Adds reusable width-aware text wrapping for descriptions and key help.
mithril-setup/​src/​tui/​widgets/​mod.rs Exposes the shared TUI widgets.
mithril-setup/​src/​tui/​widgets/​button.rs Adds reusable focused and unfocused button rendering.
mithril-setup/​src/​tui/​terminal.rs Handles review and result screen event loops and terminal modes.
mithril-setup/​src/​tui/​setup_result/​view.rs Renders setup success and failure result screens.
mithril-setup/​src/​tui/​setup_result/​model.rs Models result-screen state, outcomes, and navigation.
mithril-setup/​src/​tui/​setup_result/​mod.rs Registers the result-screen modules.
mithril-setup/​src/​tui/​setup_result/​keys.rs Maps result-screen keyboard input to actions.
mithril-setup/​src/​tui/​review/​view.rs Renders the review table, footer, buttons, and validation-error popup.
mithril-setup/​src/​tui/​review/​model.rs Adds review validation, button navigation, paste handling, and popup state.
mithril-setup/​src/​tui/​review/​mod.rs Registers review columns and popup modules.
mithril-setup/​src/​tui/​review/​keys.rs Maps keyboard, paste, and mouse-wheel events for review interactions.
mithril-setup/​src/​tui/​review/​errors_popup.rs Renders the list of fields with validation errors.
mithril-setup/​src/​tui/​review/​columns.rs Defines review-table columns and value truncation and editing behavior.
mithril-setup/​src/​tui/​mod.rs Exposes the result-screen and shared widget modules.
mithril-setup/​src/​setups/​signer/​schema.rs Adds signer configuration fields, allowed values, and validation rules.
mithril-setup/​src/​setups/​signer/​effect_handler.rs Adds hardcoded signer discovery and guessing values and result-screen effects.
mithril-setup/​src/​orchestrator/​state_machine.rs Adds result, failure, and back-navigation states and transitions.
mithril-setup/​src/​orchestrator/​runner.rs Executes result and failure display effects.
mithril-setup/​src/​config/​rules.rs Adds path, endpoint, IP, JSON, whitespace, and bounded-error validation rules.
mithril-setup/​README.md Documents the signer setup screens and keyboard controls.

Review effort: Lite

Comment thread mithril-setup/src/config/rules.rs Resolved

@jpraynaud jpraynaud left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@turmelclem turmelclem left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍 with some non-blocking suggestions and questions.

  • I was asking myself if we want to track with screenshots (somewhere in ticket or PR ?) what the TUI looks like.
  • and also keep track of what could be improved next (mouse support, JSON multi-lines editing)

Comment thread mithril-setup/src/tui/review/model.rs Resolved
Comment thread mithril-setup/src/tui/review/model.rs Resolved
Comment thread mithril-setup/src/tui/review/view.rs Resolved
Comment thread mithril-setup/src/tui/terminal.rs Resolved
@damrobi
damrobi force-pushed the damrobi/3699-implement-tui-mithril-setup-signer branch from dcf2dc7 to f18d9d2 Compare December 1, 2026 17:56
@damrobi
damrobi temporarily deployed to testing-preview December 1, 2026 18:08 — with GitHub Actions Inactive
@damrobi
damrobi temporarily deployed to testing-2-preview December 1, 2026 18:08 — with GitHub Actions Inactive
@damrobi

damrobi commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator Author

Current screens states:
Review screen
Error popup
Success screen

Comment thread mithril-setup/src/tui/review/model.rs Resolved
@damrobi
damrobi deployed to testing-2-preview December 3, 2026 08:34 — with GitHub Actions Active
@damrobi
damrobi deployed to testing-preview December 3, 2026 08:34 — with GitHub Actions Active
The setup script will provide the Cardano CLI path of the signer.
… result screen

The only realistic failure of the script generation is an existing file with the same name, which does not justify the complexity of going back to the review. A save failure ends the setup with its reason, and the result screen only has an Exit button.
…face trait

The review and the result screen move out of the EffectHandler into a UserInterface given to the runner. Its terminal implementation is built with the fields and the result of a setup, so the setups can share it.
…erminal modes guard and the missing status

- Left and Right actions next to Up and Down
- TerminalModes renamed TerminalModesGuard, it is a guard disabling the modes on drop
- Missing status documented as a mandatory value left unset
… values

The hardcoded guessed values were the mainnet ones while the guessed network and aggregator are pre-release-preview.
The http_url rule only checked the scheme prefix, so values without a valid host or port like 'https://?' or 'http://:bad' were accepted.
…and runs

The errors popup absence while navigating, its highlighted field and the centering of the result screen text are checked by running the command.
…re the first review

The guessing step now requests the validation of its values
* mithril-setup from `0.1.4` to `0.1.5`
@damrobi
damrobi force-pushed the damrobi/3699-implement-tui-mithril-setup-signer branch from 13e1d64 to 89e7f48 Compare December 3, 2026 15:14
@damrobi
damrobi deployed to testing-2-preview December 3, 2026 15:28 — with GitHub Actions Active
@damrobi
damrobi deployed to testing-preview December 3, 2026 15:28 — with GitHub Actions Active
@damrobi
damrobi merged commit 9a5abbb into main Dec 3, 2026
53 checks passed
@damrobi
damrobi deleted the damrobi/3699-implement-tui-mithril-setup-signer branch December 3, 2026 16:13

This branch was successfully deployed

2 active deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 🚀 New implemented feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the terminal user interface of the mithril-setup signer command

5 participants