Repository navigation
fix(backups): back up only Lens's own files, so upgrading in a microsandbox works - #403
Merged
Merged
Conversation
…andbox works Back up and install in Settings stopped at the backup with "Permission denied: '/data/.lens/apt/lock'" in a microsandbox, and so did every backup there: since backups keep the files under data_dir, they walked into /data/.lens, the Lens the microsandbox runs (apt, the venv, the web build, some of it root's). Backups now leave out hidden entries at the top of data_dir (.lens, caches) and SurrealDB's own folder (surreal; the export holds the database), and a file Lens can't read is left out with a warning instead of stopping the backup. A backup that stops an upgrade marks "Back up the database" as the failed step, not "Download the new version". Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GMryXNWd5MJ3vsjM7RkV93
…-t3gsjl # Conflicts: # CHANGELOG.md
…-t3gsjl # Conflicts: # CHANGELOG.md
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.
Requested by Adeel · project thread
Description
Before: in a microsandbox, Settings › Updates › Back up and install v0.10.0 failed with
backing up failed: [Errno 13] Permission denied: '/data/.lens/apt/lock', and every manual or scheduled backup failed the same way. The step list showed Back up the database as done and Download the new version as failed.After: backups keep only Lens's own files, so the backup and the upgrade go through. When a backup does stop an upgrade, Back up the database is the step marked failed.
Since #385 a backup keeps every file under
data_dir. In a microsandboxdata_diris the whole/datavolume, which also holds.lens(the Lens the sandbox runs: apt, the venv, node, the web build, partly root's),.cache,.pnpm-storeand SurrealDB's own foldersurreal. The first unreadable file,.lens/apt/lock, failed the whole backup.How:
datafilesnow leaves out hidden entries at the top ofdata_dirandsurreal, both when backing up and when restoring. The export already holds the database, and copying a live surrealkv folder wouldn't give a consistent copy anyway. A file Lens can't read is left out with one warning in the log, and the backup carries on._hand_overrecordsstep: backupwhen backing up fails, and the updates panel marks that step.Motivation and Context
Adeel's install (microsandbox, v0.9.0) couldn't install v0.10.0 from the web app. The traceback in his Lens log:
It would also crash-loop the API in a microsandbox whenever a release brings database upgrade steps, because
migrations._backup_beforetakes the same backup at start.Steps to reproduce (if appropriate):
Microsandbox install on v0.9.0 or later: Settings › Updates › Back up and install, or Settings › Backups › Back up now.
test_a_microsandbox_backs_up_only_lenss_own_filesreproduces it: it fails on main with the samePermissionErrorand passes here.Types of changes
!in the title)Checklist:
make hookschecks it on commit).docs/accordingly.## UnreleasedinCHANGELOG.md.Done questions (AGENTS.md)
POST /api/v1/admin/updates/upgradeandPOST /api/v1/admin/backupswork the same, and the run'sstepsays which step failed.docs/database.mdupdated, OpenAPI and client regenerated withmake openapi.backup: false.🤖 Generated with Claude Code
https://claude.ai/code/session_01GMryXNWd5MJ3vsjM7RkV93
Generated by Claude Code