* Fix the black screen of death
* fmt
* make check
* Clean up
* Fix up zoom to fit
* Change how emulateNetworkConditions work
* Do NOT use browser's offline/online mechanisms
* Fix test
* Improve network error messages
* Signal offline when failed event comes in
* Don't use logic on components that only want a loader
* Remove unnecessary pause state transition
---------
Co-authored-by: jacebrowning <jacebrowning@gmail.com>
* fix test
* fix e2e test in another way so it doesnt break unit tests
* Cleanup
* Update src/hooks/useQueryParamEffects.ts
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
* hasAskToOpen should only be used if not in desktop
---------
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
# Symptoms
This code produces a big ugly confusing error in the frontend, see #7340.
# Root cause
I added a new test case, with an unknown type. In `ast.snap` under `body[0].declaration.init.ty` there two different `type` fields in the AST node for the type's name, and they have conflicting values Primitive and Identifier.
<img width="602" alt="Screenshot 2025-06-03 at 4 04 55 PM" src="https://github.com/user-attachments/assets/913a0fa0-3e8d-473f-bb64-003d44915be0" />
# Solution
Change the `enum PrimitiveType` variant from `Named(Node<Identifier>)` to `Named { name: Node<Identifier> }` so that the fields nest differently.
Now the error correctly points out to the user that the type `NotARealType` can't be found. Much better error message that shows the user the problem.
# Alternative solutions
Stop the duplicated JSON fields altogether. I tried this previously in https://github.com/KittyCAD/modeling-app/pull/4369 but it was very involved, and I didn't think it was worth it. Maybe I should reopen that PR and solve this properly.
Closes#7340
I ignored some new clippy lints about large differences between enum variants.
We can always revisit these later (the compiler suggests boxing them so
that the enum variants are similar size)
There's some bug in the frontend or KCL somewhere, which results in the TypeScript frontend sending an AST (serialized to JSON) to the KCL executor, but the JSON cannot be deserialized into an AST. If this happens, it's a bug in ZDS, not a user error.
The problem is that this sort of error will cause the frontend to silently stop rendering KCL, and it won't show the user any errors. They need to open up the console and look at the error there, and even if they do, it's hard to understand.
This PR changes how we report these unexpected errors due to bugs in ZDS. ZDS should not silently stop working, it should at least print a half-decent error like this:
<img width="527" alt="nicer error" src="https://github.com/user-attachments/assets/1bb37a64-0915-4472-849c-d146f397356b" />
## Fix
Right now, the wasm library exports a function `execute`. It previous returned an error as a String if one occurred. The frontend assumed this error string would be JSON that matched the schema `KclErrorWithOutputs`. This was not always true! For example, if something couldn't be serialized to JSON, we'd take the raw Serde error and stringify that. It wouldn't match `KclErrorWithOutputs`.
Now I've changed `execute` so that if it errors, it'll returns a JsValue not a string. So that's one check (can this string be deserialized into a JSON object) that can be removed -- it'll return a JSON object directly now. The next check is "does this JSON object conform to the KclErrorWithOutputs schema". To prove that's correct, I changed `execute` to be a thin wrapper around `fn execute_typed` which returns `Result<ExecOutcome, KclErrorWithOutputs>`. Now we know the error will be the right type.
* Fix orbit style setting not updating in camControls
* Break apart camera movement tests, add trackball to orbit one
* I don't think zoom was actually testing changes, this fixes that
* test refactor: pass in expected cam pos, not its inverse
* Lints
* Lint fix broke the test, fix fix
* Gah biome whyyy did you format other test names like that?
Previously, `x = cos(x)` would just say "`x` is undefined". Now it says that `x` cannot be referenced in its own definition, try using a different variable instead.
To do this, I've added a new `Option<String>` field to the mod-local executor context, tracking the current variable declaration. This means cloning some strings, implying a small performance hit. I think it's fine, for the better diagnostics.
In the future we could refactor this to use a &str or store variable labels in stack-allocated strings like docs.rs/compact_str or something.
Closes https://github.com/KittyCAD/modeling-app/issues/6072
We've changed the unnamed field of `KclError` variants to a named called `details`.
To clarify: previously KCL errors looked like this:
```rust
pub enum KclError {
Lexical(KclErrorDetails),
Syntax(KclErrorDetails),
```
Now they look like this:
```rust
pub enum KclError {
Lexical { details: KclErrorDetails },
Syntax { details: KclErrorDetails },
}
```
This lets us more easily add fields to the errors. For example, in the UndefinedValue case, adding a field for what the undefined name was. This PR refactors the code to make my PR in https://github.com/KittyCAD/modeling-app/pull/7309 much easier.
Pure refactor, should not change any behaviour.
* fix bug of not saving project when dragging a segment, add a test
* Update e2e/playwright/projects.spec.ts
Co-authored-by: Jace Browning <jacebrowning@gmail.com>
---------
Co-authored-by: Jace Browning <jacebrowning@gmail.com>
* Don't use WEAK and yellow
* fmt && lint && tsc
* Fix up the rebase & dark mode colors
* Update src/hooks/useNetworkStatus.tsx
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
* Change Weak to Ok
* Change Connected to Strong
* fmt
* Sync selectors for start sketch
* Remove unused test-util brought back in a rebase
* Align the other OKs
* Add an else statement to overallState
---------
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
This program:
```kcl
1
|> extrude(
length=depth,
})
```
was giving this bad error:
```
unexpected token |>
```
Now it gives
```kcl
There was an unexpected }. Try removing it.
```
and it correctly puts the diagnostic on the extra }.
Fixes https://github.com/KittyCAD/modeling-app/issues/6126
Previously, this KCL
```
arc(
endAbsolute = [0, 50]
interiorAbsolute = [-50, 0]
)
```
gave the error `This argument has a label, but no value. Put some value after the equals sign`.
Now it gives this much better error `Missing comma between arguments, try adding a comma in`, and its source range (red underline) is on the whitespace which was missing a comma:
<img width="666" src="https://github.com/user-attachments/assets/aa5035f5-f748-4dab-b918-b81b05733323" />
Thanks for reporting this @benjamaan476
* first step of UI using trelative angentialArc
* use tangentialArcTo when snapping to one of the axes
* remove duplications via tangentialArcHelpers
* update test: snapToProfile start only works for current profile
* add test: Can add multiple profiles to a sketch (all tool types)
* update test: Straight line snapping to previous tangent
* fixes for removing individual constraints (should keep endAbsolute for lines, tangentialArcs)
* fix fnNameToToolTipFromSegment arcTo
* update snapshot test to use relative tangentialArc
* stabilize some snapshot tests
* stabilize and update Inch snapshot test on ubuntu
* fix tsc
* stabilize and update Millimeter scale snapshot test on ubuntu
* update snapshot for Inch scale test
* Update snapshots
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Move some sketch functions to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move asserts to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* sweep, loft -> KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move pattern transforms to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Fix the black screen of death
* fmt
* make check
* Clean up
* Fix up zoom to fit
* Change how emulateNetworkConditions work
* Do NOT use browser's offline/online mechanisms
* Fix test
* Rename desktop e2e scripts and tags for consistency
* Show local command in main test step
* Restore 'e2e' prefix to clarify GitHub UI
* Add web script to contributor guide
* Replace uses of get_unlabeled_kw_arg with _typed version
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Remove more untyped arg getters
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>