Hostname screen: rework into two-step selector + input flow#2
Merged
Conversation
Replace the single-screen hostname text input with toggle approach with a two-step flow: a selector screen (Static vs Network-assigned) followed by an optional text input sub-screen. The spec version is bumped from +2 to +3, marking all existing impl and test references as stale.
The spec changes have already been committed. This rewrites the plan to remove the spec change section and replace the implementation steps with a detailed checklist that tracks every stale reference and what needs to happen to each one.
Replace the single Hostname screen (text input with DHCP toggle) with a two-step flow: 1. Screen::Hostname - an Up/Down selector choosing between 'Static hostname' and 'Network-assigned (DHCP)' (or 'DHCP / cloud-init' for cloud variant). Metal defaults to Static, Cloud defaults to Static (configurable via hostname-from-dhcp config). 2. Screen::HostnameInput - text input for the hostname, shown only when Static is selected. Required (non-empty) for metal, optional for cloud. If the user selects network-assigned, the flow skips HostnameInput and proceeds directly to Login. Updates all tracey references from installer.tui.hostname+2 to +3. Updates all unit tests and integration tests for the new flow.
Per the spec, cloud defaults to 'Network-assigned (DHCP / cloud-init)' while metal defaults to 'Static hostname'. The default is set at construction time based on the variant, and toggle_variant() resets it when switching between variants (unless a hostname has been typed or was provided via a hostname template). Config overrides: - hostname-from-dhcp = true forces DHCP selected for any variant - A non-empty hostname or hostname-template forces Static selected Also adds tests for the new defaulting behavior.
…iants Choosing 'Static hostname' is an explicit decision to set a hostname, so an empty value is never accepted — regardless of whether the variant is metal or cloud. Previously cloud allowed empty static hostnames. Also fixes the spec formatting: the hostname requirement now uses quoted (> prefixed) lines so tracey correctly tracks the full multi-paragraph requirement body. Bumps installer.tui.hostname from +3 to +4.
Add hostname format validation on Enter in the HostnameInput screen: - Only ASCII letters, digits, and hyphens allowed - Must not start or end with a hyphen - Max 63 characters - Cannot be empty (already enforced, now with same validator) Extract validate_hostname() into config.rs as a shared function used by both the config file validator and the TUI key handler. Validation errors are shown inline in red and cleared when the user types or backspaces. Also fixes the spec formatting for the hostname requirement to use quoted (> prefixed) multi-paragraph blocks so tracey tracks the full body. Bumps installer.tui.hostname from +4 to +5.
Validate hostname format live as the user types (Char/Backspace), showing errors immediately instead of waiting for Enter. The empty hostname check is still only enforced on Enter to avoid nagging while the user is still typing. Updated existing test and added a new test to verify the live validation behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The hostname screen had a confusing UX: a text input with a DHCP toggle checkbox below it for metal, and an optional text input for cloud. Users were presented with a required text input and a toggle that disables it at the same time, with no clear indication of which path to choose first.
Solution
Replace the single hostname screen with a two-step flow matching the variant selection pattern:
Screen::Hostname): Up/Down selector choosing between "Static hostname" and "Network-assigned (DHCP)" (or "DHCP / cloud-init" for cloud).Screen::HostnameInput): Text input shown only when Static is selected. Required (non-empty) for metal, optional for cloud.If the user selects network-assigned, the flow skips the input screen and proceeds directly to Login.
Defaults by variant
Switching variant via the variant selection screen resets the default (unless a hostname has already been typed or was provided via template).
Config overrides
hostname-from-dhcp = trueforces DHCP selected for any varianthostnameorhostname-templateforces Static selectedChanges
Screen::HostnameInputto theScreenenumadvance()/go_back()navigation for the two-step flowScreen::Hostnamekey handler as Up/Down selectorScreen::HostnameInputkey handler for text inputrender_hostname()as selector UI, addedrender_hostname_input()toggle_variant()to reset hostname default when switching variantsinstaller.tui.hostname+2to+3Verification
cargo fmt-- cleancargo clippy-- cleantracey query stale-- no stale referencescargo test-- 252 unit tests + 68 integration tests pass (320 total)