Subject
assert-json-diff compares two Serialize values by converting them to serde_json::Value and producing a structured list of differences with paths (e.g. .data.users[0].country.name). It exposes three macros — assert_json_include! (inclusive: actual may contain extra data), assert_json_eq! (strict: exact equality), and assert_json_matches! (config-driven) — plus a assert_json_matches_no_panic function returning Result<(), String>. It supports two numeric modes (Strict, AssumeFloat) and two compare modes (Inclusive, Strict).
Methodology
The published crate (assert-json-diff-2.0.2.crate) was unpacked. Source files (src/lib.rs 660 lines, src/diff.rs 532 lines, src/core_ext.rs 55 lines), the integration test (tests/integration_test.rs, 184 lines) and tests/version-numbers.rs, and the maintainer release shell script (bin/release) were read in full. Manifest was compared against the upstream Git checkout at commit bca0d2c59080 using diff -qr; only cargo-generated meta differences. Source was greped for unsafe, extern, process::, std::net, std::fs, and env::; the crate uses #![deny(unsafe_code)] at crate level. The bin/release shell script was inspected with file(1).
Tools used: openvet (workspace creation, claim/finding management), GNU diff 2.8, grep 2.6, file(1) (BSD).
Results
The published source matches upstream byte-for-byte (text). The crate ships no binary artefacts (justifying has-binaries), no build.rs and no proc-macro (justifying has-build-exec and has-install-exec). The bin/release script is a maintainer helper, not part of the library build path; it has no effect on consumers and contains no payloads.
The crate enforces #![deny(unsafe_code)] (justifying uses-unsafe). No std::process, std::net, std::fs, or env:: usage was found, justifying uses-network, uses-filesystem, uses-exec, uses-environment, uses-crypto, uses-jit, uses-interpreter, and uses-concurrency. The crate implements the JSON-tree diff algorithm in src/diff.rs over serde_json::Value (justifying impl-algorithm = true); impl-crypto, impl-parser, impl-interpreter, impl-jit, impl-protocol, impl-datastructure, and impl-concurrency are all false.
The diff algorithm is a recursive folder over Value::{Null,Bool,Number,String,Array,Object}. The algorithm is memory-safe (justifying algorithm-impl-safe), correct against the documented inclusive/strict semantics as exercised by the embedded and integration tests (justifying algorithm-impl-correct), exhaustively unit-tested across primitives, nested objects, arrays, and both numeric modes (justifying algorithm-impl-tested), and runs in time linear in the total node count of the inputs with a per-call allocation profile that scales linearly — no quadratic adversarial input is admitted (justifying algorithm-impl-bounds). No fuzz or property tests are shipped (justifying has-fuzz-tests and has-property-tests); the unit tests embedded in src/lib.rs and src/diff.rs (justifying has-unit-tests) and the integration tests under tests/ (justifying has-integration-tests) provide adequate coverage for a deterministic structural diff.
Three low-severity findings were recorded:
- FINDING-1 (correctness):
assert_json_matches_no_panic is documented as panic-free but panics on serialisation failure.
- FINDING-2 (correctness): inclusive array compare is positional, not subset-style; documentation is ambiguous about which is intended.
- FINDING-3 (quality):
Indent::indent is byte-space oriented and lines() collapses trailing newlines — robustness nit, not currently triggered by the crate's own output.
No malicious patterns, build-side hooks, hidden capabilities, or surprising dependencies were observed, justifying is-benign.
Conclusion
assert-json-diff is a small, benign test-time JSON comparison crate with zero unsafe code (enforced at crate level), no I/O, and no surprising capability surface. The three recorded findings are minor: a panic-contract mismatch in the "no-panic" helper, a doc-vs-behaviour ambiguity in inclusive array matching, and a robustness nit in the indentation helper. None impacts the primary assertion code-paths under test-time usage. The package is suitable for use as a dev-dependency.