Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Agents and scripts: Inspect HDR Source and Save Render Settings with HDR describe their exact parameters and reply (#11761) (#11762)

austin62jake3fde538320cc
diff --git a/crates/engine/src/cmd/render.rs b/crates/engine/src/cmd/render.rs
index 7a1cfcbfa0..acbacd72b9 100644
--- a/crates/engine/src/cmd/render.rs
+++ b/crates/engine/src/cmd/render.rs
@@ -155,9 +155,13 @@ CommandSpec::new("render.library.studio.prepare", "Prepare Authored Studio Light
.params("id: RIG-*; variant: complete for emitter-only rigs, emitters_only for rigs with passive cards; center_mm and subject_extent_mm required. Converts exact rectangular half-edges and solar direction/radius to GPU lighting. Blocked calibration and external-sun rigs refuse. Returns a geometry-clearance review requirement; does not create cards or modify the scene."),
CommandSpec::new("render.library.studio.apply", "Apply Authored Studio Lights", library::apply_studio).icon("settings")
.params("rig: render.library.studio.prepare parameters; name; set?: typed GPU setup patch; replace_lighting_and_environment:true required. Saves the explicit rig projection in one undo, removing prior lighting/environment only with that confirmation. Subject clearance still needs review; passive cards are never silently omitted."),
-CommandSpec::new("render.hdr.inspect", "Inspect HDR Source", resources::inspect).icon("inspect").noundo().doc_only()
+CommandSpec::new("render.hdr.inspect", "Inspect HDR Source", crate::checked!("render.hdr.inspect", resources::inspect)).icon("inspect").noundo().doc_only()
+ .contract(&resources::INSPECT_CONTRACT)
+ .output(crate::schema::output_schema_for::<crate::schema::render_hdr::HdrInspected>)
.params("path: scoped Radiance HDR file; validates the complete bounded source and returns sha256, width, height, encoded_bytes and primaries without saving or rendering"),
-CommandSpec::new("render.settings.capture_hdr", "Save Render Settings with HDR", resources::capture_settings).icon("settings").doc_only()
+CommandSpec::new("render.settings.capture_hdr", "Save Render Settings with HDR", crate::checked!("render.settings.capture_hdr", resources::capture_settings)).icon("settings").doc_only()
+ .contract(&resources::CAPTURE_CONTRACT)
+ .output(crate::schema::output_schema_for::<crate::schema::render_hdr::HdrCaptured>)
.params("name, set: typed CPU/GPU setup patch with hdr/environment unset; path: scoped HDR; expected_sha256?: digest returned by render.hdr.inspect (changed sources refuse); rotation_rad?:0, intensity?:1; samples?:1/4/16/64 for CPU only (default16); assume_linear_srgb?:false for GPU only. Captures immutable bytes and saves resource plus setup atomically in one undo, without a host; returns name/setup/resource metadata, never source bytes"),
CommandSpec::new("render.preflight", "Check Render Request", jobs::preflight).icon("inspect").noundo().doc_only()
.params("setup?: saved name OR settings?: full RenderSetup. A typed job selects raster/cpu_raytrace/gpu_path and its numerical options plus embedded HDR before dispatch; only replace and transient studio_weights may accompany it. Without job, the legacy runtime controls below remain available. See docs/render-settings.md. studio_weights?: three finite 0..1 visibility weights for raster or implicit GPU studio sources only; never saved. integrator?: raster (default) or raytrace; progressive?: false (registered GPU path, CPU integrator/LED options are mutually exclusive); samples?: 1..4096; max_depth?: 1..16; seed?: u32 for progressive; raytrace?: bounded runtime progressive/primary_samples/lights/punctual_lights/area_lights/area_samples/seed/exposure_ev/shadows/reflections/anisotropic_faces/emissions/surface_effects/dielectrics/environment options, only with raytrace. CPU raytrace.budget?: compact (legacy default), studio or workstation; see docs/render-cpu-resource-profiles.md for explicit image/geometry/memory/work limits. CPU raytrace.progressive?: {samples_per_pixel:1..profile limit, seed:u32}; requires primary_samples:1 and selected reflections.samples:1; no area/LED, anisotropy or dielectrics in this initial mode. See docs/render-cpu-progressive.md; environment?: {path: scoped HDR, expected_sha256?: inspected digest, rotation_radians: 0, intensity: 1, samples: 16} OR {resource: saved HDR digest, rotation_radians, intensity, samples}; embedded resources cannot combine with path/hash; explicit sRGB/D65 HDR primaries required. Opaque CPU preview with selected mirror/rough-specular reflections and certified planar anisotropy. HDR with rough reflections or anisotropy requires fully metallic selected bodies and all effective faces; unsupported combinations refuse. No MIS or GI. CPU runtime dielectrics support only certified thin_sheet/closed_box boundaries with explicit IOR and Beer absorption; see docs/render-raytrace-dielectrics.md. CPU emissions are visible radiance only; surface_effects change roughness/shading normals without geometry changes. led_strip?: continuous world-mm LED rectangle recipe; led_samples?: 1/4/16/64 for the whole strip, default16. At most8directional+8punctual+4rectangle/LED sources; shared area N. See docs/render-light-union.md. transparent_background?: false; replace?: false. With progressive:true, raytrace instead accepts GPU dielectrics/clear_coats/textures; environment instead accepts tagged hdr/embedded_hdr/sky with rotation_rad/intensity; file hdr supports expected_sha256, embedded_hdr uses a document resource digest. See docs/render-hdr-resources.md. GPU lens, studio lighting, tone_map, denoise, bounded finishing/backdrop and linear_exr retention are also available. GPU adaptive?: {pilot_samples:16..256,min_samples:16..samples,relative_error:0..1,absolute_error:0.000001..1000000,coverage_error:0.001..0.25} allocates independent production budgets; pilots are discarded, not a certified error guarantee. transmission_samples?:1|2|4 stratifies the first Fresnel branch with extra path cost. volume?:{min_mm:[x,y,z],max_mm:[x,y,z],extinction_per_mm:0..1000,scattering_albedo:[r,g,b],anisotropy:-0.95..0.95} is one finite homogeneous world-mm medium; active media require explicit lighting/environment and refuse glass, denoise and multiple transmission strata. These fields also persist in GPU job.options. See docs/render-materials/TRANSPORT-MASTER-BATCH-2026-10-23.md; see docs/render-transmission.md, render-environment.md, render-runtime-textures.md, render-thin-lens.md, render-studio-lighting.md and render-denoise.md. Optional CPU raytracing requires a raytrace-cpu build and native host, checked before scene capture. Stale geometry is rejected. See docs/render-jobs.md"),
diff --git a/crates/engine/src/cmd/render/resources.rs b/crates/engine/src/cmd/render/resources.rs
index 19e637ffab..c579a53b3e 100644
--- a/crates/engine/src/cmd/render/resources.rs
+++ b/crates/engine/src/cmd/render/resources.rs
@@ -2,42 +2,18 @@
use std::sync::Arc;
-use serde::Deserialize;
-use serde_json::{Value, json};
+use serde_json::Value;
use solidcraft_doc::{
render_resources::{CpuHdrEnvironment, GpuHdrEnvironment, HdrId, HdrResource},
render_settings::RenderJob,
};
+use crate::schema::TypedContract;
+use crate::schema::render_hdr::{HdrCaptureParams, HdrCaptured, HdrInspectParams, HdrInspected, HdrSourceInfo};
use crate::{Result, Session, params::bad};
-fn unit() -> f64 {
- 1.0
-}
-
-#[derive(Deserialize)]
-#[serde(deny_unknown_fields)]
-struct Inspect {
- path: String,
-}
-
-#[derive(Deserialize)]
-#[serde(deny_unknown_fields)]
-struct Capture {
- name: String,
- set: Value,
- path: String,
- #[serde(default)]
- expected_sha256: Option<HdrId>,
- #[serde(default)]
- rotation_rad: f64,
- #[serde(default = "unit")]
- intensity: f64,
- #[serde(default)]
- samples: Option<u32>,
- #[serde(default)]
- assume_linear_srgb: Option<bool>,
-}
+pub(super) const INSPECT_CONTRACT: TypedContract<HdrInspectParams> = TypedContract::new();
+pub(super) const CAPTURE_CONTRACT: TypedContract<HdrCaptureParams> = TypedContract::new();
fn capture(path: &str, expected: Option<HdrId>, command: &str) -> Result<HdrResource> {
if path.is_empty() || path.len() > 4096 || path.chars().any(char::is_control) {
@@ -50,20 +26,28 @@ fn capture(path: &str, expected: Option<HdrId>, command: &str) -> Result<HdrReso
HdrResource::new(bytes).map_err(|e| bad(command, e.to_string()))
}
-fn metadata(resource: &HdrResource) -> Value {
+/// What both commands report about an HDR source.
+fn metadata(resource: &HdrResource) -> HdrSourceInfo {
let info = resource.info();
- json!({"sha256":resource.id(),"width":info.width,"height":info.height,"encoded_bytes":info.encoded_bytes,"primaries":info.primaries})
+ HdrSourceInfo {
+ sha256: resource.id().to_string(),
+ width: info.width,
+ height: info.height,
+ encoded_bytes: info.encoded_bytes,
+ primaries: info.primaries,
+ }
}
pub(super) fn inspect(_s: &mut Session, params: &Value) -> Result<Value> {
let command = "render.hdr.inspect";
- let input: Inspect = serde_json::from_value(params.clone()).map_err(|e| bad(command, e.to_string()))?;
- capture(&input.path, None, command).map(|source| metadata(&source))
+ let input: HdrInspectParams = serde_json::from_value(params.clone()).map_err(|e| bad(command, e.to_string()))?;
+ let source = metadata(&capture(&input.path, None, command)?);
+ serde_json::to_value(HdrInspected { source, param_warnings: Vec::new() }).map_err(|e| bad(command, e.to_string()))
}
pub(super) fn capture_settings(s: &mut Session, params: &Value) -> Result<Value> {
let command = "render.settings.capture_hdr";
- let input: Capture = serde_json::from_value(params.clone()).map_err(|e| bad(command, e.to_string()))?;
+ let input: HdrCaptureParams = serde_json::from_value(params.clone()).map_err(|e| bad(command, e.to_string()))?;
let mut setup = super::patched_settings(s, &input.name, &input.set, command)?;
// Every numerical and method-dependent rejection happens before touching the source.
match &setup.job {
@@ -109,8 +93,11 @@ pub(super) fn capture_settings(s: &mut Session, params: &Value) -> Result<Value>
}
settings.setups.insert(input.name.clone(), setup.clone());
settings.validate().map_err(|e| bad(command, e.to_string()))?;
+ // Serialized before the document changes, so a setup that can't be written leaves it as it was.
+ let setup = serde_json::to_value(&setup).map_err(|e| bad(command, e.to_string()))?;
if settings != *s.doc.render {
s.doc_mut().render = Arc::new(settings);
}
- Ok(json!({"name":input.name,"setup":setup,"resource":info}))
+ let reply = HdrCaptured { name: input.name, setup, resource: info, param_warnings: Vec::new() };
+ serde_json::to_value(reply).map_err(|e| bad(command, e.to_string()))
}
diff --git a/crates/engine/src/schema/mod.rs b/crates/engine/src/schema/mod.rs
index e352ed0b35..fff9aca88f 100644
--- a/crates/engine/src/schema/mod.rs
+++ b/crates/engine/src/schema/mod.rs
@@ -78,6 +78,7 @@ pub mod parameter_sweep;
pub mod parts;
pub mod print_face;
pub mod render;
+pub mod render_hdr;
pub mod render_library;
pub mod render_lights;
pub mod render_shots;
diff --git a/crates/engine/src/schema/render_hdr.rs b/crates/engine/src/schema/render_hdr.rs
new file mode 100644
index 0000000000..f35885ad5f
--- /dev/null
+++ b/crates/engine/src/schema/render_hdr.rs
@@ -0,0 +1,149 @@
+//! Contracts and result types for the HDR environment commands in `cmd/render/resources.rs`
+//! (#11761): check an HDR file, and copy it into a render setup. The handlers read these same
+//! parameter types, so each contract is exactly what its handler takes; like the handlers, a
+//! contract refuses unknown keys.
+//!
+//! `expected_sha256` is the doc crate's `HdrId`, which has no `JsonSchema` (the doc crate
+//! doesn't depend on schemars), so its schema is written here by hand.
+
+use schemars::{JsonSchema, Schema, SchemaGenerator, json_schema};
+use serde::{Deserialize, Serialize};
+use serde_json::Value;
+use solidcraft_doc::render_resources::HdrId;
+
+fn one() -> f64 {
+ 1.0
+}
+
+/// An HDR file's SHA-256, as `render.hdr.inspect` gives it: 64 lowercase hex digits.
+fn digest_schema(_: &mut SchemaGenerator) -> Schema {
+ json_schema!({
+ "description": "The file's SHA-256 as `render.hdr.inspect` gave it: 64 lowercase hex digits. A file whose bytes changed since is refused, so the saved setup uses the file the caller checked. Default: no check.",
+ "type": ["string", "null"],
+ "pattern": "^[0-9a-f]{64}$"
+ })
+}
+
+/// The fields of a render setup, as `render.settings.get` gives them. A `set` patch may give up
+/// to 13 of them; `patched_settings` reads the patched setup as a `RenderSetup`, which refuses any
+/// other key.
+const SETUP_FIELDS: &[&str] = &[
+ "backend",
+ "mode",
+ "camera",
+ "width",
+ "height",
+ "format",
+ "exposure_ev",
+ "environment_rotation",
+ "environment_intensity",
+ "background",
+ "job",
+ "surfaces",
+ "optics",
+ "stage",
+];
+
+/// Each setup field, without its own schema: `patched_settings` checks the values.
+fn setup_properties() -> serde_json::Map<String, Value> {
+ SETUP_FIELDS.iter().map(|field| (field.to_string(), Value::Object(serde_json::Map::new()))).collect()
+}
+
+/// `set`: changes to the setup, as `render.settings.set` takes them. `patched_settings` in
+/// `cmd/render.rs` refuses anything but an object of at most 13 setup fields, with its own
+/// message.
+fn set_schema(_: &mut SchemaGenerator) -> Schema {
+ json_schema!({
+ "description": "Changes to the setup the HDR is saved into, as `render.settings.set` takes them: at most 13 of the setup's fields. The setup they make (a saved one keeps the fields left out) must have a `job` with method `cpu_raytrace` or `gpu_path`, without an `hdr` or an `environment`.",
+ "type": "object",
+ "properties": setup_properties(),
+ "additionalProperties": false,
+ "maxProperties": 13
+ })
+}
+
+/// Read an HDR file and check it: its size in pixels, its byte count, its SHA-256 and the colour
+/// primaries it declares. Nothing is saved, and the design doesn't change.
+#[derive(Debug, Deserialize, JsonSchema)]
+#[serde(deny_unknown_fields)]
+pub struct HdrInspectParams {
+ /// The HDR file, in a folder the session may read: 1 to 4096 bytes, without control
+ /// characters. At most 16 MiB.
+ pub path: String,
+}
+
+/// Copy an HDR file's bytes into the design and save a render setup that lights the product with
+/// them, in one undo step. The design keeps the bytes, so the setup still renders when the file
+/// is gone. No render device is needed.
+#[derive(Debug, Deserialize, JsonSchema)]
+#[serde(deny_unknown_fields)]
+pub struct HdrCaptureParams {
+ /// The render setup, saved or new.
+ pub name: String,
+ #[schemars(schema_with = "set_schema")]
+ pub set: Value,
+ /// The HDR file, as `render.hdr.inspect` takes it.
+ pub path: String,
+ #[serde(default)]
+ #[schemars(schema_with = "digest_schema")]
+ pub expected_sha256: Option<HdrId>,
+ /// The environment's turn about the up axis (radians): at most 1000000 in size. Default: 0.
+ #[serde(default)]
+ pub rotation_rad: f64,
+ /// How bright the environment is, linear: 0 to 64 for the CPU raytracer, 0 to 100 for the GPU
+ /// path tracer. Default: 1.
+ #[serde(default = "one")]
+ pub intensity: f64,
+ /// The CPU raytracer's environment samples: 1, 4, 16 or 64. Default: 16. Refused for the GPU
+ /// path tracer, even as `null`.
+ #[serde(default)]
+ pub samples: Option<u32>,
+ /// The GPU path tracer only: treat a file that declares no primaries as linear sRGB. Default:
+ /// false. Refused for the CPU raytracer, even as `null`; the CPU raytracer needs primaries the
+ /// file declares.
+ #[serde(default)]
+ pub assume_linear_srgb: Option<bool>,
+}
+
+/// An HDR file as `render.hdr.inspect` reads it, and as `render.settings.capture_hdr` saves it.
+#[derive(Debug, Serialize, JsonSchema)]
+pub struct HdrSourceInfo {
+ /// Its SHA-256: 64 lowercase hex digits.
+ pub sha256: String,
+ /// Its size in pixels.
+ pub width: u32,
+ pub height: u32,
+ /// The file's size in bytes.
+ pub encoded_bytes: u64,
+ /// The colour primaries the file declares (Rx, Ry, Gx, Gy, Bx, By, Wx, Wy); `null` when it
+ /// declares none.
+ pub primaries: Option<[f64; 8]>,
+}
+
+/// What `render.hdr.inspect` returns: the file's [`HdrSourceInfo`] at the top level.
+#[derive(Debug, Serialize, JsonSchema)]
+pub struct HdrInspected {
+ #[serde(flatten)]
+ pub source: HdrSourceInfo,
+ /// In the warn parameter-check mode: what the call's parameters got wrong.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ pub param_warnings: Vec<String>,
+}
+
+/// What `render.settings.capture_hdr` returns.
+#[derive(Debug, Serialize, JsonSchema)]
+pub struct HdrCaptured {
+ /// The render setup.
+ pub name: String,
+ /// The setup as saved, as the render settings commands give it, with its `hdr` set.
+ pub setup: Value,
+ /// The HDR the design now keeps.
+ pub resource: HdrSourceInfo,
+ /// In the warn parameter-check mode: what the call's parameters got wrong.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ pub param_warnings: Vec<String>,
+}
+
+#[cfg(test)]
+#[path = "render_hdr_tests.rs"]
+mod tests;
diff --git a/crates/engine/src/schema/render_hdr_tests.rs b/crates/engine/src/schema/render_hdr_tests.rs
new file mode 100644
index 0000000000..87d4402ab5
--- /dev/null
+++ b/crates/engine/src/schema/render_hdr_tests.rs
@@ -0,0 +1,136 @@
+use serde_json::{Value, json};
+
+use super::{HdrCaptureParams, HdrCaptured, HdrInspectParams, HdrInspected};
+use crate::Session;
+use crate::schema::tests::{assert_keys, conforms};
+use crate::schema::{ParamCheck, input_schema_for, output_schema_for};
+
+/// A small HDR file in the temporary folder, removed when dropped: 4 × 2 pixels with declared
+/// sRGB/D65 primaries, which both renderers accept. `bytes` replaces its content.
+struct HdrFile(String);
+
+impl HdrFile {
+ fn new(name: &str, bytes: Option<&[u8]>) -> Self {
+ let path = std::env::temp_dir().join(format!("solidcraft-hdr-schema-{}-{name}.hdr", std::process::id()));
+ let mut hdr = b"#?RADIANCE\nFORMAT=32-bit_rle_rgbe\nPRIMARIES=0.64 0.33 0.30 0.60 0.15 0.06 0.3127 0.3290\n\n-Y 2 +X 4\n".to_vec();
+ hdr.extend([128, 64, 32, 129].repeat(8));
+ std::fs::write(&path, bytes.unwrap_or(&hdr)).unwrap_or_else(|e| panic!("{e}"));
+ HdrFile(path.to_string_lossy().into_owned())
+ }
+}
+
+impl Drop for HdrFile {
+ fn drop(&mut self) {
+ let _ = std::fs::remove_file(&self.0);
+ }
+}
+
+/// A design with two saved render setups, `Gpu` (the GPU path tracer) and `Cpu` (the CPU
+/// raytracer), at the parameter-check level `level`.
+fn with_setups(level: ParamCheck) -> Session {
+ let mut s = Session { param_check: level, ..Session::default() };
+ for (name, job) in [("Gpu", json!({"method": "gpu_path"})), ("Cpu", json!({"method": "cpu_raytrace", "options": {"budget": "studio"}}))] {
+ let p = json!({"name": name, "set": {"job": job}});
+ s.execute("render.settings.set", &p).unwrap_or_else(|e| panic!("{p}: {e}"));
+ }
+ s
+}
+
+/// The `set` of a capture: the saved setup `name` as `render.settings.set` gives its job.
+fn job_of(name: &str) -> Value {
+ if name == "Gpu" { json!({"job": {"method": "gpu_path"}}) } else { json!({"job": {"method": "cpu_raytrace", "options": {"budget": "studio"}}}) }
+}
+
+#[test]
+fn schemas_and_the_key_check_agree() {
+ assert_keys(input_schema_for::<HdrInspectParams>(), &["path"]);
+ assert_keys(
+ input_schema_for::<HdrCaptureParams>(),
+ &["assume_linear_srgb", "expected_sha256", "intensity", "name", "path", "rotation_rad", "samples", "set"],
+ );
+}
+
+/// The handlers refuse these calls after reading them; strict refuses them with their message.
+/// They need an HDR file and saved setups, so the shared helper doesn't fit.
+#[test]
+fn strict_keeps_todays_errors() {
+ let hdr = HdrFile::new("strict", None);
+ let not_hdr = HdrFile::new("strict-not-hdr", Some(b"not an HDR file"));
+ let missing = hdr.0.replace("strict", "strict-missing");
+ let capture = |name: &str, extra: Value| {
+ let mut p = json!({"name": name, "set": job_of(name), "path": hdr.0});
+ if let (Some(p), Some(extra)) = (p.as_object_mut(), extra.as_object()) {
+ p.extend(extra.clone());
+ }
+ p
+ };
+ let cases = [
+ ("render.hdr.inspect", json!({"path": ""})),
+ ("render.hdr.inspect", json!({"path": missing})),
+ ("render.hdr.inspect", json!({"path": not_hdr.0})),
+ ("render.settings.capture_hdr", json!({"name": "Raster", "set": {}, "path": hdr.0})),
+ ("render.settings.capture_hdr", json!({"name": "Gpu", "set": 5, "path": hdr.0})),
+ ("render.settings.capture_hdr", json!({"name": " Gpu", "set": {}, "path": hdr.0})),
+ ("render.settings.capture_hdr", capture("Gpu", json!({"samples": 16}))),
+ ("render.settings.capture_hdr", capture("Gpu", json!({"intensity": 200}))),
+ ("render.settings.capture_hdr", capture("Gpu", json!({"rotation_rad": 2e6}))),
+ ("render.settings.capture_hdr", capture("Gpu", json!({"expected_sha256": "0".repeat(64)}))),
+ // Only the key's presence matters to the handler: `null` is refused like `false`.
+ ("render.settings.capture_hdr", capture("Cpu", json!({"assume_linear_srgb": null}))),
+ ("render.settings.capture_hdr", capture("Cpu", json!({"samples": 5}))),
+ ("render.settings.capture_hdr", capture("Cpu", json!({"intensity": 65}))),
+ ];
+ for (id, p) in &cases {
+ let error = |level: ParamCheck| with_setups(level).execute(id, p).err().map(|e| e.to_string());
+ let off = error(ParamCheck::Off);
+ assert!(off.is_some(), "{id} {p} should fail today");
+ assert_eq!(error(ParamCheck::Strict), off, "{id} {p}");
+ }
+}
+
+/// #11761: inspecting an HDR file and capturing it into a GPU and a CPU setup reply as the
+/// output schemas say, in Warn without warnings. Like the handlers, warn and strict refuse a
+/// misspelt key.
+#[test]
+fn hdr_commands_reply_with_their_schemas() {
+ let (inspected, captured) = (output_schema_for::<HdrInspected>(), output_schema_for::<HdrCaptured>());
+ let hdr = HdrFile::new("replies", None);
+ let mut s = with_setups(ParamCheck::Warn);
+ let run = |s: &mut Session, schema: &schemars::Schema, id: &str, p: Value| {
+ let r = s.execute(id, &p).unwrap_or_else(|e| panic!("{id} {p}: {e}"));
+ let schema = schema.as_value();
+ assert!(conforms(schema, schema, &r), "{r} doesn't match {schema}");
+ assert!(r.get("param_warnings").is_none(), "{r}");
+ r
+ };
+ let info = run(&mut s, &inspected, "render.hdr.inspect", json!({"path": hdr.0}));
+ assert_eq!((info["width"].as_u64(), info["height"].as_u64()), (Some(4), Some(2)), "{info}");
+ let gpu = json!({"name": "Gpu", "set": job_of("Gpu"), "path": hdr.0, "expected_sha256": info["sha256"],
+ "rotation_rad": -0.25, "intensity": 2.5, "assume_linear_srgb": false});
+ let r = run(&mut s, &captured, "render.settings.capture_hdr", gpu);
+ assert_eq!(r["resource"]["sha256"], info["sha256"], "{r}");
+ let cpu = json!({"name": "Cpu", "set": job_of("Cpu"), "path": hdr.0, "samples": 4, "expected_sha256": null});
+ run(&mut s, &captured, "render.settings.capture_hdr", cpu);
+ for level in [ParamCheck::Warn, ParamCheck::Strict] {
+ let p = json!({"path": hdr.0, "pth": hdr.0});
+ let error = with_setups(level).execute("render.hdr.inspect", &p).err().map(|e| e.to_string()).unwrap_or_default();
+ assert!(error.contains("`pth`"), "{level:?}: {error}");
+ }
+}
+
+/// `set` names the render setup's fields: `patched_settings` reads the patched setup as a
+/// `RenderSetup`, which refuses any other key, so the schema refuses a misspelt one too (and
+/// more than 13 at once).
+#[test]
+fn the_set_schema_names_the_setup_fields() {
+ let root = input_schema_for::<HdrCaptureParams>();
+ let root = root.as_value();
+ let set = &root["properties"]["set"];
+ for (patch, takes) in
+ [(json!({}), true), (json!({"width": 640, "height": 480, "job": {"method": "gpu_path"}}), true), (json!({"widht": 640}), false)]
+ {
+ assert_eq!(conforms(root, set, &patch), takes, "{patch}");
+ }
+ // `conforms` doesn't read `maxProperties`, so the limit is pinned here.
+ assert_eq!((set["maxProperties"].as_u64(), set["properties"].as_object().map(|p| p.len())), (Some(13), Some(super::SETUP_FIELDS.len())), "{set}");
+}
diff --git a/crates/engine/src/schema/unconverted.txt b/crates/engine/src/schema/unconverted.txt
index 4372312dd1..81243679d3 100644
--- a/crates/engine/src/schema/unconverted.txt
+++ b/crates/engine/src/schema/unconverted.txt
@@ -135,7 +135,6 @@ render.camera.set
render.cancel
render.effects.describe
render.export
-render.hdr.inspect
render.library.appearance.apply
render.library.environment.apply
render.library.physical.prepare
@@ -154,7 +153,6 @@ render.result.pin
render.result.regrade
render.scene
render.settings.apply
-render.settings.capture_hdr
render.settings.get
render.settings.set
render.start