diff --git a/benchmarks/rust-resource-number-scanner-2026-10-06/model-baking.json b/benchmarks/rust-resource-number-scanner-2026-10-06/model-baking.json new file mode 100644 index 000000000..5e774bb2c --- /dev/null +++ b/benchmarks/rust-resource-number-scanner-2026-10-06/model-baking.json @@ -0,0 +1,47 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_models": 2883, + "graph_fixtures": 440, + "rejected_roots": 1039, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java": "fca267347a21149791a3260826be98df55705208c30396277ef6c3feba875748", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_model_baking_parity.py": "392ffec44918fb91740ca4a1316d684480d39f14bd34d46175f7f44946d15bd7", + "tools/test_cuboid_model_parity.py": "4a8b1cdcac335751c23413341ae939eea1c49c38d33d70d0708b8904ab8d0461", + "tools/test_model_resolution_parity.py": "d9595f2f1442f1f590b72d2a46600657e79ae103bec3d4c45db98242b964bde0", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "fed441cad861a44e9919087307cdb9b3d8165fe36ae05ab03f72dde23758cbd5", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "59caca09dd5afd0b70a2e8fdb8e949deb9322f00adc617918b33d1e7e5b0b522", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "92482e4ff4ca46ff5c11a9618ed5007e205762be6390d91648f95068510f0390", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-model-baking-parity/inputs.jsonl": "aba24d38f4fc1af060502f983923c2f279c016d0fd412d40f6d50093fac1d811" + }, + "rust_output_sha256": "9216be3bbae9e59bb89b6ed780ccedc5608cd4583c8e7527e50b165a0d8d30da", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "9216be3bbae9e59bb89b6ed780ccedc5608cd4583c8e7527e50b165a0d8d30da", + "matched_output_lines": 7100 + } + ], + "scope": "Actual client FaceBakery geometry overload with a real unit-atlas sprite and default JOML math options. Identity blockstate transform, all bundled cuboid geometry and synthetic rotations, rescaling, default/explicit UVs, winding, degenerate and reversed bounds, inherited models and missing materials. Positions, UVs and element matrix coefficients compare by float bits. This does not cover blockstate transforms/UV lock, atlas packing, transparency classification, lighting, GPU rendering or gameplay." +} diff --git a/benchmarks/rust-resource-number-scanner-2026-10-06/model-decoding.json b/benchmarks/rust-resource-number-scanner-2026-10-06/model-decoding.json new file mode 100644 index 000000000..33b99b897 --- /dev/null +++ b/benchmarks/rust-resource-number-scanner-2026-10-06/model-decoding.json @@ -0,0 +1,44 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_models": 2883, + "synthetic_models": 2457, + "rejected_models": 1071, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_cuboid_model_parity.py": "4a8b1cdcac335751c23413341ae939eea1c49c38d33d70d0708b8904ab8d0461", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "fed441cad861a44e9919087307cdb9b3d8165fe36ae05ab03f72dde23758cbd5", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "59caca09dd5afd0b70a2e8fdb8e949deb9322f00adc617918b33d1e7e5b0b522", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "92482e4ff4ca46ff5c11a9618ed5007e205762be6390d91648f95068510f0390", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-cuboid-model-parity/inputs.jsonl": "0b22593eb0dfe0cf3a5fcb01747a6c845319d1f7001234767b45d2d988d7fc67" + }, + "rust_output_sha256": "c60acdc2d44b2385ff2f9e81c60c2cd335357e920d316adedd6119315cb1e151", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "c60acdc2d44b2385ff2f9e81c60c2cd335357e920d316adedd6119315cb1e151", + "matched_output_lines": 5340 + } + ], + "scope": "Actual pinned CuboidModel.fromStream parser compared over every bundled block model and synthetic JSON/numeric/syntax cases. Decoded geometry, texture materials/references, nullable children, inheritance markers, face quadrants, light emission and display transforms; floats compare by IEEE-754 bits. Rejections normalize exception text. This client-only API is absent from the server. Does not yet validate parent resolution, rotation matrices, quad baking, blockstate dispatch, rendered pixels or gameplay." +} diff --git a/benchmarks/rust-resource-number-scanner-2026-10-06/model-resolution.json b/benchmarks/rust-resource-number-scanner-2026-10-06/model-resolution.json new file mode 100644 index 000000000..b479e27f7 --- /dev/null +++ b/benchmarks/rust-resource-number-scanner-2026-10-06/model-resolution.json @@ -0,0 +1,46 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_models": 2883, + "graph_fixtures": 439, + "rejected_cyclic_roots": 702, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelResolutionOracle.java": "bd6581d68c69a96586d158ede8be4f3270d0d7a16288ca82dddab16785685b26", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_model_resolution_parity.py": "d9595f2f1442f1f590b72d2a46600657e79ae103bec3d4c45db98242b964bde0", + "tools/test_cuboid_model_parity.py": "4a8b1cdcac335751c23413341ae939eea1c49c38d33d70d0708b8904ab8d0461", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "fed441cad861a44e9919087307cdb9b3d8165fe36ae05ab03f72dde23758cbd5", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "59caca09dd5afd0b70a2e8fdb8e949deb9322f00adc617918b33d1e7e5b0b522", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "92482e4ff4ca46ff5c11a9618ed5007e205762be6390d91648f95068510f0390", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-model-resolution-parity/inputs.jsonl": "9b3f9cb64bdb84303a3393ab035a00c11e857a5140e2992c0c5ebac0da2d3744" + }, + "rust_output_sha256": "146858eb5c73a16d71bf255bbd21f6082f330df5b322f10a288b4149b2cc98a4", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "146858eb5c73a16d71bf255bbd21f6082f330df5b322f10a288b4149b2cc98a4", + "matched_output_lines": 5648 + } + ], + "scope": "Actual ModelDiscovery and ResolvedModel/TextureSlots APIs over all bundled block models plus synthetic parent/alias graphs. Compares inherited geometry, AO/gui defaults, per-context display transforms, resolved materials, missing-model fallback, ignored built-in override, cyclic parent rejection, long alias/parent chains and slot lookup. Native rejection text/logging and discovery map iteration order are not compared. Geometry is shared through Arc in Rust; this does not prove quad baking, blockstate dispatch, pixels or gameplay." +} diff --git a/benchmarks/rust-resource-number-scanner-2026-10-06/sprite-animation.json b/benchmarks/rust-resource-number-scanner-2026-10-06/sprite-animation.json new file mode 100644 index 000000000..331ab541b --- /dev/null +++ b/benchmarks/rust-resource-number-scanner-2026-10-06/sprite-animation.json @@ -0,0 +1,48 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_animations": 63, + "native_tick_states": 258996, + "fixtures": 907, + "rejected": 203, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSpriteAnimationOracle.java": "90b291abb0b76620f9ca719162393d4fe305ecfb9388d4675d3df89ac1ba136b", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_sprite_animation_parity.py": "ea5961ff5e7770eeec6e91a916fedd3ec72dbf05e87cbeb8a8d2429440407d48", + "tools/test_model_baking_parity.py": "392ffec44918fb91740ca4a1316d684480d39f14bd34d46175f7f44946d15bd7", + "tools/test_cuboid_model_parity.py": "4a8b1cdcac335751c23413341ae939eea1c49c38d33d70d0708b8904ab8d0461", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "fed441cad861a44e9919087307cdb9b3d8165fe36ae05ab03f72dde23758cbd5", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "59caca09dd5afd0b70a2e8fdb8e949deb9322f00adc617918b33d1e7e5b0b522", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "92482e4ff4ca46ff5c11a9618ed5007e205762be6390d91648f95068510f0390", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-sprite-animation-parity/inputs.jsonl": "72ccfab50067a4e578c5ce498e395abfdc55df65c487cea758c1e723cabf4da7" + }, + "rust_output_sha256": "842c6693d75234d93b5623be5f55c2fbe739e94b3ec32241b96c81cd6d81317e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "842c6693d75234d93b5623be5f55c2fbe739e94b3ec32241b96c81cd6d81317e", + "matched_output_lines": 907 + } + ], + "scope": "Actual AnimationMetadataSection JsonOps codec, frame-size calculation, SpriteContents sequence construction and AnimationState ticks. All bundled animated texture metadata plus synthetic numeric, null, invalid, repeated and out-of-image frame cases. Valid image grids only for SpriteContents construction. No resource-loader fallback, image decoding, GPU interpolation pixels, atlas packing or gameplay parity claim." +} diff --git a/crates/horizon-assets/src/animation.rs b/crates/horizon-assets/src/animation.rs index 00d905b74..66f494798 100644 --- a/crates/horizon-assets/src/animation.rs +++ b/crates/horizon-assets/src/animation.rs @@ -21,30 +21,13 @@ fn optional<'a>(object: &Object<'a>, name: &str) -> Option<&'a RawValue> { object.get(name).copied().filter(|v| v.get() != "null") } fn bounded_integer(value: &RawValue, minimum: i32) -> Result { - // JsonReader stops recognizing a number at its buffer limit. Its integer - // scanner also keeps wrapping a negative i64 accumulator after overflow: - // if that accumulator becomes zero, a following digit triggers the same - // rejection as a leading zero. JsonParser then exposes a string, which the - // uncompressed integer codec rejects. - let token = value.get(); - if token.len() >= 1024 { - return Err(error("animation number exceeds native reader buffer")); - } - let mut accumulator = 0i64; - for (index, digit) in token - .trim_start_matches('-') - .bytes() - .take_while(u8::is_ascii_digit) - .enumerate() - { - if index > 0 && accumulator == 0 { - return Err(error( - "native reader classifies animation number as a string", - )); - } - accumulator = accumulator - .wrapping_mul(10) - .wrapping_sub(i64::from(digit - b'0')); + // A lenient JsonParser exposes scanner failures as strings, which the + // uncompressed numeric codec rejects. Model streams instead reject them + // globally, even inside ignored fields. + if !native_number_token(value.get()) { + return Err(error( + "native reader classifies animation number as a string", + )); } let value = integer(value)?; if value < minimum { diff --git a/crates/horizon-assets/src/json.rs b/crates/horizon-assets/src/json.rs index 4f6ed2594..32a90d9f5 100644 --- a/crates/horizon-assets/src/json.rs +++ b/crates/horizon-assets/src/json.rs @@ -20,13 +20,37 @@ pub(crate) type Object<'a> = BTreeMap; pub(crate) fn error(message: &str) -> DecodeError { DecodeError(message.to_owned()) } -/// The native reader recognizes numeric tokens only while they fit its 1024 -/// character lookahead buffer. This applies even in fields the model ignores. +/// Whether a syntactically valid JSON number is classified as numeric by the +/// native reader. Its wrapping i64 scanner can hit zero after overflow, causing +/// the next integer digit to be rejected as if it followed a leading zero. +pub(crate) fn native_number_token(token: &str) -> bool { + if token.len() >= 1024 { + return false; + } + let mut accumulator = 0i64; + for (index, digit) in token + .trim_start_matches('-') + .bytes() + .take_while(u8::is_ascii_digit) + .enumerate() + { + if index > 0 && accumulator == 0 { + return false; + } + accumulator = accumulator + .wrapping_mul(10) + .wrapping_sub(i64::from(digit - b'0')); + } + true +} +/// Strict stream parsing rejects numeric scanner failures everywhere, including +/// ignored fields. Quoted copies of those tokens remain ordinary strings. pub(crate) fn validate_number_tokens(raw: &RawValue) -> Result<()> { + let text = raw.get(); let mut quoted = false; let mut escaped = false; - let mut length = 0; - for byte in raw.get().bytes() { + let mut start = None; + for (index, byte) in text.bytes().enumerate() { if quoted { if escaped { escaped = false; @@ -35,17 +59,25 @@ pub(crate) fn validate_number_tokens(raw: &RawValue) -> Result<()> { } else if byte == b'"' { quoted = false; } - } else if byte == b'"' { - quoted = true; - length = 0; - } else if byte.is_ascii_digit() || b"-.eE+".contains(&byte) { - length += 1; - if length >= 1024 { - return Err(error("numeric token exceeds native reader buffer")); - } - } else { - length = 0; + continue; } + if let Some(begin) = start { + if byte.is_ascii_digit() || b"-.eE+".contains(&byte) { + continue; + } + if !native_number_token(&text[begin..index]) { + return Err(error("native reader rejects numeric token")); + } + start = None; + } + if byte == b'"' { + quoted = true; + } else if byte.is_ascii_digit() || byte == b'-' { + start = Some(index); + } + } + if start.is_some_and(|begin| !native_number_token(&text[begin..])) { + return Err(error("native reader rejects numeric token")); } Ok(()) } diff --git a/docs/native-client.md b/docs/native-client.md index cb9eb6667..4e4ddc78f 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -69,18 +69,25 @@ physical key positions; typing the character W can report physical Escape. The separate `horizon-assets` crate decodes the pinned 26.3 cuboid model format. Its native comparison covers all **2,883 block-model JSON files** in the client -JAR plus **2,337 synthetic cases**: element bounds, optional geometry, nullable +JAR plus **2,457 synthetic cases**: element bounds, optional geometry, nullable children, face UVs and quarter turns, single-axis/Euler rotations, texture references and translucency materials, light emission, display transforms and inheritance markers. Floating-point fields compare by their exact bits. The comparison also covers primitive coercion, integer truncation/wraparound and -selected strict-reader numeric/syntax limits. +selected strict-reader numeric/syntax limits. The numeric scanner also preserves +vanilla's rejection when its wrapping integer accumulator hits zero before +another digit, including in ignored fields. Twenty newly exposed acceptance +mismatches were corrected; the complete comparison now covers 5,340 models. +The [resolution](../benchmarks/rust-resource-number-scanner-2026-10-06/model-resolution.json), +[baking](../benchmarks/rust-resource-number-scanner-2026-10-06/model-baking.json) and +[animation](../benchmarks/rust-resource-number-scanner-2026-10-06/sprite-animation.json) +comparisons also pass with the shared scanner correction. ```sh python3 tools/test_cuboid_model_parity.py ``` -The [archived decoder result](../benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json) +The [archived decoder result](../benchmarks/rust-resource-number-scanner-2026-10-06/model-decoding.json) records source, fixture and reference hashes. The oracle uses actual client classes; those rendering APIs are absent from the server. The decoder, parent resolver and baker now feed the development gallery. Blockstate selection, transformed diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 950e8f0f1..023d83016 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -15,7 +15,7 @@ complete chunk generation, entity behavior, networking, rendering and playable integration remain unfinished. The linked subsystem documents and hashed reports record the exact tested scope and remaining gaps. The `horizon-assets` crate now decodes pinned cuboid models, with all 2,883 bundled -block-model JSON files and 2,337 synthetic cases compared against the actual +block-model JSON files and 2,457 synthetic cases compared against the actual client parser. [Decoder scope and validation](native-client.md#validation) also include parent/texture resolution over 5,648 roots and cuboid baking over 7,100 roots with identity blockstate transforms. Blockstate selection, transformed diff --git a/tools/test_cuboid_model_parity.py b/tools/test_cuboid_model_parity.py index bc0b3da57..8d34eef60 100644 --- a/tools/test_cuboid_model_parity.py +++ b/tools/test_cuboid_model_parity.py @@ -78,11 +78,19 @@ def corpus(): '1e2147483647', '1e2147483648', '1e-2147483648', '1.00000005960464477539062500000001', '1e-46', '-1e-46', '3.5e38', '1e9999', '1e10000', '1e-9999', '1e-10000', '1.0e10000', '1.0e10001', - '1' * 1023, '1' * 1024, '1' * 10000, '1' * 10001] + '1' * 1023, '1' * 1024, '1' * 10000, '1' * 10001, + *('1' + '0' * (n - 2) + '1' for n in [20, 64, 65, 66, 100, 1023, 1024]), + '1844674407370955161601', '-1844674407370955161601', + '18446744073709551616.1', '18446744073709551616e-18'] for number in numbers: for field in ['tintindex', 'rotation', 'texture']: yield '{"elements":[{"from":[0,0,0],"to":[16,16,16],"faces":{"up":{"texture":"#all","' + field + '":' + number + '}}}]}' yield '{"display":{"gui":{"rotation":[' + number + ',0,0],"translation":[' + number + ',0,0],"scale":[' + number + ',0,0]}}}' + # Strict stream parsing rejects scanner failures even in ignored fields; + # quoted copies remain ordinary strings. + for number in numbers: + yield '{"unknown":' + number + '}' + yield '{"unknown":"' + number + '"}' rng = random.Random(0x4355424f4944) for _ in range(1200): modified = copy.deepcopy(element)