fix: revert from ciborium to serde_cbor_2, make apply_patches iterative

- ciborium's deserialize_str bug (#32) caused DB deserialization to fail
  silently, nuking the database value to null on compress
- Switch to dr-bonez/cbor fork (serde_cbor_2) which has StreamDeserializer
  change_output_type support
- Propagate deserialization errors instead of falling back to null
- Convert apply_patches from recursion to iteration to prevent stack
  overflow on patches with many operations (e.g. 953 ops)
This commit is contained in:
Aiden McClelland
2026-03-09 23:42:14 -06:00
parent 003cb1dcf2
commit 10413414dc
6 changed files with 128 additions and 107 deletions

View File

@@ -3,7 +3,7 @@ authors = ["Aiden McClelland <aiden@start9labs.com>"]
categories = ["database-implementations"]
description = "A database that tracks state updates as RFC 6902 JSON Patches"
edition = "2018"
keywords = ["json", "json-pointer", "json-patch"]
keywords = ["json", "json-patch", "json-pointer"]
license = "MIT"
name = "patch-db"
readme = "README.md"
@@ -18,6 +18,7 @@ unstable = []
[dependencies]
async-trait = "0.1.42"
serde_cbor = { package = "serde_cbor_2", git = "https://github.com/dr-bonez/cbor.git" }
fd-lock-rs = "0.1.3"
futures = "0.3.8"
imbl = "6"
@@ -25,24 +26,23 @@ imbl-value = "0.4.1"
json-patch = { path = "../json-patch" }
json-ptr = { path = "../json-ptr" }
lazy_static = "1.4.0"
tracing = { version = "0.1.29", optional = true }
tracing-error = { version = "0.2.0", optional = true }
nix = "0.30.1"
patch-db-macro = { path = "../macro" }
serde = { version = "1", features = ["rc"] }
ciborium = "0.2"
thiserror = "2"
tokio = { version = "1", features = ["sync", "fs", "rt", "io-util", "macros"] }
tokio = { version = "1", features = ["fs", "io-util", "macros", "rt", "sync"] }
tracing = { version = "0.1.29", optional = true }
tracing-error = { version = "0.2.0", optional = true }
[dev-dependencies]
proptest = "1.0.0"
serde = { version = "1.0.118", features = ["rc", "derive"] }
rand = "0.9.1"
serde = { version = "1.0.118", features = ["derive", "rc"] }
tokio = { version = "1.0.1", features = [
"sync",
"fs",
"rt",
"rt-multi-thread",
"io-util",
"macros",
"rt",
"rt-multi-thread",
"sync",
] }
rand = "0.9.1"