Skip to content

cms mode: primo dev --author cms deletes site content files from disk (recovered twice from .primo/trash) #1241

Open

Description

@elemdos

What happened

While running primo dev --author cms against a local workspace, site content was deleted from disk twice in one session. Deleted from both test sites in the workspace:

  • pages/
  • page-types/
  • site/
  • most of blocks/

Files were moved to .primo/trash/ with names of the form <ISO8601>_<Site Name>_<path with __ separators>, which is the only reason they were recoverable. The workspace is not a git repo. Recovery: copy the newest trash entry per unique path back into place, skipping destinations that already exist.

Possible causes to investigate

  • CMS→file sync treating "absent in CMS" as "delete from disk" (i.e. the CMS DB was missing the content, and sync propagated that as deletions rather than as a desync to flag)
  • Deletion may be intended in cms mode, in which case the real bug is the absence of any warning/confirmation before destructive sync
  • Possibly triggered by mode-switching during the session (files → cms → files)
  • Possible precondition rather than coincidence: an empty sites/coffee-shop/page-types/default/head.svelte was hand-created and then deleted shortly before the first loss

Open questions

  • Is deletion of disk files reachable in a normal cms-mode workflow, or only via mode-switching?
  • Is there any warning path at all today?
  • Does the trash naming carry enough information to script recovery reliably?

Reproduction notes

⚠️ The affected workspace was reproducibly destroyed by this command — do not run it against a workspace you care about. Any investigation should use a copy of the workspace.

Discovered during verification of #1233 (browse mode).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions