Add maintenance windows and backups tools#22
Open
minuteman3 wants to merge 4 commits intoplanetscale:mainfrom
Open
Add maintenance windows and backups tools#22minuteman3 wants to merge 4 commits intoplanetscale:mainfrom
minuteman3 wants to merge 4 commits intoplanetscale:mainfrom
Conversation
- list_maintenance_windows: Lists maintenance schedules for Vitess databases with human-readable formatting (day, time, frequency, duration) and optional window history showing start/finish times of past runs - list_backups: Lists backup policies (schedule, retention, next run) and optionally fetches recent backup history with size, duration, and state Both tools follow the existing inline-fetch pattern and use PlanetScaleAPIError for error handling. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Export apiRequest from planetscale-api.ts and use it in both tools
instead of duplicated fetchJson helpers
- Export formatBytes from list-cluster-sizes.ts and reuse it in
list-backups.ts instead of a divergent copy
- Fix inconsistent frequency formatting in list-backups ("every 1 hour"
→ "every hour") to match list-maintenance-windows
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Avoids cross-tool imports — both list-cluster-sizes and list-backups now import from lib/format.ts instead of one tool importing from the other. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| id: p.id, | ||
| name: p.display_name, | ||
| target: p.target, | ||
| schedule: `${freq} at ${p.schedule_time} UTC`, |
There was a problem hiding this comment.
Backup schedule formatting drops day-of-week information
Medium Severity
formatPolicy builds the schedule string as `${freq} at ${p.schedule_time} UTC` but never uses schedule_day or schedule_week from the BackupPolicy interface. For weekly or monthly policies, this produces incomplete descriptions like "every week at 03:00 UTC" with no indication of which day. The sibling formatSchedule in list-maintenance-windows.ts correctly includes the day name in its schedule string, suggesting this is an oversight.
Additional Locations (1)
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
Adds two new tools for operational visibility:
list_maintenance_windows— Lists maintenance schedules for Vitess databases with human-readable formatting (e.g., "every week, Tuesday at 09:00 UTC, 4h window") and optionally fetches recent window history with start/finish times. Flags pending Vitess version updates. Returns a clear error when called against Postgres databases.list_backups— Lists backup policies (schedule, retention, next run) and optionally fetches recent backup history for a branch with size, duration, and state. Formats sizes as human-readable (e.g., "360.8 TB") and computes backup duration from start/completion timestamps.Both tools follow the existing inline-fetch pattern with
PlanetScaleAPIErrorfor error handling.API endpoints used
GET /v1/organizations/{org}/databases/{db}/maintenance-schedules(docs)GET /v1/organizations/{org}/databases/{db}/maintenance-schedules/{id}/windows(docs)GET /v1/organizations/{org}/databases/{db}/backup-policies(docs)GET /v1/organizations/{org}/databases/{db}/branches/{branch}/backups(docs)