[PR #4354] [MERGED] fix: reconcile orphaned Noodle character accounts on open #6345

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

📋 Pull Request Information

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

Base: staging ← Head: noodle-ghost-cleanup-pd


📝 Commits (2)

  • 98a8b49 fix: reconcile orphaned Noodle character accounts on open
  • 588b900 fix: don't abort Noodle bootstrap on ghost-account cleanup failure

📊 Changes

1 file changed (+11 additions, -1 deletions)

View changed files

📝 packages/server/src/services/noodle/noodle-public-support.ts (+11 -1)

📄 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

No existing issue found for this — should be opened before merge to gather opinions per CONTRIBUTING.md.

Closes #

Why this change

Deleting a character is supposed to delete its Noodle account too (characters.routes.ts delete handler), but that cleanup is best-effort: if it throws, the error is only logged and the account is left behind. Those orphaned "ghost" accounts keep showing up in the Noodle feed/profile list with no character behind them, and there was no reconciliation path to clear them — a user affected by one had no self-serve way to remove it.

What changed

  • noodle-public-support.ts's bootstrapVisibleNoodle (runs on every GET /noodle/, i.e. every time Noodle is opened) already loops character-backed accounts against live characters and used to just continue past any account whose character no longer exists.
  • Changed that branch to call the existing deleteAccountByEntity("character", entityId) teardown instead, so ghost accounts (and their posts/interactions/subscriptions/digests, via that function's existing cascade) are cleared the next time Noodle is opened.
  • Wrapped the cleanup call in try/catch: a failure reconciling one ghost account now logs via logger.error and moves on, instead of throwing and aborting bootstrap for every other account. Failed cleanups are simply retried on the next open.

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: delete a character with an existing Noodle presence, simulate/force the account-cleanup step to fail (or manually leave a stray noodle_accounts row pointing at a deleted character id), then reopen Noodle and confirm the ghost account and its posts disappear.
  • Manually verify: force deleteAccountByEntity to throw for one ghost account (e.g. via a temporary DB error) and confirm other accounts still load and the error is logged instead of the whole Noodle bootstrap failing.
  • Manually verify: normal character delete + Noodle open still works with no ghost accounts present (no-op path).

Docs and release impact

  • No docs changes needed

UI evidence (if applicable)

N/A — behavior-only fix, no UI surface changed.

Summary by CodeRabbit

  • Bug Fixes
    • Automatically removes obsolete Noodle accounts when their associated character records no longer exist.
    • Continues processing remaining accounts if an account cleanup fails.

🔄 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/4354 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 7/31/2026 **Status:** ✅ Merged **Merged:** 7/31/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `noodle-ghost-cleanup-pd` --- ### 📝 Commits (2) - [`98a8b49`](https://github.com/Pasta-Devs/Marinara-Engine/commit/98a8b49275201006886cba4d1102f0028531b3dc) fix: reconcile orphaned Noodle character accounts on open - [`588b900`](https://github.com/Pasta-Devs/Marinara-Engine/commit/588b900e884407fe9b918e118653748a60950bc7) fix: don't abort Noodle bootstrap on ghost-account cleanup failure ### 📊 Changes **1 file changed** (+11 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/noodle/noodle-public-support.ts` (+11 -1) </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 No existing issue found for this — should be opened before merge to gather opinions per CONTRIBUTING.md. Closes # ## Why this change Deleting a character is supposed to delete its Noodle account too (`characters.routes.ts` delete handler), but that cleanup is best-effort: if it throws, the error is only logged and the account is left behind. Those orphaned "ghost" accounts keep showing up in the Noodle feed/profile list with no character behind them, and there was no reconciliation path to clear them — a user affected by one had no self-serve way to remove it. ## What changed - `noodle-public-support.ts`'s `bootstrapVisibleNoodle` (runs on every `GET /noodle/`, i.e. every time Noodle is opened) already loops character-backed accounts against live characters and used to just `continue` past any account whose character no longer exists. - Changed that branch to call the existing `deleteAccountByEntity("character", entityId)` teardown instead, so ghost accounts (and their posts/interactions/subscriptions/digests, via that function's existing cascade) are cleared the next time Noodle is opened. - Wrapped the cleanup call in try/catch: a failure reconciling one ghost account now logs via `logger.error` and moves on, instead of throwing and aborting bootstrap for every other account. Failed cleanups are simply retried on the next open. ## 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 <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - Manually verify: delete a character with an existing Noodle presence, simulate/force the account-cleanup step to fail (or manually leave a stray `noodle_accounts` row pointing at a deleted character id), then reopen Noodle and confirm the ghost account and its posts disappear. - Manually verify: force `deleteAccountByEntity` to throw for one ghost account (e.g. via a temporary DB error) and confirm other accounts still load and the error is logged instead of the whole Noodle bootstrap failing. - Manually verify: normal character delete + Noodle open still works with no ghost accounts present (no-op path). ## Docs and release impact - [x] No docs changes needed ## UI evidence (if applicable) N/A — behavior-only fix, no UI surface changed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Automatically removes obsolete Noodle accounts when their associated character records no longer exist. * Continues processing remaining accounts if an account cleanup fails. <!-- 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:32 +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#6345
No description provided.