Skip to content

feat: support RDB v14 (Array, stream XNACK) via librdb v2.3.0#1

Merged
funcpp merged 2 commits into
mainfrom
feat/follow-librdb-2.3.0
Jun 11, 2026
Merged

feat: support RDB v14 (Array, stream XNACK) via librdb v2.3.0#1
funcpp merged 2 commits into
mainfrom
feat/follow-librdb-2.3.0

Conversation

@funcpp

@funcpp funcpp commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

Follows the librdb v2.3.0 release (2026-06-03), which adds RDB v14 support. Bumps the vendored submodule v2.2.0 → v2.3.0 and surfaces the new Level2 callbacks through the safe wrapper.

Upstream v2.3.0 adds (PRs #98, #100, #95):

  • Array data type (RDB_TYPE_ARRAY, sparse array)
  • Stream XNACK — NACK-zone entries (RDB_TYPE_STREAM_LISTPACKS_5)
  • git-commit-hash tracking in the build

Changes

Area Change
Submodule librdb-sys/librdb v2.2.0 → v2.3.0
Bindings Regenerated (bindgen 0.71.1); diff is exactly the v2.3.0 API additions
types.rs DataType::Array (+ #[non_exhaustive])
handlers.rs handle_array_metadata, handle_array_element, handle_stream_nack_zone_entry (default no-op)
trampoline.rs 3 new trampolines + build_callbacks wiring
tests/level2.rs 5 tests against the new v14 fixtures
Versions librdb-sys 0.1.0+2.2.0 → 0.2.0+2.3.0; librdb 0.1.1 → 0.2.0

Notable decisions

  • build.rs needs no change. PR #95's git-hash is a Makefile -D flag, but we build with the cc crate. parser.c has an #ifndef LIBRDB_GIT_COMMIT … "unknown" fallback, so compilation is unaffected. No new source files or deps were added upstream.
  • insert_idxOption<u64>. librdb encodes "no insert cursor" as RDB_ARRAY_INSERT_IDX_NONE (UINT64_MAX). bindgen mis-evaluates that #define as i32 = -1, so the var is blocklisted and re-declared with correct width (u64) in librdb-sys/src/lib.rs; the trampoline maps the sentinel to None. The array_v14_insert_idx_boundary fixture (u64::MAX - 1) guards against an off-by-one.
  • update-bindings.sh fixed. It couldn't run under the pinned bindgen 0.71.1 (invalid --with-derive-debug; -I clang args before --). The documented regeneration workflow now works and reproduces bindings.rs byte-for-byte.
  • #[non_exhaustive] on DataType — RDB gains data types across versions; this keeps future additions non-breaking. The breaking enum-variant addition is reflected in the librdb 0.2.0 minor bump.

Out of scope (pre-existing, not part of the version follow)

  • handle_hash_field's raw -1 sentinel (predates this; unifying to Option is a separate breaking change)
  • .pre-commit-config.yaml's clippy hook uses --all-features, which trips build.rs's mutually-exclusive linking-feature guard — broken independently of this PR

Testing

  • cargo build ✓ · cargo test --all26 passed ✓ · cargo clippy --all-targets -- -D warnings ✓ · cargo fmt --check
  • New tests parse the real v2.3.0 fixtures (array_v14_*.rdb, stream_v14_xnack.rdb) and assert counts, ascending-idx ordering, value bytes, the insert-idx sentinel boundary, and NACK-zone IDs.

Review

Reviewed by three independent adversarial agents (FFI/safety, API design/semver, build/bindings/completeness). Round 1 surfaced a mistyped public constant, a DataType semver gap, and a stale README; all were fixed. Round 2: all three APPROVE (95% / 98% / 99%) — bindings reproducibility and a standalone out-of-tree packaged-crate build were verified.

🤖 Generated with Claude Code

funcpp and others added 2 commits June 11, 2026 23:46
Bump bundled librdb v2.2.0 -> v2.3.0 and surface the new RDB v14 Level2
callbacks through the safe wrapper:

- DataType::Array + handle_array_metadata / handle_array_element
- handle_stream_nack_zone_entry (XNACK / NACK-zone entries)

Notable changes:
- Regenerate bindgen FFI bindings; fix update-bindings.sh to run under the
  pinned bindgen 0.71.1 (drop invalid --with-derive-debug; move -I args after --).
- bindgen mistypes RDB_ARRAY_INSERT_IDX_NONE (UINT64_MAX) as i32 = -1; blocklist
  it and hand-declare the correct u64 const in librdb-sys/lib.rs. The trampoline
  maps the sentinel to insert_idx: Option<u64>.
- build.rs unchanged: parser.c has an #ifndef LIBRDB_GIT_COMMIT fallback, so the
  cc-crate build is unaffected by upstream Makefile-only git-hash tracking.
- Mark DataType #[non_exhaustive] so future RDB types stay non-breaking.
- Add integration tests against the new v14 fixtures (array + stream_xnack),
  incl. the u64::MAX-1 insert-idx boundary that guards the sentinel mapping.

Versions: librdb-sys 0.1.0+2.2.0 -> 0.2.0+2.3.0; librdb 0.1.1 -> 0.2.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
librdb-sys vendors deps/redis sources under BSD-3-Clause (Redis core),
BSD-2-Clause (lzf), and Zlib (crcspeed) in addition to the MIT crate/librdb
code. Replace the inaccurate `license = "MIT"` with the full SPDX expression
so license scanners see the bundled licenses. sha256 is public-domain (no
obligation); all upstream file headers are retained for attribution.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@funcpp funcpp merged commit 0dea1f8 into main Jun 11, 2026
1 check passed
@funcpp funcpp deleted the feat/follow-librdb-2.3.0 branch June 11, 2026 15:51
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