Skip to content

v0.4.1 release

Choose a tag to compare

@homer6 homer6 released this 18 Feb 22:09
· 22 commits to main since this release

automerge-cpp v0.4.1

This maintenance release focuses on storage reliability, encoding correctness, and exhaustive validation of the Run-Length Encoding (RLE) engine. It resolves critical bugs in the binary format that previously led to document corruption and incomplete data persistence.

This release achieves test suite parity with the upstream library's test suite.


RLE Engine & Columnar Fixes

A comprehensive overhaul of the RLE (Run-Length Encoding) and columnar storage layers ensures full data integrity across complex concurrent editing scenarios.

Bug Fixes

  • RLE Null Coalescing: Fixed a logic error where append_null() triggered a premature flush of pending runs. This caused consecutive null values to be encoded individually (taking 2 bytes each) rather than as a compact run (2 bytes total), and occasionally led to misaligned buffers.
  • Column Header Ambiguity: Resolved a critical parsing bug where RLE literal control bytes (specifically 0x7F) were misidentified as ascending column specifications. This caused the parser to consume data as headers, shifting all subsequent data and breaking Document::load().
  • Explicit Column Count: Introduced an explicit column count prefix to the raw column format to replace the previous ascending-order heuristic, making the parser immune to data-payload overlap.

Improved Serializer Support

  • Complete Actor Table: ensure_actor_table() now recursively extracts actor IDs from obj, insert_after, and pred fields. This ensures that documents containing increment operations on nested objects or complex causal histories remain loadable.
  • Object Type Round-Trips: Fixed a limitation where insert_object operations into lists lost their ObjType identity during serialization. These are now correctly encoded using action codes 0 (map) or 2 (list) to preserve their identity during load.

Testing & Validation

This release represents a major leap in test coverage, achieving closer parity with the upstream Rust implementation.

  • Expanded RLE Test Suite: 59 new tests (increasing the count from 10 to 69) cover exhaustive edge cases, including:

  • Null positioning and interleaving (nulls at start/middle/end).

  • Signed integer transition patterns (run literal null).

  • Compactness verification and stress tests for unique value runs.

  • New Integration Tests: Added 23 new integration tests to document_test.cpp focusing on:

  • List Conflicts: Conflict resolution and deterministic insertion ordering across multiple actors.

  • Counter Edge Cases: Verification that independent counters do not combine incorrectly and survive nested map operations.

  • Large Data Stress: Validated O(n) scan performance with 500-element lists and 100+ put/delete cycles.


Performance & Parallelism Refinements

The threading model introduced in v0.4.0 has been tightened for production stability.

  • Thread Pool API Integration: The parallel_perf_demo has been rewritten to use the built-in parallelize_loop API. It now demonstrates lock-free parallel reads by leveraging set_read_locking(false) to eliminate shared_mutex contention.

  • API Enhancements:

  • Added Document::get_thread_pool() to allow sharing pools between documents.

  • Added Document::read_locking() to query the current synchronization state.

  • Platform Compatibility: Replaced std::jthread with std::thread and explicit join loops to improve compatibility with older toolchains and the FreeBSD environment.

  • CMake Infrastructure: Added Threads as a public dependency, ensuring proper linking of pthread across all consumer targets.


Statistics & Environment

  • Version: 0.4.1
  • Total Tests: 347 passing tests.
  • Dependencies: CMake 3.28+, zlib, and C++23.