Skip to content

Agents and scripts: Export describes its exact parameters and reply (#13315) - #13321

Merged
bherbruck merged 2 commits into
tangency-labs:mainfrom
LouisBunt:export-schemas-13315
Nov 8, 2026
Merged

bherbruck merged 2 commits into
tangency-labs:mainfrom
LouisBunt:export-schemas-13315

Conversation

@LouisBunt

@LouisBunt LouisBunt commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Change

Agents and scripts drive SolidCraft through named commands. The MCP tool describe_command and engine.describe give a command's exact parameters and reply, but only for commands with schemas. This PR gives them to Export (file.export), the command behind File › Export that writes every format. The export command of each format (Export STEP, STL, 3MF, OBJ and URDF) already has them. With the parameter check at warn or strict, a misspelt or wrong-typed parameter is now reported or refused. Fixes #13315, part of #2829.

The contract ExportParams and the reply type FileExportResult extend schema/file.rs (tests in file_tests.rs). file.export leaves schema/unconverted.txt.

  • Keys read per format: ExportParams has a hand-written Deserialize that reads what the handler reads, in the same cases. path comes first; the other keys are read only once there is a path to write to and format (or the path's extension) names a known format, as the handler refuses those first. For URDF it reads bodies, mesh_prefix, effort and velocity, and not quality or objects. For the other formats it reads bodies, quality and objects, and not the URDF keys. So {"path": "robot.urdf", "quality": "rough"}, which works today, is not refused in strict.
  • The handler's messages: path, bodies (through params::string_list itself), quality (trimmed and case-blind, as MeshQuality::from_name reads it), objects (component only for 3MF) and a positive effort or velocity fail with the handler's own message. path is optional in the type and required in the schema, so a call without it keeps the handler's message.
  • The reply: FileExportResult is the reply of the export command of the format: ExportResult (path, bytes, format, and files for OBJ) or UrdfExportResult. The handler still builds the replies, as the per-format commands do; nothing in them changes. ExportResult's format doc now also names StlAscii, ThreeMfTagged and Design, which only file.export writes.

Stricter than the handler: the handler reads format and mesh_prefix with str_, so a value that is not text is read as if it were left out (a format of 3 falls back to the path's extension). Warn now reports such a value and strict refuses it. null is still read as left out.

Schemas for keys a format ignores: the published schema lists every key of every format, so a URDF key sent with an STL path is not an unknown key, and the contract does not check it, as the handler does not read it.

What changes for callers: nothing for a call that works today, apart from a format or mesh_prefix that is not text, in warn/strict mode.

Changes a default: no

Tests

New tests in crates/engine/src/schema/file_tests.rs:

  • schemas_and_the_key_check_agree: now with ExportParams
  • strict_keeps_todays_errors: 21 failing calls (no path, a blank, wrong-typed or 4096-character path, an unknown format, bad quality, objects and bodies, design JSON and URDF with bodies, non-positive effort, wrong velocity) give the same error in strict as with the check off, and write nothing
  • the_export_type_reads_each_key_only_for_its_format
  • the_export_schema_takes_what_the_handler_reads
  • export_replies_match_the_output_schema: real exports of STL, ASCII STL, OBJ, STEP, 3MF with component parts, tagged 3MF, design JSON and URDF from a two-component design, in warn (no param_warnings) and strict, each matching the output schema
  • a_misspelt_or_wrong_typed_export_key_is_reported: a misspelt key and a wrong-typed format are reported in warn, and strict refuses the misspelt key before anything is written

Validation

On Linux:

  • cargo fmt --check: pass.
  • cargo clippy -p solidcraft-engine --all-targets -- -D warnings: clean.
  • cargo test -p solidcraft-engine --lib -- schema:: hostile cmd::file: 595 passed, 1 failed (a case of the new schema test that the test helper conforms can't check, as it does not read oneOf; since removed). Rerun after that change, schema::file cmd::file (the URDF export tests included): 72 passed, 0 failed.
  • cargo xtask lists and cargo xtask mesh-decisions: pass.
  • Not run: the full workspace suite, the param-audit recorder, web-offline-test and the wasm and UI builds.

Made with Claude Opus 5.5 in Claude Code (Ultra plan, default effort, fast mode off, Ultracode off).

Summary by CodeRabbit

  • New Features

    • File export options are now described together, including format-specific settings for mesh quality, selected bodies or objects, and URDF exports.
    • Export results are now described for both standard file exports and URDF exports.
  • Bug Fixes

    • Invalid export settings, including unsupported values and misspelled or incorrectly typed options, are handled more consistently in strict validation mode.

…angency-labs#13315)

file.export gets a typed contract (ExportParams) and an output schema
(FileExportResult), so describe_command and engine.describe give its
exact parameters and reply, and warn and strict can check its calls.

The contract reads each key only for the format the handler reads it
for (the URDF keys for URDF, quality and objects for the others), with
the handler's own messages, so a call that works today is not refused.
A format or mesh_prefix that is not text, which the handler reads as
left out, is now reported in warn and refused in strict.

Made with Claude Opus 5.5 in Claude Code (Ultra plan, default effort, fast mode off, Ultracode off).
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

file.export now uses typed input and output schemas and checked parameter handling. Tests cover format-specific parsing, schema conformity, export replies, and warn and strict validation.

Changes: Export command schemas

Layer / File(s) Summary
Export parameter and result contracts
crates/engine/src/schema/file.rs
Adds ExportParams with format-specific deserialization and the untagged FileExportResult enum for file and URDF results. Updates the documented export formats.
Checked command registration
crates/engine/src/cmd/file.rs, crates/engine/src/schema/unconverted.txt
Registers file.export through crate::checked! with its input contract and output schema. Removes the command from the unconverted list.
Export schema validation
crates/engine/src/schema/file_tests.rs
Adds tests for parameter parsing, schema conformity, output validation across formats, and warn and strict handling of invalid parameters.

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

Change: Feature · Severity of issue fixed: Medium

Possibly related issues

Possibly related PRs

Suggested reviewers: austin62jake, bherbruck

Merge Risk: Low · up to be4c0

The export schema accepts unsupported format names, although the handler rejects them. This is a bounded validation gap and does not block merging.

Security architecture risk: Low · up to be4c0

The command retains its existing write authority and permission controls. Strict parameter checking can now prevent an export before writing begins. No security regression was established in the inspected paths, but deployment-specific permissions and recovery guarantees remain incompletely established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — Agent and script callers could already invoke the registered file.export command. Its sensitive outcomes remain writes to the requested export path and format-dependent companion files, rather than a newly exposed command or write capability.

Trust Boundaries and Controls

  • observed — Agent requests can install a VFS path scope, and native VFS writes enforce the active scope. Scope installation depends on supplied allow_paths, a preexisting behavior; the PR does not remove host command checks or path enforcement. Deployment-wide policy settings were not established.

Resilience and Maintainability Implications

  • observed — OBJ and URDF exports preflight all targets but write companion files sequentially before the primary file. Later failures can leave partial output and are reported explicitly. This non-transactional behavior is unchanged from the PR base; cleanup, interruption recovery, and concurrent-overwrite ownership are not established by the available evidence.
Pre-merge checks: Passed 6

Check name Status Explanation
Title check Passed The title names the change: the export command now describes its exact parameters and reply. The changeset adds ExportParams and FileExportResult schemas for file.export and removes it from unconverte…
Description check Passed The description follows the template well. The Change section explains what Export does and for whom, names the problem (no schema for file.export), and links the issue (#13315) and parent (#2829). It…
Linked Issues check Passed Directly linked issue #13315 (part of #2829) is the only active target. Its coding requirements, with the evidence at the reviewed head:

1. Typed input contract for file.export [#13315, #2829]. Met. …
Out of Scope Changes check Passed All changed files relate to the file.export contract, its reply, its tests, or its unconverted.txt entry:

- cmd/file.rs: command registration, EXPORT_CONTRACT, and .output(...). The handler…
Docstring Coverage Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Existing Defaults Unchanged Passed No existing default changes were found. file.export keeps its handler and export defaults. Parameter checking remains off by default. Warn and strict modes now report or reject some previously accep…
Full details: Title check

Explanation

The title names the change: the export command now describes its exact parameters and reply. The changeset adds ExportParams and FileExportResult schemas for file.export and removes it from unconverted.txt, which matches the title. The title is specific enough for a teammate to see the primary change. It names a group prefix 'Agents and scripts' and cites the issue number, which is minor noise but not a problem.

Full details: Description check

Explanation

The description follows the template well. The Change section explains what Export does and for whom, names the problem (no schema for file.export), and links the issue (#13315) and parent (#2829). It states 'Changes a default: no' as required. The Validation section lists commands run, results, and what was not run. The template also asks for screenshots when behavior is observable. The PR is a schema and error-handling change with no visible UI change, so the omission is reasonable, but the description does not explain why screenshots are absent. The Integration status section from the template is missing. The description also does not record the upstream commit or PR status checked before handoff.

Resolution

Optional: add a short note that the change has no visible UI behavior, so screenshots are omitted. Add the Integration status section (upstream commit and PR status checked, any conflicts resolved, validation after integration), since the template asks for it and the objectives note a conflict with PR #13322.

Full details: Linked Issues check

Explanation

Directly linked issue #13315 (part of #2829) is the only active target. Its coding requirements, with the evidence at the reviewed head:

  1. Typed input contract for file.export [#13315, #2829]. Met. ExportParams in crates/engine/src/schema/file.rs has a format-aware hand-written Deserialize. cmd/file.rs declares EXPORT_CONTRACT and wraps file.export with crate::checked!.
  2. Output schema [#13315]. Met. FileExportResult (untagged: File(ExportResult) or Urdf(UrdfExportResult)) is registered with .output(...) on file.export.
  3. Handler keeps its behaviour, messages and replies [#13315]. Supported. The whole-PR diff of cmd/file.rs changes only the command registration and adds EXPORT_CONTRACT. The export handler body does not appear in the diff.
  4. Remove the converted line from unconverted.txt [#13315]. Supported by the change summary (+0/-1). The file was not read directly.
  5. Automated tests [#13315]. The new tests are listed in schema/file_tests.rs. The tests were not run in this review. The PR reports a passing run of schema::file cmd::file (72 passed).

Open point: ExportParams refuses effort and velocity at an absolute value of 1e9 or more (x.abs() < 1e9). The PR description does not mention this bound. The export handler body was not readable within the output limit, so this review could not confirm that the handler applies the same bound. If the handler does not, strict mode refuses a URDF call that works today. This does not change the verdict above, because the bound does not affect the typed contract, the output schema, the unchanged handler, or the unconverted.txt removal.

Full details: Out of Scope Changes check

Explanation

All changed files relate to the file.export contract, its reply, its tests, or its unconverted.txt entry:

  • cmd/file.rs: command registration, EXPORT_CONTRACT, and .output(...). The handler body is not in the diff.
  • schema/file.rs: ExportParams and its deserializer, FileExportResult, and the ExportResult format doc. The doc change names the formats that only file.export writes, so it supports the new reply.
  • schema/file_tests.rs: tests for the new contract and reply.
  • schema/unconverted.txt: removes the converted command.

The warn and strict checks are stricter than the handler for non-text format or mesh_prefix values. The PR description discloses this. The 1e9 bound on effort and velocity is part of the same contract. Its parity with the handler is unverified (see the linked-issue assessment), but the change is not unrelated to the linked objective.

No change is unrelated to the linked objective.

Full details: Docstring Coverage

Explanation

Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 3 files.

Full details: Existing Defaults Unchanged

Explanation

No existing default changes were found. file.export keeps its handler and export defaults. Parameter checking remains off by default. Warn and strict modes now report or reject some previously accepted invalid parameters.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5a70675 and be4c00a.

Files selected for processing: 1

  • crates/engine/src/cmd/file.rs

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

@theironchef

Copy link
Copy Markdown
Contributor

Tested this merged onto current main (Windows, MSVC, --profile ci).

No problems found:

  • cargo test -p solidcraft-engine --lib -- schema file export hostile param_check: 798 passed, 3 ignored, including the new file_tests.
  • cargo test -p solidcraft-mcp: 114 passed.
  • cargo clippy -p solidcraft-engine --lib -- -D warnings: clean.

I checked ExportParams against export in cmd/file.rs. It reads path first, then format or the extension. For URDF it reads bodies only to refuse them, then export_urdf's keys. For the other formats it reads quality and objects (through mesh_parts), plus bodies. That matches the type's per-format reading, so a URDF call with quality is still not refused.

A heads-up: #13322 (New Design's contract) conflicts with this PR in crates/engine/src/cmd/file.rs. Both add their contract constant just above EXPORT_STEP_CONTRACT. The fix is to keep both lines.

@bherbruck bherbruck added approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) ready to merge reviewed, every ask addressed; merge once CI is green and removed approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) labels Nov 8, 2026
@bherbruck
bherbruck enabled auto-merge November 8, 2026 18:37
@bherbruck bherbruck added approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) and removed approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) labels Nov 8, 2026
@bherbruck
bherbruck added this pull request to the merge queue Nov 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 8, 2026
@bherbruck
bherbruck added this pull request to the merge queue Nov 8, 2026
Merged via the queue into tangency-labs:main with commit c7fb4f7 Nov 8, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) ready to merge reviewed, every ask addressed; merge once CI is green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export: input and output schemas (part of #2829)

3 participants