Skip to content

Comments

Don't mix kcmc types and kittycad.rs types in CmdFileSnapshot#1479

Merged
adamchalmers merged 6 commits intomainfrom
achalmers/rip-out-kittycad-dot-rs
Feb 21, 2026
Merged

Don't mix kcmc types and kittycad.rs types in CmdFileSnapshot#1479
adamchalmers merged 6 commits intomainfrom
achalmers/rip-out-kittycad-dot-rs

Conversation

@adamchalmers
Copy link
Contributor

@adamchalmers adamchalmers commented Feb 20, 2026

Most of zoo file subcommands use the generated API client types from the kittycad crate. The one exception is the zoo file snapshot subcommand, which needs to start a modeling session (WebSocket) and import the file, then take a 2D snapshot (JPG or PNG etc). This feature is only available via our WebSocket API, not the REST API.

Problem is, the kittycad crate only works with our REST API. And the kittycad-modeling-cmds crate only works with our WebSocket API. So we have two very similar types, e.g. FileImportFormat, one for each of these libraries.

To make this easier to work with, we implemented conversions between them via the From trait. But this causes problems upstream because it couples the kittycad-modeling-cmds crate to the kittycad crate, making it difficult to maintain.

Solution is, don't mix-and-match kittycad and kcmc crates in the same command. Use exclusively kcmc for the file snapshot command, and exclusively kittycad.rs for the other file commands.

Uses this branch of kcmc: KittyCAD/modeling-api#1099

Most of `zoo file` subcommands use the generated API client types from
the `kittycad` crate. The one exception is the `zoo file snapshot`
subcommand, which needs to start a modeling session (WebSocket) and
import the file, then take a 2D snapshot (JPG or PNG etc). This feature
is only available via our WebSocket API, not the REST API.

Problem is, the `kittycad` crate only works with our REST API. And the
`kittycad-modeling-cmds` crate only works with our WebSocket API. So we
have two very similar types, e.g. FileImportFormat, one for each of
these libraries.

To make this easier to work with, we implemented conversions between
them via the From trait. But this causes problems upstream because it
couples the `kittycad-modeling-cmds` crate to the `kittycad` crate,
making it difficult to maintain.

Solution is, don't mix-and-match kittycad and kcmc crates in the same
command. Use exclusively kcmc for the file snapshot command, and
exclusively kittycad.rs for the other file commands.
@adamchalmers adamchalmers force-pushed the achalmers/rip-out-kittycad-dot-rs branch 2 times, most recently from a3c9e03 to fd7151f Compare February 20, 2026 21:33
@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 4.87805% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.57%. Comparing base (10e7e7f) to head (83f6276).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/cmd_file.rs 3.03% 32 Missing ⚠️
src/cmd_kcl.rs 14.28% 6 Missing ⚠️
src/context.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1479      +/-   ##
==========================================
- Coverage   69.60%   69.57%   -0.04%     
==========================================
  Files          41       41              
  Lines        6840     6843       +3     
==========================================
  Hits         4761     4761              
- Misses       2079     2082       +3     
Flag Coverage Δ
unittests 69.57% <4.87%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

adamchalmers added a commit to KittyCAD/modeling-api that referenced this pull request Feb 21, 2026
CLI was using these conversion features, I've integrated this PR into CLI here: KittyCAD/cli#1479

---------

Co-authored-by: alteous <alteous@outlook.com>
@adamchalmers adamchalmers force-pushed the achalmers/rip-out-kittycad-dot-rs branch from fd7151f to 83f6276 Compare February 21, 2026 02:40
@adamchalmers adamchalmers merged commit fa0cf5c into main Feb 21, 2026
18 checks passed
@adamchalmers adamchalmers deleted the achalmers/rip-out-kittycad-dot-rs branch February 21, 2026 04:13
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.

3 participants