-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rust artifact graph #5068
Rust artifact graph #5068
Conversation
QA Wolf here! As you write new code it's important that your test coverage is keeping up. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
e5a9326
to
177c078
Compare
177c078
to
5d9ce98
Compare
8095105
to
87283e0
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5068 +/- ##
==========================================
+ Coverage 86.04% 86.09% +0.04%
==========================================
Files 88 89 +1
Lines 31450 32389 +939
==========================================
+ Hits 27062 27884 +822
- Misses 4388 4505 +117
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looking through the crux of the changes in wasm-lib, but during user testing I am seeing a similar behavior to the issue that arose last week, where sweeps were not being populated in the artifactGraph from code mods, but they appear in there after a refresh. Has this PR received the fixes you applied to main for this?
Screenshare.-.2025-01-16.12_48_42.PM-compressed.mp4
|
||
impl EdgeDirection { | ||
#[must_use] | ||
fn merge(&self, other: EdgeDirection) -> EdgeDirection { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[c] Neat! this is fun to read
12b5f2c
to
b3c87f5
Compare
641b348
to
2cc2c91
Compare
2cc2c91
to
9bbcc1b
Compare
@franknoirot, see the follow-up: |
I think I know what the problem is. We need to also save the engine responses in the execution cache. |
Cargo bench fix is here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behavior I raised an issue about is fixed, and the app is behaving as expected now. Excellent work on this wow!
* Start implementing a "prepareToEdit" callback for extrude * Start of generic edit flow for operations * Actually invoking command bar send generically on double-click * Refactor: break out non-React hook helper to calculate Kcl expression value * Add unit tests, fmt * Integrate helper to get calculated KclExpression * Clean up unused imports, simplify use of `programMemoryFromVariables` * Implement basic extrude editing * Refactor: move DefaultPlanesStr to its own lib file * Add support for editing offset planes * Add Edit right-click menu option * Turn off edit flow for sketch for now * Add e2e tests for sketch and offset plane editing, fix bug found with offset plane editing * Add failing e2e extrude edit test * Remove action version of extrude AST mod * Fix behavior when adding a constant while editing operation, fixing e2e test * Patch in changes from 61b02b5 * Remove shell's prepareToEdit * Add other Surface types to `artifactIsPlaneWithPaths` * refactor: rename `item` to `operation` * Allow `prepareToEdit` to fail with a toast, signal sketch-on-offset is unimplemented * Rework sketch e2e test to test several working and failing cases * Fix tsc errors related to making `codeRef` optional * Make basic error messages more friendly * fmt * Reset modifyAst.ts to main * Fix broken artifactGraph unit test * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Remove unused import * Look at this (photo)Graph *in the voice of Nickelback* * Make the offset plane insert at the end, not one before * Fix bug caught by e2e test failure with "Command needs review" logic * Update src/machines/modelingMachine.ts Co-authored-by: Pierre Jacquier <[email protected]> * Remove console logs per @pierremtb * Update src/components/CommandBar/CommandBarHeader.tsx Co-authored-by: Jonathan Tran <[email protected]> * Use better programMemory init thanks @jtran * Fix tsc post merge of #5068 * Fix logic for `artifactIsPlaneWithPaths` post-merge * Need to disable the sketch-on-face case now that artifactGraph is in Rust. Will active in a future PR (cc @jtran) * Re-run CI after snapshots * Update FeatureTreePane to not use `useCommandsContext`, missed during merge * Fix merge issue, import location change on edited file * fix click test step, which I believe is waiting for context scripts to load * Convert toolbarFixture.exeIndicator to getter We need to convert all these selectors on fixtures to getters, because they can go stale if called on the fixture constructor. * Missed a dumb little thing in toolbarFixture.ts * Fix goof with merge * fmt * Another dumb missed thing during merge I gotta get used to the LazyGit merge tool I'm not good at it yet * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Conver sceneFixture's exeIndicator to a getter Locators on fixtures will be frozen from the time of the fixture's initialization, I'm increasingly convinced * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Post-kwargs E2E test cleanup * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Pierre Jacquier <[email protected]> Co-authored-by: Jonathan Tran <[email protected]>
* Start porting artifact graph creation to Rust * Add most of artifact graph creation * Add handling loft command from recent PR * Refactor artifact merge code so that it errors when a new artifact type is added * Add sweep subtype * Finish implementation of build artifact graph * Fix wasm.ts to use new combined generated ts-rs file * Fix Rust lints * Fix lints * Fix up replacement code * Add artifact graph to WASM outcome * Add artifact graph to simulation test output * Add new artifact graph output snapshots * Fix wall field and reduce unreachable code * Change field order for subtype * Change subtype to be determined from the request, like the TS * Fix plane sweep_id * Condense code * Change ID types to be properly optional * Change to favor the new ID, the same as TS * Fix to make error impossible * Rename artifact type tag values to match TS * Fix name of field on Cap * Update outputs * Change to use Rust source range * Update output snapshots * Add conversion to mermaid mind map and add to snapshot tests * Add new mermaid mind map output * Add flowchart * Remove raw artifact graph from tests * Remove JSON artifact graph output * Update output file with header * Update output after adding flowchart * Fix flowchart to not have duplicate edges, one in each direction * Fix not not output duplicate edges in flowcharts * Change flowchart edge style to be more obvious when a direction is missing * Update output after deduplication of edges * Fix not not skip sketch-on-face artifacts * Add docs * Fix edge iteration order to be stable * Update output after fixing order * Port TS artifactGraph.test.ts tests to simulation tests * Add grouping segments and solid2ds with their path * Update output flowcharts since grouping paths * Remove TS artifactGraph tests * Remove unused d3 dependencies * Fix to track loft ID on paths * Add command ID to error messages * Move artifact graph test code to a separate file since it's a large file * Reduce function visibility * Remove TS artifact graph code * Fix spelling error with serde * Add TODO for edge cut consumed ID * Add comment about mermaid edge rank * Fix mermaid flowchart edge cuts to appear as children of their edges * Update output since fixing flowchart order * Fix to always build the artifact graph even when there's a KCL error * Add artifact graph to error output * Change optional ID merge to match TS * Remove redundant SourceRange definition * Remove Rust-flavored default source range function * Add helper for source range creation * Update doc comment for the website * Update docs after doc comment change * Fix to save engine responses in execution cache * Remove unused import * Fix to not call WASM function before beforeAll callback is run * Remove more unused imports
Resolves #4860.
This moves the creation of the artifact graph from TS to Rust, which is returned as an output of KCL execution. Besides a minor rename (
solid2D
tosolid2d
), the actual graph should have zero changes. I did a direct port in order to preserve the current output and maintain the team's understanding.Visualizations
Check out the new visualizations using Mermaid.
src/wasm-lib/kcl/tests/artifact_graph_example_code1/artifact_graph_flowchart.snap.md
src/wasm-lib/kcl/tests/fillet-and-shell/artifact_graph_mind_map.snap.md
Related issues:
The Mermaid representations of the artifact graph serve a few purposes:
KCL Program Output
The artifact graph is (part of) the output of a KCL program, so it's important that we both understand it and make sure we don't break it.
Data Flow
Instead of returning from WASM and building the artifact graph in TS, it's built in Rust on the WASM side before returning from KCL execution. This means that the artifact graph is part of
ExecState
which is cached on the Rust side.Before:
After:
The only exception to this is that
PathToNode
s are all empty. The wrapper inwasm.ts
immediately fills them in on the TS side.