Skip to content

Blends and envelopes: a boolean given as text is refused - #3290

Open
dotCooCoo wants to merge 1 commit into
storytold:mainfrom
dotCooCoo:fix/live-commands-refuse-booleans-as-text
Open

dotCooCoo wants to merge 1 commit into
storytold:mainfrom
dotCooCoo:fix/live-commands-refuse-booleans-as-text

Conversation

@dotCooCoo

@dotCooCoo dotCooCoo commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What and why

On main, the blend and envelope commands read their on/off params with bool_or, which falls back to a default or the current value for a value that is not true or false. object.envelope.editContents {"editing": "false"} turns Edit Contents on, and object.envelope.options {"antiAlias": "false"} leaves Anti-Alias on. Each call reports success. The reference app's envelope page says "Select Maintain Envelope Shape to keep the warp shape intact" for Reset With Mesh, and "Deselecting Anti-Alias can decrease the time it takes to distort rasters" under Envelope options (Reshape using envelopes).

  • object.blend.make and object.blend.options (smooth), object.blend.spine.moveAnchor (independent), object.blend.spine.reshapeSegment (perpendicular), object.envelope.makeWithWarp, resetWithWarp and options (horizontal), object.envelope.resetWithMesh (maintainShape), object.envelope.options (antiAlias, distortAppearance, distortLinearGradients, distortPatternFills) and object.envelope.editContents (editing) fail with "<key> must be true or false" for a value that is not true, false or null, the message the grid and overprint commands give (crates/engine/src/cmd/create.rs:423, overprint.rs:124). The document, the undo history and the options new blends and envelopes start with stay as they were. A null is read as a key left out.
  • Make and Blend Options refuse such a smooth also beside steps or distance. The warp commands refuse such a horizontal also beside an orientation, and Envelope Options refuses it whether or not a warp envelope is selected.
  • docs/mcp.md lists the keys, and docs/target-app-parity.md has one line for the change. The true-or-false message already has a row in every complete catalog. The change adds no new message text and no catalog rows.

How it was tested

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

  • tests_live::blend_make_and_options_refuse_a_smooth_given_as_text gives smooth as strings, a number or an array, alone and beside steps; no blend is made, the selected blend and the options new blends start with keep their spacing, and smooth: true still sets Smooth Color.
  • tests_blendspine::spine_edits_refuse_a_boolean_given_as_text gives independent and perpendicular as a string, a number or an array; the blend stays as it was, and a handle moved with a null independent leaves the point smooth.
  • tests_live::envelope_make_and_reset_refuse_a_boolean_given_as_text gives horizontal as text or a number, also beside an orientation, to Make with Warp and Reset with Warp, and maintainShape to Reset with Mesh; no envelope is made and the warp envelope keeps its warp, and horizontal: false and a null maintainShape still work.
  • tests_live::envelope_options_refuse_a_boolean_given_as_text gives each Anti-Alias and Distort flag and horizontal as text, a number or an array, with a warp envelope, a mesh envelope and nothing selected; none of them changes, and antiAlias: false beside a null distortAppearance and horizontal still works.
  • tests_live::envelope_edit_contents_refuses_editing_given_as_text gives editing as "true", "false", 1 and an array; the envelope, the selection and the undo history stay as they were, and a null editing turns Edit Contents on.

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 bc1ae08:

  • CRAFT_FONTS_DIR=<craft-fonts checkout> cargo xtask ci passes its 10 steps: 8,575 tests passed, 0 failed, 13 ignored.

git merge-tree reports no conflicts with main at bc1ae08. #3266 (crates/engine/src/cmd/live.rs, tests_blendspine.rs) and #2539 (live.rs) also change these files and merge with this branch there; cargo check -p vectorcraft-engine --tests passes on the branch merged with each.

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.

Summary by CodeRabbit

  • Bug Fixes

    • Blend and envelope commands now reject non-boolean option values with clear command errors.
    • Invalid inputs no longer modify documents, selections, preferences, or undo history.
    • null values are treated like omitted options and use the applicable defaults.
    • Valid boolean settings continue to update blend and envelope behavior correctly.
  • Documentation

    • Updated parameter guidance and compatibility notes to describe strict boolean validation and null handling.

The blend and envelope commands read their on/off params with bool_or,
which falls back to a default for a value that is not true or false.
object.envelope.editContents {"editing": "false"} turned Edit Contents
on, and object.envelope.options {"antiAlias": "false"} left Anti-Alias
on. Each call reported success. Make and Blend Options ignored smooth
given as text, and Move Spine Point ignored independent. Reshape Spine
Segment ignored perpendicular, and Make with Warp, Reset with Warp and
Envelope Options ignored horizontal. Reset with Mesh ignored
maintainShape, and Envelope Options ignored distortAppearance,
distortLinearGradients and distortPatternFills. Each used its default
or the current value instead.

These commands now fail with "`<key>` must be true or false" for a
value that is not true, false or null, as the grid and overprint
commands do. They leave the document, its undo history and the options
new blends and envelopes start with as they were. Make and Blend
Options refuse such a smooth also beside steps or distance, and the
warp commands refuse such a horizontal also beside an orientation.
Envelope Options refuses it whether or not a warp envelope is selected.
A null is read as a key left out.

Docs: docs/mcp.md, docs/target-app-parity.md.
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: storytold/vectorcraft/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3cd4a11b-54b3-4a98-87cd-147305cfc81a
📥 Commits

Reviewing files that changed from the base of the PR and between bc1ae08 and 061bc73.

📒 Files selected for processing: 5
  • crates/engine/src/cmd/live.rs
  • crates/engine/src/tests_blendspine.rs
  • crates/engine/src/tests_live.rs
  • docs/mcp.md
  • docs/target-app-parity.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

📝 Walkthrough

Blend and envelope commands now reject non-boolean option values. Missing and null values follow command-specific defaults or preserve current settings. Tests verify error handling and state preservation, and documentation lists the affected options.

Changes: Blend and Envelope Boolean Validation

Layer / File(s) Summary
Shared validation and blend spine options
crates/engine/src/cmd/live.rs, crates/engine/src/tests_blendspine.rs, crates/engine/src/tests_live.rs
A shared helper handles missing and null boolean values and rejects other non-boolean values. Blend spacing and spine-edit commands use strict validation. Tests cover invalid values and null handling.
Envelope options and content editing
crates/engine/src/cmd/live.rs, crates/engine/src/tests_live.rs, docs/mcp.md, docs/target-app-parity.md
Envelope creation, reset, options, and content-editing commands validate boolean parameters. Tests cover invalid values, null behavior, valid updates, and state preservation. Documentation lists the affected options.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: bflatastic

Merge Risk: ⚪ Minimal · up to 061bc

No actionable issue remains in the reviewed boolean-validation changes; the PR is ready to merge after normal checks.

Security architecture risk: 🔵 Low · up to 061bc

The change rejects malformed inputs without adding command access or privileges. No introduced security concern was identified. Remaining risk is limited to caller compatibility and incomplete end-to-end recovery coverage.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed behavior affects existing command callers, selected document objects, and session-level blend/envelope creation defaults. The inspected diff establishes no expansion into additional services, tenants, credentials, or privileged operations.

Trust Boundaries and Controls

  • observed — Caller-supplied JSON reaches the same enabled command handlers as before, but malformed booleans now stop at parameter validation before state mutation. Temporary selection used for enablement is restored, and the affected commands are not in the pre-dispatch selection-mutation list.

Resilience and Maintainability Implications

  • observed — A failed preview restores the interaction baseline and clears the pending preview, so commit cannot replay the rejected request. Ordinary edit errors restore document and selection; redo is cleared only when an undo entry is successfully recorded. These recovery mechanisms are unchanged.
  • observed — Batch failure restores document snapshots and history, but its session-state snapshot excludes blend preferences and envelope creation defaults. Thus per-command atomic rejection must not be interpreted as rollback of defaults changed by earlier successful batch steps. This limitation predates the PR and is not an introduced security concern.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 67.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 3 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description includes the required What and why, How it was tested, and Checklist sections. It clearly explains the behavior change, affected parameters, regression tests, validation commands, comp…
Title check Passed The title clearly identifies the main change: blend and envelope commands now reject boolean values supplied as text. It is concise and related to the changeset.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes the required What and why, How it was tested, and Checklist sections. It clearly explains the behavior change, affected parameters, regression tests, validation commands, compatibility checks, and completed checklist items.

Full details: Docstring Coverage

Explanation

Docstring coverage is 67.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 3 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 LanguageTool
docs/target-app-parity.md

LanguageTool checks are incomplete because the per-file request limit of 5 was reached. Remaining text was skipped; findings from completed checks are retained.

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

This branch has not been deployed

No deployments
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.

1 participant