MOD-14010 support Homogenues array floating point forcing(deserializa…#17
Merged
AvivDavid23 merged 33 commits intomasterfrom Mar 3, 2026
Conversation
|
Did you look at c2pa_cbor? |
Author
@galcohen-redislabs I can try that, although it doesnt have a major release, and very low usage: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
galcohen-redislabs
approved these changes
Mar 3, 2026
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.

…tion path only)
no production-quality Rust CBOR library implements RFC 8746 natively (the only candidate,
cbor_enhanced, has been unmaintained since 2020 and lacks F16-LE and BF16 support), so a thinIValue ↔ ciborium::Valueconversion layer is still neededSize comparison (vs JSON baseline)
Example payloads
1 — FP32 typed array (1 000 elements, stored with FPHA F32 tag)
2 — FP64 typed array (1 000 elements, stored with FPHA F64 tag)
3 — Heterogeneous float array (same data, no FPHA hint)
Same JSON as above; without an FPHA hint the array is stored as
ArrayHetero(each element tagged individually). zstd still achieves the same ratio because
the repeated tag bytes compress well.
4 — String-heavy object (50 keys)
{ "key_0": "value_0_some_longer_string_here", "key_1": "value_1_some_longer_string_here", "key_2": "value_2_some_longer_string_here", ... // 50 keys total }5 — Small mixed object
{ "name": "Alice", "age": 30, "scores": [1, 2, 3, null, true, "bonus"], "meta": {"active": true, "level": 42} }6 — Nested FP32 arrays + string
{ "a": [0.0, 0.1, 0.2, ...], // 100 F32 elements "b": [0.0, 0.1, 0.2, ...], // 100 F32 elements "label": "test" }7 — Big mixed JSON (200 records, heterogeneous embeddings)
[ { "id": 0, "name": "user_0", "active": true, "score": 0.0, "tags": ["alpha", "beta", "gamma"], "embedding": [0.0, 0.001, 0.002, ...] // 32 floats }, // ... 200 records total, repeated schema ]The repeated key names (
"id","name","active","score","tags","embedding")across 200 records are what zstd compresses so aggressively here.
8 — Repeated-string records (500 records, RED-141886 scenario)
[ {"id": 0, "status": "active", "region": "us-east-1", "tier": "free", "owner": "team-a", "count": 0}, {"id": 1, "status": "inactive", "region": "eu-west-1", "tier": "standard", "owner": "team-b", "count": 10}, // ... 500 records; status/region/tier/owner values repeat from a small fixed set ]Note
High Risk
Adds new CBOR/zstd encoding and changes core
IArrayfallible APIs to return a newIJsonError, which can affect downstream callers and data interchange correctness.Overview
Adds optional floating-point homogeneous array (FPHA) enforcement during JSON deserialization via
FPHAConfig/IValueDeserSeed, plusIArray::push_with_fp_typeto forceF16/BF16/F32/F64storage and reject out-of-range values.Introduces a new
cbormodule withencode/decodeand zstd-compressed variants that preserve typed array tags using RFC 8746 (with a private BF16 tag), and surfaces this API fromlib.rs.Refactors array-related fallible APIs to return
IJsonError(wrapping allocation failures and new range errors), adds extensive unit tests, and expands CI fuzzing to cover CBOR decode + round-trip (with updated fuzz runtime/memory flags).Written by Cursor Bugbot for commit 9675e63. This will update automatically on new commits. Configure here.