Repository navigation
Agents and scripts: the standard part commands describe their exact parameters and reply (#11003) - #11004
Open
austin62jake wants to merge 2 commits into
Open
Agents and scripts: the standard part commands describe their exact parameters and reply (#11003)#11004austin62jake wants to merge 2 commits into
austin62jake wants to merge 2 commits into
Conversation
austin62jake
marked this pull request as ready for review
November 2, 2026 08:20
bherbruck
enabled auto-merge
November 2, 2026 18:24
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Nov 2, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
parts.library, parts.insert, parts.fastener and parts.resize get typed contracts and reply types in schema/parts.rs and leave unconverted.txt. Each key reads as the handler reads it, with its message; the replies are built from PartsLibrary, InsertedPart and ResizedPart, with the same JSON as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
austin62jake
force-pushed
the
schema-parts-11003
branch
from
November 3, 2026 03:50
fb3a452 to
383e85e
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Agents and scripts drive SolidCraft through named commands. The MCP tool
describe_commandand the commandengine.describegive a command's exact parameters and reply, but only for commands with schemas. The standard part commands (parts.library,parts.insert,parts.fastenerandparts.resize), which insert fasteners, dowel pins and bearings, now have them. With the parameter check at warn or strict, the check now warns about or refuses a misspelt or wrong-typed parameter, instead of ignoring it. Fixes #11003, part of #2829.The conversion follows
docs/book/src/dev/schemas.md, and takes the commands offschema/unconverted.txt. The contracts and reply types are in a newschema/parts.rs.parts.libraryfamily?PartsLibrary:{families}, or one family's{family, name, standard, system, sizes, lengths}parts.insert,parts.fastenerfamily,size,length?,at?,point?,direction?,name?InsertedPart{component, occurrence, name}, withjoint,occurrencesandjointswhen seated in holesparts.resizecomponent,size?,length?ResizedPart{component, name, size, length}parts.insertandparts.fastenerrun the same handler and share one contract.Each key reads as the handler reads it, with its message:
familyandsize: "familyis required (parts.library)", "sizeis required".length: above 0 and at most 2000 mm, or "lengthmust be 0…2000 mm".at(HolePicks): one point, or a list of up to 1000. A list is told apart the way the handler tells it, by a first item that is a list, or by being empty. The messages are "atmust be [x,y,z] or a list of them" and "attakes at most 1000 holes".component: an id or a name, or "componentmust be an id or a name".The handlers build their replies from these types instead of
json!literals; the JSON is the same. A size's dimensions differ by family, sosizesstays a list of objects, each with itssize.One difference in strict: the insert's messages name it
parts.insert (Insert Fastener)under either id. Strict names the id called (parts.insertorparts.fastener); the message after the name is the same.With no
familyorcomponentat all, strict says "familyis required" or "componentis required", as for every contract's missing key, where the handlers add "(parts.library)" or ask for an id or a name.What warn and strict now catch:
point,directionornamethat isn't the right kind as absent;familythat isn't text as absent;sizethat isn't text as absent.A call that works today works the same.
Changes a default: no
Tests
In
crates/engine/src/schema/parts_tests.rs:schemas_and_the_key_check_agree: the keys of the three contracts.strict_keeps_todays_errors: an unknown family for the library; acomponentthat istrueor unknown for the resize.the_insert_keeps_its_messages_in_strict: ten calls that fail today get the same message in strict under both ids, compared after the command's name:familyas a number, unknown, or with nosize;sizeas a number;length0, text or 3000;atas text, with a 2-number point, or 1001 points.It also checks a resize's
lengthof 0 on an inserted part.part_commands_reply_with_their_schemas, in Warn, with no warnings for each good call:{x, y, z}direction and named, with no joint;parts.fastener, with two occurrences and two joints;Then a misspelt key on each command gets
param_warnings, and the reply still matches.The tests already in
cmd/parts.rspass unchanged.Validation
On Windows 10, with
--profile ci:cargo test -p solidcraft-engine -p solidcraft-mcp --lib --tests --features solidcraft-engine/param-audit: every binary passed. The engine library had 3160 passed and 8 ignored; mcp had 96 passed.cargo test -p solidcraft-ui-egui --lib agent_chat: 247 passed.cargo clippy -p solidcraft-engine -p solidcraft-mcp --all-targets -- -D warnings: clean.cargo fmt --all -- --check,cargo xtask lists,cargo xtask layers,cargo xtask skills: OK.Parameter audit, from the runs above with
SOLIDCRAFT_PARAM_AUDIT: 4205 call signatures. The calls to these commands that work today and that strict would refuse are:tests::hostile_arguments_never_panic, which sendsparts.libraryunknown keys on purpose;The calls that already fail get the same message in strict, apart from the command's name in the insert's messages and a missing
familyorcomponent, as noted above.Integration status
Checked against main at
147b4049c. Rebased onto main after the SMLib kernel merge (#11351), for the conflicts inschema/mod.rsandschema/unconverted.txt. The merge added a range check forpointanddirectionto the insert. The contract'sPoint3already takes only points under 1e9 mm.The numbers in Validation are from before the rebase; this PR's CI run checks the rebased branch with SMLib. In that run, "Native Linux tests" fails only
licences::tests::the_licences_are_built_in, which main itself fails since #11351 (main's run 41553615059 on147b4049c). This PR doesn't touch the licence list.🤖 Generated with Claude Code