feat(cli): require --confirm for bucket delete and document cascade deletion#125
Conversation
…eletion Bucket deletion now cascades (all objects and access keys are removed via the Management API force-delete path), so the command requires --confirm <bucket-id> matching the positional argument exactly before proceeding -- consistent with how database remove protects against accidental destruction. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbit
WalkthroughThe 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@packages/cli/tests/bucket.test.ts`:
- Around line 220-264: The bucket deletion tests only validate the error
payload, not that the bucket remains intact. Extend both rejected-confirmation
cases in the “requires --confirm…” and “rejects --confirm…” tests with a
post-failure existence or listing assertion, or mock the provider to verify
deleteBucket is not called, while preserving the existing payload and exit-code
assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8571cc2b-d252-4e3e-a489-167c9381f248
📒 Files selected for processing (5)
docs/product/command-spec.mddocs/product/resource-model.mdpackages/cli/src/commands/bucket/index.tspackages/cli/src/controllers/bucket.tspackages/cli/tests/bucket.test.ts
…et intact Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Purpose of change
Bucket deletion now cascades (the Management API force-deletes all stored objects and revokes all access keys), so the CLI must guard against accidental data loss with the same
--confirm <id>gate thatdatabase removealready uses.What's changed and why
controllers/bucket.ts:runBucketDeletenow accepts aBucketDeleteFlagsparameter withconfirm?: string. Before calling the provider it checksflags.confirm !== idand throwsCONFIRMATION_REQUIRED(exit 2) withmeta: { expectedConfirm, receivedConfirm }— matching thedatabase removeerror shape exactly.commands/bucket/index.ts:createBucketDeleteCommandwires a--confirm <bucket-id>option and passes it through to the controller.tests/bucket.test.ts: Updated the two existing delete tests to include--confirm; added tests for missing confirm (nullreceivedConfirm) and mismatched confirm.docs/product/command-spec.md:bucket deleteheading now shows--confirm <bucketId>; behavior section replaces the empty-bucket limitation note with cascade semantics and the confirmation requirement.docs/product/resource-model.md: Object Store section updated to describe cascade deletion and the--confirmguard.Testing notes / Before-after
Before:
prisma-cli bucket delete bkt_123succeeded immediately.After: same command exits 2 with
CONFIRMATION_REQUIRED; must pass--confirm bkt_123.Verify manually:
prisma-cli bucket delete bkt_123→ exit 2, errorCONFIRMATION_REQUIREDprisma-cli bucket delete bkt_123 --confirm bkt_456→ exit 2,receivedConfirm: "bkt_456"prisma-cli bucket delete bkt_123 --confirm bkt_123→ exit 0, successNotes for reviewers:
force=trueon the Tigris partner API) is gated on a pdp-control-plane PR landing first. The CLI change is safe to merge independently — it guards deletion regardless of whether the platform side has landed.bucket delete <id>without--confirmwill now exit 2. This is intentional and matchesdatabase removeprecedent.bucket key deletedoes not get a--confirmflag — keys are individually revocable and don't cascade to other resources, so the guard would be disproportionate.