Skip to content

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

Open
damrobi wants to merge 11 commits into
mainfrom
damrobi/3699-implement-tui-mithril-setup-signer
Open

damrobi wants to merge 11 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 a Back button to the review
  • Failure screen when the script generation fails, with the Back button
  • More signer fields and their rules, 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.
The value SIMULATE_SCRIPT_GENERATION_FAILURE in src/setups/signer/effect_handler.rs can be set to true to force the Continue button to move to the failure screen.

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   58m 21s ⏱️ - 54m 12s
 4 772 tests + 32   4 772 ✅ + 32  0 💤 ±0  0 ❌ ±0 
15 773 runs  +311  15 773 ✅ +311  0 💤 ±0  0 ❌ ±0 

Results for commit dcf2dc7. ± Comparison against base commit 736297b.

This pull request removes 72 and adds 104 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::saving_saved_err_goes_to_failed
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 deployed to testing-preview November 26, 2026 18:04 — with GitHub Actions Active
@damrobi
damrobi deployed to testing-2-preview November 26, 2026 18:04 — with GitHub Actions Active
@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 on lines +74 to +79
(ERA_READER_ADAPTER_TYPE, "cardano-chain"),
(ERA_READER_ADAPTER_PARAMS, ERA_READER_ADAPTER_PARAMS_EXAMPLE),
(
PROTOCOL_CONFIGURATION_READER_ADAPTER_CONFIG,
PROTOCOL_CONFIGURATION_READER_ADAPTER_CONFIG_EXAMPLE,
),
Comment on lines +94 to +101
Arc::new(|value| {
let after_scheme = value
.strip_prefix("https://")
.or_else(|| value.strip_prefix("http://"));

match after_scheme {
Some(rest) if !rest.is_empty() && !rest.starts_with('/') => Ok(()),
_ => Err(format!("{} is not an http(s) URL", quoted(value))),
Comment on lines 121 to 123
description: "Magic number of the Cardano network, for the devnet and private networks",
presence: Presence::Optional,
rules: vec![integer_between(0, u32::MAX as u64)],
@damrobi
damrobi deployed to testing-preview November 27, 2026 15:13 — with GitHub Actions Active
@damrobi
damrobi deployed to testing-2-preview November 27, 2026 15:13 — with GitHub Actions Active

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

2 participants