diff --git a/pkgs/id/crates/id-core/src/world_limits.rs b/pkgs/id/crates/id-core/src/world_limits.rs index 6136c198a5..cf64aad8f8 100644 --- a/pkgs/id/crates/id-core/src/world_limits.rs +++ b/pkgs/id/crates/id-core/src/world_limits.rs @@ -308,22 +308,17 @@ pub struct WorldExecutionProfile { } impl WorldExecutionProfile { - /// Validate values and resolve them beneath the server's hard limits. + /// Validate the requested bounds on their own. /// - /// A request may lower a bound or inherit it, but can never raise the - /// server ceiling. The Wasm module-size cap is always taken from `hard`. + /// Every bound that is set must be positive and at or above its floor: + /// Wasm memory at least one Wasm page, native address space at least + /// 16 MiB, and every other bound nonzero. A bound left as `None` + /// inherits the server ceiling and is always valid. /// - /// # Errors - /// - /// A requested bound of zero or a value that cannot be represented on - /// this host. - /// Validate the requested bounds on their own: every bound that is set - /// must be positive and at or above its floor. inherits the - /// server ceiling and is always valid. - /// - /// This is the single source of truth for the bound checks: [] - /// runs it against the live profile at apply time, and the world - /// manifest validator runs it at parse time, so a manifest can never + /// This is the single source of truth for the bound checks: + /// [`Self::resolve`] runs it against the live profile at apply time, + /// and the world manifest validator (`WorldManifest::validate`, in the + /// parent `id` crate) runs it at parse time, so a manifest can never /// accept bounds that apply would later refuse (#3015). /// /// # Errors @@ -359,6 +354,21 @@ impl WorldExecutionProfile { Ok(()) } + /// Resolve these requested bounds beneath the server's hard limits. + /// + /// Every bound may lower the server ceiling or inherit it, but never + /// raise it: a set value is clamped to the corresponding `hard` limit + /// and a `None` value takes the ceiling. The Wasm module-size cap is + /// always taken from `hard` (the profile cannot request it). + /// + /// Calls [`Self::validate`] first, so an invalid requested bound is + /// refused here exactly as the world manifest validator refuses it at + /// parse time (#3015). + /// + /// # Errors + /// + /// Propagates [`Self::validate`]'s errors, and fails when a resolved + /// bound cannot be represented on this host. pub fn resolve(self, hard: RuntimeLimits) -> Result { self.validate()?;