fix(backups): validate S3 storage before scheduling - #10389
Conversation
Prevent scheduled database backups from enabling S3 uploads without a valid team-owned storage configuration, and preserve the previous S3 storage ID in missing-storage error messages. Add coverage for backup edit/create validation and S3 upload failure messaging.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughThis PR adds S3 storage ownership and availability validation to database backup workflows. It captures the prior ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. 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 `@app/Livewire/Project/Database/CreateScheduledBackup.php`:
- Around line 52-58: In submit(), replace the stale mount-time snapshot check
that uses $this->definedS3s->contains('id', $this->s3StorageId) with a fresh DB
existence query scoped to the current team: when $this->saveToS3 and
$this->s3StorageId is set, perform an existence check (e.g., query the S3
storage model for team_id = currentTeam()->id and id = $this->s3StorageId using
exists()) and if it does not exist dispatch the same error and return; update
the logic around $this->saveToS3, $this->s3StorageId, and submit() accordingly
so runtime ownership/authorization is validated at submit time.
🪄 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: cbeb2378-f9d0-4d52-9405-916c18ad84d1
📒 Files selected for processing (8)
app/Jobs/DatabaseBackupJob.phpapp/Livewire/Project/Database/BackupEdit.phpapp/Livewire/Project/Database/CreateScheduledBackup.phpapp/Models/S3Storage.phpapp/Models/ScheduledDatabaseBackupExecution.phptests/Feature/BackupEditValidationTest.phptests/Feature/CreateScheduledBackupValidationTest.phptests/Feature/DatabaseBackupJobTest.php
Check the selected S3 storage against the database at submit time so stale Livewire state cannot schedule backups with storage that was reassigned or marked unusable after the component mounted.
Summary