Repository navigation
Description
Rewritten on 2026-11-23 after looking at how hexuria/buwiz-forms#265 uses recipes. The gap is unchanged. The fix is no longer a nesting language of our own: an argument spec may carry a standard JSON Schema that the app supplies.
Gap
An app schema can say an invoke arg is an object or an array, but not what is inside. ArgSchema has type and required, and check_invoke_args checks the top-level type and stops.
Measured at f6cbb86, with an app schema whose x.save declares rows (array), meta (object), tags (array) and weird ("type": "strng"), written with items and properties the way an author might expect to work:
args |
recipe validate |
|---|---|
{"rows": [{"id": 1}], "meta": {"owner": "me"}, "tags": ["a"]} |
ok |
{"rows": "not-an-array"} |
recipe_invalid_args: arg rows must be array |
{"rows": [1, "x", null, {"id": "not-an-int"}], "meta": {"owner": [1, 2]}, "tags": [1, 2, 3], "weird": 5} |
ok |
Three things are visible in the last row:
- Contents are not checked.
itemsandpropertiesin the schema file are read and dropped, with no error or warning.- A type name that is not one of the six is not checked, so a typo (
strng) turns the check off. This is documented, and still easy to hit.
What changed in the plan
The first version of this issue added items and properties to ArgSchema, each another ArgSchema. Looking at a real app changed that:
- In buwiz-forms the main nested argument is
form.fill'sfields: a map whose keys are the boxes of one tax form. The keys differ for every form, so no fixed nested description fits it. - The app already describes those shapes itself, as JSON Schema, at run time (
form.schema, and theinput_schemaits recipe generator returns), and checks values with its ownform.checkinvoke.
A second, smaller schema language of ours would be one more thing to keep in step with JSON Schema, and it still could not describe that argument.
Proposal
- An argument spec may carry a JSON Schema. An optional
schemaonArgSchema, holding a standard JSON Schema for that argument's value. The app writes it, or exports it from its invoke table (Design: an app declares its invokes once, in a table the SDK serves #117).check_invoke_argsvalidates the value against it once any placeholders are bound.typeandrequiredkeep working alone. - Deep checks stay in the app. Where the shape depends on run-time state, the app checks it when the invoke runs, or through a dry-run invoke of its own. Nothing in gpui-agent tries to describe that.
- Decide the two silent cases (points 2 and 3 above), apart from the rest: refuse an unknown key in an argument spec and an unknown type name when the schema file is loaded (
recipe_invalid_schema), or keep accepting them. Refusing is a behavior change for files that load today.
ArgSchema is #[non_exhaustive] since 0.4.0, so a new field does not break Rust callers.
Open questions
- Which validator checks the embedded schema.
jsonschemais a dev-dependency of the recipe crate today; using it at run time adds about 40 crates to the CLI. - Placeholders inside nested values: an optional param with no value is already left out "at any depth in
args", butcoerce_invoke_argsconverts a bound"$id"to its declared type only at the top level. - Whether an embedded schema may be a
$refto something the app serves, or must be inline.
Done when
- An argument spec can carry a JSON Schema, and the third row above is refused with
recipe_invalid_args. - A schema file without it behaves as it does today.
- The two silent cases are decided and documented.
- The per-app recipe schema of Design: a recipe schema per app, made from the app's invoke table #115 passes an embedded schema through.
Activity
[-]Design: let an app schema describe what is inside object and array invoke args[/-][+]Design: let an invoke argument carry a JSON Schema for what is inside it[/+]hexuria commentedon Nov 30, 2026
Probe at
fbd3856(v0.5.0): verified.ArgSchemastill exposes only the top-leveltype/requiredshape; nested object/array content is unchecked, and unknown keys/type spellings are still silent design decisions.Plan:
jsonschemais currently dev-only and pulling it into the CLI runtime is not free.This remains blocked behind #117 and is not part of the first small-fix batch.
Validate nested invoke argument schemas (#141)
hexuria commentedon Nov 30, 2026
Implemented and merged in PR #141 (
336617c). Embedded invoke argument JSON Schemas now round-trip over the live invoke table and schema files, compile offline with bounded regex validation, deep-validate bound recipe values, and distinguish runtime step-node references from literal node-shaped user data.