Commit Graph
13 Commits
Author SHA1 Message Date
BFlat edb228ac33 Merge pull request #7402 from dotCooCoo/fix/more-int-param-wrong-type
MCP: path, type, panel, library, style and ruler indices refuse a wrong-type value
2026-11-14 16:54:34 +07:00
dotCooCoo 531fad0532 MCP: path, type, panel, library, style and ruler indices refuse a wrong-type value
A required index given as something other than a whole number of 0 or
more, such as "3", 2.5, -1 or true, was reported as missing: `anchor` of
path.setHandle, path.moveAnchor and text.setPathHandle, `segment` of
path.insertAnchor, and `to` of artboard.reorder, library.moveGroup and
graphicStyle.move. Each now refuses it with "`anchor` must be a whole
number", naming the key; left out or null, it is still missing.

An optional `subpath` of path.appendAnchor, path.close and path.reverse
given that way was read as left out, so the command extended, closed or
reversed the default subpath (path.reverse reversed every subpath). The
`artboard` of the ruler origin commands answered "index out of range"
for such a value and for null. Both now refuse such a value with the
same message and change nothing. A null `artboard` is artboard 0, as one
left out is; a whole number past the artboards is still out of range.
2026-11-13 19:08:16 -08:00
dotCooCoo 78ce56d021 MCP: an integer given as a string or a fraction is refused as the wrong type, not reported as missing
A command that needs a whole number of 0 or more, such as `index` of
`appearance.setItem`, `anchor` of `path.removeAnchor` and
`addon.pen.removePoint`, `sourceDocument` of `edit.dropSelection`, `index`
of `document.activate` and `to` of `document.move`, answered "missing
integer `index`" (or "missing index") both when the key was left out and
when it was given as a value that is not a whole number of 0 or more, such
as "3", 2.5, -1 or true. A value that is given but is not one is now
refused with "`index` must be a whole number", the message object ids
already use. A key left out or given as null is still missing, and an
optional index such as `subpath` keeps its default. Neither error changes
the document or records an undo step.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-13 18:02:42 -08:00
dotCooCoo 4dc5c4f719 Live Shapes: object.setLiveShape refuses unknown keys and invalid sides or radius
object.setLiveShape was in params::UNCHECKED, so a key it does not read,
such as `path`, ran the command with the key ignored. Its description
names every key it reads, so it now goes through check_keys like other
commands, for MCP, scripts and command.batch steps. Each of `items` takes
`id` and `corners` alone; another key is refused as
`items[0].corner`, with the nearest accepted key. Saved steps still
replay leniently.

A `sides` that is not a whole number from 3 to 1000 (2.5, -1, 2, 1001)
and a negative `radius` are now errors naming the key, and leave the
document and its undo history as they were; a radius of 0 still
removes rounding. The Transform panel's Sides field takes 3 to 1000,
the Corners dialog's radius field stops at 0, and the panels' corner
radius fields send 0 for a negative value typed in.
2026-11-13 12:46:15 -08:00
dotCooCoo f5bfe0c425 Effects: effect.apply refuses a wrongly typed parameter that has no default
effect.apply, appearance.addEffect and effect.setParams checked an effect
parameter's type only when the effect has a dialog default for the key. Keys
that only the params text names were stored as given: an Outline Stroke with
`width: "10 pt"` drew at the stroke's own weight, and a Gaussian Blur with
`linear: 1` blurred in linear light.

- The earlier 3D `perspective`, `lightAzimuth` and `lightElevation`,
  Scribble's `variation` and Outline Stroke's `width` must be numbers, and
  Gaussian Blur's `linear` must be true or false. A test walks every effect
  so a new key without a default needs a listed type or a check of its own.
- The `style` of Crop Marks must be `roman` or `japanese`, and `null` is
  refused. Any other value drew as Roman.
- An installed plug-in effect's parameters are checked against its manifest
  when the command runs, as plugin.run already checks the effect records a
  filter returns.
- effect.setParams with `warpStyle` checks the parameters against the new
  Warp style's effect, as it already did for a 3D effect's new
  `threeDType`. It checked them against the old style.
- effect.setParams refuses a `visible` that is not true or false, such as
  `1` or `"false"`, when called and when a step plays, and nothing changes.
  Before, the value was ignored and the rest of the call applied. `null`
  still leaves the visibility as it is.

A step of command.batch is refused the same way. A replayed journal or
action still plays a wrongly typed effect parameter, as it plays a key the
effect no longer takes.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-12 20:27:09 -08:00
dotCooCoo 3efdf4ab9c MCP: a required number given as a string is refused as the wrong type, not reported as missing
A command that needs a number, such as `x` of `shape.rectangle`, `intensity`
of `edit.colors.saturate` or `index` of `object.envelope.setMeshPoint`,
answered "missing number `x`" both when the key was left out and when it was
given as a value that is not a number, such as "40". A value that is given but
is not a number is now refused with "`x` must be a number, not "40"", the
message the optional number checks already use, showing the value as given.
A key left out or given as null is still a missing number. Neither error
changes the document or records an undo step.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-12 15:44:02 -08:00
dotCooCoo 5c2e182388 MCP: a malformed object id is refused as such, not reported as missing
Commands that need an object id read it with `id_param`, which returns
None for a value that is not a non-negative integer, so `{"id": "5"}` or
`{"id": -1}` was refused with "missing id". They now read it with
`object_param`, which refuses such a value with "`id` must be a whole
number", naming the key. This covers `document.node`, the `path.*` anchor
and handle commands, the `text.*` range and path commands, the mesh,
envelope and slice point commands, `layer.target`, `layer.move`,
`node.move`, `select.magicWand`, and the `source`, `target`, `group` and
`path` keys of `appearance.transfer`, `appearance.copyFrom`, the
`livePaint.*` commands and `text.createInPath`.

The optional `group` of `livePaint.fill` and `parent` of `node.move` are
refused the same way when given. Before, a malformed `parent` moved the
object to the top level and a malformed `group` fell back to the
selection.
2026-11-11 12:47:49 -08:00
dotCooCoo e152973836 Save: saved Export for Screens keys no longer read don't block the export
The Export for Screens dialog and the Asset Export panel open
remembered settings and presets without the row and settings keys the
export no longer reads, and without settings for a format it doesn't
write, so their export and Save Preset are not refused.

A format row and a format's settings take `params`, an exporter
plug-in's own, and `security.passwordRequired`, which remembered
settings hold where PDF passwords were left out, and `settings` takes an
exporter plug-in's format, as before the key check. assets.export and assets.settings.set check the
rows and settings they are given as document.exportForScreens does.
An unknown top-level key of document.exportForScreens gets the
command's usual "the command takes" error.

The MCP save and Export for Screens calls no longer check the params
themselves: Session::execute checks them before anything runs.
2026-11-08 09:51:22 -08:00
dotCooCoo 5522059417 Save: the save commands and Export for Screens refuse an unknown option key
document.save, file.saveAs, file.saveCopy and file.saveAsTemplate wrote
the file when given a key that no save format reads, beside the path or
in options, or an unknown key inside a PDF option object such as
marks.useDocumentBleed. document.exportForScreens did the same for an
unknown top-level key, a key in a format row and a key in the settings
of a format.

These commands now refuse such a key and name its path
(options.noSuchOption, formats[1].marks.useDocumentBleed). The svg
object is checked in every save, export and format row, also when the
file written is not SVG. A save still leaves out a key that only another
save format reads, and warns as before. A format row and a format's
settings still take includeArtboardFill and richBlack, which the
encoders read. document.exportPresets.save checks its settings, with the
rows and settings in it, the same way.

In the app, file.save and file.exportForScreens sent as commands are
checked as document.save and document.exportForScreens, and app.save is
checked before anything is written; MCP's app.save, file.save and
file.exportForScreens are checked the same way. The SVG Options dialog
no longer passes its internal fields on to the save.
2026-11-08 08:31:24 -08:00
dotCooCoo 6ffcf800c8 Export: the export commands refuse an unknown option key
document.export, document.exportSelection, document.serialize, app.export
and file.export took {noSuchOption: true} and wrote the file with no
warning. They now refuse a key that no format lists in document.formats,
and name the nearest key when one is close. document.exportPdf,
document.pdfSettings and pdf.preset.save refuse a key PDF doesn't take,
document.exportEps one EPS doesn't take and document.exportDxf one DXF
doesn't take. Each refuses an unknown key inside an option object it takes,
such as marks.useDocumentBleed, and names its path.

A key that only another format reads, such as {format: pdf, quality: 80},
is still ignored: docs/mcp.md says one object can carry several formats'
options. The check runs for callers (the control channel, MCP, the CLI).
A journal or a recorded action isn't checked, and a saved PDF preset with
a key that is no longer read still loads.

document.formats now also lists PDF's thumbnails, fastWebView and
viewAfterSaving.
2026-11-06 23:09:15 -08:00
Don Omondi 41ceaadc7e SVG import: Gaussian blurs keep color-interpolation-filters; Gaussian Blur can blur in linear light (#5877) 2026-11-06 16:05:55 +07:00
Franco Jacquet c16c833c58 Check stroke.set params: a misnamed key is refused (#1442)
Squashed from #5453 onto main.
2026-11-04 08:13:52 +07:00
aiongg 83eec43b18 refactor(engine): move tests_*.rs to tests/<topic>.rs 2026-10-26 18:26:56 +00:00