Skip to content

Fix empty undo argument handling - #64

Merged
omlahore merged 1 commit into
omlahore:mainfrom
cosmicsid004:fix/undo-empty-arguments
Oct 18, 2026
Merged

omlahore merged 1 commit into
omlahore:mainfrom
cosmicsid004:fix/undo-empty-arguments

Conversation

@cosmicsid004

@cosmicsid004 cosmicsid004 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #57 by rejecting undo commands that are called without any tweak names.

Changes

  • Add an empty-argument guard to TweakCommands.undo.
  • Display a clear error message when no tweak names are provided.

Testing

  • swift build -c release — passed
  • RemoveMacAI self-test — passed
  • removemacai undo — prints the expected error and exits with code 1
  • git diff --check — passed after removing trailing whitespace

Environment

  • macOS 27.0.1
  • Apple Swift 6.4

Summary by CodeRabbit

  • Bug Fixes
    • Undo commands now prompt for tweak IDs when none are provided, without creating a snapshot or undo plan.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a8e6ff49-63fd-4166-80f2-a05763a5d9be
📥 Commits

Reviewing files that changed from the base of the PR and between 8eeb5fc and 202d6ca.

📒 Files selected for processing: 1
  • Sources/removemacai/TweakCommands.swift

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📝 Walkthrough

The undo command now rejects an empty ID list with name the tweaks to undo before creating a snapshot or building an undo plan.

Changes: Undo argument validation

Layer / File(s) Summary
Reject empty undo requests
Sources/removemacai/TweakCommands.swift
When the ID list is empty, undo fails with name the tweaks to undo before snapshot creation or undo plan construction.

Priority: ⬇️ Low

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

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: bubleg

Merge Risk: ⚪ Minimal · up to 202d6

Undo requests without tweak names now exit with a clear prompt before doing undo work, while named requests retain their existing behavior. No actionable merge risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: handling an empty argument list for the undo command.
Linked Issues check Passed Issue #57 requires undo without tweak names to fail with a clear prompt. The supplied change summary states that undo(ids:dryRun:yes:) rejects an empty ID list before snapshot and plan creation, w…
Out of Scope Changes check Passed The supplied whole-PR evidence identifies one four-line change in TweakCommands.undo. The change adds only the empty-argument guard and its error message. The change directly implements issue #57, a…
Full details: Linked Issues check

Explanation

Issue #57 requires undo without tweak names to fail with a clear prompt. The supplied change summary states that undo(ids:dryRun:yes:) rejects an empty ID list before snapshot and plan creation, with the message name the tweaks to undo. The PR testing report states that removemacai undo prints the expected error and exits with code 1.

Full details: Out of Scope Changes check

Explanation

The supplied whole-PR evidence identifies one four-line change in TweakCommands.undo. The change adds only the empty-argument guard and its error message. The change directly implements issue #57, and no unrelated change is shown.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@omlahore

Copy link
Copy Markdown
Owner

i tested it locally and removemacai undo with no names fails now, same as apply 👍
thanks @cosmicsid004, this goes out in 1.1.4

@omlahore
omlahore merged commit bc2330e into omlahore:main Oct 18, 2026
1 check passed
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.

removemacai undo with no tweak names says nothing needs changing

2 participants