Skip to content

Commit 41966b7

Browse files
fix(deps): bump ijson-jcs to 03df9ed for RFC 8785 number ties (#261)
Closes the "ijson-jcs tie case" follow-up from #237/#247. ## Problem The pinned `ijson-jcs` (3a9a4ee) built ECMAScript number output by rearranging Rust's float formatting. Rust doesn't guarantee ECMAScript's choice on a decimal tie, so RFC 8785 Appendix B vector `0x43143ff3c1cb0959` came out as `1424953923781206.3`. JCS requires `1424953923781206.2`. A report or attestation holding such a float would hash differently from other JCS implementations. ## Fix Bump to ijson-jcs `main` (03df9ed). It now formats numbers with `ryu-js`, which implements ECMAScript `Number::toString`, and passes every Appendix B vector (`cargo test --test rfc8785` in ijson-jcs: 5/5). The fix was already upstream, so only the pin needed to move. The lockfile was updated with `cargo update -p ijson-jcs`. ## Validation - **New test `json::tests::numbers_follow_rfc_8785_on_decimal_ties`** pins the vector. It **fails on the old pin** with `left: "1424953923781206.3\n"` and passes on the new one. - `cargo fmt --check`, plus `cargo clippy --locked --all-targets -D warnings` with and without `--all-features`: clean. - `cargo test --locked --all-features`: all suites green (lib: 524 passed). - `cargo audit`: no new advisories; only the four known upstream `unmaintained` warnings remain, tracked as W1/W2 in standards' upstream-dependency watch. - **New transitive dependency:** `ryu-js` 1.0.3, licensed `Apache-2.0 OR BSL-1.0`, which is compatible with MPL-2.0. Existing golden fixtures are unchanged: none of them hold a tie-case float. --- _Generated by [Claude Code](https://claude.ai/code/session_01PFaqv6iBXrt3W5Akd1Fq5k)_ Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0a4159b commit 41966b7

4 files changed

Lines changed: 25 additions & 9 deletions

File tree

‎CHANGELOG.adoc‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
=== [Unreleased]
44

5-
==== Changed — evidence hash is platform-independent
6-
7-
* The attestation evidence hash now feeds `+files_read+` to SHA-256 as an 8-byte
8-
little-endian `+u64+`, like the other counts, instead of a platform-sized
9-
`+usize+`. Hashes are unchanged on 64-bit platforms; 32-bit builds now agree
10-
with them. The computation lives in `+attestation::evidence::evidence_hash+`,
11-
with a known-answer test whose value comes from coreutils `+sha256sum+`.
5+
==== Fixed — JCS numbers on decimal ties
6+
7+
* `+ijson-jcs+` is bumped from 3a9a4ee to 03df9ed, which formats numbers with
8+
`+ryu-js+` (ECMAScript `+Number::toString+`). The old pin printed RFC 8785
9+
Appendix B vector 0x43143ff3c1cb0959 as `+1424953923781206.3+`; JCS requires
10+
`+1424953923781206.2+` (ties to even). Any report or attestation holding such a
11+
float now hashes to the value other JCS implementations compute. A test in
12+
`+crate::json+` pins the vector.
1213

1314
==== Fixed — KYAML keys holding a line separator
1415

‎Cargo.lock‎

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ serde = { version = "1.0", features = ["derive"] }
2929
serde_json = "1.0"
3030
# JCS (RFC 8785) for JSON artefacts: the estate tool behind JSON-POLICY rule
3131
# J-1. Not on crates.io, so pinned to a full commit SHA.
32-
ijson-jcs = { git = "https://github.com/hyperpolymath/ijson-jcs", rev = "3a9a4ee326a968a32b2f152b4faec243a2d00765" }
32+
ijson-jcs = { git = "https://github.com/hyperpolymath/ijson-jcs", rev = "03df9ed20c1a2e1d6d913b8b20cf0874651bb61a" }
3333
# Pure safe-Rust YAML (replaces serde_yaml + unsafe-libyaml, RUSTSEC-2024-0449).
3434
serde-saphyr = "2.0"
3535
regex = "1.10"

‎src/json.rs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ mod tests {
6161
);
6262
}
6363

64+
#[test]
65+
fn numbers_follow_rfc_8785_on_decimal_ties() {
66+
// RFC 8785 Appendix B: binary64 0x43143ff3c1cb0959 must print as
67+
// ECMAScript does, choosing the even digit on a decimal tie.
68+
let tie = f64::from_bits(0x4314_3ff3_c1cb_0959);
69+
assert_eq!(to_canonical_string(&tie).unwrap(), "1424953923781206.2\n");
70+
}
71+
6472
#[test]
6573
fn rejects_integers_outside_i_json_range() {
6674
// I-JSON safe integers: [-(2^53 - 1), 2^53 - 1].

0 commit comments

Comments
 (0)