Skip to content

fix: return error instead of nil when service delete is blocked in non-interactive mode#213

Open
eliajhmauve wants to merge 1 commit intozeabur:mainfrom
eliajhmauve:fix/service-delete-ni-exit-code
Open

fix: return error instead of nil when service delete is blocked in non-interactive mode#213
eliajhmauve wants to merge 1 commit intozeabur:mainfrom
eliajhmauve:fix/service-delete-ni-exit-code

Conversation

@eliajhmauve
Copy link
Copy Markdown
Contributor

Problem

service delete already has a guard for non-interactive mode without --yes:

} else if !f.Interactive && !opts.skipConfirm {
    f.Log.Info("Please use --yes to confirm deletion without interactive prompt")
    return nil   // ← exit code 0
}

The guard is correct — deletion is blocked. But returning nil means exit code 0, so CI/CD scripts cannot tell whether the service was actually deleted or silently skipped.

Fix

Replace f.Log.Info(...); return nil with return fmt.Errorf(...) so the exit code is non-zero when deletion is blocked.

The --yes/-y flag and all existing behavior are unchanged.

Files changed

  • internal/cmd/service/delete/delete.go — 1-line fix

…n-interactive mode

When --yes is omitted in non-interactive mode, the existing guard
already blocks deletion — but returns nil (exit code 0). This makes it
impossible for CI/CD scripts to detect that the deletion did not occur.

Fix: return fmt.Errorf so the process exits with a non-zero exit code,
consistent with how other CLI errors are reported.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Warning

Rate limit exceeded

@eliajhmauve has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 24 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 7 minutes and 24 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 03bb25aa-06a9-4977-88a5-6c9b314542bb

📥 Commits

Reviewing files that changed from the base of the PR and between 76b8768 and 441f654.

📒 Files selected for processing (1)
  • internal/cmd/service/delete/delete.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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.

2 participants