From ecd8b2f4db710974d10f101cdc63a40ee952d5e1 Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Sun, 1 Nov 2026 02:01:50 -0600 Subject: [PATCH] id(world-manifest): document module_hash as plain hex, not blake3: The rustdoc claimed the form blake3:, which validate can never accept (71 chars > 64 max, colon is not a hex digit), while the producer, stored state, fixtures and plan() comparisons are all plain hex. Correct the rustdoc to the plain-hex canonical form (1 to 64 hex digits, no prefix) and add a regression test: a full 64-hex module_hash parses; blake3:-prefixed values (short and full-length) are rejected. Fixes #2166 --- pkgs/id/src/world_manifest.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pkgs/id/src/world_manifest.rs b/pkgs/id/src/world_manifest.rs index 03c4cf9a23..98baa61560 100644 --- a/pkgs/id/src/world_manifest.rs +++ b/pkgs/id/src/world_manifest.rs @@ -26,8 +26,9 @@ use crate::world_limits::WorldExecutionProfile; #[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] #[serde(default, rename_all = "snake_case")] pub struct WorldManifest { - /// A content hash of an already-installed module (`blake3:`). Mutually - /// exclusive with `module_source`. + /// A content hash of an already-installed module, encoded as 1 to 64 plain + /// hexadecimal digits (no `blake3:` prefix). Mutually exclusive with + /// `module_source`. pub module_hash: Option, /// A source file or directory to compile on the host before install. /// Mutually exclusive with `module_hash`. @@ -603,6 +604,16 @@ wasm_fuel = 5_000_000 ); } + #[test] + fn module_hash_uses_plain_hex_without_a_blake3_prefix() { + let full_hash = "a".repeat(64); + let manifest = parse(&format!("module_hash = \"{full_hash}\"")).unwrap(); + assert_eq!(manifest.module_hash.as_deref(), Some(full_hash.as_str())); + + assert!(parse("module_hash = \"blake3:abc123\"").is_err()); + assert!(parse(&format!("module_hash = \"blake3:{full_hash}\"")).is_err()); + } + #[test] fn validation_rejects_unknown_names_and_bad_hashes() { assert!(parse("grants = [\"time.nwo\"]").is_err());