[GH-ISSUE #159] [Feature]: Safely remove unreferenced archived World Maps locations #79

Closed
opened 2026-10-20 17:24:09 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @thetopham on GitHub (Jul 31, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/159

Originally assigned to: @thetopham on GitHub.

What problem does this solve?

World Maps allows locations to be archived and restored, but chat-owned maps provide no way to permanently remove an archived location. Accidental locations and locations made obsolete during world revisions therefore remain in the map indefinitely and are also carried into exported map files.

Archival is appropriately protective when a location is referenced by campaign history, but users cannot tell which archived locations are genuinely history-protected and which are merely unused. Over time, mistakes and revisions can leave permanent “scars” in an otherwise cleaned-up world.

Proposed package or change

Add a guarded archived-location cleanup flow:

  • Offer Delete permanently only for archived locations that can be removed without invalidating stored state.
  • Run a preflight check for references from current/starting location state, parent/child relationships, direct links, spatial snapshots and campaign history, route plans, Game map bindings, shared-world links/drafts, and other persisted map metadata.
  • If the location is safe to remove, show a destructive confirmation naming exactly what will be deleted, including child locations if applicable.
  • If the location is protected, disable or replace the action with a clear explanation such as “Kept because 4 historical messages reference this location.”
  • Preserve stable IDs and archived definitions whenever deletion would break historical breadcrumbs or old message context.
  • Consider a bulk Clean up archived locations action that removes only demonstrably unreferenced entries and previews the result before changing the draft.
  • Clarify export behavior: retained history-protected locations should remain in exports, while safely deleted locations should not.
  • Keep all changes behind the normal map Save boundary.

Why should this be optional?

This belongs to the downloadable World Maps package because it concerns package-owned spatial definitions, history validation, authoring UI, and export behavior. It does not require a general Marinara Engine deletion facility.

Alternatives considered

  • Keep every archived location forever: safest for history, but leaves accidental and unused records impossible to clean up.
  • Allow unconditional hard deletion: unacceptable because snapshots, routes, bindings, shared worlds, and older messages may depend on stable location IDs.
  • Omit all archived locations during export: risks producing an export that cannot preserve or validate existing spatial history.

Additional context

  • Marinara Engine version: v2.3.5
  • Engine build: a121d12
  • Package version: World Maps v1.2.3

The existing server save path intentionally rejects removal when campaign history uses a location and instructs the user to archive instead. The existing Delete map flow similarly preserves history-linked locations by archiving them. This request is therefore for safe garbage collection of unreferenced archived locations, not weakening those history guarantees.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @thetopham on GitHub (Jul 31, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/159 Originally assigned to: @thetopham on GitHub. ## What problem does this solve? World Maps allows locations to be archived and restored, but chat-owned maps provide no way to permanently remove an archived location. Accidental locations and locations made obsolete during world revisions therefore remain in the map indefinitely and are also carried into exported map files. Archival is appropriately protective when a location is referenced by campaign history, but users cannot tell which archived locations are genuinely history-protected and which are merely unused. Over time, mistakes and revisions can leave permanent “scars” in an otherwise cleaned-up world. ## Proposed package or change Add a guarded archived-location cleanup flow: - Offer **Delete permanently** only for archived locations that can be removed without invalidating stored state. - Run a preflight check for references from current/starting location state, parent/child relationships, direct links, spatial snapshots and campaign history, route plans, Game map bindings, shared-world links/drafts, and other persisted map metadata. - If the location is safe to remove, show a destructive confirmation naming exactly what will be deleted, including child locations if applicable. - If the location is protected, disable or replace the action with a clear explanation such as “Kept because 4 historical messages reference this location.” - Preserve stable IDs and archived definitions whenever deletion would break historical breadcrumbs or old message context. - Consider a bulk **Clean up archived locations** action that removes only demonstrably unreferenced entries and previews the result before changing the draft. - Clarify export behavior: retained history-protected locations should remain in exports, while safely deleted locations should not. - Keep all changes behind the normal map Save boundary. ## Why should this be optional? This belongs to the downloadable World Maps package because it concerns package-owned spatial definitions, history validation, authoring UI, and export behavior. It does not require a general Marinara Engine deletion facility. ## Alternatives considered - Keep every archived location forever: safest for history, but leaves accidental and unused records impossible to clean up. - Allow unconditional hard deletion: unacceptable because snapshots, routes, bindings, shared worlds, and older messages may depend on stable location IDs. - Omit all archived locations during export: risks producing an export that cannot preserve or validate existing spatial history. ## Additional context - Marinara Engine version: v2.3.5 - Engine build: a121d12 - Package version: World Maps v1.2.3 The existing server save path intentionally rejects removal when campaign history uses a location and instructs the user to archive instead. The existing Delete map flow similarly preserves history-linked locations by archiving them. This request is therefore for safe garbage collection of unreferenced archived locations, not weakening those history guarantees. ## Template check - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@thetopham commented on GitHub (Jul 31, 2026):

Implementation triage (2026-07-31):

  • The current save guard in definition.service.ts calls hasMessageSnapshots(chatId) and forbids removal of any saved location once the chat has committed spatial history.
  • The persistence contract already exposes listForChat(chatId), so snapshot references can be checked per location instead of treating the whole definition as permanently protected.
  • A complete safe-delete preflight also needs to account for the saved current/starting location, subtree and link cleanup, queued route state, and Game map bindings. Shared-world edits have their own linked-chat protection and should remain conservative.
  • This should ship as a separate package enhancement after the focused 1.2.4 movement and unsaved-edit fixes, rather than being folded into that bugfix release. No implementation branch or draft PR has been started for #159 yet.
<!-- gh-comment-id:5147303311 --> @thetopham commented on GitHub (Jul 31, 2026): Implementation triage (2026-07-31): - The current save guard in definition.service.ts calls hasMessageSnapshots(chatId) and forbids removal of any saved location once the chat has committed spatial history. - The persistence contract already exposes listForChat(chatId), so snapshot references can be checked per location instead of treating the whole definition as permanently protected. - A complete safe-delete preflight also needs to account for the saved current/starting location, subtree and link cleanup, queued route state, and Game map bindings. Shared-world edits have their own linked-chat protection and should remain conservative. - This should ship as a separate package enhancement after the focused 1.2.4 movement and unsaved-edit fixes, rather than being folded into that bugfix release. No implementation branch or draft PR has been started for #159 yet.
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-Agents#79
No description provided.