Skip to content

fix: model session destroy target as a required arg group - #1043

Merged
norrietaylor merged 1 commit into
mainfrom
inbox-patch/session-destroy-arggroup-7bdd5fe8ee87e68e
Jul 29, 2026
Merged

fix: model session destroy target as a required arg group#1043
norrietaylor merged 1 commit into
mainfrom
inbox-patch/session-destroy-arggroup-7bdd5fe8ee87e68e

Conversation

@gominimal-aw-bot

@gominimal-aw-bot gominimal-aw-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #1038
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABKmghtQ

min session destroy -f demanded both --all and <SESSION> on the error path — impossible, since --all and [SESSION] are mutually exclusive — while bare min session destroy hid --all and marked [SESSION] required, contradicting --help. The fix drops the required_unless_present/conflicts_with pair on session for a clap ArgGroup over session and all (required, non-multiple), so the usage line renders them as alternatives. force still requires --all specifically: it is read only in the --all branch (destroy_all_sessions) and is a no-op for a single-session destroy, so tying it to --all — not the group, as the routing hint proposed — is the correct scope.

Verification

cargo fmt --all --check --manifest-path target/Cargo.toml — clean, no diff
cargo clippy --workspace --locked -- -D warnings — exit 0, no warnings
cargo build --workspace --locked — exit 0
cargo test --workspace --locked — exit 0 (minimal lib: 132 passed, incl. new regression test)

Generated by inbox-patch ·

Note

Fix session destroy to require exactly one of a session identifier or --all

Previously, the DestroyArgs struct used per-field required_unless_present/conflicts_with constraints to enforce mutual exclusivity. This replaces those with a clap ArgGroup named target that marks the group as required and non-multiple, so supplying neither or both is a parse error. A new test in lib.rs covers the three cases: session-only, --all-only, and both together.

Macroscope summarized f2daff3.

Summary by CodeRabbit

  • Bug Fixes
    • Improved validation for min session destroy commands.
    • Requires exactly one session target: a specific session or --all.
    • Prevents invalid combinations, including using --all with a session identifier.
    • Ensures --force is used only with --all.

`min session destroy -f` demanded both --all and <SESSION> on the error
path, an impossible combination since --all and [SESSION] are mutually
exclusive. Bare `min session destroy` likewise hid --all and rendered
[SESSION] as required, contradicting the optional form shown by --help.

Express the choice as a clap ArgGroup over `session` and `all`
(required, non-multiple). This subsumes the old required_unless_present
/ conflicts_with pair on `session` and makes the error-path usage line
render the two as alternatives. `force` still requires `--all`
specifically, since it is a no-op for a single-session destroy.

Closes: #1038
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The min session destroy CLI now models session targeting through a required, mutually exclusive clap ArgGroup. Regression coverage verifies session, --all, and --force parsing behavior and usage output.

Changes

Session destroy CLI

Layer / File(s) Summary
Target argument group and validation
crates/minimal/src/lib.rs
DestroyArgs now requires exactly one of session or --all through a top-level clap ArgGroup; imports and regression tests cover the updated constraints and --force behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • gominimal/inbox issue 384 — Describes the same min session destroy argument-group validation change.

Possibly related PRs

  • gominimal/minimal#811 — Directly overlaps with the DestroyArgs session-versus---all parsing constraints and tests.

Suggested reviewers: twitchyliquid64, 0chroma, norrietaylor

Poem

A rabbit reviewed the flags with care,
“One target only” floated through the air.
--all or a session, never both in the run,
--force joins when --all is the one.
Tests sprang like carrots, neat and bright.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The ArgGroup change and regression test satisfy the issue's requirements for exactly one target and correct usage rendering.
Out of Scope Changes check ✅ Passed The changes stay focused on the session destroy argument validation fix and related test coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title is concise, conventional, and accurately reflects the main clap ArgGroup change.
Description check ✅ Passed The description includes the change summary and testing evidence; only the checklist section is missing.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@norrietaylor
norrietaylor merged commit a3027a1 into main Jul 29, 2026
28 of 29 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
crates/minimal/src/lib.rs (1)

2789-2812: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Also assert that SESSION --force is rejected.

The implementation correctly enforces this through requires = "all", but the regression test should cover the direct single-session case as well as bare -f.

         assert!(parse(&["min", "session", "destroy", "--all", "web"]).is_err());
+        assert!(parse(&["min", "session", "destroy", "web", "--force"]).is_err());
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/minimal/src/lib.rs` around lines 2789 - 2812, Extend
destroy_models_session_and_all_as_required_alternatives to assert that parsing
["min", "session", "destroy", "web", "--force"] fails, covering --force with a
specific SESSION in addition to the existing bare -f case.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/minimal/src/lib.rs`:
- Around line 2789-2812: Extend
destroy_models_session_and_all_as_required_alternatives to assert that parsing
["min", "session", "destroy", "web", "--force"] fails, covering --force with a
specific SESSION in addition to the existing bare -f case.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cd6f4933-789c-448d-a47a-ad7e834ae4cd

📥 Commits

Reviewing files that changed from the base of the PR and between c1d466c and f2daff3.

📒 Files selected for processing (1)
  • crates/minimal/src/lib.rs

@norrietaylor
norrietaylor deleted the inbox-patch/session-destroy-arggroup-7bdd5fe8ee87e68e branch July 29, 2026 18:39
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.

min session destroy -f prints a usage line that can never parse

1 participant