Skip to content

🧹 [Simplify interactive CLI menu function]#178

Merged
ffalcinelli merged 3 commits into
mainfrom
refactor/simplify-cli-menu-18032350460419519051
Jul 26, 2026
Merged

🧹 [Simplify interactive CLI menu function]#178
ffalcinelli merged 3 commits into
mainfrom
refactor/simplify-cli-menu-18032350460419519051

Conversation

@ffalcinelli

Copy link
Copy Markdown
Owner

🎯 What: Extracted the error-handling logic from the match block in src/cli/mod.rs into 8 separate handle_* async functions.

💡 Why: The run function was vertically long and cluttered with repetitive error-handling boilerplate. Moving this logic to dedicated helper functions significantly improves code maintainability and readability while preserving the exact behavior.

Verification: Verified that the refactored code compiles cleanly (cargo check) and passes all unit and integration tests (cargo test), ensuring no functionality was broken or regressions introduced.

Result: The run function's match block is now clean and concise, strictly mapping selections to their respective handler functions.


PR created automatically by Jules for task 18032350460419519051 started by @ffalcinelli

Extracted the interactive action error-handling logic from the central `match` block in `src/cli/mod.rs` into 8 dedicated async helper functions (`handle_create_user`, `handle_change_password`, etc.). This dramatically reduces the vertical length of the `run` function and improves readability without altering functionality.

Co-authored-by: ffalcinelli <1167082+ffalcinelli@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.42%. Comparing base (1cc8b9e) to head (c3ec420).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #178      +/-   ##
==========================================
+ Coverage   96.13%   96.42%   +0.29%     
==========================================
  Files          29       29              
  Lines        2925     2941      +16     
==========================================
+ Hits         2812     2836      +24     
+ Misses        113      105       -8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

google-labs-jules Bot and others added 2 commits July 26, 2026 10:01
Extracted the interactive action error-handling logic from the central `match` block in `src/cli/mod.rs` into 8 dedicated async helper functions (`handle_create_user`, `handle_change_password`, etc.). This dramatically reduces the vertical length of the `run` function and improves readability without altering functionality. Added a new unit test `test_cli_errors_hit` to ensure coverage targets are met.

Co-authored-by: ffalcinelli <1167082+ffalcinelli@users.noreply.github.com>
Added unit tests to hit the extracted handler error paths, `prompt_realm` fallback branch, and `get_realms` filter branches in `cli_interactive_test.rs` to satisfy coverage metrics.

Co-authored-by: ffalcinelli <1167082+ffalcinelli@users.noreply.github.com>
@ffalcinelli
ffalcinelli merged commit 6b53d1d into main Jul 26, 2026
10 checks passed
@ffalcinelli
ffalcinelli deleted the refactor/simplify-cli-menu-18032350460419519051 branch July 26, 2026 20:43
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