Skip to content

Add SyncedDocumentOptions#37

Merged
peachbits merged 1 commit intomasterfrom
matthew/matthew/synced-doc-preservation-redo
Mar 18, 2026
Merged

Add SyncedDocumentOptions#37
peachbits merged 1 commit intomasterfrom
matthew/matthew/synced-doc-preservation-redo

Conversation

@peachbits
Copy link
Contributor

@peachbits peachbits commented Mar 18, 2026

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

Note

Medium Risk
Changes how syncedDocument.sync behaves when the cleaner throws, which can affect what gets written back to CouchDB and what in-memory state is retained. Risk is mitigated by new unit tests but could impact consumers relying on previous failure semantics.

Overview
Adds optional SyncedDocumentOptions to syncedDocument, allowing callers to control cleaner failure behavior via cleanFailStrategy (reset to defaults or preserve last good value) and an onCleanFail callback.

Updates syncedDocument.sync to catch cleaner exceptions, invoke onCleanFail, and choose the fallback document based on the configured strategy before continuing the usual repair/writeback flow. Includes a new test suite covering creation, dirty repair, change notifications, and both failure strategies, and documents the change in CHANGELOG.md.

Written by Cursor Bugbot for commit 20b3564. This will update automatically on new commits. Configure here.

@peachbits
Copy link
Contributor Author

This PR replaces #36 which was merged before cleaning up

@peachbits peachbits merged commit a0b6e07 into master Mar 18, 2026
4 checks passed
@peachbits peachbits deleted the matthew/matthew/synced-doc-preservation-redo branch March 18, 2026 23:07
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