[PR #7977] [MERGED] fix(presets): keep library folder counts and references accurate #8035

Closed
opened 2026-10-24 04:09:50 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7977
Author: @minikkeuen
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @SpicyMarinara

Base: staging ← Head: pr/preset-folders-staging


📝 Commits (1)

  • d14e97a fix(presets): keep library folder counts and references accurate

📊 Changes

6 files changed (+151 additions, -6 deletions)

View changed files

📝 packages/client/src/components/panels/PresetsPanel.tsx (+4 -4)
📝 packages/client/src/hooks/use-presets.ts (+2 -0)
📝 packages/server/src/app.ts (+9 -0)
📝 packages/server/src/services/storage/library-folders.storage.ts (+24 -1)
📝 packages/server/src/services/storage/prompts.storage.ts (+5 -1)
➕ scripts/regressions/preset-library-folder-references.regression.ts (+107 -0)

📄 Description

Port local commit 8446413642cc0ee1264b8e367521ab93cdd49355 onto official v2.5.1. Exclude personal release notes and retain the release startup cleanup retry policy.

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 #7976

Related: #7431, #7435

Why this change

  • Deleting a preset can leave stale preset IDs in library folder references.
  • Folder counts may continue including presets that no longer exist.
  • Unlike lorebook folders, preset folders do not consistently clean up orphaned references after deletion or startup.

What changed

  • Remove deleted preset references from library folders.
  • Clean up references to missing presets during startup.
  • Keep folder item counts consistent with existing presets.
  • Refresh preset folder state after deletion so the UI reflects the updated counts.
  • Add a regression test covering preset folder reference cleanup and count consistency.

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

Additional automated validation:

  • Relevant preset folder regression test passed.
  • Additional TypeScript checks passed.
  • Changes were applied to the latest upstream/staging without manual conflict resolution.

Manual verification notes

  • Browser-based manual verification has not been performed.
  • Automated regression tests cover preset deletion, orphaned folder references, and folder count consistency.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) 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)

No screenshots or recordings are currently available. Browser-based UI verification has not been performed.


🔄 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/7977 **Author:** [@minikkeuen](https://github.com/minikkeuen) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `pr/preset-folders-staging` --- ### 📝 Commits (1) - [`d14e97a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d14e97af85f56284eb379f61eaa0f8b451e7203b) fix(presets): keep library folder counts and references accurate ### 📊 Changes **6 files changed** (+151 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/panels/PresetsPanel.tsx` (+4 -4) 📝 `packages/client/src/hooks/use-presets.ts` (+2 -0) 📝 `packages/server/src/app.ts` (+9 -0) 📝 `packages/server/src/services/storage/library-folders.storage.ts` (+24 -1) 📝 `packages/server/src/services/storage/prompts.storage.ts` (+5 -1) ➕ `scripts/regressions/preset-library-folder-references.regression.ts` (+107 -0) </details> ### 📄 Description Port local commit 8446413642cc0ee1264b8e367521ab93cdd49355 onto official v2.5.1. Exclude personal release notes and retain the release startup cleanup retry policy. > [!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`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7976 Related: #7431, #7435 ## Why this change - Deleting a preset can leave stale preset IDs in library folder references. - Folder counts may continue including presets that no longer exist. - Unlike lorebook folders, preset folders do not consistently clean up orphaned references after deletion or startup. ## What changed - Remove deleted preset references from library folders. - Clean up references to missing presets during startup. - Keep folder item counts consistent with existing presets. - Refresh preset folder state after deletion so the UI reflects the updated counts. - Add a regression test covering preset folder reference cleanup and count consistency. ## Validation - [x] `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) - [x] Read and followed `CONTRIBUTING.md` Additional automated validation: - Relevant preset folder regression test passed. - Additional TypeScript checks passed. - Changes were applied to the latest `upstream/staging` without manual conflict resolution. ### Manual verification notes - Browser-based manual verification has not been performed. - Automated regression tests cover preset deletion, orphaned folder references, and folder count consistency. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) 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) No screenshots or recordings are currently available. Browser-based UI verification has not been performed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:09:50 +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#8035
No description provided.