[GH-ISSUE #4295] Deleting a character leaves orphaned Noodle/NoodleR accounts and posts #2322

Closed
opened 2026-10-21 05:47:17 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Gunterlie on GitHub (Jul 30, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4295

Originally assigned to: @Gunterlie on GitHub.

Summary

Deleting a character via DELETE /api/characters/:id removes the row from characters.json but does not clean up the corresponding Noodle data. This leaves the deleted character's account (and its posts, interactions, subscriptions) visible in the Noodle timeline indefinitely, since Noodle posts also carry a denormalized authorSnapshot.

Where

packages/server/src/routes/characters.routes.ts, the app.delete<{ Params: { id: string } }>("/:id", ...) handler (around line 892):

app.delete<{ Params: { id: string } }>("/:id", async (req, reply) => {
  if (req.params.id === PROFESSOR_MARI_ID) {
    return reply.status(403).send({ error: "Professor Mari is a built-in character and cannot be deleted" });
  }
  const galleryDir = join(CHARACTER_GALLERY_ROOT, req.params.id);
  if (existsSync(galleryDir)) {
    rmSync(galleryDir, { recursive: true, force: true });
  }
  await storage.remove(req.params.id);
  return reply.status(204).send();
});

It removes the character's gallery folder and row, but never touches noodle_accounts (platform noodle, kind: "character", entityId: <characterId>) or any dependent noodle_posts / noodle_interactions / noodle_account_subscriptions rows.

Repro

  1. Invite one or more characters into Noodle and let a timeline refresh run so they get Noodle profiles/posts.
  2. Delete those characters from the Character Library.
  3. Open Noodle — the deleted characters' accounts and posts are still there ("ghost" characters), because noodle_accounts still has kind: "character" rows pointing at now-nonexistent entityIds.

On one dev instance this had accumulated 145 orphaned noodle_accounts rows (platform noodle) pointing at characters that no longer existed in characters.json.

Expected

Deleting a character should also cascade-clean its Noodle presence: remove/uninvite its noodle_accounts row(s) and either delete or clearly mark its noodle_posts as orphaned, rather than leaving indefinite ghost accounts in the timeline.

Workaround used

No delete API exists for individual noodle (non-noodler) accounts, so cleanup currently requires DELETE /api/noodle/invites (un-invite everyone) + DELETE /api/noodle/timeline (wipe all posts) as a blunt full reset — there's no way to clean up just the orphans.

Originally created by @Gunterlie on GitHub (Jul 30, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4295 Originally assigned to: @Gunterlie on GitHub. ## Summary Deleting a character via `DELETE /api/characters/:id` removes the row from `characters.json` but does not clean up the corresponding Noodle data. This leaves the deleted character's account (and its posts, interactions, subscriptions) visible in the Noodle timeline indefinitely, since Noodle posts also carry a denormalized `authorSnapshot`. ## Where `packages/server/src/routes/characters.routes.ts`, the `app.delete<{ Params: { id: string } }>("/:id", ...)` handler (around line 892): ```ts app.delete<{ Params: { id: string } }>("/:id", async (req, reply) => { if (req.params.id === PROFESSOR_MARI_ID) { return reply.status(403).send({ error: "Professor Mari is a built-in character and cannot be deleted" }); } const galleryDir = join(CHARACTER_GALLERY_ROOT, req.params.id); if (existsSync(galleryDir)) { rmSync(galleryDir, { recursive: true, force: true }); } await storage.remove(req.params.id); return reply.status(204).send(); }); ``` It removes the character's gallery folder and row, but never touches `noodle_accounts` (platform `noodle`, `kind: "character"`, `entityId: <characterId>`) or any dependent `noodle_posts` / `noodle_interactions` / `noodle_account_subscriptions` rows. ## Repro 1. Invite one or more characters into Noodle and let a timeline refresh run so they get Noodle profiles/posts. 2. Delete those characters from the Character Library. 3. Open Noodle — the deleted characters' accounts and posts are still there ("ghost" characters), because `noodle_accounts` still has `kind: "character"` rows pointing at now-nonexistent `entityId`s. On one dev instance this had accumulated 145 orphaned `noodle_accounts` rows (platform `noodle`) pointing at characters that no longer existed in `characters.json`. ## Expected Deleting a character should also cascade-clean its Noodle presence: remove/uninvite its `noodle_accounts` row(s) and either delete or clearly mark its `noodle_posts` as orphaned, rather than leaving indefinite ghost accounts in the timeline. ## Workaround used No delete API exists for individual `noodle` (non-`noodler`) accounts, so cleanup currently requires `DELETE /api/noodle/invites` (un-invite everyone) + `DELETE /api/noodle/timeline` (wipe all posts) as a blunt full reset — there's no way to clean up just the orphans.
bsakaguchi 2026-10-21 05:47:17 +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#2322
No description provided.