Skip to content

Comments

Adde FTUE changes for account setup#88

Open
madclaws wants to merge 1 commit intomainfrom
feat/ftue
Open

Adde FTUE changes for account setup#88
madclaws wants to merge 1 commit intomainfrom
feat/ftue

Conversation

@madclaws
Copy link
Member

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Feb 21, 2026

📝 Walkthrough

Walkthrough

This change updates account-related terminology and introduces a first-time user experience (FTUE) setup flow. User-facing messages replace "Root account" with "Local Identity" in account creation and status outputs. The FTUE addition introduces a new onboarding function that prompts users for a nickname, creates a local identity, saves it, and displays the result. This FTUE runs early in the model execution workflow before standard initialization. Supporting imports for account utilities and config helpers are added, and prompt/message formatting is updated with additional newlines and styling for clarity.

Sequence Diagram

sequenceDiagram
    actor User
    participant Runtime as Runtime/Server
    participant AccountSystem as Account System
    participant ConfigSystem as Config System
    participant Output as Output/Display

    User->>Runtime: Start application
    Runtime->>AccountSystem: Check if root user exists
    alt No root user found
        Runtime->>User: Prompt for nickname (FTUE)
        User->>Runtime: Enter nickname
        Runtime->>AccountSystem: create_root_account(nickname)
        AccountSystem->>AccountSystem: Generate identity
        AccountSystem-->>Runtime: Identity created
        Runtime->>ConfigSystem: save_root_account(identity)
        ConfigSystem-->>Runtime: Account saved
        Runtime->>Output: Display created identity
        Output->>User: Show identity details
    else Root user exists
        Runtime->>AccountSystem: get_root_user_details()
        AccountSystem-->>Runtime: User details
        Runtime->>Runtime: Continue with normal flow
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to evaluate relevance to the changeset. Add a pull request description that explains the purpose and context of the FTUE account setup changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title contains a typo ('Adde' instead of 'Add') and refers to the main change—FTUE setup for account creation—which aligns with the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/ftue

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
tiles/src/runtime/mlx.rs (2)

279-287: .to_string() on string literals is unnecessary before OwoColorize methods.

OwoColorize is blanket-implemented for all T: Display, and &str already implements Display. Calling .to_string() allocates a String unnecessarily.

♻️ Proposed refactor
-        println!(
-            "{}",
-            "Welcome to Tiles: Your private and secure AI assistant for everyday use.\n"
-                .to_string()
-                .bold()
-                .blue()
-        );
-        println!("{}",
-            "\nPlease set a nickname for your local Tiles identity (You can change this later via `tiles account set-nickname`)\n".to_string().cyan()
-        );
+        println!(
+            "{}",
+            "Welcome to Tiles: Your private and secure AI assistant for everyday use.\n"
+                .bold()
+                .blue()
+        );
+        println!(
+            "{}",
+            "\nPlease set a nickname for your local Tiles identity (You can change this later via `tiles account set-nickname`)\n".cyan()
+        );

The same pattern also appears at line 331 ("\nDo you want to add a custom memory location right now instead? [Y/N]".to_string().cyan()).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tiles/src/runtime/mlx.rs` around lines 279 - 287, Remove the unnecessary
.to_string() allocations before calling OwoColorize methods: call .bold().blue()
and .cyan() directly on the string literals (which implement Display) instead of
converting to String; update the two occurrences shown (the welcome/FTUE println
that uses .to_string().bold().blue()/.to_string().cyan() and the later "\nDo you
want to add a custom memory location right now instead? [Y/N]" instance) so they
operate on &str and avoid the extra allocation.

295-302: Prefer format! over format_args! for user-facing colored output.

format_args! returns fmt::Arguments<'_>, which is an internal macro-helper type primarily used to avoid heap allocation inside format macros. Using it directly in application code and chaining .green() on it compiles (since fmt::Arguments implements Display and thus OwoColorize), but it is non-idiomatic. format! returns a String, which is the conventional choice here.

♻️ Proposed refactor
-        println!(
-            "{}",
-            format_args!(
-                "\nYour Tiles local identity: {} has been created with nickname {}\n",
-                root_user_config.id, root_user_config.nickname
-            )
-            .green()
-        );
+        println!(
+            "{}",
+            format!(
+                "\nYour Tiles local identity: {} has been created with nickname {}\n",
+                root_user_config.id, root_user_config.nickname
+            )
+            .green()
+        );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tiles/src/runtime/mlx.rs` around lines 295 - 302, Replace the non-idiomatic
use of format_args! in the println! call with format! so the expression passed
to .green() is a String; update the call that currently uses format_args!(
"\nYour Tiles local identity: {} has been created with nickname {}\n",
root_user_config.id, root_user_config.nickname ) to use format! instead, keeping
the same interpolation of root_user_config.id and root_user_config.nickname and
the .green() colorization before printing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tiles/src/runtime/mlx.rs`:
- Around line 288-292: The code reads a nickname into `input` and immediately
calls `create_root_account` which can receive an empty string; change this to
validate and re-prompt until a non-empty trimmed nickname is provided: loop
reading from `stdin` into `input`, trim and check `!input.is_empty()`, and only
then call `create_root_account(&root_config, Some(input))` and
`RootUser::new(...)`; keep the existing variables (`stdin`, `input`,
`create_root_account`, `RootUser::new`, `root_config`) but replace the single
read with a loop that prints a prompt and repeats if the trimmed `input` is
empty.

---

Nitpick comments:
In `@tiles/src/runtime/mlx.rs`:
- Around line 279-287: Remove the unnecessary .to_string() allocations before
calling OwoColorize methods: call .bold().blue() and .cyan() directly on the
string literals (which implement Display) instead of converting to String;
update the two occurrences shown (the welcome/FTUE println that uses
.to_string().bold().blue()/.to_string().cyan() and the later "\nDo you want to
add a custom memory location right now instead? [Y/N]" instance) so they operate
on &str and avoid the extra allocation.
- Around line 295-302: Replace the non-idiomatic use of format_args! in the
println! call with format! so the expression passed to .green() is a String;
update the call that currently uses format_args!( "\nYour Tiles local identity:
{} has been created with nickname {}\n", root_user_config.id,
root_user_config.nickname ) to use format! instead, keeping the same
interpolation of root_user_config.id and root_user_config.nickname and the
.green() colorization before printing.

Comment on lines +288 to +292
let stdin = io::stdin();
let mut input = String::new();
stdin.read_line(&mut input)?;
input = input.trim().to_owned();
let root_user_config = RootUser::new(&create_root_account(&root_config, Some(input))?)?;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Validate that the nickname is non-empty before proceeding.

After input.trim().to_owned(), input can still be an empty string if the user presses Enter without typing. This results in create_root_account being called with Some(""), which stores an empty nickname in the persisted identity — a broken FTUE state that is hard to recover from without explicitly running tiles account set-nickname.

🐛 Proposed fix — re-prompt on empty input
-    let stdin = io::stdin();
-    let mut input = String::new();
-    stdin.read_line(&mut input)?;
-    input = input.trim().to_owned();
-    let root_user_config = RootUser::new(&create_root_account(&root_config, Some(input))?)?;
+    let stdin = io::stdin();
+    let mut input = String::new();
+    loop {
+        input.clear();
+        stdin.read_line(&mut input)?;
+        input = input.trim().to_owned();
+        if !input.is_empty() {
+            break;
+        }
+        println!("Nickname cannot be empty. Please enter a nickname:");
+    }
+    let root_user_config = RootUser::new(&create_root_account(&root_config, Some(input))?)?;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let stdin = io::stdin();
let mut input = String::new();
stdin.read_line(&mut input)?;
input = input.trim().to_owned();
let root_user_config = RootUser::new(&create_root_account(&root_config, Some(input))?)?;
let stdin = io::stdin();
let mut input = String::new();
loop {
input.clear();
stdin.read_line(&mut input)?;
input = input.trim().to_owned();
if !input.is_empty() {
break;
}
println!("Nickname cannot be empty. Please enter a nickname:");
}
let root_user_config = RootUser::new(&create_root_account(&root_config, Some(input))?)?;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tiles/src/runtime/mlx.rs` around lines 288 - 292, The code reads a nickname
into `input` and immediately calls `create_root_account` which can receive an
empty string; change this to validate and re-prompt until a non-empty trimmed
nickname is provided: loop reading from `stdin` into `input`, trim and check
`!input.is_empty()`, and only then call `create_root_account(&root_config,
Some(input))` and `RootUser::new(...)`; keep the existing variables (`stdin`,
`input`, `create_root_account`, `RootUser::new`, `root_config`) but replace the
single read with a loop that prints a prompt and repeats if the trimmed `input`
is empty.

@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

❌ Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
tiles/src/runtime/mlx.rs 0.00% 18 Missing ⚠️
tiles/src/commands/mod.rs 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant