Add building the artifact graph in sketch mode, take 2 (#7557)

* Add building the artifact graph in mock execution

* Update output

* Add updating the artifact graph after mock execution

* Fix spelling

* Fix to return it all the way

* Fix to not make artifact fields undefined in TS
This commit is contained in:
Jonathan Tran
2025-06-23 11:34:14 -04:00
committed by GitHub
parent 7ce0ef770a
commit eabcf86436
11 changed files with 71 additions and 59 deletions

View File

@ -2286,6 +2286,25 @@ w = f() + f()
ctx2.close().await;
}
#[cfg(feature = "artifact-graph")]
#[tokio::test(flavor = "multi_thread")]
async fn mock_has_stable_ids() {
let ctx = ExecutorContext::new_mock(None).await;
let code = "sk = startSketchOn(XY)
|> startProfile(at = [0, 0])";
let program = crate::Program::parse_no_errs(code).unwrap();
let result = ctx.run_mock(program, false).await.unwrap();
let ids = result.artifact_graph.iter().map(|(k, _)| *k).collect::<Vec<_>>();
assert!(!ids.is_empty(), "IDs should not be empty");
let ctx2 = ExecutorContext::new_mock(None).await;
let program2 = crate::Program::parse_no_errs(code).unwrap();
let result = ctx2.run_mock(program2, false).await.unwrap();
let ids2 = result.artifact_graph.iter().map(|(k, _)| *k).collect::<Vec<_>>();
assert_eq!(ids, ids2, "Generated IDs should match");
}
#[cfg(feature = "artifact-graph")]
#[tokio::test(flavor = "multi_thread")]
async fn sim_sketch_mode_real_mock_real() {