Skip to content

feat: restore keeps document ids (--preserve-ids) - #10

Merged
amenophis1er merged 1 commit into
mainfrom
feat/restore-preserve-ids
Nov 9, 2026
Merged

amenophis1er merged 1 commit into
mainfrom
feat/restore-preserve-ids

Conversation

@amenophis1er

Copy link
Copy Markdown
Contributor

Item 6 of the 3.6 "things that will bite you" work: trokky restore used to give every non-singleton document a new id, breaking anything outside the CMS that names a document by id.

  • Default: ids are kept when the target has none of the restored documents (singletons, which the Studio auto-creates and which are always restored under their own id, are left out of that check), or with --clean. The create names its id, which the server keeps.
  • --preserve-ids keeps them in a populated target too, overwriting same-id documents. --preserve-ids=false opts out.
  • A target that cannot be listed, or answers in a shape the CLI cannot read, is never assumed empty.
  • The run prints which mode it chose and why.
  • A refused document write now reports the server's reason (it may be the publish permission) instead of always naming content:write.

Tested end to end against two real Trokky instances (empty and populated targets, singletons, cyclic references, media, --clean, --dry-run, --collections). That run found a server bug, fixed in Trokky/trokky#100: a create by existing id suffixed the document's own slug. Against servers older than 3.6 the overwrite case can still suffix slugs; the help text says so. Reviewed by Codex as well.

…n empty target)

Restore POSTs each document with its backup id when the target has none of the
restored (non-singleton) documents, or with --clean, so links and systems that name
a document by id survive a restore. --preserve-ids forces it into a populated target
(overwriting same-id documents); --preserve-ids=false opts out. An unlistable or
unreadable target is never assumed empty. A refused write now reports the server's
reason instead of always naming content:write.
@amenophis1er
amenophis1er merged commit 552c6c2 into main Nov 9, 2026
1 check passed
@amenophis1er
amenophis1er deleted the feat/restore-preserve-ids branch November 9, 2026 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant