[PR #7091] [MERGED] fix(backup): coordinate profile restore with the active Long-Term Memory vault (#7043) #7470

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7091
Author: @Promansis
Created: 10/5/2026
Status: ✅ Merged
Merged: 10/5/2026
Merged by: @Promansis

Base: staging ← Head: fix/profile-restore-vault-lock-7043


📝 Commits (1)

  • 0e8aaac fix(backup): coordinate profile restore with the active Long-Term Memory vault (#7043)

📊 Changes

2 files changed (+34 additions, -6 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 packages/server/src/routes/backup.routes.ts (+32 -6)

📄 Description

Linked issue

Closes #7043

Why this change

Restoring a settings profile that contains a Long-Term Memory vault while the Long-Term Memory package is active could publish memory files the package's own lock and caches never observed: the package could keep serving the pre-restore copy, and a restore could interleave with a memory read or index rebuild. When the installed package is too old to expose the coordination hook, the restore must be refused rather than publish memory the package cannot see.

What changed

  • packages/server/src/routes/backup.routes.ts: when a profile contains long-term-memory/ assets, resolve the active long-term-memory:runtime capability. An active package without withVaultMutation is refused with a clear update/disable message; a compatible active package runs database replacement, asset promotion, rollback and staging cleanup inside withVaultMutation (the package's reentrant vault lock plus cache reset). An inactive package keeps the existing disk-only restore. The compatibility decision is made from the profile's declared asset inputs before staging, so a refused restore never stages vault bytes.
  • CHANGELOG.md: user-facing 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

  • Manually verify in the browser/app: with the Long-Term Memory package active and current, importing a profile that contains long-term memory restores memory and the next recall serves the restored copy (no stale pre-restore memory).
  • Manually verify: with an active package too old to expose the coordination hook, the import is refused with the update/disable message and no .profile-import-* staging directory remains under the data directory.
  • Manually verify: with the Long-Term Memory package inactive or disabled, importing a profile that contains long-term memory still restores the directory to disk.

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: server-side restore behavior only.

Summary by CodeRabbit

  • Bug Fixes
    • Restoring a profile that includes Long-Term Memory now waits for ongoing reads or rebuilds to finish before reloading the restored memory.
    • If the installed package cannot safely coordinate the restore, the import is refused with guidance to update or disable the package.
    • Profile imports without Long-Term Memory assets continue to work without this coordination.

🔄 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/7091 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/5/2026 **Status:** ✅ Merged **Merged:** 10/5/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `fix/profile-restore-vault-lock-7043` --- ### 📝 Commits (1) - [`0e8aaac`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0e8aaacf5893da885402fb8b05a4aabb7110cced) fix(backup): coordinate profile restore with the active Long-Term Memory vault (#7043) ### 📊 Changes **2 files changed** (+34 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `packages/server/src/routes/backup.routes.ts` (+32 -6) </details> ### 📄 Description ## Linked issue Closes #7043 ## Why this change Restoring a settings profile that contains a Long-Term Memory vault while the Long-Term Memory package is active could publish memory files the package's own lock and caches never observed: the package could keep serving the pre-restore copy, and a restore could interleave with a memory read or index rebuild. When the installed package is too old to expose the coordination hook, the restore must be refused rather than publish memory the package cannot see. ## What changed - `packages/server/src/routes/backup.routes.ts`: when a profile contains `long-term-memory/` assets, resolve the active `long-term-memory:runtime` capability. An active package without `withVaultMutation` is refused with a clear update/disable message; a compatible active package runs database replacement, asset promotion, rollback and staging cleanup inside `withVaultMutation` (the package's reentrant vault lock plus cache reset). An inactive package keeps the existing disk-only restore. The compatibility decision is made from the profile's declared asset inputs before staging, so a refused restore never stages vault bytes. - `CHANGELOG.md`: user-facing 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 - Manually verify in the browser/app: with the Long-Term Memory package active and current, importing a profile that contains long-term memory restores memory and the next recall serves the restored copy (no stale pre-restore memory). - Manually verify: with an active package too old to expose the coordination hook, the import is refused with the update/disable message and no `.profile-import-*` staging directory remains under the data directory. - Manually verify: with the Long-Term Memory package inactive or disabled, importing a profile that contains long-term memory still restores the directory to disk. ## 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: server-side restore behavior only. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Restoring a profile that includes Long-Term Memory now waits for ongoing reads or rebuilds to finish before reloading the restored memory. * If the installed package cannot safely coordinate the restore, the import is refused with guidance to update or disable the package. * Profile imports without Long-Term Memory assets continue to work without this coordination. <!-- 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:20: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#7470
No description provided.