Skip to content

fix: require --yes for money operations in non-interactive mode#216

Open
eliajhmauve wants to merge 1 commit intozeabur:mainfrom
eliajhmauve:fix/money-ops-ni-mode-confirmation
Open

fix: require --yes for money operations in non-interactive mode#216
eliajhmauve wants to merge 1 commit intozeabur:mainfrom
eliajhmauve:fix/money-ops-ni-mode-confirmation

Conversation

@eliajhmauve
Copy link
Copy Markdown
Contributor

@eliajhmauve eliajhmauve commented Apr 4, 2026

Summary

server rent and domain purchase skip confirmation entirely in non-interactive mode when --yes is not provided, allowing money operations to proceed silently. This can cause unintended charges in CI/CD pipelines.

Bug

Both commands use if f.Interactive && !opts.skipConfirm to guard the confirmation prompt. In non-interactive mode this condition is false, so the code falls through to the API call without any confirmation or error.

server/rent/rent.go:

if f.Interactive && !opts.skipConfirm {
    confirm, err := f.Prompter.Confirm(...)
    // ...
}
// NI mode: falls through directly to RentServer()

domain/purchase/purchase.go:

if f.Interactive && !opts.skipConfirm {
    confirm, err := f.Prompter.Confirm(...)
    // ...
}
// NI mode: falls through directly to PurchaseDomain()

Fix

Add an else if guard that returns an error when --yes is not provided in non-interactive mode:

} else if !f.Interactive && !opts.skipConfirm {
    return fmt.Errorf("... requires --yes flag in non-interactive mode")
}

This is consistent with how project delete already handles the same scenario.

Affected Commands

  • zeabur server rent — rents a server (charges money)
  • zeabur domain purchase — purchases a domain (charges money)

Summary by CodeRabbit

  • Bug Fixes
    • Domain purchases in non-interactive mode now require the --yes flag for confirmation
    • Server rentals in non-interactive mode now require the --yes flag for confirmation

Server rent and domain purchase proceed without confirmation in
non-interactive mode when --yes is not provided. This can cause
unintended charges in CI/CD pipelines. Add an else-if guard to
return an error requiring the --yes flag, consistent with how
project delete already handles this.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5ae9ff62-e232-4f50-9bc9-19851b8b4038

📥 Commits

Reviewing files that changed from the base of the PR and between 4750f37 and 9f275ec.

📒 Files selected for processing (2)
  • internal/cmd/domain/purchase/purchase.go
  • internal/cmd/server/rent/rent.go

Walkthrough

Both the domain purchase and server rent CLI commands now enforce the --yes flag requirement when running in non-interactive mode. Previously, non-interactive execution without explicit confirmation would proceed to the API call; the commands now return validation errors instead.

Changes

Cohort / File(s) Summary
Non-interactive mode validation
internal/cmd/domain/purchase/purchase.go, internal/cmd/server/rent/rent.go
Added error checks that reject non-interactive execution without the --yes flag, returning descriptive error messages requiring explicit confirmation for domain purchase and server rent operations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a requirement for the --yes flag in non-interactive mode for money operations (server rent and domain purchase).

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

✨ 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