[PR #5569] [MERGED] Preserve the Universal Preset during Permanent Delete #6827

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5569
Author: @Gunterlie
Created: 8/27/2026
Status: ✅ Merged
Merged: 8/27/2026
Merged by: @Gunterlie

Base: staging ← Head: universal-stays-put


📝 Commits (2)

  • 668bd14 fix: preserve universal preset during expunge
  • b0bcd13 fix: preserve a valid preset default after expunge

📊 Changes

3 files changed (+212 additions, -5 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 packages/server/src/routes/admin.routes.ts (+42 -5)
➕ scripts/regressions/admin-preset-expunge.regression.ts (+168 -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 #5568

Why this change

Permanent Delete currently removes Marinara's immutable Universal Preset, leaving affected users without the stock prompt structure until startup seeding repairs it. The destructive action should remove only editable presets and their organization data.

What changed

  • Resolve the stock Universal Preset through its reserved systemKey before preset expunge.
  • Preserve that preset and its groups, sections, and choice blocks in both scoped expunge and the Clear All compatibility route.
  • Continue deleting editable presets, their child rows, and preset folders.
  • Add a regression covering both routes, stock-name/author lookalikes, editable defaults, child rows, and folders.
  • Add an [Unreleased] changelog entry.

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 locally.
  • pnpm regression passed: 159/159.
  • Targeted admin-preset-expunge regression passed after the final negative-control update.
  • Local CodeRabbit CLI review completed with zero findings across all three changed files.
  • An isolated production server reached ready state, but browser click-through could not run on this host because Chromium requires the unavailable libnspr4.so shared library and no system browser is installed.

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)

The user-visible fix is documented in CHANGELOG.md. No version, schema, public API, client, localization, or user-facing documentation changes are required.

UI evidence (if applicable)

No UI code changed. Browser evidence is unavailable due to the host dependency limitation described above.

Proof

The regression builds the real Fastify app, creates the seeded stock preset plus an editable preset and owned child rows, invokes both deletion endpoints, and verifies that the stock row and its original children remain byte-for-byte unchanged while editable data and preset folders are removed. A user preset imitating the stock name and author is also deleted, proving that only the reserved marinara-universal-preset system key grants protection.

Summary by CodeRabbit

  • Bug Fixes

    • Permanent Delete now preserves the stock Universal Preset and its associated prompt structure.
    • Editable presets, folders, groups, sections, and choices continue to be removed as expected.
    • Scoped deletion and clear-all deletion now behave consistently.
  • Documentation

    • Added an Unreleased changelog entry describing preset deletion behavior.

🔄 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/5569 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 8/27/2026 **Status:** ✅ Merged **Merged:** 8/27/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `universal-stays-put` --- ### 📝 Commits (2) - [`668bd14`](https://github.com/Pasta-Devs/Marinara-Engine/commit/668bd14fb6804f8eda860ff650582e210c61c16f) fix: preserve universal preset during expunge - [`b0bcd13`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b0bcd139da8edf3d79e3ec34e3cb4cd81f113ff1) fix: preserve a valid preset default after expunge ### 📊 Changes **3 files changed** (+212 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `packages/server/src/routes/admin.routes.ts` (+42 -5) ➕ `scripts/regressions/admin-preset-expunge.regression.ts` (+168 -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`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #5568 ## Why this change Permanent Delete currently removes Marinara's immutable Universal Preset, leaving affected users without the stock prompt structure until startup seeding repairs it. The destructive action should remove only editable presets and their organization data. ## What changed - Resolve the stock Universal Preset through its reserved `systemKey` before preset expunge. - Preserve that preset and its groups, sections, and choice blocks in both scoped expunge and the Clear All compatibility route. - Continue deleting editable presets, their child rows, and preset folders. - Add a regression covering both routes, stock-name/author lookalikes, editable defaults, child rows, and folders. - Add an `[Unreleased]` changelog entry. ## 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 locally. - `pnpm regression` passed: 159/159. - Targeted `admin-preset-expunge` regression passed after the final negative-control update. - Local CodeRabbit CLI review completed with zero findings across all three changed files. - An isolated production server reached ready state, but browser click-through could not run on this host because Chromium requires the unavailable `libnspr4.so` shared library and no system browser is installed. ## 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) The user-visible fix is documented in `CHANGELOG.md`. No version, schema, public API, client, localization, or user-facing documentation changes are required. ## UI evidence (if applicable) No UI code changed. Browser evidence is unavailable due to the host dependency limitation described above. ## Proof The regression builds the real Fastify app, creates the seeded stock preset plus an editable preset and owned child rows, invokes both deletion endpoints, and verifies that the stock row and its original children remain byte-for-byte unchanged while editable data and preset folders are removed. A user preset imitating the stock name and author is also deleted, proving that only the reserved `marinara-universal-preset` system key grants protection. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Permanent Delete now preserves the stock Universal Preset and its associated prompt structure. - Editable presets, folders, groups, sections, and choices continue to be removed as expected. - Scoped deletion and clear-all deletion now behave consistently. - **Documentation** - Added an Unreleased changelog entry describing preset deletion behavior. <!-- 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:14:04 +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#6827
No description provided.