feat: add protection lease concept for time-limited clone protection
Summary
Implement a protection lease concept for database clones, replacing infinite deletion protection with time-limited protection.
Requirements
- Variable protection duration: Users can select from preset durations (1h, 12h, 1-7d, 14d, 30d, or "forever" if allowed)
-
Admin-configurable maximum: Admins can set
protectionMaxDurationMinutesto cap the maximum duration users can select - UI dropdown filtering: Options are automatically filtered based on admin's max duration setting
-
CLI support: Add
--protection-durationflag toclone createandclone updatecommands -
API support: Add
protectionDurationMinutesparameter to create/update clone endpoints -
Webhook events: Add
clone_protection_expiringandclone_protection_expiredevents for enterprise notifications - Background monitoring: Protection leases should be checked periodically
Configuration
cloning:
protectionLeaseDurationMinutes: 1440 # Default protection (1 day)
protectionMaxDurationMinutes: 10080 # Max allowed (7 days); 0 = no limit
protectionExpiryWarningMinutes: 1440 # Warning 24h before expiry
Acceptance Criteria
- Users can select protection duration from dropdown (UI)
- Admins can limit max protection duration via config
-
CLI supports
--protection-durationflag -
API accepts
protectionDurationMinutesparameter - Webhook events fire when protection is expiring/expired
- Background job monitors and expires protection leases
- Comprehensive tests cover all paths
Definition of Done
- Protection lease configuration options (
protectionLeaseDurationMinutes,protectionMaxDurationMinutes,protectionExpiryWarningMinutes) implemented and documented - UI dropdown shows preset durations filtered by admin's max duration setting
- CLI
clone createandclone updatecommands support--protection-durationflag - API
protectionDurationMinutesparameter accepted in create/update clone endpoints - Webhook events (
clone_protection_expiring,clone_protection_expired) fire correctly with test coverage - Background job monitors and expires protection leases on schedule
- Comprehensive tests cover: creating with various durations, admin max enforcement, expiry, webhook events, CLI usage
- Documentation updated with protection lease configuration examples and usage guide
Edited by Nikolay Samokhvalov