-
Notifications
You must be signed in to change notification settings - Fork 31
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
Change artifact IDs to be stable across KCL executions #4101
Open
jtran
wants to merge
21
commits into
main
Choose a base branch
from
jtran/stable-artifact-ids
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+889
−323
Conversation
This file contains 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
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 ↗︎
|
jtran
force-pushed
the
jtran/stable-artifact-ids
branch
from
October 5, 2024 06:27
ffd5aae
to
2cf04f4
Compare
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.
Related: #868, #3836, #4045
Stable IDs are useful because the face ID selected, for example, can be meaningful through user code edits and AST modifications.
This adds a debug view of the artifact graph at the bottom of the Debug Pane in order to prove that segment IDs don't change after editing KCL code.
Note: Some IDs, like plane IDs, do change. We'll address this in a future PR.
Implementation
We create an
IdGenerator
that's part of the executor'sExecState
.ExecState
is threaded through execution of all KCL code #3877. Whenever we would have generated a UUID, we instead ask theIdGenerator
. It accumulates IDs generated and only generates a new UUID if needed. The executor returns theIdGenerator
as part of its return value. The web app stores this and provides it to the next run. Now the executor has all the UUIDs it generated last time and reuses them in the same order.In the future, we may be able to optimize by reducing the amount of data that must cross the WASM boundary by only storing a random seed, rather than all IDs. But IDs do need to be unique. So it didn't seem worth the effort for now.