Skip to content

Show backup-listing failures and stop the create button crashing on big databases - #2101

Merged
stefan-burke merged 1 commit into
mainfrom
claude/backups-admin-panel-display-i33i8w
Aug 18, 2026
Merged

Show backup-listing failures and stop the create button crashing on big databases#2101
stefan-burke merged 1 commit into
mainfrom
claude/backups-admin-panel-display-i33i8w

Conversation

@stefan-burke

Copy link
Copy Markdown
Member

Why

Two linked problems on the Backups page:

  1. Backups made by the CI job did not show under "Existing backups". The page swallowed every storage-listing failure and showed "No backups found", so an empty folder, a wrong storage key, and a zone or folder mismatch with the CI upload all looked identical. Worse, a failed Bunny listing (for example a 401 from a bad key) fed Bunny's JSON error object into the file filter and crashed with a meaningless TypeError — which the page then hid.

  2. Clicking "Create backup now" crashed with Subrequest allowance exceeded: 51 database + 0 external calls once the database grew past what one edge request can dump. Bunny allows 50 subrequests per request, and the dump reads each table in 500-row pages, so a big enough database can never finish from the page. The button kept promising something it could not do.

What changed

  • A failed storage listing now throws a clear error naming the folder and HTTP status, and the Backups page shows it as "Could not read the list of backups: …" instead of pretending the list is empty. The encryption key and restore instructions still render.
  • The page now says where it looks: "Backups for this database live in the folder folder of the zone storage zone." Comparing that line with the CI job's log line ("Backup uploaded to storage: …") shows at a glance whether the two sides use the same zone and folder.
  • Before creating a backup, the app now counts every table's rows in one batched read and prices the dump. When it cannot fit the request's remaining allowance, the page replaces the button with a plain explanation pointing at deno task backup (which has no size limit and uploads to the same place), and a direct POST refuses with the same message instead of crashing partway through.

Why the CI backups are probably invisible

The CI job and the page use the same code ({db-name}/backup-{timestamp}.zip in the configured zone), so with identical secrets the backups must appear. They differ only in environment, which leaves these candidates — the new page copy makes it possible to tell them apart:

  • The repository's STORAGE_ZONE_NAME/STORAGE_ZONE_KEY secrets name a different zone than the site's own storage settings.
  • The repository's DB_URL secret points at a different address than the site's DB_URL (for example after a Turso migration), so CI writes into a different per-database folder.
  • The site's storage key is wrong, so the listing fails — previously shown as "No backups found", now shown as the real error.
  • The deployed build predates the per-database backup folders, so it lists the zone root while current CI uploads into {db-name}/.

Tests

  • Bunny listing: a 401 with Bunny's JSON error body now rejects with "Storage listing for the zone root failed: HTTP 401" (was a TypeError); a 500 names its status too.
  • Page: shows the folder line, shows the listing failure instead of "No backups found", and names the zone under Bunny storage.
  • Dump pricing: table-driven cases for the calls-per-page maths, an exact-row-count check over the real schema, and boundary tests proving a backup fits when the allowance exactly equals the need and refuses one call short.
  • Too-big flow: with BACKUP_PAGE_SIZE=1 and one hundred batch-seeded log rows, the page swaps the button for the explanation and a direct POST redirects with the plain error.

deno task precommit passes. deno task precommit:mutation is running; survivors, if any, will be resolved before merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01A5kRwqm349kpsgkcQLeSpw


Generated by Claude Code

…t budget

The Backups page hid every storage-listing failure behind "No backups
found", so an operator could not tell an empty folder from a broken
listing — the state that makes CI-made backups seem to vanish. The page
now says when the listing failed and why, and names the storage folder
(and Bunny zone) it reads, so a mismatch with the folder the CI job
uploads to is visible at a glance. A failed Bunny listing also throws a
clear "HTTP <status>" error instead of feeding the error body into the
file filter.

The "Create backup now" button used to crash mid-dump with a raw
"Subrequest allowance exceeded" error once the database outgrew the
edge's 50-call request budget. The dump's cost is now priced up front
from one batched row count; when it cannot fit, the page replaces the
button with a plain explanation pointing at the out-of-band
`deno task backup`, and a direct POST refuses with the same message
before touching any table.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A5kRwqm349kpsgkcQLeSpw
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 28 minutes

Limit details: You’ve used all 3 included reviews currently available under your plan. You completed 72 included PR reviews in the past 7 days; at that activity level, included reviews refill at 3 reviews per hour.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d82643af-f2ef-4f1d-8dea-de79584f1360

📥 Commits

Reviewing files that changed from the base of the PR and between 8db985c and 4c3a6cd.

📒 Files selected for processing (12)
  • src/features/admin/backup.ts
  • src/locales/en/backup.json
  • src/locales/en/guide-operations.json
  • src/shared/db/backup-snapshot.ts
  • src/shared/db/backup.ts
  • src/shared/storage.ts
  • src/ui/templates/admin/backup.tsx
  • test/features/admin/backup/server.test.ts
  • test/shared/db/backup-snapshot.test.ts
  • test/shared/db/backup.test.ts
  • test/shared/storage/bunny.test.ts
  • test/ui/templates/admin/backup.test.ts

Comment @coderabbitai help to get the list of available commands.

@stefan-burke
stefan-burke added this pull request to the merge queue Aug 18, 2026
Merged via the queue into main with commit 9ccbbb9 Aug 18, 2026
3 checks passed
@stefan-burke
stefan-burke deleted the claude/backups-admin-panel-display-i33i8w branch August 18, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants