Repository navigation
fix: preserve committed CRDT updates when mutations throw - #6
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
YKS can commit changes and emit updates before a mutation callback or observer throws. Previously, the adapter dropped those collected updates when propagating the exception, leaving the live document ahead of peers and append-only persistence.
Carry committed deltas in
CrdtMutationExceptionand deliver them through the server's existing broadcast/change/store path before rethrowing the original cause. This covers client updates, Redis updates, local transactions, and document merges. Initial-load failures still discard the unpublished document; failures without committed updates retain their original exception. Public method signatures remain unchanged, with the additive exception documented in the API and README.Validation
onChange.check consumerSmokeTest consumerKotlinCompatibilityTestpassed against CI-pinned YKS47095ae9(0.2.15): 157 tests, zero failures or skips, including disposable Redis 8.2.5 and S3Mock integration tests, ABI checks, and Kotlin 2.3.21 consumer compatibility.fcfa849a(0.2.14).mainat0aad64332124f3e610430bbe7039b864653718d3.Downstream compatibility review
Reviewed Norric API main/develop collaboration paths and the browser collaboration/answer-document paths. No production caller depending on discarded committed deltas was found. Client-origin append, Redis no-store, cancellation/reconnect handling, failed-load cleanup, and the absence of a success acknowledgement after failure are preserved. Standalone scratch YDoc workflows remain unchanged.
This is a source audit plus library integration tests, not a live Norric PostgreSQL/browser end-to-end run. Norric's dependency pins are unchanged; adopting the fix requires a later library release and dependency update. Direct
CrdtDocumentconsumers now receive the documented exception envelope when a failed mutation has committed updates; server-facing callers still receive the original cause.