Skip to content

add_docs: OnDeletedId='restore' to re-add a retired document id - #110

Merged
stevevanhooser merged 1 commit into
mainfrom
claude/pensive-cannon-7ncs7l
Nov 13, 2026
Merged

stevevanhooser merged 1 commit into
mainfrom
claude/pensive-cannon-7ncs7l

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

Summary

Mirrors the DID-matlab change of the same name, for VH-Lab/NDI-matlab#1238 (a cloud mirror fails after a local delete because the document's id is retired).

  • add_docs(..., OnDeletedId="error" | "restore"), validated up front like OnDuplicate; forwarded to _do_add_doc only when not the default.
  • In SQLiteDB._do_add_doc, "restore" deletes the id from deleted_docs inside the add's try block, so a failed add rolls the un-retirement back with everything else.
  • The refusal message now mentions the option.

Testing

  • New tests in tests/test_document_reclamation.py: restore works and un-retires the id, a re-removal retires it again, a failed restore leaves the id retired, and an invalid value is rejected.
  • Full suite passes locally: 860 passed, 10 skipped, 1 xfailed. black and ruff (CI-pinned versions) are clean.

Generated by Claude Code

Mirrors the DID-matlab change of the same name. A document id retired by
removal from every branch is refused by default as before; with
OnDeletedId='restore' it is un-retired inside the add's transaction (so a
failed add leaves it retired) and the document is added fresh. For the
same document coming back, e.g. NDI re-downloading from the cloud a
document deleted locally (VH-Lab/NDI-matlab#1238).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011v7R5vMg5Qz8W7zUb26wM2
@stevevanhooser
stevevanhooser merged commit 0fac164 into main Nov 13, 2026
7 checks passed
@stevevanhooser
stevevanhooser deleted the claude/pensive-cannon-7ncs7l branch November 13, 2026 17:27
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.

2 participants