[PR #6085] [MERGED] fix(backup): leave the storage writer lease out of full backups #7055

Closed
opened 2026-10-23 04:16:07 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6085
Author: @SonaGat3
Created: 9/12/2026
Status: ✅ Merged
Merged: 9/12/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/6083-backup-writer-lease


📝 Commits (1)

  • 5c1a8b7 fix(backup): leave the storage writer lease out of full backups

📊 Changes

3 files changed (+30 additions, -1 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 packages/server/src/routes/backup.routes.ts (+8 -1)
📝 scripts/regressions/automatic-backup-retention.regression.ts (+20 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #6083

Why this change

  • Download Backup and the automatic backup archive storage/.writer-lease/owner.json, the per-process writer lease record. It is runtime state, not user data.
  • Restoring the archive by hand (the manual path RESTORE.txt describes) carries the stale lease into the new data folder. On another machine the lease reclaim logic has no same-host proof, so startup stops with "Another Marinara Engine process (PID …, host …) may be using …" until the user deletes the directory.
  • The inclusion was never a decision: storage has been a backup directory since 1.4.0 and the lease was added under it in August (#5389) without the backup being revisited. Nothing reads the lease from an archive, and the launcher's update snapshot already leaves the directory out for the same reason (#6056).

What changed

  • collectDirectoryZipSources skips the top-level .writer-lease directory of each backup source directory (only storage has one). One line plus a one-line comment; nothing else about the walk changes.
  • New test seam collectBackupDirectorySourcesForRegression and a case in automatic-backup-retention.regression.ts proving the top-level lease is left out while a same-named directory deeper in the tree is still collected.
  • CHANGELOG entry under [Unreleased].

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • pnpm check: passed (exit code 0).
  • node scripts/run-regressions.mjs --filter automatic-backup-retention: passed, including the new case.
  • Isolated server built from this branch (DATA_DIR, TEMP, MARINARA_ENV_FILE pointing to a scratch folder, port 9123): with storage/.writer-lease/owner.json present on disk, POST /api/backup/download/start → /status → /file produced a backup with 192 entries and no writer-lease entry. Before this change the same flow on 2.4.5 included <root>/storage/.writer-lease/owner.json (verified on a real Download Backup while writing the issue).
  • Import Profile is unaffected: it merges tables from the profile manifest and never copies raw storage/ files, so the lease entry was only reaching manual restores.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Not applicable: no UI change.

Summary by CodeRabbit

  • Bug Fixes
    • Downloaded and automatic backups no longer include the storage writer lease.
    • Manually restored data folders now start without the “Another Marinara Engine process may be using” error.
    • Table-level lease and settings files remain included in backups.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/6085 **Author:** [@SonaGat3](https://github.com/SonaGat3) **Created:** 9/12/2026 **Status:** ✅ Merged **Merged:** 9/12/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/6083-backup-writer-lease` --- ### 📝 Commits (1) - [`5c1a8b7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5c1a8b7d3b48dbf9d61dd47beb94e630e337a877) fix(backup): leave the storage writer lease out of full backups ### 📊 Changes **3 files changed** (+30 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `packages/server/src/routes/backup.routes.ts` (+8 -1) 📝 `scripts/regressions/automatic-backup-retention.regression.ts` (+20 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #6083 ## Why this change - Download Backup and the automatic backup archive `storage/.writer-lease/owner.json`, the per-process writer lease record. It is runtime state, not user data. - Restoring the archive by hand (the manual path `RESTORE.txt` describes) carries the stale lease into the new data folder. On another machine the lease reclaim logic has no same-host proof, so startup stops with "Another Marinara Engine process (PID …, host …) may be using …" until the user deletes the directory. - The inclusion was never a decision: `storage` has been a backup directory since 1.4.0 and the lease was added under it in August (#5389) without the backup being revisited. Nothing reads the lease from an archive, and the launcher's update snapshot already leaves the directory out for the same reason (#6056). ## What changed - `collectDirectoryZipSources` skips the top-level `.writer-lease` directory of each backup source directory (only `storage` has one). One line plus a one-line comment; nothing else about the walk changes. - New test seam `collectBackupDirectorySourcesForRegression` and a case in `automatic-backup-retention.regression.ts` proving the top-level lease is left out while a same-named directory deeper in the tree is still collected. - CHANGELOG entry under `[Unreleased]`. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - `pnpm check`: passed (exit code 0). - `node scripts/run-regressions.mjs --filter automatic-backup-retention`: passed, including the new case. - Isolated server built from this branch (`DATA_DIR`, `TEMP`, `MARINARA_ENV_FILE` pointing to a scratch folder, port 9123): with `storage/.writer-lease/owner.json` present on disk, `POST /api/backup/download/start` → `/status` → `/file` produced a backup with 192 entries and no `writer-lease` entry. Before this change the same flow on 2.4.5 included `<root>/storage/.writer-lease/owner.json` (verified on a real Download Backup while writing the issue). - Import Profile is unaffected: it merges tables from the profile manifest and never copies raw `storage/` files, so the lease entry was only reaching manual restores. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Not applicable: no UI change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Downloaded and automatic backups no longer include the storage writer lease. - Manually restored data folders now start without the “Another Marinara Engine process may be using” error. - Table-level lease and settings files remain included in backups. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:16:07 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7055
No description provided.