Skip to content

Blends, meshes and envelopes: a number given as text is refused - #2851

Merged
bflatastic merged 1 commit into
storytold:mainfrom
dotCooCoo:fix/live-commands-refuse-text-numbers
Oct 18, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
dotCooCoo:fix/live-commands-refuse-text-numbers

Conversation

@dotCooCoo

Copy link
Copy Markdown
Contributor

What and why

On main, the blend, envelope and gradient mesh commands read their optional numbers with f64_or or as_f64, which fall back to a default for a value that is not a JSON number. object.blend.make {"steps": "8"} makes a Smooth Color blend and reports success, and object.mesh.create {"rows": "3"} makes a mesh of 4 rows.

  • object.blend.make and object.blend.options (steps, distance, value), object.envelope.makeWithWarp, resetWithWarp and options (bend, h, v, horizontalDistortion, verticalDistortion), object.envelope.makeWithMesh, resetWithMesh and object.mesh.create (rows, cols, columns), object.envelope.options (fidelity), object.mesh.create (highlight) and object.mesh.setPointColor (opacity) fail with "<key> must be a number, not " for a value that is not a number or null, as the transform commands do since Transform commands: a string for an optional number is an error (#1952) #1967 (check_numbers, crates/engine/src/cmd/mod.rs:317). The document, the undo history and the options new blends and envelopes start with stay as they were.
  • object.envelope.options refuses the warp keys whether or not a warp envelope is selected.
  • object.mesh.create refuses an at that is not exactly two numbers with "at must be [x, y]", the message text.thread.add uses. Before, it took the first two entries of a longer array, and for any other value it made a mesh with no lines through the point.
  • docs/mcp.md lists the keys, and docs/target-app-parity.md has one line for the change. The 17 catalogs that translate every status and error message, and bg, already have a row for "at must be [x, y]"; the change adds no catalog rows.

How it was tested

New tests in tests_live (vectorcraft-engine), each failing on main, where the first call succeeds:

  • blend_make_refuses_a_number_given_as_text gives steps, distance and value as strings, an array or true; no blend is made, and steps: 8 still makes 8 steps.
  • blend_options_refuse_a_number_given_as_text: the selected blend and the options new blends start with keep their spacing.
  • envelope_make_with_warp_refuses_a_number_given_as_text and envelope_reset_with_warp_refuses_a_number_given_as_text give each warp key as text, by its short and long name.
  • envelope_make_with_mesh_refuses_a_number_given_as_text and envelope_reset_with_mesh_refuses_a_number_given_as_text give rows, cols and columns as text.
  • envelope_options_refuse_a_number_given_as_text gives fidelity and the warp keys as text, with an envelope selected and with none.
  • mesh_create_refuses_a_number_given_as_text gives rows, cols, columns and highlight as text, and four at values that are not [x, y].
  • mesh_set_point_color_refuses_an_opacity_given_as_text gives opacity as text with and without color; the point keeps its color and opacity.

Targeted checks while building: cargo clippy -p vectorcraft-engine --all-targets -- -D warnings; cargo test -p vectorcraft-engine --lib and --test command_sweep; cargo fmt --all -- --check; cargo xtask brands, layers and assets.

On Windows 11 (x86-64) with rustc 1.99.1, on top of main at 299a4b3:

git merge-tree reports no conflicts with main at 299a4b3 or at 5e68106, or with #2812 and #2829, which also change crates/engine/src/cmd/live.rs. #2539 also changes live.rs and merges with this branch there; its conflicts with main in five other files are the same with or without this branch. cargo check -p vectorcraft-engine --tests passes on the branch merged with each of the three.

Checklist

  • cargo xtask ci passes (fmt, clippy, tests, assets, brands, layers, wasm).
  • No panics in shipped code: no unwrap(), expect(), panic!, unreachable!, todo! or
    unimplemented! outside tests, and no unchecked indexing on data from files, parameters or
    messages. Errors are returned as Result and shown to the user
    (why and how).
  • Clean-room: nothing copied from Adobe products or GPL/AGPL code (AGENTS.md).
  • Every new asset has a row in ASSETS.md.

The blend, envelope and gradient mesh commands read their optional
numbers with f64_or or as_f64, which fall back to a default for a value
that is not a JSON number. object.blend.make {"steps": "8"} made a
Smooth Color blend and reported success. Blend Options did the same
with steps, distance and value. Make with Warp, Reset with Warp and
Envelope Options did the same with bend, h and v (and their long
names). Make with Mesh, Reset with Mesh and Create Gradient Mesh did
the same with rows, cols and columns. Envelope Options did the same
with fidelity, Create Gradient Mesh did the same with highlight, and
Set Mesh Point Color did the same with opacity.

These commands now fail with "`<key>` must be a number, not <value>"
for a value that is not a number or null, as the transform commands
do, and change nothing. Envelope Options refuses the warp keys whether
or not a warp envelope is selected. Create Gradient Mesh refuses an
`at` that is not exactly two numbers with "`at` must be [x, y]".
Before, it took the first two entries of a longer array, and for any
other value it made a mesh with no lines through the point.

Docs: docs/mcp.md, docs/target-app-parity.md.
@bflatastic
bflatastic force-pushed the fix/live-commands-refuse-text-numbers branch from e0cff05 to d8b0ce1 Compare October 18, 2026 06:25
@bflatastic
bflatastic merged commit 14d1667 into storytold:main Oct 18, 2026
2 of 5 checks passed
@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 47927d85-6f4f-4009-a8f5-e7c9146e9ab1
📥 Commits

Reviewing files that changed from the base of the PR and between 5a25105 and d8b0ce1.

📒 Files selected for processing: 4
  • crates/engine/src/cmd/live.rs
  • crates/engine/src/tests_live.rs
  • docs/mcp.md
  • docs/target-app-parity.md
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
| Don't be a slave to formal methods. Don't blindly adopt any technique without putting it into the context of your development practices and capabilities. |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@bflatastic

Copy link
Copy Markdown
Member

Thanks @dotCooCoo, merged. It went through the full gate (fmt, clippy, tests, layers, wasm) in a batch with the other PRs landed today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants