Revert "ignore errors on the modeling cmds that are only for the artifact graph"
This reverts commit db62c1962d.
			
			
This commit is contained in:
		| @ -51,8 +51,6 @@ pub struct EngineConnection { | ||||
|     /// If the server sends session data, it'll be copied to here. | ||||
|     session_data: Arc<RwLock<Option<ModelingSessionData>>>, | ||||
|  | ||||
|     ignore_failed_responses: Arc<RwLock<Vec<uuid::Uuid>>>, | ||||
|  | ||||
|     execution_kind: Arc<RwLock<ExecutionKind>>, | ||||
|     stats: EngineStats, | ||||
| } | ||||
| @ -345,7 +343,6 @@ impl EngineConnection { | ||||
|             batch_end: Arc::new(RwLock::new(IndexMap::new())), | ||||
|             artifact_commands: Arc::new(RwLock::new(Vec::new())), | ||||
|             default_planes: Default::default(), | ||||
|             ignore_failed_responses: Arc::new(RwLock::new(Vec::new())), | ||||
|             session_data, | ||||
|             execution_kind: Default::default(), | ||||
|             stats: Default::default(), | ||||
| @ -367,10 +364,6 @@ impl EngineManager for EngineConnection { | ||||
|         self.responses.clone() | ||||
|     } | ||||
|  | ||||
|     fn ignore_failed_responses(&self) -> Arc<RwLock<Vec<Uuid>>> { | ||||
|         self.ignore_failed_responses.clone() | ||||
|     } | ||||
|  | ||||
|     fn artifact_commands(&self) -> Arc<RwLock<Vec<ArtifactCommand>>> { | ||||
|         self.artifact_commands.clone() | ||||
|     } | ||||
|  | ||||
| @ -32,7 +32,6 @@ pub struct EngineConnection { | ||||
|     execution_kind: Arc<RwLock<ExecutionKind>>, | ||||
|     /// The default planes for the scene. | ||||
|     default_planes: Arc<RwLock<Option<DefaultPlanes>>>, | ||||
|     ignore_failed_responses: Arc<RwLock<Vec<uuid::Uuid>>>, | ||||
|     stats: EngineStats, | ||||
| } | ||||
|  | ||||
| @ -44,7 +43,6 @@ impl EngineConnection { | ||||
|             artifact_commands: Arc::new(RwLock::new(Vec::new())), | ||||
|             execution_kind: Default::default(), | ||||
|             default_planes: Default::default(), | ||||
|             ignore_failed_responses: Arc::new(RwLock::new(Vec::new())), | ||||
|             stats: Default::default(), | ||||
|         }) | ||||
|     } | ||||
| @ -64,10 +62,6 @@ impl crate::engine::EngineManager for EngineConnection { | ||||
|         Arc::new(RwLock::new(IndexMap::new())) | ||||
|     } | ||||
|  | ||||
|     fn ignore_failed_responses(&self) -> Arc<RwLock<Vec<uuid::Uuid>>> { | ||||
|         self.ignore_failed_responses.clone() | ||||
|     } | ||||
|  | ||||
|     fn stats(&self) -> &EngineStats { | ||||
|         &self.stats | ||||
|     } | ||||
|  | ||||
| @ -43,7 +43,6 @@ pub struct EngineConnection { | ||||
|     responses: Arc<RwLock<IndexMap<Uuid, WebSocketResponse>>>, | ||||
|     artifact_commands: Arc<RwLock<Vec<ArtifactCommand>>>, | ||||
|     execution_kind: Arc<RwLock<ExecutionKind>>, | ||||
|     ignore_failed_responses: Arc<RwLock<Vec<uuid::Uuid>>>, | ||||
|     /// The default planes for the scene. | ||||
|     default_planes: Arc<RwLock<Option<DefaultPlanes>>>, | ||||
|     stats: EngineStats, | ||||
| @ -64,7 +63,6 @@ impl EngineConnection { | ||||
|             artifact_commands: Arc::new(RwLock::new(Vec::new())), | ||||
|             execution_kind: Default::default(), | ||||
|             default_planes: Default::default(), | ||||
|             ignore_failed_responses: Arc::new(RwLock::new(Vec::new())), | ||||
|             stats: Default::default(), | ||||
|         }) | ||||
|     } | ||||
| @ -158,10 +156,6 @@ impl crate::engine::EngineManager for EngineConnection { | ||||
|         self.responses.clone() | ||||
|     } | ||||
|  | ||||
|     fn ignore_failed_responses(&self) -> Arc<RwLock<Vec<uuid::Uuid>>> { | ||||
|         self.ignore_failed_responses.clone() | ||||
|     } | ||||
|  | ||||
|     fn stats(&self) -> &EngineStats { | ||||
|         &self.stats | ||||
|     } | ||||
|  | ||||
| @ -90,9 +90,6 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static { | ||||
|     /// Get the command responses from the engine. | ||||
|     fn responses(&self) -> Arc<RwLock<IndexMap<Uuid, WebSocketResponse>>>; | ||||
|  | ||||
|     /// Ignore failed responses of these command ids. | ||||
|     fn ignore_failed_responses(&self) -> Arc<RwLock<Vec<Uuid>>>; | ||||
|  | ||||
|     /// Get the artifact commands that have accumulated so far. | ||||
|     fn artifact_commands(&self) -> Arc<RwLock<Vec<ArtifactCommand>>>; | ||||
|  | ||||
| @ -153,7 +150,6 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static { | ||||
|     async fn clear_queues(&self) { | ||||
|         self.batch().write().await.clear(); | ||||
|         self.batch_end().write().await.clear(); | ||||
|         self.ignore_failed_responses().write().await.clear(); | ||||
|     } | ||||
|  | ||||
|     /// Send a modeling command and wait for the response message. | ||||
| @ -300,21 +296,6 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static { | ||||
|         Ok(()) | ||||
|     } | ||||
|  | ||||
|     // Add a modeling command to the batch but don't fire it right away. | ||||
|     // Ignore the failure of this command. | ||||
|     async fn batch_modeling_cmd_ignore_failure( | ||||
|         &self, | ||||
|         id: uuid::Uuid, | ||||
|         source_range: SourceRange, | ||||
|         cmd: &ModelingCmd, | ||||
|     ) -> Result<(), crate::errors::KclError> { | ||||
|         self.ignore_failed_responses().write().await.push(id); | ||||
|  | ||||
|         self.batch_modeling_cmd(id, source_range, cmd).await?; | ||||
|  | ||||
|         Ok(()) | ||||
|     } | ||||
|  | ||||
|     // Add a vector of modeling commands to the batch but don't fire it right away. | ||||
|     // This allows you to force them all to be added together in the same order. | ||||
|     // When we are running things in parallel this prevents race conditions that might come | ||||
| @ -486,7 +467,6 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static { | ||||
|                 if let OkWebSocketResponseData::ModelingBatch { responses } = response { | ||||
|                     let responses = responses.into_iter().map(|(k, v)| (Uuid::from(k), v)).collect(); | ||||
|                     self.parse_batch_responses(last_id.into(), id_to_source_range, responses) | ||||
|                         .await | ||||
|                 } else { | ||||
|                     // We should never get here. | ||||
|                     Err(KclError::Engine(KclErrorDetails { | ||||
| @ -677,7 +657,7 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async fn parse_batch_responses( | ||||
|     fn parse_batch_responses( | ||||
|         &self, | ||||
|         // The last response we are looking for. | ||||
|         id: uuid::Uuid, | ||||
| @ -705,16 +685,6 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static { | ||||
|                     } | ||||
|                 } | ||||
|                 BatchResponse::Failure { errors } => { | ||||
|                     // If this was in our ignore list, we don't care about it. | ||||
|                     if self | ||||
|                         .ignore_failed_responses() | ||||
|                         .read() | ||||
|                         .await | ||||
|                         .iter() | ||||
|                         .any(|id| id == cmd_id) | ||||
|                     { | ||||
|                         continue; | ||||
|                     } | ||||
|                     // Get the source range for the command. | ||||
|                     let source_range = id_to_source_range.get(cmd_id).cloned().ok_or_else(|| { | ||||
|                         KclError::Engine(KclErrorDetails { | ||||
|  | ||||
| @ -370,17 +370,6 @@ impl Args { | ||||
|         self.ctx.engine.batch_modeling_cmd(id, self.source_range, &cmd).await | ||||
|     } | ||||
|  | ||||
|     pub(crate) async fn batch_modeling_cmd_ignore_failure( | ||||
|         &self, | ||||
|         id: uuid::Uuid, | ||||
|         cmd: ModelingCmd, | ||||
|     ) -> Result<(), crate::errors::KclError> { | ||||
|         self.ctx | ||||
|             .engine | ||||
|             .batch_modeling_cmd_ignore_failure(id, self.source_range, &cmd) | ||||
|             .await | ||||
|     } | ||||
|  | ||||
|     // Add multiple modeling commands to the batch but don't fire them right away. | ||||
|     pub(crate) async fn batch_modeling_cmds(&self, cmds: &[ModelingCmdReq]) -> Result<(), crate::errors::KclError> { | ||||
|         self.ctx.engine.batch_modeling_cmds(self.source_range, cmds).await | ||||
|  | ||||
| @ -130,6 +130,7 @@ async fn inner_extrude( | ||||
|                 sketch, | ||||
|                 id.into(), | ||||
|                 length, | ||||
|                 false, | ||||
|                 &NamedCapTags { | ||||
|                     start: tag_start.as_ref(), | ||||
|                     end: tag_end.as_ref(), | ||||
| @ -154,6 +155,7 @@ pub(crate) async fn do_post_extrude<'a>( | ||||
|     sketch: &Sketch, | ||||
|     solid_id: ArtifactId, | ||||
|     length: f64, | ||||
|     sectional: bool, | ||||
|     named_cap_tags: &'a NamedCapTags<'a>, | ||||
|     exec_state: &mut ExecState, | ||||
|     args: &Args, | ||||
| @ -206,43 +208,45 @@ pub(crate) async fn do_post_extrude<'a>( | ||||
|         vec![] | ||||
|     }; | ||||
|  | ||||
|     for (curve_id, face_id) in face_infos | ||||
|         .iter() | ||||
|         .filter(|face_info| face_info.cap == ExtrusionFaceCapType::None) | ||||
|         .filter_map(|face_info| { | ||||
|             if let (Some(curve_id), Some(face_id)) = (face_info.curve_id, face_info.face_id) { | ||||
|                 Some((curve_id, face_id)) | ||||
|             } else { | ||||
|                 None | ||||
|             } | ||||
|         }) | ||||
|     { | ||||
|         // Batch these commands, because the Rust code doesn't actually care about the outcome. | ||||
|         // So, there's no need to await them. | ||||
|         // Instead, the Typescript codebases (which handles WebSocket sends when compiled via Wasm) | ||||
|         // uses this to build the artifact graph, which the UI needs. | ||||
|         // | ||||
|         // We ignore the failure here because if one of these fails, in the case of a sectional | ||||
|         // sweep, the whole model should not fail, this is merely for the artifact graph. | ||||
|         args.batch_modeling_cmd_ignore_failure( | ||||
|             exec_state.next_uuid(), | ||||
|             ModelingCmd::from(mcmd::Solid3dGetOppositeEdge { | ||||
|                 edge_id: curve_id, | ||||
|                 object_id: sketch.id, | ||||
|                 face_id, | ||||
|             }), | ||||
|         ) | ||||
|         .await?; | ||||
|     // Face filtering attempt in order to resolve https://github.com/KittyCAD/modeling-app/issues/5328 | ||||
|     // We need to not run Solid3dGetOppositeEdge and Solid3dGetNextAdjacentEdge because it is too | ||||
|     // hard to know when they work or fail. | ||||
|     if !sectional { | ||||
|         for (curve_id, face_id) in face_infos | ||||
|             .iter() | ||||
|             .filter(|face_info| face_info.cap == ExtrusionFaceCapType::None) | ||||
|             .filter_map(|face_info| { | ||||
|                 if let (Some(curve_id), Some(face_id)) = (face_info.curve_id, face_info.face_id) { | ||||
|                     Some((curve_id, face_id)) | ||||
|                 } else { | ||||
|                     None | ||||
|                 } | ||||
|             }) | ||||
|         { | ||||
|             // Batch these commands, because the Rust code doesn't actually care about the outcome. | ||||
|             // So, there's no need to await them. | ||||
|             // Instead, the Typescript codebases (which handles WebSocket sends when compiled via Wasm) | ||||
|             // uses this to build the artifact graph, which the UI needs. | ||||
|             args.batch_modeling_cmd( | ||||
|                 exec_state.next_uuid(), | ||||
|                 ModelingCmd::from(mcmd::Solid3dGetOppositeEdge { | ||||
|                     edge_id: curve_id, | ||||
|                     object_id: sketch.id, | ||||
|                     face_id, | ||||
|                 }), | ||||
|             ) | ||||
|             .await?; | ||||
|  | ||||
|         args.batch_modeling_cmd_ignore_failure( | ||||
|             exec_state.next_uuid(), | ||||
|             ModelingCmd::from(mcmd::Solid3dGetNextAdjacentEdge { | ||||
|                 edge_id: curve_id, | ||||
|                 object_id: sketch.id, | ||||
|                 face_id, | ||||
|             }), | ||||
|         ) | ||||
|         .await?; | ||||
|             args.batch_modeling_cmd( | ||||
|                 exec_state.next_uuid(), | ||||
|                 ModelingCmd::from(mcmd::Solid3dGetNextAdjacentEdge { | ||||
|                     edge_id: curve_id, | ||||
|                     object_id: sketch.id, | ||||
|                     face_id, | ||||
|                 }), | ||||
|             ) | ||||
|             .await?; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     let Faces { | ||||
|  | ||||
| @ -175,6 +175,7 @@ async fn inner_loft( | ||||
|             &sketch, | ||||
|             id.into(), | ||||
|             0.0, | ||||
|             false, | ||||
|             &super::extrude::NamedCapTags { | ||||
|                 start: tag_start.as_ref(), | ||||
|                 end: tag_end.as_ref(), | ||||
|  | ||||
| @ -107,6 +107,7 @@ async fn inner_revolve( | ||||
|                 sketch, | ||||
|                 id.into(), | ||||
|                 0.0, | ||||
|                 false, | ||||
|                 &super::extrude::NamedCapTags { | ||||
|                     start: tag_start.as_ref(), | ||||
|                     end: tag_end.as_ref(), | ||||
|  | ||||
| @ -211,6 +211,7 @@ async fn inner_sweep( | ||||
|                 sketch, | ||||
|                 id.into(), | ||||
|                 0.0, | ||||
|                 sectional, | ||||
|                 &super::extrude::NamedCapTags { | ||||
|                     start: tag_start.as_ref(), | ||||
|                     end: tag_end.as_ref(), | ||||
|  | ||||
| @ -24,7 +24,6 @@ pub struct EngineConnection { | ||||
|     batch_end: Arc<RwLock<IndexMap<uuid::Uuid, (WebSocketRequest, kcl_lib::SourceRange)>>>, | ||||
|     core_test: Arc<RwLock<String>>, | ||||
|     execution_kind: Arc<RwLock<ExecutionKind>>, | ||||
|     ignore_failed_responses: Arc<RwLock<Vec<uuid::Uuid>>>, | ||||
|     /// The default planes for the scene. | ||||
|     default_planes: Arc<RwLock<Option<DefaultPlanes>>>, | ||||
|     stats: EngineStats, | ||||
| @ -40,7 +39,6 @@ impl EngineConnection { | ||||
|             core_test: result, | ||||
|             execution_kind: Default::default(), | ||||
|             default_planes: Default::default(), | ||||
|             ignore_failed_responses: Default::default(), | ||||
|             stats: Default::default(), | ||||
|         }) | ||||
|     } | ||||
| @ -373,10 +371,6 @@ impl kcl_lib::EngineManager for EngineConnection { | ||||
|         Arc::new(RwLock::new(IndexMap::new())) | ||||
|     } | ||||
|  | ||||
|     fn ignore_failed_responses(&self) -> Arc<RwLock<Vec<uuid::Uuid>>> { | ||||
|         self.ignore_failed_responses.clone() | ||||
|     } | ||||
|  | ||||
|     fn stats(&self) -> &EngineStats { | ||||
|         &self.stats | ||||
|     } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user