[PR #5195] [MERGED] Fix stale macOS storage writer leases #6669

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5195
Author: @SpicyMarinara
Created: 8/17/2026
Status: ✅ Merged
Merged: 8/17/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/5194-stable-macos-writer-lease


📝 Commits (2)

  • 15a1c51 fix: stabilize storage writer lease identity
  • 1051762 test: keep live legacy leases protected

📊 Changes

3 files changed (+128 additions, -8 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/db/file-backed-store.ts (+72 -7)
📝 scripts/regressions/storage-writer-lock.regression.ts (+55 -1)

📄 Description

Linked issue

Closes #5194

Why this change

  • A stale macOS storage lease could survive its owner process and permanently block startup after VPN, privacy, or virtual interfaces changed the network-adapter list used by the v1 host fingerprint.

What changed

  • Write v2 leases using a stable, hashed platform machine identity on macOS, Windows, and machine-id platforms.
  • Reclaim dead legacy v1 macOS leases by hostname only for that compatibility path; v2 leases still require the stable identity.
  • Extend the storage writer-lock regression with legacy recovery and foreign-v2 negative controls.
  • Document the user-facing fix in the changelog.

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

  • Ran pnpm build:shared && node ./scripts/run-regressions.mjs --filter scripts/regressions/storage-writer-lock.regression.ts; the targeted regression passed.
  • Started pnpm dev:server against the reported stale v1 lease. The server reclaimed PID 75050's lease, rewrote it as v2, and returned status: ok from /api/health.
  • A separate automatic-backup attempt reported ENOSPC because the host disk was nearly full; no user data was removed.

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] <paths> 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; this is a server bootstrap/storage-lock fix.

Summary by CodeRabbit

  • Bug Fixes

    • Improved file-storage writer lease stability on macOS when network interfaces change.
    • Added safer recovery of abandoned leases from exited processes.
    • Preserved compatibility with existing legacy leases while preventing reclaim of active or unrelated leases.
  • Documentation

    • Added a changelog entry describing the storage lease improvements.

🔄 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/5195 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 8/17/2026 **Status:** ✅ Merged **Merged:** 8/17/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/5194-stable-macos-writer-lease` --- ### 📝 Commits (2) - [`15a1c51`](https://github.com/Pasta-Devs/Marinara-Engine/commit/15a1c518af688fc54a190e5cf3fe705e58ecf2b7) fix: stabilize storage writer lease identity - [`1051762`](https://github.com/Pasta-Devs/Marinara-Engine/commit/10517621c57702b0bdf3d9d4f70fed848abcc975) test: keep live legacy leases protected ### 📊 Changes **3 files changed** (+128 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/db/file-backed-store.ts` (+72 -7) 📝 `scripts/regressions/storage-writer-lock.regression.ts` (+55 -1) </details> ### 📄 Description ## Linked issue Closes #5194 ## Why this change - A stale macOS storage lease could survive its owner process and permanently block startup after VPN, privacy, or virtual interfaces changed the network-adapter list used by the v1 host fingerprint. ## What changed - Write v2 leases using a stable, hashed platform machine identity on macOS, Windows, and machine-id platforms. - Reclaim dead legacy v1 macOS leases by hostname only for that compatibility path; v2 leases still require the stable identity. - Extend the storage writer-lock regression with legacy recovery and foreign-v2 negative controls. - Document the user-facing fix in the changelog. ## 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 - Ran `pnpm build:shared && node ./scripts/run-regressions.mjs --filter scripts/regressions/storage-writer-lock.regression.ts`; the targeted regression passed. - Started `pnpm dev:server` against the reported stale v1 lease. The server reclaimed PID 75050's lease, rewrote it as v2, and returned `status: ok` from `/api/health`. - A separate automatic-backup attempt reported `ENOSPC` because the host disk was nearly full; no user data was removed. ## 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] <paths>` 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; this is a server bootstrap/storage-lock fix. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved file-storage writer lease stability on macOS when network interfaces change. - Added safer recovery of abandoned leases from exited processes. - Preserved compatibility with existing legacy leases while preventing reclaim of active or unrelated leases. - **Documentation** - Added a changelog entry describing the storage lease improvements. <!-- 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:12:35 +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#6669
No description provided.