From 5d2083b64ccd1be66fe7e0a47055e6546576a26e Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 7 Oct 2026 15:01:56 +0700 Subject: [PATCH] Comp: comp.new / comp.settings no longer advertise an `advanced3D` key (#177) Their params docs wrote the renderer as `renderer? classic3D|advanced3D`. Without a `:`, the doc parser reads `|` as "or another key", so `advanced3D` became an accepted key in the schemas and the unknown-key check: `comp.new {"advanced3D": true}` succeeded and made a Classic 3D comp. The docs now use the value-list form the other commands use, `renderer?: classic3D|advanced3D`. The key is removed rather than implemented: it would only duplicate `renderer` (and could contradict it). A scan of every command's schema found no other key that came from a value list. Test: renderer_values_are_not_parameter_keys (not in the schema, rejected as unknown, `renderer` still works on both commands). Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/commands/comp.rs | 4 ++-- crates/engine/src/tests.rs | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/commands/comp.rs b/crates/engine/src/commands/comp.rs index 8114cb73..a3267fa1 100644 --- a/crates/engine/src/commands/comp.rs +++ b/crates/engine/src/commands/comp.rs @@ -268,7 +268,7 @@ pub fn specs() -> Vec { "New Composition...", ["Composition"], Some("Cmd+N"), - "{name?, width?, height?, frameRate?, duration? (s), startTime? (s) | startTimecode?, background? [r,g,b]|#hex, pixelAspect?, shutterAngle?, shutterPhase?, motionBlurSamples?, adaptiveSampleLimit? (16–256), preserveFrameRate?: bool, preserveResolution?: bool, renderer? classic3D|advanced3D, anchor?, open?}", + "{name?, width?, height?, frameRate?, duration? (s), startTime? (s) | startTimecode?, background? [r,g,b]|#hex, pixelAspect?, shutterAngle?, shutterPhase?, motionBlurSamples?, adaptiveSampleLimit? (16–256), preserveFrameRate?: bool, preserveResolution?: bool, renderer?: classic3D|advanced3D, anchor?, open?}", always, new_comp ), @@ -277,7 +277,7 @@ pub fn specs() -> Vec { "Composition Settings...", ["Composition"], Some("Cmd+K"), - "{comp?, name?, width?, height?, anchor? 0-8 (resize anchor, 4 = center), frameRate?, duration?, startTime? (s) | startTimecode?, background?, shutterAngle?, shutterPhase?, motionBlurSamples?, adaptiveSampleLimit? (16–256), preserveFrameRate?: bool (nested or in the render queue it shows only its own frames), preserveResolution?: bool (nested, it renders at full size), pixelAspect?, renderer? classic3D|advanced3D}", + "{comp?, name?, width?, height?, anchor? 0-8 (resize anchor, 4 = center), frameRate?, duration?, startTime? (s) | startTimecode?, background?, shutterAngle?, shutterPhase?, motionBlurSamples?, adaptiveSampleLimit? (16–256), preserveFrameRate?: bool (nested or in the render queue it shows only its own frames), preserveResolution?: bool (nested, it renders at full size), pixelAspect?, renderer?: classic3D|advanced3D}", has_comp, settings ), diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 93e67a4a..f505b2a5 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -371,6 +371,27 @@ fn comp_settings_anchor_start_timecode_renderer() { assert_eq!(c.renderer, crate::project::Renderer::Advanced3D); } +/// `advanced3D` is a value of `renderer`, not a key: comp.new / comp.settings don't advertise it +/// in their schemas and reject it as unknown instead of ignoring it (#177). +#[test] +fn renderer_values_are_not_parameter_keys() { + let mut s = Session::default(); + for (id, p) in [("comp.new", json!({"name": "A"})), ("comp.settings", json!({}))] { + let spec = crate::command_specs().iter().find(|c| c.id == id).unwrap(); + let keys = crate::commands::accepted_params(spec.params).unwrap(); + assert!(keys.contains(&"renderer".to_string()) && !keys.contains(&"advanced3D".to_string()), "{id}: {keys:?}"); + let mut bad = p.clone(); + bad["advanced3D"] = json!(true); + let e = s.execute_checked(id, bad).unwrap_err().to_string(); + assert!(e.contains("unknown parameter(s) `advanced3D`"), "{id}: {e}"); + let mut good = p; + good["renderer"] = json!("advanced3D"); + s.execute_checked(id, good).unwrap(); + assert_eq!(s.active_comp().unwrap().renderer, crate::project::Renderer::Advanced3D, "{id}"); + s.execute("comp.renderer", json!({"renderer": "classic3d"})).unwrap(); + } +} + #[test] fn comp_rejects_zero_and_negative_frame_rates() { let mut s = Session::default();