Closed dshaw closed 5 months ago
Uses #2316 as a part of its test fixture.
Add fileMachine.
@Irev-Dev @franknoirot Currently dumping ast
and kclErrors
from kclManager
. What other properties from kclManager
would be useful for debugging?
Sample output of SceneInfra (client_state.scene_infra
) using a full object copy from https://github.com/KittyCAD/modeling-app/commit/48774ba8bf025706857ca1b6c54e939ff9ec6563
@Irev-Dev @franknoirot Now that I have some of the higher level structs in Rustland accepting flexible JavaScript objects, I can go back and reimplement kclManager
to include similar fidelity to SceneInfra
. I just have to delete some of the struct definitions and convert things to simply use serde_json::Value. https://github.com/KittyCAD/modeling-app/issues/2338#issuecomment-2135901422
Current status of client_state
@jessfraz How attached are we to making everything snake_case? Since I'm pulling the just pass me JSON escape hatch, I'm no longer coercing everything to snake_case in Rust. A quick scroll through the data above will display many instances of keys left in camelCase from the JavaScript side of things. If maintaining snake_case is important for our final object, I can update the keys in the TypeScript processing.
super not attached ahaha even if we made a parser we could alias what we needed to make it work, its just internal use anyways
Cool, I won't prioritize.
Before I rip open XState, does anyone want to add any of the following singletons to coredump?
// TODO: /src/lib/singletons.ts also defines the following singletons
// sceneEntitiesManager
console.log(
'CoreDump: TODO? sceneEntitiesManager',
globalThis?.window?.sceneEntitiesManager
)
// editorManager
console.log(
'CoreDump: TODO? editorManager',
globalThis?.window?.editorManager
)
// enableMousePositionLogs
console.log(
'CoreDump: TODO? enableMousePositionLogs',
globalThis?.window?.enableMousePositionLogs
)
@Irev-Dev @franknoirot Currently dumping ast and kclErrors from kclManager. What other properties from kclManager would be useful for debugging?
@Irev-Dev will know better than me, but my thoughts are:
isExecuting
logs
programMemory
wasmInitFailed
Yeah I was going to mention programMemory
I'll be a bit more helpful on the XState set than I will be with the singletons. Getting access to each machine's state will be a matter of:
use<insertMachineName>Context()
state.value
and the event that brought us here with state.event
state.context
For example:
const { state: modelingState } = useModelingContext()
const modelingDataToSend = {
value: modelingState.value,
event: modelingState.event,
context: modelingState.context,
}
I'll be a bit more helpful on the XState set than I will be with the singletons. Getting access to each machine's state will be a matter of...
Thank you, @franknoirot. This is really helpful. I had punched my way into XState internals at one point during my testing, but __xstate__
is no longer showing up on global. https://github.com/KittyCAD/modeling-app/blob/coredump-clientstate/src/lib/coredump.ts#L349
Thanks for showing me the right way to access the reference. I was about to hit you up for this, so your timing is impeccable.
No sweat @dshaw! Just know that the use<insertMachineName>Context()
function call is a React hook, so will only be available from within a React component. I think wherever the coredump.getClientState()
gets called from React is where you can safely queue up all your XState context calls, and maybe it's best to pass them or their already-processed data into getClientState
? However you want, just want you to know you can't call those hooks from outside a React component.
@franknoirot I think we might need to add some plumbing to the various machines so they each share the data we need with coredump given XState's data privacy. Given that, I think I might land the singleton portion of the code first to limit the surface area of these changes.
activeSegments
Coredump of all singletons have landed in https://github.com/KittyCAD/modeling-app/tree/coredump-clientstate. The size of the JSON we're producing is now significantly larger than the initial implementation, so the data can no longer be urlencode and pass to GitHub. It needs to be uploaded similar to how we upload screenshots.
One of my favorite commits as I prepare to land coredump was deleting all the Rust structs I had to build out before getting ts-rs
upgraded to 8.1 and patched since it is the implementation I had in mind when I began working on this. https://github.com/KittyCAD/modeling-app/commit/ec20e9752fbfc9707cf5881ebebfafc23af38884
I got hung up on some rust stuff that I'll try resolve on Thursday, 2024-05-30 with @paultag. https://github.com/KittyCAD/modeling-app/commit/62302ccfda46b62ad29c61dde760b5f8a0f144cd
Last but not least, I want to get a Playwright/e2e test in to accompany the PR.
Completed Rust upload implementation in https://github.com/KittyCAD/modeling-app/tree/coredump-uploadmulti
See demo of final upload in https://github.com/KittyCAD/modeling-app/issues/2650
This issue extends #1573 and captures the details needed to complete the implementation.
Client state needed to understand the state of the modeling-app front end is contained within several singletons and xstate machines. Most of the entries in coredump so far have been relatively flat. None of these will be flat and some might have arbitrary structures. Some state might need to be excluded in the dump, like TOKEN in Auth. For excluded data that’s provides critical insights into whether the app should be functional, we may want to include a data validation like
isValidToken: boolean
.Proposed structure