Skip to content
Closed
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
67b0ea0
cosmos(driver): add RFC-style binary-encoding wire-format spec and a …
Jul 22, 2026
d30b22a
test(cosmos): add corpus-shape samplers, size-scale knob, and reserve…
Jul 28, 2026
510aef0
ci(cosmos): run binary-JSON codec fuzzing as a non-blocking Linux/nig…
Jul 29, 2026
eb13279
ci(cosmos): trim weekly fuzz budget to fit the 90-min cap and rename …
Jul 29, 2026
7c4fd77
docs(cosmos): use absolute GitHub URLs for internal doc links
Jul 29, 2026
5952688
test(cosmos): expand binary-JSON golden vectors to cover all decodabl…
Jul 29, 2026
083f2c5
fix(cosmos): gate account-metadata failover test on emulator category…
Jul 30, 2026
1223cb9
test(cosmos): move binary round-trip fuzzer into azure_data_cosmos so…
Jul 30, 2026
44a1623
ci(cosmos): run the binary round-trip fuzzer on a live binary_encodin…
Jul 30, 2026
b59f2fa
ci(cosmos): gate the byte-level cargo-fuzz leg to the weekly pipeline
Jul 30, 2026
0b80524
docs(cosmos): fix round-trip fuzzer link after move to azure_data_cosmos
Jul 30, 2026
b54e0c4
ci(cosmos): give the two binary-fuzz legs distinct, meaningful job names
Jul 30, 2026
a16c950
ci(cosmos): run golden-vector validation in the Build stage only, not…
Jul 30, 2026
7475ab6
test(cosmos): raise default round-trip fuzzer SHAPE_RATIO to 85
Jul 30, 2026
9e2eb33
Cosmos: fix binary encoding round-trip test for large u64
Jul 30, 2026
0fc8d22
test(cosmos): retry transient errors in round-trip fuzzer and pin it …
Jul 30, 2026
04c4620
test(cosmos): fuzz true u64/wide floats, fail-fast on bad seed, robus…
Jul 30, 2026
cdcfeab
Merge branch 'main' into users/kundadebdatta/4864_build_binary_round_…
Jul 30, 2026
6639ad8
Merge branch 'main' into users/kundadebdatta/4864_build_binary_round_…
kundadebdatta Jul 30, 2026
320b4b1
test(cosmos): normalize i64 >= 2^53 as lossy double token in fuzzer o…
Jul 30, 2026
c9d112a
Merge branch 'main' into users/kundadebdatta/4864_build_binary_round_…
kundadebdatta Jul 30, 2026
69d76ad
test(cosmos): address Copilot PR review feedback on binary round-trip…
Jul 31, 2026
b265809
test(cosmos): fix fuzzer harness reproducibility, ASCII-key filtering…
Jul 31, 2026
ab51324
docs(cosmos): address remaining Copilot doc feedback on binary fuzzer…
Jul 31, 2026
42bb226
test(cosmos): use non-dictionary non-ASCII strings in unicode-off tes…
Jul 31, 2026
9d3261d
test(cosmos): harden binary round-trip fuzzer oracle and retry semantics
Jul 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ version = "1.0.0"
version = "1.0.0"

[workspace.dependencies]
arbitrary = { version = "1.4", features = ["derive"] }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a blurb to /CONTRIBUTING.md about fuzz testing and using arbitrary - even just a "Fuzzing" subheading under "Testing" and recommending use of arbitrary with a link to https://docs.rs/arbitrary would be fine. I want to avoid a situation where people keep adding similar but disparate dependencies for what should be shared. Or if you have more that you think other should use, just a brief write-up. Doesn't have to be extensive.

arbitrary-json = "0.1"
Comment thread
kundadebdatta marked this conversation as resolved.
async-lock = "3.4"
async-stream = { version = "0.3.6" }
async-trait = "0.1"
Expand Down Expand Up @@ -117,6 +119,7 @@ hdrhistogram = "7.5"
hostname = "0.4"
hmac = { version = "0.12" }
include-file = { version = "1.0.0", default-features = false }
json-canon = "0.1"
Comment thread
kundadebdatta marked this conversation as resolved.
openssl = { version = "0.10.79" }
opentelemetry = { version = "0.32", features = ["trace"] }
opentelemetry-appender-tracing = { version = "0.32" }
Expand Down
7 changes: 7 additions & 0 deletions eng/dict/crates.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
arbitrary
arbitrary_json
arbitrary-json
arc_swap
arc-swap
async_lock
Expand Down Expand Up @@ -70,8 +73,12 @@ hostname
http
include_file
include-file
json_canon
json-canon
json_patch
json-patch
libfuzzer_sys
libfuzzer-sys
litemap
openssl
opentelemetry
Expand Down
39 changes: 39 additions & 0 deletions sdk/cosmos/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"cabi",
"canadacentral",
"canadaeast",
"CBOR",
"cbindgen",
"CDLL",
"cdriver",
Expand All @@ -52,6 +53,7 @@
"chinaeast",
"chinanorth",
"chokepoint",
"canonicalizer",
"cloneable",
"codepoint",
"codepoints",
Expand Down Expand Up @@ -172,6 +174,7 @@
"libazurecosmosdriver",
"libclang",
"LIBCLANG",
"libfuzzer",
"libqueryplaninterop",
"QUERYPLANINTEROP",
"linearizability",
Expand Down Expand Up @@ -256,10 +259,14 @@
"RAII",
"readfeed",
"recompiles",
"redecoded",
"reencode",
"reencoded",
"refetch",
"refetched",
"refetches",
"refcounted",
"reparses",
"reparsed",
"Replicaset",
"reqs",
Expand All @@ -284,6 +291,7 @@
"serviceunavailable",
"serviceversion",
"sess",
"Signedness",
"southafricanorth",
"southafricawest",
"southcentralus",
Expand Down Expand Up @@ -313,11 +321,13 @@
"testdb",
"thinclient",
"threadsafe",
"tmin",
"TOCTOU",
"Tokio",
"TOPCOUNT",
"TPIO",
"transcoders",
"trippable",
"uaecentral",
"uaenorth",
"udfs",
Expand Down Expand Up @@ -374,6 +384,35 @@
"writability",
"xorshift",
"xpart",
"artifactname",
"fsanitize",
"logissue",
"MSVC",
"AFORM",
"ANID",
"Chenault",
"devtestcoll",
"ENOENT",
"errno",
"feff",
"Flacco",
"logdata",
"lossily",
"Millett",
"modhash",
"MSNH",
"MUID",
"muid",
"nametype",
"Qsml",
"recclass",
"reclat",
"reclong",
"similars",
"Unschematized",
"vout",
"Xpert",
"xpert",
"yxxx"
],
"ignorePaths": [
Expand Down
12 changes: 12 additions & 0 deletions sdk/cosmos/azure_data_cosmos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ azure_data_cosmos_driver = { path = "../azure_data_cosmos_driver", default-featu
] }
azure_identity.workspace = true
clap.workspace = true
# Test-only deps for the binary round-trip fuzzer
# (tests/binary_roundtrip_fuzzer.rs): it generates arbitrary JSON, canonicalizes
# it (RFC 8785), and hashes the canonical form for differential comparison.
Comment on lines +55 to +57

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary comment IMO

arbitrary = { workspace = true }
arbitrary-json = { workspace = true }
json-canon = { workspace = true }
sha2 = { workspace = true }
# Enabled here (dev-only) so the metrics and tracing handler tests can drive
# in-memory OpenTelemetry exporters. `testing` provides `InMemoryMetricExporter`
# and `InMemorySpanExporter`.
Expand Down Expand Up @@ -144,6 +151,11 @@ name = "binary_encoding"
path = "tests/binary_encoding.rs"
required-features = ["key_auth", "control_plane", "fault_injection"]

[[test]]
name = "binary_roundtrip_fuzzer"
path = "tests/binary_roundtrip_fuzzer.rs"
required-features = ["key_auth", "control_plane", "fault_injection"]

[[test]]
name = "gateway_v2"
path = "tests/gateway_v2.rs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ fn binary_encoding_options() -> TestOptions {
}

/// A document covering every JSON value shape the binary encoder emits: literal
/// and wide integers, an unsigned value beyond `i64::MAX`, a double, booleans,
/// `null`, unicode/empty strings, nested arrays and objects, and a vector of
/// objects.
/// and wide integers, a large unsigned value, a double, booleans, `null`,
/// unicode/empty strings, nested arrays and objects, and a vector of objects.
///
/// Note: `huge` stays at or below `2^53` because the live Cosmos service
/// normalizes JSON numbers to IEEE-754 doubles. A value beyond `2^53` (e.g.
/// `u64::MAX`) is echoed back as a `Double` and can no longer be deserialized
/// into a `u64` field, so it does not round-trip against the real service.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
struct BinaryItem {
id: String,
Expand Down Expand Up @@ -95,11 +99,11 @@ fn sample_item(id: &str, partition_key: &str) -> BinaryItem {
text: "hello binary".to_owned(),
unicode: "café ☃ 𝄞 quotes:\" backslash:\\".to_owned(),
empty: String::new(),
small_int: 7, // literal-int form (0..32)
big_int: 9_000_000_000, // Int64 form
negative: -1_234_567, // Int64 form
huge: u64::MAX, // UInt64 form (beyond i64::MAX)
ratio: 123.456_789, // Double form
small_int: 7, // literal-int form (0..32)
big_int: 9_000_000_000, // Int64 form
negative: -1_234_567, // Int64 form
huge: 9_007_199_254_740_992, // UInt64 form, exactly f64-representable (2^53)
ratio: 123.456_789, // Double form
active: true,
inactive: false,
maybe: None, // null
Expand Down
Loading
Loading