ZIP 복구 결과와 경고 화면을 연결함
- 작성자
- 호시노 히나타
- 작성 시각
- 커밋
fec7fdd95034a49830fa6dfbeed5ae82e678068d- 부모
- 902ecf5
변경된 파일 14개
+871-30| @@ -192,3 +192,21 @@ Ubuntu 제거 안내는 패키지 관리자 터미널 출력입니다. 이전 | ||
| 192 | 192 | - create-sevenzip-resource: 7z 생성의 큰 작업 허용 질문. |
| 193 | 193 | |
| 194 | 194 | 7z를 선택하면 입력한 ZIP 암호와 실행 취소 기록을 지우며, ZIP으로 돌아와도 암호를 복원하지 않는다. 기본 저장 창은 .7z를 제안하며 암호가 필요하면 ZIP을 선택한다. 이 상황들은 가짜 작업자로 화면을 구성하므로 실제 7z 생성과 독립 도구 호환 시험을 대신하지 않는다. |
| 195 | 추가: | |
| 196 | 추가: ### ZIP 복구 | |
| 197 | 추가: | |
| 198 | 추가: 손상 오류에서 "복구본 저장 위치 선택"을 누르면 운영체제 기본 저장 창이 열립니다. | |
| 199 | 추가: 원본을 수정하지 않고 새 ZIP을 만들며, 기존 파일은 덮어쓰지 않습니다. | |
| 200 | 추가: 복구본 저장 완료와 일부 복구를 구분하고, 일부 복구본을 열어도 유실 경고를 유지합니다. | |
| 201 | 추가: 검증된 항목도 손상 전 원본과 동일하다는 보증은 아닙니다. | |
| 202 | 추가: | |
| 203 | 추가: - recovery-progress: 항목 분석 중에는 전체 개수나 완료율을 추정하지 않습니다. | |
| 204 | 추가: - recovery-complete: 검증과 저장, 작업자 종료를 확인한 복구본입니다. | |
| 205 | 추가: - recovery-partial: 유실 항목을 구분하고 저장된 부분 복구본을 열 수 있습니다. | |
| 206 | 추가: - recovery-unknown: 전체 목록을 알 수 없어 추가 유실 여부를 확인할 수 없습니다. | |
| 207 | 추가: - recovery-impossible: 복구 가능한 항목과 생성된 복구본이 없습니다. | |
| 208 | 추가: - recovery-cancelled: 취소 종료와 출력 없음 상태입니다. | |
| 209 | 추가: - recovery-save-error: 분석이 끝났어도 저장 실패를 완료로 표시하지 않습니다. | |
| 210 | 추가: - recovery-resource: 원본 제한은 유지하면서 압축률 예산 승인을 확인합니다. | |
| 211 | 추가: | |
| 212 | 추가: 예: `Zipelo --ui-scenario recovery-partial`. 상황 명령은 가짜 작업자만 사용합니다. |
| @@ -7,6 +7,7 @@ pub enum Purpose { | ||
| 7 | 7 | Folder, |
| 8 | 8 | Destination, |
| 9 | 9 | Retry, |
| 10 | 추가: SaveRecoveryZip, | |
| 10 | 11 | SaveZip, |
| 11 | 12 | SaveSevenZip, |
| 12 | 13 | SaveGzip, |
| @@ -110,7 +111,7 @@ fn choose_portal(request: DialogRequest) -> Result<Option<Vec<PathBuf>>, String> | ||
| 110 | 111 | use ashpd::desktop::file_chooser::{FileFilter, OpenFileRequest, SaveFileRequest}; |
| 111 | 112 | let filters = match request.purpose { |
| 112 | 113 | Purpose::Open => archive_filters(), |
| 113 | 삭제: Purpose::SaveZip => vec![("ZIP 압축파일", vec!["zip".into()])], | |
| 114 | 추가: Purpose::SaveZip | Purpose::SaveRecoveryZip => vec![("ZIP 압축파일", vec!["zip".into()])], | |
| 114 | 115 | Purpose::SaveSevenZip => vec![("7z 압축파일", vec!["7z".into()])], |
| 115 | 116 | _ => Vec::new(), |
| 116 | 117 | } |
| @@ -130,22 +131,26 @@ fn choose_portal(request: DialogRequest) -> Result<Option<Vec<PathBuf>>, String> | ||
| 130 | 131 | .collect::<Vec<_>>(); |
| 131 | 132 | portal_response(pollster::block_on(async move { |
| 132 | 133 | let selected = match request.purpose { |
| 133 | 삭제: Purpose::SaveZip | Purpose::SaveSevenZip | Purpose::SaveGzip | Purpose::RetryGzip => { | |
| 134 | 삭제: SaveFileRequest::default() | |
| 135 | 삭제: .title(if request.purpose == Purpose::SaveSevenZip { | |
| 136 | 삭제: "7z 파일 저장" | |
| 137 | 삭제: } else if request.purpose == Purpose::SaveZip { | |
| 138 | 삭제: "ZIP 파일 저장" | |
| 139 | 삭제: } else { | |
| 140 | 삭제: "압축 해제 파일 저장" | |
| 141 | 삭제: }) | |
| 142 | 삭제: .current_name(Some(request.file_name.as_str())) | |
| 143 | 삭제: .filters(filters) | |
| 144 | 삭제: .current_folder::<&PathBuf>(Some(&request.directory))? | |
| 145 | 삭제: .send() | |
| 146 | 삭제: .await? | |
| 147 | 삭제: .response()? | |
| 148 | 삭제: } | |
| 134 | 추가: Purpose::SaveRecoveryZip | |
| 135 | 추가: | Purpose::SaveZip | |
| 136 | 추가: | Purpose::SaveSevenZip | |
| 137 | 추가: | Purpose::SaveGzip | |
| 138 | 추가: | Purpose::RetryGzip => SaveFileRequest::default() | |
| 139 | 추가: .title(if request.purpose == Purpose::SaveRecoveryZip { | |
| 140 | 추가: "복구본을 새 ZIP 파일로 저장" | |
| 141 | 추가: } else if request.purpose == Purpose::SaveSevenZip { | |
| 142 | 추가: "7z 파일 저장" | |
| 143 | 추가: } else if request.purpose == Purpose::SaveZip { | |
| 144 | 추가: "ZIP 파일 저장" | |
| 145 | 추가: } else { | |
| 146 | 추가: "압축 해제 파일 저장" | |
| 147 | 추가: }) | |
| 148 | 추가: .current_name(Some(request.file_name.as_str())) | |
| 149 | 추가: .filters(filters) | |
| 150 | 추가: .current_folder::<&PathBuf>(Some(&request.directory))? | |
| 151 | 추가: .send() | |
| 152 | 추가: .await? | |
| 153 | 추가: .response()?, | |
| 149 | 154 | purpose => OpenFileRequest::default() |
| 150 | 155 | .title(match purpose { |
| 151 | 156 | Purpose::Open => "압축파일 열기", |
| @@ -206,6 +211,12 @@ fn choose_native(request: DialogRequest) -> Result<Option<Vec<PathBuf>>, String> | ||
| 206 | 211 | .add_filter("7z 압축파일", &["7z"]) |
| 207 | 212 | .save_file() |
| 208 | 213 | .map(|path| vec![path]), |
| 214 | 추가: Purpose::SaveRecoveryZip => dialog | |
| 215 | 추가: .set_title("복구본을 새 ZIP 파일로 저장") | |
| 216 | 추가: .set_file_name(request.file_name) | |
| 217 | 추가: .add_filter("ZIP 압축파일", &["zip"]) | |
| 218 | 추가: .save_file() | |
| 219 | 추가: .map(|path| vec![path]), | |
| 209 | 220 | Purpose::SaveZip => dialog |
| 210 | 221 | .set_title("ZIP 파일 저장") |
| 211 | 222 | .set_file_name(request.file_name) |
| @@ -19,6 +19,8 @@ pub const FOLDER_ERROR: &str = "풀 위치 폴더를 만들 수 없습니다. | ||
| 19 | 19 | |
| 20 | 20 | pub fn error_text(code: ErrorCode) -> &'static str { |
| 21 | 21 | match code { |
| 22 | 추가: ErrorCode::RecoveryIncomplete => "일부 항목만 복구했습니다. 복구본과 경고를 확인하세요.", | |
| 23 | 추가: ErrorCode::RecoveryImpossible => "복구 가능한 항목이 없습니다.", | |
| 22 | 24 | ErrorCode::MissingVolume => { |
| 23 | 25 | "분할 압축파일의 조각이 없습니다. 모든 조각을 같은 폴더에 모은 뒤 .001을 다시 여세요" |
| 24 | 26 | } |
| @@ -201,6 +201,15 @@ fn start_to_wire(start: ui::Start) -> wire::Start { | ||
| 201 | 201 | entry_id, |
| 202 | 202 | list_id: list_to_wire(list_id), |
| 203 | 203 | }, |
| 204 | 추가: ui::Start::RecoverZip { | |
| 205 | 추가: archive, | |
| 206 | 추가: output_file, | |
| 207 | 추가: } => wire::Action::RecoverZip { | |
| 208 | 추가: archive: wire::NativePath::from_path(&crate::archive_path::worker_path(&archive)), | |
| 209 | 추가: output_file: wire::NativePath::from_path(&crate::archive_path::worker_path( | |
| 210 | 추가: &output_file, | |
| 211 | 추가: )), | |
| 212 | 추가: }, | |
| 204 | 213 | ui::Start::CreateSevenZip { |
| 205 | 214 | sources, |
| 206 | 215 | output_file, |
| @@ -253,6 +262,8 @@ fn start_to_wire(start: ui::Start) -> wire::Start { | ||
| 253 | 262 | } |
| 254 | 263 | fn error_to_ui(error: wire::ErrorCode) -> Option<ui::ErrorCode> { |
| 255 | 264 | Some(match error { |
| 265 | 추가: wire::ErrorCode::RecoveryIncomplete => ui::ErrorCode::RecoveryIncomplete, | |
| 266 | 추가: wire::ErrorCode::RecoveryImpossible => ui::ErrorCode::RecoveryImpossible, | |
| 256 | 267 | wire::ErrorCode::MissingVolume => ui::ErrorCode::MissingVolume, |
| 257 | 268 | wire::ErrorCode::None => return None, |
| 258 | 269 | wire::ErrorCode::Integrity => ui::ErrorCode::Integrity, |
| @@ -275,6 +286,12 @@ fn event_to_ui( | ||
| 275 | 286 | expected: Option<wire::ActionKind>, |
| 276 | 287 | ) -> Result<ui::Event, ()> { |
| 277 | 288 | Ok(match message { |
| 289 | 추가: wire::Message::RecoveryEntry(entry) if expected == Some(wire::ActionKind::RecoverZip) => { | |
| 290 | 추가: ui::Event::RecoveryEntry(entry) | |
| 291 | 추가: } | |
| 292 | 추가: wire::Message::RecoveryEnd(end) if expected == Some(wire::ActionKind::RecoverZip) => { | |
| 293 | 추가: ui::Event::RecoveryEnd(end) | |
| 294 | 추가: } | |
| 278 | 295 | wire::Message::VolumeProblem { reason, volume } |
| 279 | 296 | if matches!( |
| 280 | 297 | expected, |
| @@ -243,6 +243,7 @@ pub struct ArchiveApp { | ||
| 243 | 243 | list_focused: bool, |
| 244 | 244 | marquee: Option<Marquee>, |
| 245 | 245 | last_request: Option<Start>, |
| 246 | 추가: recovery_warning: Option<(PathBuf, String)>, | |
| 246 | 247 | targets: Option<BTreeSet<String>>, |
| 247 | 248 | directories: BTreeSet<String>, |
| 248 | 249 | dismissed: bool, |
| @@ -308,6 +309,7 @@ impl ArchiveApp { | ||
| 308 | 309 | list_focused: false, |
| 309 | 310 | marquee: None, |
| 310 | 311 | last_request: None, |
| 312 | 추가: recovery_warning: None, | |
| 311 | 313 | targets: None, |
| 312 | 314 | directories: BTreeSet::new(), |
| 313 | 315 | dismissed: false, |
| @@ -450,6 +452,13 @@ impl ArchiveApp { | ||
| 450 | 452 | if self.model.busy() { |
| 451 | 453 | return; |
| 452 | 454 | } |
| 455 | 추가: if self | |
| 456 | 추가: .recovery_warning | |
| 457 | 추가: .as_ref() | |
| 458 | 추가: .is_some_and(|(path, _)| path != &archive) | |
| 459 | 추가: { | |
| 460 | 추가: self.recovery_warning = None; | |
| 461 | 추가: } | |
| 453 | 462 | self.clear_password(); |
| 454 | 463 | self.destination = present::default_destination(&archive); |
| 455 | 464 | self.automatic_destination = true; |
| @@ -468,6 +477,12 @@ impl ArchiveApp { | ||
| 468 | 477 | if self.picker.is_some() { |
| 469 | 478 | return false; |
| 470 | 479 | } |
| 480 | 추가: if matches!(request, Start::RecoverZip { .. }) { | |
| 481 | 추가: self.work = WorkWindow { | |
| 482 | 추가: height: 480.0, | |
| 483 | 추가: ..WorkWindow::default() | |
| 484 | 추가: }; | |
| 485 | 추가: } | |
| 471 | 486 | self.last_request = Some(request.clone()); |
| 472 | 487 | self.dismissed = false; |
| 473 | 488 | self.details = false; |
| @@ -682,7 +697,7 @@ impl ArchiveApp { | ||
| 682 | 697 | }; |
| 683 | 698 | let directory = match purpose { |
| 684 | 699 | Purpose::SaveZip | Purpose::SaveSevenZip => self.zip_folder.clone(), |
| 685 | 삭제: Purpose::Destination | Purpose::SaveGzip => self | |
| 700 | 추가: Purpose::SaveRecoveryZip | Purpose::Destination | Purpose::SaveGzip => self | |
| 686 | 701 | .model |
| 687 | 702 | .archive |
| 688 | 703 | .as_ref() |
| @@ -700,7 +715,16 @@ impl ArchiveApp { | ||
| 700 | 715 | let request = DialogRequest { |
| 701 | 716 | purpose, |
| 702 | 717 | directory, |
| 703 | 삭제: file_name: if matches!(purpose, Purpose::SaveGzip | Purpose::RetryGzip) { | |
| 718 | 추가: file_name: if purpose == Purpose::SaveRecoveryZip { | |
| 719 | 추가: let stem = self | |
| 720 | 추가: .model | |
| 721 | 추가: .archive | |
| 722 | 추가: .as_ref() | |
| 723 | 추가: .and_then(|p| p.file_stem()) | |
| 724 | 추가: .unwrap_or_default() | |
| 725 | 추가: .to_string_lossy(); | |
| 726 | 추가: format!("{stem}-recovered.zip") | |
| 727 | 추가: } else if matches!(purpose, Purpose::SaveGzip | Purpose::RetryGzip) { | |
| 704 | 728 | self.gzip_name.clone() |
| 705 | 729 | } else { |
| 706 | 730 | self.zip_name.clone() |
| @@ -734,6 +758,14 @@ impl ArchiveApp { | ||
| 734 | 758 | Ok(Some(paths)) if !paths.is_empty() => { |
| 735 | 759 | let path = paths[0].clone(); |
| 736 | 760 | match purpose { |
| 761 | 추가: Purpose::SaveRecoveryZip => { | |
| 762 | 추가: if let Some(archive) = self.model.archive.clone() { | |
| 763 | 추가: self.start(Start::RecoverZip { | |
| 764 | 추가: archive, | |
| 765 | 추가: output_file: path, | |
| 766 | 추가: }); | |
| 767 | 추가: } | |
| 768 | 추가: } | |
| 737 | 769 | Purpose::Open => { |
| 738 | 770 | if std::fs::symlink_metadata(&path) |
| 739 | 771 | .is_ok_and(|m| m.is_file() && !m.file_type().is_symlink()) |
| @@ -812,7 +844,7 @@ impl ArchiveApp { | ||
| 812 | 844 | if let Some(request) = self.last_request.clone() { |
| 813 | 845 | match request { |
| 814 | 846 | Start::List { archive } => self.open_path(archive), |
| 815 | 삭제: Start::Preview { .. } => {} | |
| 847 | 추가: Start::Preview { .. } | Start::RecoverZip { .. } => {} | |
| 816 | 848 | Start::Extract { |
| 817 | 849 | selection, |
| 818 | 850 | gzip_output_name, |
| @@ -1066,6 +1098,9 @@ impl ArchiveApp { | ||
| 1066 | 1098 | .inner_margin(egui::Margin::ZERO), |
| 1067 | 1099 | ) |
| 1068 | 1100 | .show(root, |ui| { |
| 1101 | 추가: if let Some((_, warning)) = &self.recovery_warning { | |
| 1102 | 추가: ui.colored_label(theme::WARNING, warning); | |
| 1103 | 추가: } | |
| 1069 | 1104 | if self.model.archive.is_some() { |
| 1070 | 1105 | self.archive_list(ui); |
| 1071 | 1106 | } else { |
| @@ -1998,7 +2033,11 @@ impl ArchiveApp { | ||
| 1998 | 2033 | ) { |
| 1999 | 2034 | "저장 위치와 추가한 항목을 확인하세요" |
| 2000 | 2035 | } else { |
| 2001 | 삭제: "풀 위치와 선택한 항목을 확인하세요" | |
| 2036 | 추가: if matches!(self.last_request, Some(Start::RecoverZip { .. })) { | |
| 2037 | 추가: "원본과 다른 새 복구본 저장 위치를 선택하세요" | |
| 2038 | 추가: } else { | |
| 2039 | 추가: "풀 위치와 선택한 항목을 확인하세요" | |
| 2040 | 추가: } | |
| 2002 | 2041 | } |
| 2003 | 2042 | }, |
| 2004 | 2043 | ); |
| @@ -2006,6 +2045,20 @@ impl ArchiveApp { | ||
| 2006 | 2045 | } |
| 2007 | 2046 | |
| 2008 | 2047 | fn progress(&mut self, ui: &mut egui::Ui) { |
| 2048 | 추가: if matches!(self.last_request, Some(Start::RecoverZip { .. })) { | |
| 2049 | 추가: ui.strong("ZIP 복구 중"); | |
| 2050 | 추가: ui.label(if self.model.recovery_end.is_some() { | |
| 2051 | 추가: "분석 완료 / 복구본 저장과 작업자 종료 확인 중" | |
| 2052 | 추가: } else { | |
| 2053 | 추가: "원본을 분석하고 있습니다. 전체 항목 수는 아직 알 수 없습니다." | |
| 2054 | 추가: }); | |
| 2055 | 추가: ui.label(format!( | |
| 2056 | 추가: "확인한 항목 {}개", | |
| 2057 | 추가: self.model.recovery_entries.len() | |
| 2058 | 추가: )); | |
| 2059 | 추가: self.cancel_action(ui, false); | |
| 2060 | 추가: return; | |
| 2061 | 추가: } | |
| 2009 | 2062 | if self.model.resource.is_some() { |
| 2010 | 2063 | ui.horizontal(|ui| { |
| 2011 | 2064 | ui.label("사용자 허용을 기다리고 있습니다"); |
| @@ -2070,7 +2123,141 @@ impl ArchiveApp { | ||
| 2070 | 2123 | }); |
| 2071 | 2124 | } |
| 2072 | 2125 | |
| 2126 | 추가: fn recovery_result(&mut self, ui: &mut egui::Ui) { | |
| 2127 | 추가: let t = self.model.terminal.as_ref(); | |
| 2128 | 추가: let summary = self.model.recovery_end.as_ref(); | |
| 2129 | 추가: let confirmed = self.model.confirmed && self.model.error.is_none(); | |
| 2130 | 추가: let saved = confirmed | |
| 2131 | 추가: && t.is_some_and(|t| t.publication == Publication::Complete && t.created_count == 1) | |
| 2132 | 추가: && summary.is_some_and(|s| s.verified_entries > 0); | |
| 2133 | 추가: let partial = summary.is_some_and(|s| !s.complete()); | |
| 2134 | 추가: let title = if !confirmed { | |
| 2135 | 추가: "복구 결과를 확정할 수 없음" | |
| 2136 | 추가: } else if saved && partial { | |
| 2137 | 추가: "일부 항목만 복구함" | |
| 2138 | 추가: } else if saved && t.is_some_and(|t| t.outcome == Outcome::Completed) { | |
| 2139 | 추가: "복구본 저장 완료" | |
| 2140 | 추가: } else if t.is_some_and(|t| t.error == Some(ErrorCode::RecoveryImpossible)) { | |
| 2141 | 추가: "복구 가능한 항목 없음" | |
| 2142 | 추가: } else if t.is_some_and(|t| t.outcome == Outcome::Cancelled) { | |
| 2143 | 추가: "복구를 취소했습니다" | |
| 2144 | 추가: } else { | |
| 2145 | 추가: "복구본 저장을 완료하지 못했습니다" | |
| 2146 | 추가: }; | |
| 2147 | 추가: ui.heading(title); | |
| 2148 | 추가: ui.label( | |
| 2149 | 추가: "원본은 수정하지 않습니다. 검증 통과는 손상 전 내용과 동일하다는 보증이 아닙니다.", | |
| 2150 | 추가: ); | |
| 2151 | 추가: let output = match &self.last_request { | |
| 2152 | 추가: Some(Start::RecoverZip { output_file, .. }) => output_file.clone(), | |
| 2153 | 추가: _ => return, | |
| 2154 | 추가: }; | |
| 2155 | 추가: if saved || !self.model.outputs.is_empty() { | |
| 2156 | 추가: theme::bounded_text(ui, &output.display().to_string(), ui.available_width()); | |
| 2157 | 추가: } | |
| 2158 | 추가: if let Some(error) = &self.model.error { | |
| 2159 | 추가: ui.colored_label(theme::WARNING, error); | |
| 2160 | 추가: } | |
| 2161 | 추가: if let Some(t) = t { | |
| 2162 | 추가: if let Some(code) = t.error { | |
| 2163 | 추가: ui.label(present::error_text(code)); | |
| 2164 | 추가: } | |
| 2165 | 추가: for warning in present::publication_warnings( | |
| 2166 | 추가: Some(t), | |
| 2167 | 추가: self.model.confirmed, | |
| 2168 | 추가: Some(&BTreeSet::from([output | |
| 2169 | 추가: .file_name() | |
| 2170 | 추가: .unwrap_or_default() | |
| 2171 | 추가: .to_string_lossy() | |
| 2172 | 추가: .into_owned()])), | |
| 2173 | 추가: &BTreeSet::new(), | |
| 2174 | 추가: &self.model.outputs, | |
| 2175 | 추가: ) { | |
| 2176 | 추가: ui.colored_label(theme::WARNING, warning); | |
| 2177 | 추가: } | |
| 2178 | 추가: if let Some(warning) = present::durability_warning(t.durability) { | |
| 2179 | 추가: ui.colored_label(theme::WARNING, warning); | |
| 2180 | 추가: } | |
| 2181 | 추가: } | |
| 2182 | 추가: let notice = summary.map(|s| { | |
| 2183 | 추가: format!( | |
| 2184 | 추가: "검증되어 포함됨 {}개 / 유실됨 {}개 / 무결성 미확인 {}개{}", | |
| 2185 | 추가: s.verified_entries, | |
| 2186 | 추가: s.lost_entries, | |
| 2187 | 추가: s.unverified_entries, | |
| 2188 | 추가: if s.unknown_loss { | |
| 2189 | 추가: " / 전체 목록을 알 수 없어 추가 유실 여부를 확인할 수 없습니다" | |
| 2190 | 추가: } else { | |
| 2191 | 추가: "" | |
| 2192 | 추가: } | |
| 2193 | 추가: ) | |
| 2194 | 추가: }); | |
| 2195 | 추가: if let Some(notice) = ¬ice { | |
| 2196 | 추가: ui.label(notice); | |
| 2197 | 추가: } | |
| 2198 | 추가: egui::ScrollArea::vertical() | |
| 2199 | 추가: .id_salt("recovery-findings") | |
| 2200 | 추가: .max_height(220.0) | |
| 2201 | 추가: .show_rows(ui, 24.0, self.model.recovery_entries.len(), |ui, rows| { | |
| 2202 | 추가: for entry in &self.model.recovery_entries[rows] { | |
| 2203 | 추가: let status = match entry.status { | |
| 2204 | 추가: RecoveryStatus::Verified => "검증되어 포함됨", | |
| 2205 | 추가: RecoveryStatus::Lost => "유실됨", | |
| 2206 | 추가: RecoveryStatus::Unverified => "무결성 미확인", | |
| 2207 | 추가: }; | |
| 2208 | 추가: let reason = match entry.reason { | |
| 2209 | 추가: RecoveryReason::None => "내용 검증 통과", | |
| 2210 | 추가: RecoveryReason::HeaderRebuilt => "헤더 재구성", | |
| 2211 | 추가: RecoveryReason::Truncated => "파일 절단", | |
| 2212 | 추가: RecoveryReason::CrcMismatch => "CRC 불일치", | |
| 2213 | 추가: RecoveryReason::DecodeFailure => "압축 데이터 손상", | |
| 2214 | 추가: RecoveryReason::BoundaryUnknown => "항목 경계 불명", | |
| 2215 | 추가: RecoveryReason::UnsupportedFeature => "지원하지 않는 기능", | |
| 2216 | 추가: RecoveryReason::MetadataMissing => "메타정보 누락", | |
| 2217 | 추가: }; | |
| 2218 | 추가: theme::bounded_text( | |
| 2219 | 추가: ui, | |
| 2220 | 추가: &format!( | |
| 2221 | 추가: "{status} / {reason}: {}", | |
| 2222 | 추가: entry.name.as_deref().unwrap_or("이름 확인 불가") | |
| 2223 | 추가: ), | |
| 2224 | 추가: ui.available_width(), | |
| 2225 | 추가: ); | |
| 2226 | 추가: } | |
| 2227 | 추가: }); | |
| 2228 | 추가: if saved && theme::action(ui, "복구본 열기", true, true).clicked() { | |
| 2229 | 추가: self.recovery_warning = partial.then(|| (output.clone(), notice.unwrap_or_default())); | |
| 2230 | 추가: self.open_path(output); | |
| 2231 | 추가: } | |
| 2232 | 추가: if self.model.can_retry_expanded() | |
| 2233 | 추가: && theme::action(ui, "한도를 늘려 다시 시도", true, true).clicked() | |
| 2234 | 추가: { | |
| 2235 | 추가: self.model.retry_expanded(self.factory.as_mut()); | |
| 2236 | 추가: } | |
| 2237 | 추가: } | |
| 2238 | 추가: | |
| 2073 | 2239 | fn result(&mut self, ui: &mut egui::Ui) { |
| 2240 | 추가: if matches!(self.last_request, Some(Start::RecoverZip { .. })) { | |
| 2241 | 추가: self.recovery_result(ui); | |
| 2242 | 추가: return; | |
| 2243 | 추가: } | |
| 2244 | 추가: if self.model.confirmed | |
| 2245 | 추가: && self.model.error.is_none() | |
| 2246 | 추가: && self | |
| 2247 | 추가: .model | |
| 2248 | 추가: .terminal | |
| 2249 | 추가: .as_ref() | |
| 2250 | 추가: .is_some_and(|t| t.error == Some(ErrorCode::Integrity)) | |
| 2251 | 추가: && matches!( | |
| 2252 | 추가: self.last_request, | |
| 2253 | 추가: Some(Start::List { .. } | Start::Extract { .. }) | |
| 2254 | 추가: ) | |
| 2255 | 추가: { | |
| 2256 | 추가: ui.label("원본을 바꾸지 않고 새 ZIP 복구본을 만듭니다. 일부 항목은 복구되지 않을 수 있습니다."); | |
| 2257 | 추가: if theme::action(ui, "복구본 저장 위치 선택", true, true).clicked() { | |
| 2258 | 추가: self.open_picker(Purpose::SaveRecoveryZip); | |
| 2259 | 추가: } | |
| 2260 | 추가: } | |
| 2074 | 2261 | let t = self.model.terminal.clone(); |
| 2075 | 2262 | let listing = matches!(self.last_request, Some(Start::List { .. })); |
| 2076 | 2263 | let creating = matches!( |
| @@ -2873,6 +3060,7 @@ impl ArchiveApp { | ||
| 2873 | 3060 | ActionKind::Extract => "압축 해제", |
| 2874 | 3061 | ActionKind::CreateZip => "ZIP 만들기", |
| 2875 | 3062 | ActionKind::CreateSevenZip => "7z 만들기", |
| 3063 | 추가: ActionKind::RecoverZip => "ZIP 복구", | |
| 2876 | 3064 | ActionKind::Preview => "파일 미리보기", |
| 2877 | 3065 | }); |
| 2878 | 3066 | if question.scope.ratio { |
| @@ -69,6 +69,10 @@ pub enum Start { | ||
| 69 | 69 | entry_id: u32, |
| 70 | 70 | list_id: ListId, |
| 71 | 71 | }, |
| 72 | 추가: RecoverZip { | |
| 73 | 추가: archive: PathBuf, | |
| 74 | 추가: output_file: PathBuf, | |
| 75 | 추가: }, | |
| 72 | 76 | CreateSevenZip { |
| 73 | 77 | sources: Vec<(PathBuf, String)>, |
| 74 | 78 | output_file: PathBuf, |
| @@ -184,6 +188,8 @@ pub enum Outcome { | ||
| 184 | 188 | } |
| 185 | 189 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
| 186 | 190 | pub enum ErrorCode { |
| 191 | 추가: RecoveryIncomplete, | |
| 192 | 추가: RecoveryImpossible, | |
| 187 | 193 | MissingVolume, |
| 188 | 194 | Integrity, |
| 189 | 195 | UnsupportedFormat, |
| @@ -237,7 +243,8 @@ pub struct Terminal { | ||
| 237 | 243 | pub cleanup: Cleanup, |
| 238 | 244 | } |
| 239 | 245 | pub use worker_protocol::protocol::{ |
| 240 | 삭제: ActionKind, Limits, NativePath, PreviewFormat, PreviewInfo, ResourceScope, ResourceUsage, | |
| 246 | 추가: ActionKind, Limits, NativePath, PreviewFormat, PreviewInfo, RecoveryEnd, RecoveryEntry, | |
| 247 | 추가: RecoveryMode, RecoveryReason, RecoveryStatus, ResourceScope, ResourceUsage, | |
| 241 | 248 | VolumeProblemReason, |
| 242 | 249 | }; |
| 243 | 250 | |
| @@ -295,6 +302,8 @@ pub struct ResourceChallenge { | ||
| 295 | 302 | |
| 296 | 303 | #[derive(Clone, Debug)] |
| 297 | 304 | pub enum Event { |
| 305 | 추가: RecoveryEntry(RecoveryEntry), | |
| 306 | 추가: RecoveryEnd(RecoveryEnd), | |
| 298 | 307 | VolumeProblem(VolumeProblem), |
| 299 | 308 | PreviewBegin(PreviewInfo), |
| 300 | 309 | PreviewChunk { |
| @@ -370,6 +379,7 @@ impl Factory for Unavailable { | ||
| 370 | 379 | } |
| 371 | 380 | } |
| 372 | 381 | struct Running { |
| 382 | 추가: recovery_metadata: usize, | |
| 373 | 383 | volume_problem: Option<VolumeProblem>, |
| 374 | 384 | preview: Option<PreviewBuffer>, |
| 375 | 385 | preview_discarded: bool, |
| @@ -406,6 +416,8 @@ pub enum Close { | ||
| 406 | 416 | } |
| 407 | 417 | #[derive(Default)] |
| 408 | 418 | pub struct Model { |
| 419 | 추가: pub recovery_entries: Vec<RecoveryEntry>, | |
| 420 | 추가: pub recovery_end: Option<RecoveryEnd>, | |
| 409 | 421 | pub volume_problem: Option<VolumeProblem>, |
| 410 | 422 | running: Option<Running>, |
| 411 | 423 | pub preview: Option<Preview>, |
| @@ -539,7 +551,7 @@ impl Model { | ||
| 539 | 551 | .iter() |
| 540 | 552 | .try_fold(0u64, |sum, e| sum.checked_add(e.bytes?)); |
| 541 | 553 | } |
| 542 | 삭제: Start::List { .. } => {} | |
| 554 | 추가: Start::List { .. } | Start::RecoverZip { .. } => {} | |
| 543 | 555 | } |
| 544 | 556 | usage |
| 545 | 557 | } |
| @@ -604,6 +616,10 @@ impl Model { | ||
| 604 | 616 | .map(|e| e.id) |
| 605 | 617 | .collect(); |
| 606 | 618 | let validation = match &start { |
| 619 | 추가: Start::RecoverZip { | |
| 620 | 추가: archive, | |
| 621 | 추가: output_file, | |
| 622 | 추가: } => archive.is_absolute() && output_file.is_absolute() && archive != output_file, | |
| 607 | 623 | Start::List { archive } => archive.is_absolute(), |
| 608 | 624 | Start::Preview { |
| 609 | 625 | archive, |
| @@ -699,6 +715,8 @@ impl Model { | ||
| 699 | 715 | self.selected.clear(); |
| 700 | 716 | } |
| 701 | 717 | self.next_id = id; |
| 718 | 추가: self.recovery_entries.clear(); | |
| 719 | 추가: self.recovery_end = None; | |
| 702 | 720 | self.terminal = None; |
| 703 | 721 | self.volume_problem = None; |
| 704 | 722 | self.retry_start = None; |
| @@ -713,6 +731,7 @@ impl Model { | ||
| 713 | 731 | self.error = send_error; |
| 714 | 732 | self.confirmed = false; |
| 715 | 733 | self.running = Some(Running { |
| 734 | 추가: recovery_metadata: 0, | |
| 716 | 735 | volume_problem: None, |
| 717 | 736 | preview: None, |
| 718 | 737 | preview_discarded: false, |
| @@ -1036,6 +1055,59 @@ impl Model { | ||
| 1036 | 1055 | return; |
| 1037 | 1056 | } |
| 1038 | 1057 | match event { |
| 1058 | 추가: Event::RecoveryEntry(entry) => { | |
| 1059 | 추가: let budget = if run.granted.any() { | |
| 1060 | 추가: 64 * 1024 * 1024 | |
| 1061 | 추가: } else { | |
| 1062 | 추가: 8 * 1024 * 1024 | |
| 1063 | 추가: }; | |
| 1064 | 추가: let used = run.recovery_metadata; | |
| 1065 | 추가: if !matches!(run.start, Start::RecoverZip { .. }) | |
| 1066 | 추가: || self.recovery_end.is_some() | |
| 1067 | 추가: || !entry.valid() | |
| 1068 | 추가: || entry.candidate_id as usize != self.recovery_entries.len() | |
| 1069 | 추가: || entry.name.as_ref().is_some_and(|n| { | |
| 1070 | 추가: n.len() > 4096 || !valid_relative(n.trim_end_matches('/')) | |
| 1071 | 추가: }) | |
| 1072 | 추가: || self | |
| 1073 | 추가: .recovery_entries | |
| 1074 | 추가: .last() | |
| 1075 | 추가: .is_some_and(|e| e.source_offset >= entry.source_offset) | |
| 1076 | 추가: || self.recovery_entries.len() | |
| 1077 | 추가: >= if run.granted.entries { 200_000 } else { 10_000 } | |
| 1078 | 추가: || used + 128 + entry.name.as_ref().map_or(0, String::len) > budget | |
| 1079 | 추가: { | |
| 1080 | 추가: self.error = Some("복구 항목 응답이 유효하지 않습니다".into()); | |
| 1081 | 추가: } else { | |
| 1082 | 추가: run.recovery_metadata += | |
| 1083 | 추가: 128 + entry.name.as_ref().map_or(0, String::len); | |
| 1084 | 추가: self.recovery_entries.push(entry); | |
| 1085 | 추가: } | |
| 1086 | 추가: } | |
| 1087 | 추가: Event::RecoveryEnd(summary) => { | |
| 1088 | 추가: let count = |status| { | |
| 1089 | 추가: self.recovery_entries | |
| 1090 | 추가: .iter() | |
| 1091 | 추가: .filter(|e| e.status == status) | |
| 1092 | 추가: .count() as u32 | |
| 1093 | 추가: }; | |
| 1094 | 추가: if !matches!(run.start, Start::RecoverZip { .. }) | |
| 1095 | 추가: || self.recovery_end.is_some() | |
| 1096 | 추가: || !summary.valid() | |
| 1097 | 추가: || summary.source_bytes > 4 * 1024 * 1024 * 1024 | |
| 1098 | 추가: || self | |
| 1099 | 추가: .recovery_entries | |
| 1100 | 추가: .iter() | |
| 1101 | 추가: .any(|e| e.source_offset >= summary.source_bytes) | |
| 1102 | 추가: || summary.verified_entries != count(RecoveryStatus::Verified) | |
| 1103 | 추가: || summary.lost_entries != count(RecoveryStatus::Lost) | |
| 1104 | 추가: || summary.unverified_entries != count(RecoveryStatus::Unverified) | |
| 1105 | 추가: { | |
| 1106 | 추가: self.error = Some("복구 요약이 항목과 일치하지 않습니다".into()); | |
| 1107 | 추가: } else { | |
| 1108 | 추가: self.recovery_end = Some(summary); | |
| 1109 | 추가: } | |
| 1110 | 추가: } | |
| 1039 | 1111 | Event::VolumeProblem(problem) => { |
| 1040 | 1112 | if run.cancel_sequence.is_some() { |
| 1041 | 1113 | return; |
| @@ -1109,7 +1181,11 @@ impl Model { | ||
| 1109 | 1181 | } |
| 1110 | 1182 | } |
| 1111 | 1183 | Event::Accepted { encryption } => { |
| 1112 | 삭제: if matches!(run.start, Start::CreateSevenZip { .. }) && encryption { | |
| 1184 | 추가: if matches!( | |
| 1185 | 추가: run.start, | |
| 1186 | 추가: Start::CreateSevenZip { .. } | Start::RecoverZip { .. } | |
| 1187 | 추가: ) && encryption | |
| 1188 | 추가: { | |
| 1113 | 1189 | self.error = Some("7z 생성의 암호 응답이 유효하지 않습니다".into()); |
| 1114 | 1190 | } |
| 1115 | 1191 | if run.accepted { |
| @@ -1156,8 +1232,10 @@ impl Model { | ||
| 1156 | 1232 | if run.cancel_sequence.is_some() { |
| 1157 | 1233 | return; |
| 1158 | 1234 | } |
| 1159 | 삭제: if matches!(run.start, Start::CreateSevenZip { .. }) | |
| 1160 | 삭제: || self.challenge.is_some() | |
| 1235 | 추가: if matches!( | |
| 1236 | 추가: run.start, | |
| 1237 | 추가: Start::CreateSevenZip { .. } | Start::RecoverZip { .. } | |
| 1238 | 추가: ) || self.challenge.is_some() | |
| 1161 | 1239 | || self.resource.is_some() |
| 1162 | 1240 | || challenge_id <= run.last_challenge |
| 1163 | 1241 | || self.conflict.is_some() |
| @@ -1178,6 +1256,7 @@ impl Model { | ||
| 1178 | 1256 | Start::CreateZip { .. } => ActionKind::CreateZip, |
| 1179 | 1257 | Start::CreateSevenZip { .. } => ActionKind::CreateSevenZip, |
| 1180 | 1258 | Start::Preview { .. } => ActionKind::Preview, |
| 1259 | 추가: Start::RecoverZip { .. } => ActionKind::RecoverZip, | |
| 1181 | 1260 | }; |
| 1182 | 1261 | let hard = Limits { |
| 1183 | 1262 | input: u64::MAX, |
| @@ -1261,8 +1340,19 @@ impl Model { | ||
| 1261 | 1340 | Event::Output { |
| 1262 | 1341 | relative_name, |
| 1263 | 1342 | disposition, |
| 1264 | 삭제: .. | |
| 1343 | 추가: entry_id, | |
| 1265 | 1344 | } => { |
| 1345 | 추가: if let Start::RecoverZip { output_file, .. } = &run.start { | |
| 1346 | 추가: if entry_id.is_some() | |
| 1347 | 추가: || self.recovery_end.is_none() | |
| 1348 | 추가: || !self.outputs.is_empty() | |
| 1349 | 추가: || output_file.file_name().and_then(|n| n.to_str()) | |
| 1350 | 추가: != Some(relative_name.as_str()) | |
| 1351 | 추가: { | |
| 1352 | 추가: self.error = Some("복구본 출력 응답이 유효하지 않습니다".into()); | |
| 1353 | 추가: return; | |
| 1354 | 추가: } | |
| 1355 | 추가: } | |
| 1266 | 1356 | if matches!(run.start, Start::Preview { .. }) { |
| 1267 | 1357 | self.error = Some("미리보기 중 파일 출력이 보고됐습니다".into()); |
| 1268 | 1358 | return; |
| @@ -1292,6 +1382,42 @@ impl Model { | ||
| 1292 | 1382 | } |
| 1293 | 1383 | } |
| 1294 | 1384 | Event::Terminal(t) => { |
| 1385 | 추가: if matches!(run.start, Start::RecoverZip { .. }) { | |
| 1386 | 추가: let business = t.outcome == Outcome::Completed | |
| 1387 | 추가: || matches!( | |
| 1388 | 추가: t.error, | |
| 1389 | 추가: Some( | |
| 1390 | 추가: ErrorCode::RecoveryIncomplete | |
| 1391 | 추가: | ErrorCode::RecoveryImpossible | |
| 1392 | 추가: ) | |
| 1393 | 추가: ); | |
| 1394 | 추가: if business | |
| 1395 | 추가: && !self.recovery_end.as_ref().is_some_and(|s| { | |
| 1396 | 추가: if s.verified_entries == 0 { | |
| 1397 | 추가: t.outcome == Outcome::Failed | |
| 1398 | 추가: && t.error == Some(ErrorCode::RecoveryImpossible) | |
| 1399 | 추가: && t.publication == Publication::None | |
| 1400 | 추가: && t.created_count == 0 | |
| 1401 | 추가: && self.outputs.is_empty() | |
| 1402 | 추가: } else { | |
| 1403 | 추가: t.publication == Publication::Complete | |
| 1404 | 추가: && t.created_count == 1 | |
| 1405 | 추가: && self.outputs.len() == 1 | |
| 1406 | 추가: && self.outputs[0].1 == Disposition::Created | |
| 1407 | 추가: && if s.complete() { | |
| 1408 | 추가: t.outcome == Outcome::Completed && t.error.is_none() | |
| 1409 | 추가: } else { | |
| 1410 | 추가: t.outcome == Outcome::Failed | |
| 1411 | 추가: && t.error | |
| 1412 | 추가: == Some(ErrorCode::RecoveryIncomplete) | |
| 1413 | 추가: } | |
| 1414 | 추가: } | |
| 1415 | 추가: }) | |
| 1416 | 추가: { | |
| 1417 | 추가: self.error = | |
| 1418 | 추가: Some("복구 결과와 저장 상태가 일치하지 않습니다".into()); | |
| 1419 | 추가: } | |
| 1420 | 추가: } | |
| 1295 | 1421 | if run.cancel_sequence.is_none() |
| 1296 | 1422 | && run.volume_problem.as_ref().is_some_and(|problem| { |
| 1297 | 1423 | t.outcome != Outcome::Failed |
| @@ -1463,6 +1589,8 @@ pub fn terminal_lines(t: &Terminal) -> Vec<String> { | ||
| 1463 | 1589 | if let Some(error) = t.error { |
| 1464 | 1590 | lines.push( |
| 1465 | 1591 | match error { |
| 1592 | 추가: ErrorCode::RecoveryIncomplete => "일부 항목만 복구했습니다", | |
| 1593 | 추가: ErrorCode::RecoveryImpossible => "복구 가능한 항목이 없습니다", | |
| 1466 | 1594 | ErrorCode::MissingVolume => "분할 압축파일의 조각이 없습니다. 모든 조각을 같은 폴더에 모은 뒤 첫 조각을 다시 여세요", |
| 1467 | 1595 | ErrorCode::Integrity => "압축파일이 손상됐습니다", |
| 1468 | 1596 | ErrorCode::UnsupportedFormat => "지원하지 않는 압축 형식입니다", |
| @@ -11,8 +11,7 @@ static NEXT: AtomicU64 = AtomicU64::new(0); | ||
| 11 | 11 | struct Scratch(PathBuf); |
| 12 | 12 | impl Scratch { |
| 13 | 13 | fn new() -> Self { |
| 14 | 삭제: let root = | |
| 15 | 삭제: Path::new(env!("CARGO_MANIFEST_DIR")).join("../../tests/rust-app-real-worker/runs"); | |
| 14 | 추가: let root = std::env::temp_dir().join("app-real-worker"); | |
| 16 | 15 | fs::create_dir_all(&root).unwrap(); |
| 17 | 16 | let path = root.join(format!( |
| 18 | 17 | "{}-{}", |
| @@ -699,3 +698,48 @@ fn cancel_racing_exit_without_terminal_remains_unconfirmed() { | ||
| 699 | 698 | mod guarded_flows; |
| 700 | 699 | |
| 701 | 700 | mod preview_catalog; |
| 701 | 추가: | |
| 702 | 추가: #[test] | |
| 703 | 추가: fn recovery_adapter_confirms_complete_partial_and_impossible_without_changing_source() { | |
| 704 | 추가: use sha2::{Digest, Sha256}; | |
| 705 | 추가: let fixtures = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../tests/zip-recovery-fixtures"); | |
| 706 | 추가: for (name, expected, count) in [ | |
| 707 | 추가: ("broken-local-header.zip", None, 1), | |
| 708 | 추가: ( | |
| 709 | 추가: "missing-directory.zip", | |
| 710 | 추가: Some(ErrorCode::RecoveryIncomplete), | |
| 711 | 추가: 1, | |
| 712 | 추가: ), | |
| 713 | 추가: ("body-corrupt.zip", Some(ErrorCode::RecoveryIncomplete), 1), | |
| 714 | 추가: ("unrecoverable.zip", Some(ErrorCode::RecoveryImpossible), 0), | |
| 715 | 추가: ] { | |
| 716 | 추가: let scratch = Scratch::new(); | |
| 717 | 추가: let source = scratch.path("source.zip"); | |
| 718 | 추가: fs::copy(fixtures.join(name), &source).unwrap(); | |
| 719 | 추가: let before = Sha256::digest(fs::read(&source).unwrap()); | |
| 720 | 추가: let output = scratch.path("recovered.zip"); | |
| 721 | 추가: let mut model = Model::default(); | |
| 722 | 추가: let (mut factory, observed) = observed_factory(); | |
| 723 | 추가: assert!(model.begin( | |
| 724 | 추가: Start::RecoverZip { | |
| 725 | 추가: archive: source.clone(), | |
| 726 | 추가: output_file: output.clone() | |
| 727 | 추가: }, | |
| 728 | 추가: &mut factory | |
| 729 | 추가: )); | |
| 730 | 추가: wait(&mut model); | |
| 731 | 추가: assert!(model.confirmed, "{name}: {:?}", model.error); | |
| 732 | 추가: let terminal = model.terminal.as_ref().unwrap(); | |
| 733 | 추가: assert_eq!(terminal.error, expected, "{name}"); | |
| 734 | 추가: assert_eq!(terminal.created_count, count); | |
| 735 | 추가: assert_eq!(output.exists(), count == 1); | |
| 736 | 추가: assert_eq!(Sha256::digest(fs::read(source).unwrap()), before); | |
| 737 | 추가: assert_reaped(&observed); | |
| 738 | 추가: if count == 1 { | |
| 739 | 추가: assert!(model.begin(Start::List { archive: output }, &mut factory)); | |
| 740 | 추가: wait(&mut model); | |
| 741 | 추가: completed(&model); | |
| 742 | 추가: assert!(model.list_id.is_some()); | |
| 743 | 추가: } | |
| 744 | 추가: } | |
| 745 | 추가: } |
| @@ -236,6 +236,9 @@ impl Connection for CaptureConnection { | ||
| 236 | 236 | durability: Durability::NotApplicable, |
| 237 | 237 | cleanup: Cleanup::Complete, |
| 238 | 238 | }), |
| 239 | 추가: Start::RecoverZip { .. } => { | |
| 240 | 추가: return Err("복구 상황은 --ui-scenario로 확인함".into()); | |
| 241 | 추가: } | |
| 239 | 242 | Start::CreateSevenZip { output_file, .. } => { |
| 240 | 243 | self.create_name = |
| 241 | 244 | Some(output_file.file_name().unwrap().to_string_lossy().into()); |
| @@ -23,7 +23,10 @@ impl Dialogs for TestDialogs { | ||
| 23 | 23 | if let Some(answer) = state.answers.pop_front() { |
| 24 | 24 | return Ok(answer); |
| 25 | 25 | } |
| 26 | 삭제: if matches!(request.purpose, Purpose::SaveZip | Purpose::SaveSevenZip) && !state.cancel_save | |
| 26 | 추가: if matches!( | |
| 27 | 추가: request.purpose, | |
| 28 | 추가: Purpose::SaveZip | Purpose::SaveSevenZip | Purpose::SaveRecoveryZip | |
| 29 | 추가: ) && !state.cancel_save | |
| 27 | 30 | { |
| 28 | 31 | let name = state.save_name.take().unwrap_or(request.file_name); |
| 29 | 32 | return Ok(Some(vec![request.directory.join(name)])); |
| @@ -503,6 +503,110 @@ mod widgets { | ||
| 503 | 503 | ); |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 추가: #[test] | |
| 507 | 추가: fn recovery_save_uses_native_dialog_and_partial_copy_keeps_warning_when_opened() { | |
| 508 | 추가: let scratch = Folder::new(); | |
| 509 | 추가: let factory = FakeFactory::manual(); | |
| 510 | 추가: let archive = scratch.0.join("손상.zip"); | |
| 511 | 추가: let output = scratch.0.join("복구본.zip"); | |
| 512 | 추가: let mut app = ArchiveApp::new(Box::new(factory.clone()), Some(archive.clone()), false); | |
| 513 | 추가: { | |
| 514 | 추가: let mut state = factory.state.borrow_mut(); | |
| 515 | 추가: state.frame(Event::Accepted { encryption: false }); | |
| 516 | 추가: state.frame(Event::Terminal(Terminal { | |
| 517 | 추가: outcome: Outcome::Failed, | |
| 518 | 추가: error: Some(ErrorCode::Integrity), | |
| 519 | 추가: publication: Publication::None, | |
| 520 | 추가: created_count: 0, | |
| 521 | 추가: retained_partial_count: 0, | |
| 522 | 추가: durability: Durability::NotApplicable, | |
| 523 | 추가: cleanup: Cleanup::Complete, | |
| 524 | 추가: })); | |
| 525 | 추가: state.queue.extend([ | |
| 526 | 추가: HostEvent::StdoutEof, | |
| 527 | 추가: HostEvent::StderrEof, | |
| 528 | 추가: HostEvent::Exited { success: true }, | |
| 529 | 추가: ]); | |
| 530 | 추가: } | |
| 531 | 추가: pump(&mut app.model); | |
| 532 | 추가: let dialogs = TestDialogs::default(); | |
| 533 | 추가: dialogs | |
| 534 | 추가: .0 | |
| 535 | 추가: .borrow_mut() | |
| 536 | 추가: .answers | |
| 537 | 추가: .push_back(Some(vec![output.clone()])); | |
| 538 | 추가: app.set_dialogs(Box::new(dialogs.clone())); | |
| 539 | 추가: let ctx = egui::Context::default(); | |
| 540 | 추가: click(&ctx, &mut app, "복구본 저장 위치 선택"); | |
| 541 | 추가: assert_eq!( | |
| 542 | 추가: dialogs.0.borrow().requests[0].purpose, | |
| 543 | 추가: Purpose::SaveRecoveryZip | |
| 544 | 추가: ); | |
| 545 | 추가: assert_eq!( | |
| 546 | 추가: dialogs.0.borrow().requests[0].file_name, | |
| 547 | 추가: "손상-recovered.zip" | |
| 548 | 추가: ); | |
| 549 | 추가: assert!( | |
| 550 | 추가: matches!(factory.state.borrow().starts.last(), Some(Start::RecoverZip { archive: actual, output_file }) if actual == &archive && output_file == &output) | |
| 551 | 추가: ); | |
| 552 | 추가: { | |
| 553 | 추가: let mut state = factory.state.borrow_mut(); | |
| 554 | 추가: state.frame(Event::Accepted { encryption: false }); | |
| 555 | 추가: state.frame(Event::RecoveryEntry(RecoveryEntry { | |
| 556 | 추가: candidate_id: 0, | |
| 557 | 추가: source_offset: 0, | |
| 558 | 추가: name: Some("내용.txt".into()), | |
| 559 | 추가: kind: Some(worker_protocol::protocol::EntryKind::File), | |
| 560 | 추가: status: RecoveryStatus::Verified, | |
| 561 | 추가: reason: RecoveryReason::MetadataMissing, | |
| 562 | 추가: declared_size: Some(0), | |
| 563 | 추가: verified_size: Some(0), | |
| 564 | 추가: sha256: Some([1; 32]), | |
| 565 | 추가: })); | |
| 566 | 추가: state.frame(Event::RecoveryEnd(RecoveryEnd { | |
| 567 | 추가: mode: RecoveryMode::LocalChain, | |
| 568 | 추가: source_bytes: 128, | |
| 569 | 추가: source_sha256: [2; 32], | |
| 570 | 추가: known_entries: None, | |
| 571 | 추가: verified_entries: 1, | |
| 572 | 추가: lost_entries: 0, | |
| 573 | 추가: unverified_entries: 0, | |
| 574 | 추가: unknown_loss: true, | |
| 575 | 추가: })); | |
| 576 | 추가: state.frame(Event::Output { | |
| 577 | 추가: entry_id: None, | |
| 578 | 추가: relative_name: "복구본.zip".into(), | |
| 579 | 추가: disposition: Disposition::Created, | |
| 580 | 추가: }); | |
| 581 | 추가: state.frame(Event::Terminal(Terminal { | |
| 582 | 추가: outcome: Outcome::Failed, | |
| 583 | 추가: error: Some(ErrorCode::RecoveryIncomplete), | |
| 584 | 추가: publication: Publication::Complete, | |
| 585 | 추가: created_count: 1, | |
| 586 | 추가: retained_partial_count: 0, | |
| 587 | 추가: durability: Durability::Synced, | |
| 588 | 추가: cleanup: Cleanup::Complete, | |
| 589 | 추가: })); | |
| 590 | 추가: state.queue.extend([ | |
| 591 | 추가: HostEvent::StdoutEof, | |
| 592 | 추가: HostEvent::StderrEof, | |
| 593 | 추가: HostEvent::Exited { success: true }, | |
| 594 | 추가: ]); | |
| 595 | 추가: } | |
| 596 | 추가: pump(&mut app.model); | |
| 597 | 추가: assert!(app.model.confirmed, "{:?}", app.model.error); | |
| 598 | 추가: click(&ctx, &mut app, "복구본 열기"); | |
| 599 | 추가: assert!( | |
| 600 | 추가: matches!(factory.state.borrow().starts.last(), Some(Start::List { archive }) if archive == &output) | |
| 601 | 추가: ); | |
| 602 | 추가: let labels = render(&ctx, &mut app, vec![]); | |
| 603 | 추가: assert!( | |
| 604 | 추가: labels | |
| 605 | 추가: .iter() | |
| 606 | 추가: .any(|(text, _)| text.contains("전체 목록을 알 수 없어")) | |
| 607 | 추가: ); | |
| 608 | 추가: } | |
| 609 | 추가: | |
| 506 | 610 | fn loaded(scratch: &Folder, factory: &FakeFactory) -> ArchiveApp { |
| 507 | 611 | let mut app = ArchiveApp::new( |
| 508 | 612 | Box::new(factory.clone()), |
| @@ -0,0 +1,163 @@ | ||
| 1 | 추가: use super::*; | |
| 2 | 추가: use worker_protocol::protocol::EntryKind; | |
| 3 | 추가: | |
| 4 | 추가: fn begin() -> (Model, FakeFactory) { | |
| 5 | 추가: let mut model = Model::default(); | |
| 6 | 추가: let mut factory = FakeFactory::manual(); | |
| 7 | 추가: assert!(model.begin( | |
| 8 | 추가: Start::RecoverZip { | |
| 9 | 추가: archive: path("damaged.zip"), | |
| 10 | 추가: output_file: path("recovered.zip"), | |
| 11 | 추가: }, | |
| 12 | 추가: &mut factory | |
| 13 | 추가: )); | |
| 14 | 추가: factory | |
| 15 | 추가: .state | |
| 16 | 추가: .borrow_mut() | |
| 17 | 추가: .frame(Event::Accepted { encryption: false }); | |
| 18 | 추가: (model, factory) | |
| 19 | 추가: } | |
| 20 | 추가: fn entry() -> RecoveryEntry { | |
| 21 | 추가: RecoveryEntry { | |
| 22 | 추가: candidate_id: 0, | |
| 23 | 추가: source_offset: 0, | |
| 24 | 추가: name: Some("한글.txt".into()), | |
| 25 | 추가: kind: Some(EntryKind::File), | |
| 26 | 추가: status: RecoveryStatus::Verified, | |
| 27 | 추가: reason: RecoveryReason::HeaderRebuilt, | |
| 28 | 추가: declared_size: Some(4), | |
| 29 | 추가: verified_size: Some(4), | |
| 30 | 추가: sha256: Some([1; 32]), | |
| 31 | 추가: } | |
| 32 | 추가: } | |
| 33 | 추가: fn summary(partial: bool) -> RecoveryEnd { | |
| 34 | 추가: RecoveryEnd { | |
| 35 | 추가: mode: if partial { | |
| 36 | 추가: RecoveryMode::LocalChain | |
| 37 | 추가: } else { | |
| 38 | 추가: RecoveryMode::CentralDirectory | |
| 39 | 추가: }, | |
| 40 | 추가: source_bytes: 128, | |
| 41 | 추가: source_sha256: [2; 32], | |
| 42 | 추가: known_entries: (!partial).then_some(1), | |
| 43 | 추가: verified_entries: 1, | |
| 44 | 추가: lost_entries: 0, | |
| 45 | 추가: unverified_entries: 0, | |
| 46 | 추가: unknown_loss: partial, | |
| 47 | 추가: } | |
| 48 | 추가: } | |
| 49 | 추가: fn result(partial: bool) -> Terminal { | |
| 50 | 추가: Terminal { | |
| 51 | 추가: outcome: if partial { | |
| 52 | 추가: Outcome::Failed | |
| 53 | 추가: } else { | |
| 54 | 추가: Outcome::Completed | |
| 55 | 추가: }, | |
| 56 | 추가: error: partial.then_some(ErrorCode::RecoveryIncomplete), | |
| 57 | 추가: publication: Publication::Complete, | |
| 58 | 추가: created_count: 1, | |
| 59 | 추가: retained_partial_count: 0, | |
| 60 | 추가: durability: Durability::Synced, | |
| 61 | 추가: cleanup: Cleanup::Complete, | |
| 62 | 추가: } | |
| 63 | 추가: } | |
| 64 | 추가: fn reports(factory: &FakeFactory, partial: bool) { | |
| 65 | 추가: let mut s = factory.state.borrow_mut(); | |
| 66 | 추가: s.frame(Event::RecoveryEntry(entry())); | |
| 67 | 추가: s.frame(Event::RecoveryEnd(summary(partial))); | |
| 68 | 추가: s.frame(Event::Output { | |
| 69 | 추가: entry_id: None, | |
| 70 | 추가: relative_name: "recovered.zip".into(), | |
| 71 | 추가: disposition: Disposition::Created, | |
| 72 | 추가: }); | |
| 73 | 추가: s.frame(Event::Terminal(result(partial))); | |
| 74 | 추가: } | |
| 75 | 추가: fn eof(factory: &FakeFactory) { | |
| 76 | 추가: factory.state.borrow_mut().queue.extend([ | |
| 77 | 추가: HostEvent::StdoutEof, | |
| 78 | 추가: HostEvent::StderrEof, | |
| 79 | 추가: HostEvent::Exited { success: true }, | |
| 80 | 추가: ]); | |
| 81 | 추가: } | |
| 82 | 추가: #[test] | |
| 83 | 추가: fn recovery_requires_terminal_both_eofs_and_reap_even_for_saved_partial() { | |
| 84 | 추가: for partial in [false, true] { | |
| 85 | 추가: let (mut model, factory) = begin(); | |
| 86 | 추가: reports(&factory, partial); | |
| 87 | 추가: for _ in 0..20 { | |
| 88 | 추가: model.poll(); | |
| 89 | 추가: } | |
| 90 | 추가: assert!(model.busy()); | |
| 91 | 추가: assert!(!model.confirmed); | |
| 92 | 추가: eof(&factory); | |
| 93 | 추가: pump(&mut model); | |
| 94 | 추가: assert!(model.confirmed, "{:?}", model.error); | |
| 95 | 추가: assert_eq!(model.recovery_end.as_ref().unwrap().unknown_loss, partial); | |
| 96 | 추가: assert!(model.entries.is_empty()); | |
| 97 | 추가: assert!(model.list_id.is_none()); | |
| 98 | 추가: assert!(!model.can_retry_expanded()); | |
| 99 | 추가: } | |
| 100 | 추가: } | |
| 101 | 추가: #[test] | |
| 102 | 추가: fn recovery_rejects_wrong_ids_offsets_names_and_unverified_hashes() { | |
| 103 | 추가: for change in 0..5 { | |
| 104 | 추가: let (mut model, factory) = begin(); | |
| 105 | 추가: let mut e = entry(); | |
| 106 | 추가: match change { | |
| 107 | 추가: 0 => e.candidate_id = 1, | |
| 108 | 추가: 1 => e.name = Some("../outside".into()), | |
| 109 | 추가: 2 => e.status = RecoveryStatus::Lost, | |
| 110 | 추가: 3 => e.verified_size = Some(5), | |
| 111 | 추가: _ => e.name = Some("x".repeat(4097)), | |
| 112 | 추가: } | |
| 113 | 추가: factory.state.borrow_mut().frame(Event::RecoveryEntry(e)); | |
| 114 | 추가: for _ in 0..5 { | |
| 115 | 추가: model.poll(); | |
| 116 | 추가: } | |
| 117 | 추가: assert!(model.error.is_some(), "{change}"); | |
| 118 | 추가: assert!(model.recovery_entries.is_empty()); | |
| 119 | 추가: } | |
| 120 | 추가: } | |
| 121 | 추가: #[test] | |
| 122 | 추가: fn recovery_rejects_duplicate_end_wrong_counts_and_false_success() { | |
| 123 | 추가: for change in 0..4 { | |
| 124 | 추가: let (mut model, factory) = begin(); | |
| 125 | 추가: let mut s = factory.state.borrow_mut(); | |
| 126 | 추가: s.frame(Event::RecoveryEntry(entry())); | |
| 127 | 추가: let mut end = summary(change == 3); | |
| 128 | 추가: if change == 0 { | |
| 129 | 추가: end.verified_entries = 2; | |
| 130 | 추가: } | |
| 131 | 추가: if change == 1 { | |
| 132 | 추가: end.source_bytes = 0; | |
| 133 | 추가: } | |
| 134 | 추가: s.frame(Event::RecoveryEnd(end)); | |
| 135 | 추가: if change == 2 { | |
| 136 | 추가: s.frame(Event::RecoveryEnd(summary(false))); | |
| 137 | 추가: } | |
| 138 | 추가: s.frame(Event::Output { | |
| 139 | 추가: entry_id: None, | |
| 140 | 추가: relative_name: "recovered.zip".into(), | |
| 141 | 추가: disposition: Disposition::Created, | |
| 142 | 추가: }); | |
| 143 | 추가: s.frame(Event::Terminal(result(false))); | |
| 144 | 추가: drop(s); | |
| 145 | 추가: eof(&factory); | |
| 146 | 추가: pump(&mut model); | |
| 147 | 추가: assert!(!model.confirmed, "{change}"); | |
| 148 | 추가: assert!(model.error.is_some()); | |
| 149 | 추가: } | |
| 150 | 추가: } | |
| 151 | 추가: #[test] | |
| 152 | 추가: fn recovery_summary_is_not_a_saved_artifact() { | |
| 153 | 추가: let (mut model, factory) = begin(); | |
| 154 | 추가: let mut s = factory.state.borrow_mut(); | |
| 155 | 추가: s.frame(Event::RecoveryEntry(entry())); | |
| 156 | 추가: s.frame(Event::RecoveryEnd(summary(false))); | |
| 157 | 추가: s.frame(Event::Terminal(result(false))); | |
| 158 | 추가: drop(s); | |
| 159 | 추가: eof(&factory); | |
| 160 | 추가: pump(&mut model); | |
| 161 | 추가: assert!(!model.confirmed); | |
| 162 | 추가: assert!(model.outputs.is_empty()); | |
| 163 | 추가: } |
| @@ -5,6 +5,7 @@ mod fake; | ||
| 5 | 5 | #[cfg(feature = "ui")] |
| 6 | 6 | mod native_dialogs; |
| 7 | 7 | mod preview; |
| 8 | 추가: mod recovery; | |
| 8 | 9 | mod split_volumes; |
| 9 | 10 | use fake::*; |
| 10 | 11 | use std::path::PathBuf; |
| @@ -95,6 +95,27 @@ fn every_listed_scenario_draws_and_keeps_its_expected_screen() { | ||
| 95 | 95 | app.model.error |
| 96 | 96 | ); |
| 97 | 97 | assert!(app.model.input_error.is_none(), "{}", scenario.name); |
| 98 | 추가: if scenario.name.starts_with("recovery-") { | |
| 99 | 추가: let expected = match scenario.name { | |
| 100 | 추가: "recovery-complete" => "복구본 저장 완료", | |
| 101 | 추가: "recovery-partial" => "일부 항목만 복구함", | |
| 102 | 추가: "recovery-unknown" => "전체 목록을 알 수 없어", | |
| 103 | 추가: "recovery-impossible" => "복구 가능한 항목 없음", | |
| 104 | 추가: "recovery-save-error" => "복구본 저장을 완료하지 못했습니다", | |
| 105 | 추가: "recovery-cancelled" => "복구를 취소했습니다", | |
| 106 | 추가: "recovery-resource" => "이 작업 허용", | |
| 107 | 추가: _ => "ZIP 복구 중", | |
| 108 | 추가: }; | |
| 109 | 추가: assert!(labels.contains(expected), "{}: {labels}", scenario.name); | |
| 110 | 추가: assert_eq!( | |
| 111 | 추가: labels.contains("복구본 열기"), | |
| 112 | 추가: matches!( | |
| 113 | 추가: scenario.name, | |
| 114 | 추가: "recovery-complete" | "recovery-partial" | "recovery-unknown" | |
| 115 | 추가: ) | |
| 116 | 추가: ); | |
| 117 | 추가: assert!(!labels.contains("100%")); | |
| 118 | 추가: } | |
| 98 | 119 | if scenario.name == "split-archive" { |
| 99 | 120 | assert!(app.model.list_id.as_ref().unwrap().is_split()); |
| 100 | 121 | assert!(!app.model.can_preview()); |
| @@ -21,6 +21,15 @@ macro_rules! catalog { | ||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | catalog! { |
| 24 | 추가: "recovery-progress" => "ZIP 복구 분석과 저장 확인 전 대기", | |
| 25 | 추가: "recovery-complete" => "전체 항목을 검증한 복구본 저장 완료", | |
| 26 | 추가: "recovery-partial" => "유실 항목이 있는 복구본과 경고", | |
| 27 | 추가: "recovery-unknown" => "전체 목록 불명의 추가 유실 경고", | |
| 28 | 추가: "recovery-impossible" => "복구 가능한 항목 없음과 출력 없음", | |
| 29 | 추가: "recovery-cancelled" => "복구 취소와 출력 없음", | |
| 30 | 추가: "recovery-save-error" => "복구 분석 뒤 저장 실패", | |
| 31 | 추가: "recovery-resource" => "복구 작업의 자원 승인", | |
| 32 | 추가: | |
| 24 | 33 | "create-sevenzip" => "7z 형식 선택과 LZMA2 및 암호 미지원 안내", |
| 25 | 34 | "create-sevenzip-progress" => "7z 만들기 진행과 취소", |
| 26 | 35 | "create-sevenzip-complete" => "7z 만들기 완료", |
| @@ -538,6 +547,135 @@ impl Scenario { | ||
| 538 | 547 | } |
| 539 | 548 | _ => {} |
| 540 | 549 | } |
| 550 | 추가: if self.name.starts_with("recovery-") { | |
| 551 | 추가: let request = Start::RecoverZip { | |
| 552 | 추가: archive, | |
| 553 | 추가: output_file: base.join("복구본.zip"), | |
| 554 | 추가: }; | |
| 555 | 추가: app.last_request = Some(request.clone()); | |
| 556 | 추가: app.model.begin(request, app.factory.as_mut()); | |
| 557 | 추가: let mut state = state.borrow_mut(); | |
| 558 | 추가: state.frame(Event::Accepted { encryption: false }); | |
| 559 | 추가: if self.name == "recovery-resource" { | |
| 560 | 추가: state.frame(Event::ResourceRequired(ResourceChallenge { | |
| 561 | 추가: id: 1, | |
| 562 | 추가: action: ActionKind::RecoverZip, | |
| 563 | 추가: scope: ResourceScope { | |
| 564 | 추가: ratio: true, | |
| 565 | 추가: ..Default::default() | |
| 566 | 추가: }, | |
| 567 | 추가: usage: ResourceUsage::default(), | |
| 568 | 추가: soft_limits: Limits::default(), | |
| 569 | 추가: ceiling: Limits::default(), | |
| 570 | 추가: })); | |
| 571 | 추가: } else if self.name == "recovery-progress" { | |
| 572 | 추가: state.frame(Event::Progress { | |
| 573 | 추가: stage: Stage::Scan, | |
| 574 | 추가: processed: 1024, | |
| 575 | 추가: total: None, | |
| 576 | 추가: completed_entries: 1, | |
| 577 | 추가: }); | |
| 578 | 추가: } else if self.name == "recovery-cancelled" { | |
| 579 | 추가: state.finish(Outcome::Cancelled, Publication::None); | |
| 580 | 추가: } else { | |
| 581 | 추가: let impossible = self.name == "recovery-impossible"; | |
| 582 | 추가: let partial = self.name == "recovery-partial"; | |
| 583 | 추가: let unknown = self.name == "recovery-unknown"; | |
| 584 | 추가: let failed = self.name == "recovery-save-error"; | |
| 585 | 추가: state.frame(Event::RecoveryEntry(RecoveryEntry { | |
| 586 | 추가: candidate_id: 0, | |
| 587 | 추가: source_offset: 0, | |
| 588 | 추가: name: Some("읽어주세요.txt".into()), | |
| 589 | 추가: kind: Some(worker_protocol::protocol::EntryKind::File), | |
| 590 | 추가: status: if impossible { | |
| 591 | 추가: RecoveryStatus::Lost | |
| 592 | 추가: } else { | |
| 593 | 추가: RecoveryStatus::Verified | |
| 594 | 추가: }, | |
| 595 | 추가: reason: if impossible { | |
| 596 | 추가: RecoveryReason::Truncated | |
| 597 | 추가: } else { | |
| 598 | 추가: RecoveryReason::HeaderRebuilt | |
| 599 | 추가: }, | |
| 600 | 추가: declared_size: Some(4), | |
| 601 | 추가: verified_size: (!impossible).then_some(4), | |
| 602 | 추가: sha256: (!impossible).then_some([1; 32]), | |
| 603 | 추가: })); | |
| 604 | 추가: if partial { | |
| 605 | 추가: state.frame(Event::RecoveryEntry(RecoveryEntry { | |
| 606 | 추가: candidate_id: 1, | |
| 607 | 추가: source_offset: 128, | |
| 608 | 추가: name: Some("사진.png".into()), | |
| 609 | 추가: kind: Some(worker_protocol::protocol::EntryKind::File), | |
| 610 | 추가: status: RecoveryStatus::Lost, | |
| 611 | 추가: reason: RecoveryReason::CrcMismatch, | |
| 612 | 추가: declared_size: Some(10), | |
| 613 | 추가: verified_size: None, | |
| 614 | 추가: sha256: None, | |
| 615 | 추가: })); | |
| 616 | 추가: } | |
| 617 | 추가: state.frame(Event::RecoveryEnd(RecoveryEnd { | |
| 618 | 추가: mode: if unknown { | |
| 619 | 추가: RecoveryMode::LocalChain | |
| 620 | 추가: } else { | |
| 621 | 추가: RecoveryMode::CentralDirectory | |
| 622 | 추가: }, | |
| 623 | 추가: source_bytes: 256, | |
| 624 | 추가: source_sha256: [2; 32], | |
| 625 | 추가: known_entries: (!unknown).then_some(if partial { 2 } else { 1 }), | |
| 626 | 추가: verified_entries: u32::from(!impossible), | |
| 627 | 추가: lost_entries: u32::from(impossible || partial), | |
| 628 | 추가: unverified_entries: 0, | |
| 629 | 추가: unknown_loss: unknown, | |
| 630 | 추가: })); | |
| 631 | 추가: if !impossible && !failed { | |
| 632 | 추가: state.frame(Event::Output { | |
| 633 | 추가: entry_id: None, | |
| 634 | 추가: relative_name: "복구본.zip".into(), | |
| 635 | 추가: disposition: Disposition::Created, | |
| 636 | 추가: }); | |
| 637 | 추가: } | |
| 638 | 추가: state.frame(Event::Terminal(Terminal { | |
| 639 | 추가: outcome: if partial || unknown || impossible || failed { | |
| 640 | 추가: Outcome::Failed | |
| 641 | 추가: } else { | |
| 642 | 추가: Outcome::Completed | |
| 643 | 추가: }, | |
| 644 | 추가: error: if failed { | |
| 645 | 추가: Some(ErrorCode::DiskFull) | |
| 646 | 추가: } else if impossible { | |
| 647 | 추가: Some(ErrorCode::RecoveryImpossible) | |
| 648 | 추가: } else if partial || unknown { | |
| 649 | 추가: Some(ErrorCode::RecoveryIncomplete) | |
| 650 | 추가: } else { | |
| 651 | 추가: None | |
| 652 | 추가: }, | |
| 653 | 추가: publication: if impossible || failed { | |
| 654 | 추가: Publication::None | |
| 655 | 추가: } else { | |
| 656 | 추가: Publication::Complete | |
| 657 | 추가: }, | |
| 658 | 추가: created_count: u64::from(!impossible && !failed), | |
| 659 | 추가: retained_partial_count: 0, | |
| 660 | 추가: durability: if impossible || failed { | |
| 661 | 추가: Durability::NotApplicable | |
| 662 | 추가: } else { | |
| 663 | 추가: Durability::Synced | |
| 664 | 추가: }, | |
| 665 | 추가: cleanup: Cleanup::Complete, | |
| 666 | 추가: })); | |
| 667 | 추가: state.queue.extend([ | |
| 668 | 추가: HostEvent::StdoutEof, | |
| 669 | 추가: HostEvent::StderrEof, | |
| 670 | 추가: HostEvent::Exited { success: true }, | |
| 671 | 추가: ]); | |
| 672 | 추가: } | |
| 673 | 추가: drop(state); | |
| 674 | 추가: for _ in 0..30 { | |
| 675 | 추가: app.model.poll(); | |
| 676 | 추가: } | |
| 677 | 추가: return app; | |
| 678 | 추가: } | |
| 541 | 679 | let seven_zip = self.name.starts_with("create-sevenzip"); |
| 542 | 680 | let creating = self.name.starts_with("create-") || self.name == "password-create"; |
| 543 | 681 | let listing_error = matches!(self.name, "unsupported" | "damaged"); |