Skip to content

fix: preserve committed CRDT updates when mutations throw - #6

Merged
hwisu merged 1 commit into
mainfrom
codex/preserve-committed-crdt-updates
Oct 2, 2026
Merged

hwisu merged 1 commit into
mainfrom
codex/preserve-committed-crdt-updates

Conversation

@hwisu

@hwisu hwisu commented Oct 2, 2026

Copy link
Copy Markdown
Owner

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 CrdtMutationException and 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

  • Reproduced the bug on the base revision: the document retained its edit, but the regression test timed out waiting for onChange.
  • Added 11 regression tests covering observer/callback failures, peer replay, append-log persistence, roots/origins, cancellation identity, Redis/skip-store policies, merge short-circuiting, failed loads, capture reuse, standard validation rollback, and delete-only commits.
  • check consumerSmokeTest consumerKotlinCompatibilityTest passed against CI-pinned YKS 47095ae9 (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.
  • The 18-test focused adapter/integration suite also passed against downstream-pinned YKS fcfa849a (0.2.14).
  • Based on latest main at 0aad64332124f3e610430bbe7039b864653718d3.

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 CrdtDocument consumers now receive the documented exception envelope when a failed mutation has committed updates; server-facing callers still receive the original cause.

@hwisu
hwisu merged commit 7e1d9e9 into main Oct 2, 2026
2 checks passed
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