feat(backup): cron-based backup scheduling with friendly UI picker#466
Merged
feat(backup): cron-based backup scheduling with friendly UI picker#466
Conversation
…uling Replace the confusing `interval_hours` + `backup_time` dual-field approach (where backup_time silently took priority) with a single `schedule` cron expression field using robfig/cron/v3. Backend: - Add robfig/cron/v3 dependency - MetadataBackupConfig: remove IntervalHours/BackupTime, add Schedule (cron expr) - Validate cron expression on config load via cron.ParseStandard - backup_worker: replace manual time.After loop with cron.New runner - Remove GetMetadataBackupInterval accessor (no longer needed) - Default schedule: "0 3 * * *" (daily 3 AM UTC), keep_backups default raised to 10 Frontend: - MetadataBackupConfig type: schedule string replaces interval_hours + backup_time - New schedule picker UI: hourly / daily / weekly / custom (raw cron) modes - parseCronString / buildCronString helpers for round-tripping friendly ↔ cron - "Keep Last N Backups" label with clear helper text replaces "Retention (Count)" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add cronstrue to show a plain-English description of the active cron expression below the schedule picker. Invalid custom expressions display an inline error in red instead of silently failing. Examples: "Runs: Every hour (UTC)", "Runs: At 03:00, only on Monday (UTC)" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…le picker Replace manual regex/string-split parseCronString with CronExpressionParser from cron-parser, which properly handles edge cases like Sunday=7 normalization, ranges, and invalid expressions via try/catch. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move ScheduleType, ScheduleState, DAY_NAMES, parseCronString, and buildCronString from MetadataConfigSection into frontend/src/utils/cronSchedule.ts for reusability and separation of concerns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
drondeseries
referenced
this pull request
in drondeseries/altmount_old
Apr 16, 2026
…466) * feat(backup): replace dual interval/time fields with cron-based scheduling Replace the confusing `interval_hours` + `backup_time` dual-field approach (where backup_time silently took priority) with a single `schedule` cron expression field using robfig/cron/v3. Backend: - Add robfig/cron/v3 dependency - MetadataBackupConfig: remove IntervalHours/BackupTime, add Schedule (cron expr) - Validate cron expression on config load via cron.ParseStandard - backup_worker: replace manual time.After loop with cron.New runner - Remove GetMetadataBackupInterval accessor (no longer needed) - Default schedule: "0 3 * * *" (daily 3 AM UTC), keep_backups default raised to 10 Frontend: - MetadataBackupConfig type: schedule string replaces interval_hours + backup_time - New schedule picker UI: hourly / daily / weekly / custom (raw cron) modes - parseCronString / buildCronString helpers for round-tripping friendly ↔ cron - "Keep Last N Backups" label with clear helper text replaces "Retention (Count)" Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
interval_hours+backup_timedual-field approach (wherebackup_timesilently took priority with no indication) with a singleschedulecron expression field, powered byrobfig/cron/v3keep_backupsdefault from 1 → 10 and improves all backup-related labels and descriptionsChanges
Backend
github.com/robfig/cron/v3dependencyMetadataBackupConfig: removeIntervalHours/BackupTime, addSchedule(standard cron expression, UTC)cron.ParseStandardon loadbackup_worker: replace manualtime.Afterloop withcron.New(WithLocation(UTC))runner — cleaner lifecycle, properStop()viacronRunner.Stop()with graceful drainGetMetadataBackupIntervalaccessor"0 3 * * *"(daily 3 AM UTC)Frontend
MetadataBackupConfigtype:schedule: stringreplacesinterval_hours+backup_timeparseCronString/buildCronStringhelpers for round-tripping picker state ↔ cron stringTest plan
go build ./...go test github.com/javi11/altmount/internal/metadatabun run checkschedule=...on start🤖 Generated with Claude Code