fix(backups): allow on-demand creds for not-scheduled types#283
Merged
Conversation
The /backup-credentials issuance gate rejected any backup type whose server_backup_capabilities row wasn't enabled. But 'enabled' only means 'on the auto-schedule': the UI offers 'Backup now' for declared-but-disabled types (the 'not scheduled' chip explicitly says on-demand still works), and the heartbeat surfaces those one-off requests to the device regardless of enabled. The device then hit a 409 when fetching creds. Gate now mirrors what the heartbeat is willing to ask for: issue when the type is enabled, or when a request of the matching purpose is pending. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 The
/backup-credentialsissuance gate rejected any backup type whoseserver_backup_capabilitiesrow wasn'tenabled. Butenabledonly means "on the auto-schedule": the admin UI offers Backup now for declared-but-disabled types (the "not scheduled" chip explicitly says on-demand still works), and the heartbeat (backups_due_now_for_server) surfaces those one-off requests to the device regardless ofenabled. The device then hit a 409 when fetching credentials, so a manually-requested backup of a not-scheduled type could never run.Fix
The issuance gate now mirrors exactly what the heartbeat is willing to ask the device to run: issue credentials when the type is
enabled, or when a request of the matchingpurposeis pending.BackupRequest::exists(server, type, purpose)— new DB helper.require_enabled_capability→require_issuable_capability, now takespurposeand checksenabled || pending request.This doesn't loosen scheduled backups — the scheduler still gates on
enabled, and an enabled type still works for any purpose.Tag: TAM-6877