[PR #4298] [MERGED] fix: cascade Noodle cleanup on character delete (#4295) #6325

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4298
Author: @Gunterlie
Created: 7/30/2026
Status: ✅ Merged
Merged: 7/30/2026
Merged by: @Gunterlie

Base: staging ← Head: fix/character-delete-noodle-cascade-4295


📝 Commits (3)

  • e5dc7a2 fix: cascade Noodle account cleanup when a character is deleted
  • b31ced2 fix: also delete a removed character's interactions on other posts
  • 4ea00ee fix: delete descendant replies of a removed character's interactions

📊 Changes

2 files changed (+68 additions, -0 deletions)

View changed files

📝 packages/server/src/routes/characters.routes.ts (+8 -0)
📝 packages/server/src/services/storage/noodle.storage.ts (+60 -0)

📄 Description

Closes #4295

Why

Deleting a character removed its row from characters.json but left its noodle_accounts row (and posts/interactions/subscriptions) behind, so deleted characters kept posting as ghosts in the Noodle timeline. Cleanup previously required a blunt full Noodle reset.

What

  • noodle.storage.ts: new deleteAccountByEntity(kind, entityId) — deletes the account row (dependent posts/interactions/subscriptions/unlocks go via the existing file-store CASCADES) and clears activity digests, which have no cascade. Mirrors deleteNoodlerAccount.
  • characters.routes.ts: DELETE /api/characters/:id calls it for ("character", id). Failure is logged, not fatal — the character delete still succeeds.

Only cleans up new deletions; pre-existing orphans on an instance are not swept.

Test plan

  • Invite a character to Noodle, refresh the timeline so it has posts, then delete the character — its account and posts disappear from Noodle
  • Manually verify deleting a character that was never on Noodle still returns 204
  • Manually verify unrelated Noodle accounts/posts are untouched

Summary by CodeRabbit

  • Bug Fixes
    • Deleting a character now also removes the associated Noodle account and its related activity records.
    • Cleanup is more resilient: if cleanup encounters an issue, the character deletion still completes and the problem is recorded.
    • Improved cascade cleanup now clears dependent digests and interactions (including descendants) to prevent leftover references.

🔄 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/4298 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 7/30/2026 **Status:** ✅ Merged **Merged:** 7/30/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `fix/character-delete-noodle-cascade-4295` --- ### 📝 Commits (3) - [`e5dc7a2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e5dc7a225ad62cb6e917443506cf2600849cbb5f) fix: cascade Noodle account cleanup when a character is deleted - [`b31ced2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b31ced257e9c8b49039a6f29c6122196cb6dbac9) fix: also delete a removed character's interactions on other posts - [`4ea00ee`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4ea00ee331892d924afa05fcb26a43fa0f57a526) fix: delete descendant replies of a removed character's interactions ### 📊 Changes **2 files changed** (+68 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/characters.routes.ts` (+8 -0) 📝 `packages/server/src/services/storage/noodle.storage.ts` (+60 -0) </details> ### 📄 Description Closes #4295 ## Why Deleting a character removed its row from `characters.json` but left its `noodle_accounts` row (and posts/interactions/subscriptions) behind, so deleted characters kept posting as ghosts in the Noodle timeline. Cleanup previously required a blunt full Noodle reset. ## What - `noodle.storage.ts`: new `deleteAccountByEntity(kind, entityId)` — deletes the account row (dependent posts/interactions/subscriptions/unlocks go via the existing file-store `CASCADES`) and clears activity digests, which have no cascade. Mirrors `deleteNoodlerAccount`. - `characters.routes.ts`: `DELETE /api/characters/:id` calls it for `("character", id)`. Failure is logged, not fatal — the character delete still succeeds. Only cleans up new deletions; pre-existing orphans on an instance are not swept. ## Test plan - [ ] Invite a character to Noodle, refresh the timeline so it has posts, then delete the character — its account and posts disappear from Noodle - [ ] Manually verify deleting a character that was never on Noodle still returns 204 - [ ] Manually verify unrelated Noodle accounts/posts are untouched <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Deleting a character now also removes the associated Noodle account and its related activity records. * Cleanup is more resilient: if cleanup encounters an issue, the character deletion still completes and the problem is recorded. * Improved cascade cleanup now clears dependent digests and interactions (including descendants) to prevent leftover references. <!-- 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:09:20 +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#6325
No description provided.