| 202 | } |
| 203 | |
| 204 | async fn start_fixture() -> Fixture { |
| 205 | let tmp = TempDir::new().expect("temp dir"); |
| 206 | let project_root = tmp.path().join("project"); |
| 207 | std::fs::create_dir_all(&project_root).expect("project dir"); |
| 208 | std::fs::write( |
| 209 | project_root.join("lib.rs"), |
| 210 | "pub fn lcm_fixture() -> u32 { 7 }\n", |
| 211 | ) |
| 212 | .expect("seed source file"); |
| 213 | |
| 214 | let global_db_path = tmp.path().join("global").join("global.db"); |
| 215 | let env_guards = vec![EnvVarGuard::set("TRACEDECAY_GLOBAL_DB", &global_db_path)]; |
| 216 | // Pre-create both GlobalDb-schema stores from the cached empty template |
| 217 | // so seeding and dashboard startup open existing DBs instead of paying a |
| 218 | // full schema creation each (slow on Windows). |
| 219 | write_empty_global_db_schema(&global_db_path).await; |
| 220 | let cg = TraceDecay::init(&project_root) |
| 221 | .await |
| 222 | .expect("tracedecay init"); |
| 223 | let session_db_path = project_session_db_path(&project_root); |
| 224 | write_empty_global_db_schema(&session_db_path).await; |
| 225 | let (session_id, child_node_id, parent_node_id) = |
| 226 | seed_lcm_store(&session_db_path, &project_root).await; |
| 227 | let port = pick_free_port(); |
| 228 | let base_url = format!("http://127.0.0.1:{port}"); |
| 229 | let server = tokio::spawn(async move { |
| 230 | let _ = dashboard::run(&cg, "127.0.0.1", port, false).await; |
| 231 | }); |
| 232 | wait_for_dashboard(&http_agent(), &base_url).await; |
| 233 | |
| 234 | Fixture { |
| 235 | _tmp: tmp, |
| 236 | _env_guards: env_guards, |
| 237 | base_url, |
| 238 | server, |
| 239 | session_db_path, |
| 240 | _project_root: project_root, |
| 241 | session_id, |
| 242 | child_node_id, |
| 243 | parent_node_id, |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | #[test] |
| 248 | fn lcm_overview_and_search_preserve_shapes() { |