Merge pull request #72 from Team-LJY/features/app-password-flow
실제 작업자의 암호 요청과 암호 ZIP 생성 옵션을 화면에 연결
- 작성자
- LeeJunyoung
- 작성 시각
- 커밋
2b284f88df169bc30adeb2e7470b207dc92c156f
변경된 파일 7개
+467-42| @@ -11,6 +11,8 @@ pub struct ArchiveApp { | ||
| 11 | 11 | sources: String, |
| 12 | 12 | zip_output: String, |
| 13 | 13 | password: String, |
| 14 | 추가: password_challenge: Option<u64>, | |
| 15 | 추가: aes256: bool, | |
| 14 | 16 | create: bool, |
| 15 | 17 | open: bool, |
| 16 | 18 | selected_only: bool, |
| @@ -28,6 +30,8 @@ impl ArchiveApp { | ||
| 28 | 30 | sources: String::new(), |
| 29 | 31 | zip_output: String::new(), |
| 30 | 32 | password: String::new(), |
| 33 | 추가: password_challenge: None, | |
| 34 | 추가: aes256: false, | |
| 31 | 35 | create: false, |
| 32 | 36 | open: false, |
| 33 | 37 | selected_only: false, |
| @@ -39,8 +43,12 @@ impl ArchiveApp { | ||
| 39 | 43 | } |
| 40 | 44 | app |
| 41 | 45 | } |
| 46 | 추가: fn clear_password(&mut self) { | |
| 47 | 추가: let mut bytes = std::mem::take(&mut self.password).into_bytes(); | |
| 48 | 추가: bytes.fill(0); | |
| 49 | 추가: } | |
| 42 | 50 | pub fn open_path(&mut self, archive: PathBuf) { |
| 43 | 삭제: self.password.clear(); | |
| 51 | 추가: self.clear_password(); | |
| 44 | 52 | self.model |
| 45 | 53 | .begin(Start::List { archive }, self.factory.as_mut()); |
| 46 | 54 | } |
| @@ -58,16 +66,19 @@ impl ArchiveApp { | ||
| 58 | 66 | .join("\n"); |
| 59 | 67 | self.create = true; |
| 60 | 68 | } else { |
| 61 | 삭제: self.model.error = Some("ZIP 생성 경로는 현재 UTF-8 입력만 지원합니다".into()); | |
| 69 | 추가: self.model.input_error = Some("ZIP 생성 경로는 현재 UTF-8 입력만 지원합니다".into()); | |
| 62 | 70 | } |
| 63 | 71 | } |
| 64 | 72 | } |
| 65 | 73 | impl ArchiveApp { |
| 66 | 74 | pub fn show(&mut self, root: &mut egui::Ui) { |
| 67 | 75 | self.model.poll(); |
| 68 | 삭제: if self.model.challenge.is_none() { | |
| 69 | 삭제: self.password.clear(); | |
| 76 | 추가: let challenge = self.model.challenge.map(|(id, _, _)| id); | |
| 77 | 추가: let new_challenge = challenge != self.password_challenge; | |
| 78 | 추가: if new_challenge || challenge.is_none() { | |
| 79 | 추가: self.clear_password(); | |
| 70 | 80 | } |
| 81 | 추가: self.password_challenge = challenge; | |
| 71 | 82 | let ctx = root.ctx().clone(); |
| 72 | 83 | let dropped = ctx.input(|i| { |
| 73 | 84 | i.raw |
| @@ -104,7 +115,7 @@ impl ArchiveApp { | ||
| 104 | 115 | .add_enabled(self.model.busy(), egui::Button::new("취소 요청")) |
| 105 | 116 | .clicked() |
| 106 | 117 | { |
| 107 | 삭제: self.password.clear(); | |
| 118 | 추가: self.clear_password(); | |
| 108 | 119 | self.model.cancel(); |
| 109 | 120 | } |
| 110 | 121 | }); |
| @@ -267,7 +278,7 @@ impl ArchiveApp { | ||
| 267 | 278 | ui.selectable_value(&mut self.method, Method::Deflate, "압축"); |
| 268 | 279 | ui.selectable_value(&mut self.method, Method::Store, "묶기"); |
| 269 | 280 | }); |
| 270 | 삭제: ui.label("암호 ZIP 생성은 작업자 지원 후 활성화됩니다"); | |
| 281 | 추가: ui.checkbox(&mut self.aes256, "암호로 보호"); | |
| 271 | 282 | if ui.button("ZIP 만들기").clicked() { |
| 272 | 283 | let sources = self |
| 273 | 284 | .sources |
| @@ -287,7 +298,7 @@ impl ArchiveApp { | ||
| 287 | 298 | sources, |
| 288 | 299 | output_file: self.zip_output.clone().into(), |
| 289 | 300 | method: self.method, |
| 290 | 삭제: aes256: false, | |
| 301 | 추가: aes256: self.aes256, | |
| 291 | 302 | }, |
| 292 | 303 | self.factory.as_mut(), |
| 293 | 304 | ) { |
| @@ -308,12 +319,23 @@ impl ArchiveApp { | ||
| 308 | 319 | }) |
| 309 | 320 | .collapsible(false) |
| 310 | 321 | .show(&ctx, |ui| { |
| 311 | 삭제: ui.label(format!("암호 입력 요청 {attempt}")); | |
| 322 | 추가: ui.label(if encrypt { | |
| 323 | 추가: "사용할 암호를 입력하세요" | |
| 324 | 추가: } else if attempt > 1 { | |
| 325 | 추가: "암호가 맞지 않습니다. 다시 입력하세요" | |
| 326 | 추가: } else { | |
| 327 | 추가: "암호를 입력하세요" | |
| 328 | 추가: }); | |
| 329 | 추가: ui.label("암호"); | |
| 312 | 330 | let edit = ui.add( |
| 313 | 331 | egui::TextEdit::singleline(&mut self.password) |
| 314 | 332 | .password(true) |
| 333 | 추가: .id(egui::Id::new("archive-password-input")) | |
| 315 | 334 | .char_limit(1024), |
| 316 | 335 | ); |
| 336 | 추가: if new_challenge { | |
| 337 | 추가: edit.request_focus(); | |
| 338 | 추가: } | |
| 317 | 339 | if ui.button("암호 전달").clicked() |
| 318 | 340 | || (edit.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter))) |
| 319 | 341 | { |
| @@ -321,7 +343,7 @@ impl ArchiveApp { | ||
| 321 | 343 | self.model.password(text); |
| 322 | 344 | } |
| 323 | 345 | if ui.button("작업 취소").clicked() { |
| 324 | 삭제: self.password.clear(); | |
| 346 | 추가: self.clear_password(); | |
| 325 | 347 | self.model.cancel(); |
| 326 | 348 | } |
| 327 | 349 | }); |
| @@ -381,3 +403,9 @@ impl eframe::App for ArchiveApp { | ||
| 381 | 403 | self.show(root); |
| 382 | 404 | } |
| 383 | 405 | } |
| 406 | 추가: | |
| 407 | 추가: impl Drop for ArchiveApp { | |
| 408 | 추가: fn drop(&mut self) { | |
| 409 | 추가: self.clear_password(); | |
| 410 | 추가: } | |
| 411 | 추가: } |
| @@ -54,10 +54,12 @@ pub enum Start { | ||
| 54 | 54 | pub struct Secret(Vec<u8>); |
| 55 | 55 | impl Secret { |
| 56 | 56 | pub fn new(text: String) -> Result<Self, &'static str> { |
| 57 | 삭제: if text.is_empty() || text.len() > 1024 { | |
| 57 | 추가: let mut bytes = text.into_bytes(); | |
| 58 | 추가: if bytes.is_empty() || bytes.len() > 1024 { | |
| 59 | 추가: bytes.fill(0); | |
| 58 | 60 | return Err("암호는 UTF-8 1~1024바이트로 입력하세요"); |
| 59 | 61 | } |
| 60 | 삭제: Ok(Self(text.into_bytes())) | |
| 62 | 추가: Ok(Self(bytes)) | |
| 61 | 63 | } |
| 62 | 64 | pub fn as_bytes(&self) -> &[u8] { |
| 63 | 65 | &self.0 |
| @@ -268,6 +270,7 @@ pub struct Model { | ||
| 268 | 270 | pub outputs: Vec<(String, Disposition)>, |
| 269 | 271 | pub cancel: Option<CancelStatus>, |
| 270 | 272 | pub error: Option<String>, |
| 273 | 추가: pub input_error: Option<String>, | |
| 271 | 274 | pub encryption: bool, |
| 272 | 275 | pub close: Close, |
| 273 | 276 | pub confirmed: bool, |
| @@ -323,19 +326,17 @@ impl Model { | ||
| 323 | 326 | Start::CreateZip { |
| 324 | 327 | sources, |
| 325 | 328 | output_file, |
| 326 | 삭제: aes256, | |
| 327 | 329 | .. |
| 328 | 330 | } => { |
| 329 | 331 | !sources.is_empty() |
| 330 | 332 | && output_file.is_absolute() |
| 331 | 삭제: && (!aes256 || self.encryption) | |
| 332 | 333 | && sources |
| 333 | 334 | .iter() |
| 334 | 335 | .all(|(p, n)| p.is_absolute() && valid_relative(n)) |
| 335 | 336 | } |
| 336 | 337 | }; |
| 337 | 338 | if !validation { |
| 338 | 삭제: self.error = Some("입력 경로, 출력명과 선택한 목록을 확인하세요".into()); | |
| 339 | 추가: self.input_error = Some("입력 경로, 출력명과 선택한 목록을 확인하세요".into()); | |
| 339 | 340 | return false; |
| 340 | 341 | } |
| 341 | 342 | let Some(id) = self.next_id.checked_add(1) else { |
| @@ -371,6 +372,7 @@ impl Model { | ||
| 371 | 372 | self.progress = None; |
| 372 | 373 | self.outputs.clear(); |
| 373 | 374 | self.cancel = None; |
| 375 | 추가: self.input_error = None; | |
| 374 | 376 | self.error = send_error; |
| 375 | 377 | self.confirmed = false; |
| 376 | 378 | self.running = Some(Running { |
| @@ -423,7 +425,7 @@ impl Model { | ||
| 423 | 425 | let secret = match Secret::new(text) { |
| 424 | 426 | Ok(s) => s, |
| 425 | 427 | Err(e) => { |
| 426 | 삭제: self.error = Some(e.into()); | |
| 428 | 추가: self.input_error = Some(e.into()); | |
| 427 | 429 | return false; |
| 428 | 430 | } |
| 429 | 431 | }; |
| @@ -435,7 +437,7 @@ impl Model { | ||
| 435 | 437 | .is_some() |
| 436 | 438 | { |
| 437 | 439 | self.challenge = None; |
| 438 | 삭제: self.error = None; | |
| 440 | 추가: self.input_error = None; | |
| 439 | 441 | true |
| 440 | 442 | } else { |
| 441 | 443 | false |
| @@ -475,6 +477,7 @@ impl Model { | ||
| 475 | 477 | if let Some(seq) = self.send(Command::Cancel) { |
| 476 | 478 | self.running.as_mut().unwrap().cancel_sequence = Some(seq); |
| 477 | 479 | self.challenge = None; |
| 480 | 추가: self.input_error = None; | |
| 478 | 481 | } |
| 479 | 482 | } |
| 480 | 483 | } |
| @@ -556,6 +559,7 @@ impl Model { | ||
| 556 | 559 | self.selected.clear(); |
| 557 | 560 | } |
| 558 | 561 | self.challenge = None; |
| 562 | 추가: self.input_error = None; | |
| 559 | 563 | if matches!(self.close, Close::Waiting | Close::Confirm) { |
| 560 | 564 | self.close = Close::Review; |
| 561 | 565 | } |
| @@ -668,7 +672,7 @@ impl Model { | ||
| 668 | 672 | } |
| 669 | 673 | } |
| 670 | 674 | pub fn status(&self) -> String { |
| 671 | 삭제: if let Some(error) = &self.error { | |
| 675 | 추가: if let Some(error) = self.error.as_ref().or(self.input_error.as_ref()) { | |
| 672 | 676 | return error.clone(); |
| 673 | 677 | } |
| 674 | 678 | if self.busy() { |
| @@ -51,6 +51,17 @@ fixtures/는 generate.py의 Python 표준 라이브러리로 생성한 작은 | ||
| 51 | 51 | |
| 52 | 52 | 취소와 종료 경합 회귀 시험은 실제 작업자에 List를 보낸 뒤 화면 poll 전에 취소하는 흐름을 100회 확인함. 취소 파이프 쓰기가 실패해도 검증된 Terminal과 성공 종료가 있으면 원래 결과를 보존하며, Terminal이 없는 조기 종료는 계속 실패로 처리함. 취소 쓰기 오류 판단을 미루어도 EOF와 child wait 전에는 닫기나 작업 교체를 허용하지 않음. |
| 53 | 53 | |
| 54 | 추가: 암호 화면 흐름 | |
| 55 | 추가: | |
| 56 | 추가: password_flows.rs는 공개 시험 암호 fixture-password를 사용하는 기존 합성 ZIP 6개로 | |
| 57 | 추가: ZipCrypto와 AES의 Store/Deflate 목록 및 해제를 실제 화면 위젯과 작업자로 확인함. | |
| 58 | 추가: 목록은 암호 없이 표시하며 해제 시 작업자의 challenge_id와 attempt로 암호를 요청함. | |
| 59 | 추가: 틀린 암호 뒤 재입력, 3회 실패, 빈 입력과 UTF-8 바이트 한도 초과, 대기 중 취소, | |
| 60 | 추가: 첫 실행의 AES ZIP 생성 및 재열기/해제를 검증함. 실패와 취소 중 출력이 없고 기존 파일과 | |
| 61 | 추가: 원본이 보존되며 Terminal, 양쪽 EOF 및 child wait 후 연결이 정리되는지 확인함. | |
| 62 | 추가: 암호 표시를 가리고 재요청, 취소 및 창 해제 때 앱이 소유한 입력 버퍼를 지움. | |
| 63 | 추가: Windows 실행이나 네이티브 OS 창 입력 자동화 검증은 포함하지 않음. | |
| 64 | 추가: | |
| 54 | 65 | 7z 앱 연동은 revision 2의 기존 Format 값 0~3을 유지하고 SevenZip 값 4를 추가함. |
| 55 | 66 | formats.rs는 전체 ListEnd 프레임을 고정 바이트와 비교하고 Unix/Windows 식별자가 |
| 56 | 67 | 목록 응답과 해제 요청 사이에서 보존되는지 확인함. 화면 흐름 시험은 PR69의 LZMA와 |
| @@ -271,6 +271,8 @@ mod screen { | ||
| 271 | 271 | ); |
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 추가: include!("password_flows.rs"); | |
| 275 | 추가: | |
| 274 | 276 | fn archive_flow(name: &str, format: Format) { |
| 275 | 277 | let scratch = Scratch::new(); |
| 276 | 278 | let fixture = Path::new(env!("CARGO_MANIFEST_DIR")) |
| @@ -0,0 +1,333 @@ | ||
| 1 | 추가: const FIXTURE_PASSWORD: &str = "fixture-password"; | |
| 2 | 추가: fn encrypted_fixture(scratch: &Scratch, name: &str) -> PathBuf { | |
| 3 | 추가: let archive = scratch.path(name); | |
| 4 | 추가: fs::copy( | |
| 5 | 추가: Path::new(env!("CARGO_MANIFEST_DIR")) | |
| 6 | 추가: .join("../../tests/rust-archive-worker/fixtures") | |
| 7 | 추가: .join(name), | |
| 8 | 추가: &archive, | |
| 9 | 추가: ) | |
| 10 | 추가: .unwrap(); | |
| 11 | 추가: archive | |
| 12 | 추가: } | |
| 13 | 추가: impl Screen { | |
| 14 | 추가: fn password_request(&mut self, expected_attempt: u32, encrypt: bool) -> u64 { | |
| 15 | 추가: let deadline = Instant::now() + Duration::from_secs(10); | |
| 16 | 추가: loop { | |
| 17 | 추가: self.render(vec![]); | |
| 18 | 추가: assert!(self.app.model.busy(), "{}", self.app.model.status()); | |
| 19 | 추가: if let Some((id, attempt, purpose)) = self.app.model.challenge { | |
| 20 | 추가: assert_eq!(attempt, expected_attempt); | |
| 21 | 추가: assert_eq!(purpose, encrypt); | |
| 22 | 추가: self.render(vec![]); | |
| 23 | 추가: return id; | |
| 24 | 추가: } | |
| 25 | 추가: assert!(Instant::now() < deadline); | |
| 26 | 추가: std::thread::sleep(Duration::from_millis(2)); | |
| 27 | 추가: } | |
| 28 | 추가: } | |
| 29 | 추가: fn password_answer(&mut self, text: &str) { | |
| 30 | 추가: self.render(vec![]); | |
| 31 | 추가: let input = self | |
| 32 | 추가: .context | |
| 33 | 추가: .read_response(egui::Id::new("archive-password-input")) | |
| 34 | 추가: .expect("암호 입력란이 없음") | |
| 35 | 추가: .rect | |
| 36 | 추가: .center(); | |
| 37 | 추가: self.click_at(input); | |
| 38 | 추가: let rendered = self.render(vec![ | |
| 39 | 추가: egui::Event::Key { | |
| 40 | 추가: key: egui::Key::A, | |
| 41 | 추가: physical_key: None, | |
| 42 | 추가: pressed: true, | |
| 43 | 추가: repeat: false, | |
| 44 | 추가: modifiers: egui::Modifiers::COMMAND, | |
| 45 | 추가: }, | |
| 46 | 추가: egui::Event::Text(text.into()), | |
| 47 | 추가: ]); | |
| 48 | 추가: if !text.is_empty() { | |
| 49 | 추가: assert!(!rendered.iter().any(|(value, _)| value.contains(text))); | |
| 50 | 추가: } | |
| 51 | 추가: self.click("암호 전달"); | |
| 52 | 추가: } | |
| 53 | 추가: fn start_password_extract(&mut self, output: &Path) { | |
| 54 | 추가: self.fill("출력 폴더", egui::vec2(100.0, 0.0), output); | |
| 55 | 추가: self.click("풀기"); | |
| 56 | 추가: assert!(self.app.model.busy()); | |
| 57 | 추가: } | |
| 58 | 추가: fn finish_password_job(&mut self, expected: Outcome) { | |
| 59 | 추가: let deadline = Instant::now() + Duration::from_secs(10); | |
| 60 | 추가: while self.app.model.busy() { | |
| 61 | 추가: self.render(vec![]); | |
| 62 | 추가: assert!(Instant::now() < deadline); | |
| 63 | 추가: std::thread::sleep(Duration::from_millis(2)); | |
| 64 | 추가: } | |
| 65 | 추가: assert!(self.app.model.confirmed, "{}", self.app.model.status()); | |
| 66 | 추가: assert_eq!(self.app.model.terminal.as_ref().unwrap().outcome, expected); | |
| 67 | 추가: assert!(self.app.model.challenge.is_none()); | |
| 68 | 추가: } | |
| 69 | 추가: fn start_encrypted_zip(&mut self, source: &Path, archive: &Path) { | |
| 70 | 추가: self.click("ZIP 만들기"); | |
| 71 | 추가: self.fill( | |
| 72 | 추가: "원본 파일 절대 경로 / 한 줄에 하나", | |
| 73 | 추가: egui::vec2(0.0, 25.0), | |
| 74 | 추가: source, | |
| 75 | 추가: ); | |
| 76 | 추가: self.fill("저장할 ZIP 절대 경로", egui::vec2(0.0, 22.0), archive); | |
| 77 | 추가: self.click("암호로 보호"); | |
| 78 | 추가: self.click("ZIP 만들기"); | |
| 79 | 추가: assert!(self.app.model.busy(), "{}", self.app.model.status()); | |
| 80 | 추가: } | |
| 81 | 추가: } | |
| 82 | 추가: #[test] | |
| 83 | 추가: fn encrypted_zip_list_and_extract_with_actual_password_dialog() { | |
| 84 | 추가: for name in [ | |
| 85 | 추가: "zipcrypto-store.zip", | |
| 86 | 추가: "zipcrypto-deflate.zip", | |
| 87 | 추가: "aes1-store.zip", | |
| 88 | 추가: "aes1-deflate.zip", | |
| 89 | 추가: "aes2-store.zip", | |
| 90 | 추가: "aes2-deflate.zip", | |
| 91 | 추가: ] { | |
| 92 | 추가: let scratch = Scratch::new(); | |
| 93 | 추가: let archive = encrypted_fixture(&scratch, name); | |
| 94 | 추가: let original = fs::read(&archive).unwrap(); | |
| 95 | 추가: let output = make_directory(&scratch.path("output")); | |
| 96 | 추가: let (factory, observed) = observed_factory(); | |
| 97 | 추가: let mut screen = Screen::new(factory); | |
| 98 | 추가: screen.open(&archive); | |
| 99 | 추가: assert!(screen.app.model.entries.iter().all(|entry| entry.encrypted)); | |
| 100 | 추가: assert!(screen.app.model.challenge.is_none()); | |
| 101 | 추가: screen.start_password_extract(&output); | |
| 102 | 추가: screen.password_request(1, false); | |
| 103 | 추가: assert_eq!(fs::read_dir(&output).unwrap().count(), 0); | |
| 104 | 추가: screen.password_answer(FIXTURE_PASSWORD); | |
| 105 | 추가: screen.finish_password_job(Outcome::Completed); | |
| 106 | 추가: assert_eq!( | |
| 107 | 추가: fs::read(output.join("payload.bin")).unwrap(), | |
| 108 | 추가: b"Zipelo encrypted interoperability\n".repeat(8) | |
| 109 | 추가: ); | |
| 110 | 추가: assert_eq!(fs::read(archive).unwrap(), original); | |
| 111 | 추가: assert_reaped(&observed); | |
| 112 | 추가: } | |
| 113 | 추가: } | |
| 114 | 추가: #[test] | |
| 115 | 추가: fn wrong_password_retry_clears_input_and_succeeds_without_partial_output() { | |
| 116 | 추가: let scratch = Scratch::new(); | |
| 117 | 추가: let archive = encrypted_fixture(&scratch, "aes2-deflate.zip"); | |
| 118 | 추가: let output = make_directory(&scratch.path("output")); | |
| 119 | 추가: let (factory, observed) = observed_factory(); | |
| 120 | 추가: let mut screen = Screen::new(factory); | |
| 121 | 추가: screen.open(&archive); | |
| 122 | 추가: screen.start_password_extract(&output); | |
| 123 | 추가: let first = screen.password_request(1, false); | |
| 124 | 추가: screen.password_answer("wrong-password"); | |
| 125 | 추가: let second = screen.password_request(2, false); | |
| 126 | 추가: assert_ne!(first, second); | |
| 127 | 추가: assert_eq!(fs::read_dir(&output).unwrap().count(), 0); | |
| 128 | 추가: let labels = screen.render(vec![]); | |
| 129 | 추가: assert!( | |
| 130 | 추가: labels | |
| 131 | 추가: .iter() | |
| 132 | 추가: .any(|(value, _)| value == "암호가 맞지 않습니다. 다시 입력하세요") | |
| 133 | 추가: ); | |
| 134 | 추가: screen.click("암호 전달"); | |
| 135 | 추가: assert_eq!(screen.app.model.challenge, Some((second, 2, false))); | |
| 136 | 추가: assert!( | |
| 137 | 추가: screen | |
| 138 | 추가: .app | |
| 139 | 추가: .model | |
| 140 | 추가: .input_error | |
| 141 | 추가: .as_ref() | |
| 142 | 추가: .unwrap() | |
| 143 | 추가: .contains("1~1024바이트") | |
| 144 | 추가: ); | |
| 145 | 추가: screen.render(vec![]); | |
| 146 | 추가: screen.password_answer(FIXTURE_PASSWORD); | |
| 147 | 추가: screen.finish_password_job(Outcome::Completed); | |
| 148 | 추가: assert_reaped(&observed); | |
| 149 | 추가: } | |
| 150 | 추가: #[test] | |
| 151 | 추가: fn three_wrong_passwords_fail_without_writes_and_can_start_a_new_job() { | |
| 152 | 추가: let scratch = Scratch::new(); | |
| 153 | 추가: let archive = encrypted_fixture(&scratch, "zipcrypto-deflate.zip"); | |
| 154 | 추가: let output = make_directory(&scratch.path("output")); | |
| 155 | 추가: let (factory, observed) = observed_factory(); | |
| 156 | 추가: let mut screen = Screen::new(factory); | |
| 157 | 추가: screen.open(&archive); | |
| 158 | 추가: screen.start_password_extract(&output); | |
| 159 | 추가: for attempt in 1..=3 { | |
| 160 | 추가: screen.password_request(attempt, false); | |
| 161 | 추가: assert_eq!(fs::read_dir(&output).unwrap().count(), 0); | |
| 162 | 추가: screen.password_answer("wrong-password"); | |
| 163 | 추가: } | |
| 164 | 추가: screen.finish_password_job(Outcome::Failed); | |
| 165 | 추가: assert_eq!( | |
| 166 | 추가: screen.app.model.terminal.as_ref().unwrap().error, | |
| 167 | 추가: Some(ErrorCode::WrongPassword) | |
| 168 | 추가: ); | |
| 169 | 추가: assert_eq!(fs::read_dir(&output).unwrap().count(), 0); | |
| 170 | 추가: screen.open(&archive); | |
| 171 | 추가: assert_reaped(&observed); | |
| 172 | 추가: } | |
| 173 | 추가: #[test] | |
| 174 | 추가: fn cancel_password_extraction_waits_for_cleanup_without_writes() { | |
| 175 | 추가: let scratch = Scratch::new(); | |
| 176 | 추가: let archive = encrypted_fixture(&scratch, "aes1-store.zip"); | |
| 177 | 추가: let output = make_directory(&scratch.path("output")); | |
| 178 | 추가: fs::write(output.join("existing.txt"), b"preserve").unwrap(); | |
| 179 | 추가: let (factory, observed) = observed_factory(); | |
| 180 | 추가: let mut screen = Screen::new(factory); | |
| 181 | 추가: screen.open(&archive); | |
| 182 | 추가: screen.start_password_extract(&output); | |
| 183 | 추가: screen.password_request(1, false); | |
| 184 | 추가: screen.click("작업 취소"); | |
| 185 | 추가: screen.app.model.request_close(); | |
| 186 | 추가: screen.app.model.confirm_close(); | |
| 187 | 추가: assert!(matches!( | |
| 188 | 추가: screen.app.model.close, | |
| 189 | 추가: Close::Waiting | Close::Review | |
| 190 | 추가: )); | |
| 191 | 추가: screen.finish_password_job(Outcome::Cancelled); | |
| 192 | 추가: assert_eq!(screen.app.model.close, Close::Review); | |
| 193 | 추가: assert_eq!(fs::read(output.join("existing.txt")).unwrap(), b"preserve"); | |
| 194 | 추가: assert_eq!(fs::read_dir(output).unwrap().count(), 1); | |
| 195 | 추가: assert_reaped(&observed); | |
| 196 | 추가: } | |
| 197 | 추가: #[test] | |
| 198 | 추가: fn cold_start_creates_aes_zip_then_reopens_and_extracts_with_password() { | |
| 199 | 추가: let scratch = Scratch::new(); | |
| 200 | 추가: let source = scratch.path("private.txt"); | |
| 201 | 추가: let payload = b"Public synthetic password flow payload\n"; | |
| 202 | 추가: fs::write(&source, payload).unwrap(); | |
| 203 | 추가: let archive = scratch.path("encrypted.zip"); | |
| 204 | 추가: let output = make_directory(&scratch.path("output")); | |
| 205 | 추가: let (factory, observed) = observed_factory(); | |
| 206 | 추가: let mut screen = Screen::new(factory); | |
| 207 | 추가: assert!(!screen.app.model.encryption); | |
| 208 | 추가: screen.start_encrypted_zip(&source, &archive); | |
| 209 | 추가: screen.password_request(1, true); | |
| 210 | 추가: assert!(!archive.exists()); | |
| 211 | 추가: screen.password_answer(FIXTURE_PASSWORD); | |
| 212 | 추가: screen.finish_password_job(Outcome::Completed); | |
| 213 | 추가: let bytes = fs::read(&archive).unwrap(); | |
| 214 | 추가: assert_eq!(&bytes[..4], b"PK\x03\x04"); | |
| 215 | 추가: assert_eq!(u16::from_le_bytes(bytes[6..8].try_into().unwrap()) & 1, 1); | |
| 216 | 추가: assert_eq!(u16::from_le_bytes(bytes[8..10].try_into().unwrap()), 99); | |
| 217 | 추가: screen.open(&archive); | |
| 218 | 추가: assert!(screen.app.model.entries.iter().all(|entry| entry.encrypted)); | |
| 219 | 추가: screen.start_password_extract(&output); | |
| 220 | 추가: screen.password_request(1, false); | |
| 221 | 추가: screen.password_answer(FIXTURE_PASSWORD); | |
| 222 | 추가: screen.finish_password_job(Outcome::Completed); | |
| 223 | 추가: assert_eq!(fs::read(output.join("private.txt")).unwrap(), payload); | |
| 224 | 추가: assert_eq!(fs::read(source).unwrap(), payload); | |
| 225 | 추가: assert_reaped(&observed); | |
| 226 | 추가: } | |
| 227 | 추가: #[test] | |
| 228 | 추가: fn cancel_password_creation_does_not_create_an_archive() { | |
| 229 | 추가: let scratch = Scratch::new(); | |
| 230 | 추가: let source = scratch.path("private.txt"); | |
| 231 | 추가: fs::write(&source, b"preserve").unwrap(); | |
| 232 | 추가: let archive = scratch.path("cancelled.zip"); | |
| 233 | 추가: let (factory, observed) = observed_factory(); | |
| 234 | 추가: let mut screen = Screen::new(factory); | |
| 235 | 추가: screen.start_encrypted_zip(&source, &archive); | |
| 236 | 추가: screen.password_request(1, true); | |
| 237 | 추가: screen.click("작업 취소"); | |
| 238 | 추가: screen.finish_password_job(Outcome::Cancelled); | |
| 239 | 추가: assert!(!archive.exists()); | |
| 240 | 추가: assert_eq!(fs::read(source).unwrap(), b"preserve"); | |
| 241 | 추가: assert_eq!(fs::read_dir(&scratch.0).unwrap().count(), 1); | |
| 242 | 추가: assert_reaped(&observed); | |
| 243 | 추가: } | |
| 244 | 추가: | |
| 245 | 추가: #[test] | |
| 246 | 추가: fn oversized_utf8_password_stays_in_dialog_then_accepts_valid_input() { | |
| 247 | 추가: let scratch = Scratch::new(); | |
| 248 | 추가: let archive = encrypted_fixture(&scratch, "aes2-store.zip"); | |
| 249 | 추가: let output = make_directory(&scratch.path("output")); | |
| 250 | 추가: let (factory, observed) = observed_factory(); | |
| 251 | 추가: let mut screen = Screen::new(factory); | |
| 252 | 추가: screen.open(&archive); | |
| 253 | 추가: screen.start_password_extract(&output); | |
| 254 | 추가: let id = screen.password_request(1, false); | |
| 255 | 추가: screen.password_answer(&"가".repeat(342)); | |
| 256 | 추가: assert_eq!(screen.app.model.challenge, Some((id, 1, false))); | |
| 257 | 추가: assert!( | |
| 258 | 추가: screen | |
| 259 | 추가: .app | |
| 260 | 추가: .model | |
| 261 | 추가: .input_error | |
| 262 | 추가: .as_ref() | |
| 263 | 추가: .unwrap() | |
| 264 | 추가: .contains("1~1024바이트") | |
| 265 | 추가: ); | |
| 266 | 추가: assert_eq!(fs::read_dir(&output).unwrap().count(), 0); | |
| 267 | 추가: screen.password_answer(FIXTURE_PASSWORD); | |
| 268 | 추가: screen.finish_password_job(Outcome::Completed); | |
| 269 | 추가: assert_reaped(&observed); | |
| 270 | 추가: } | |
| 271 | 추가: | |
| 272 | 추가: fn invalid_password_then_cancel(invalid: &str, close: bool) { | |
| 273 | 추가: let scratch = Scratch::new(); | |
| 274 | 추가: let source = scratch.path("private.txt"); | |
| 275 | 추가: fs::write(&source, b"preserve").unwrap(); | |
| 276 | 추가: let archive = scratch.path("cancelled.zip"); | |
| 277 | 추가: let (factory, observed) = observed_factory(); | |
| 278 | 추가: let mut screen = Screen::new(factory); | |
| 279 | 추가: screen.start_encrypted_zip(&source, &archive); | |
| 280 | 추가: let challenge = screen.password_request(1, true); | |
| 281 | 추가: screen.password_answer(invalid); | |
| 282 | 추가: assert_eq!(screen.app.model.challenge, Some((challenge, 1, true))); | |
| 283 | 추가: assert!(screen.app.model.status().contains("1~1024바이트")); | |
| 284 | 추가: if close { | |
| 285 | 추가: screen.app.model.request_close(); | |
| 286 | 추가: screen.app.model.confirm_close(); | |
| 287 | 추가: assert_eq!(screen.app.model.close, Close::Waiting); | |
| 288 | 추가: assert!(!screen.app.model.confirmed); | |
| 289 | 추가: } else { | |
| 290 | 추가: screen.click("작업 취소"); | |
| 291 | 추가: } | |
| 292 | 추가: screen.finish_password_job(Outcome::Cancelled); | |
| 293 | 추가: assert_eq!(screen.app.model.status(), "작업 취소됨"); | |
| 294 | 추가: assert_eq!( | |
| 295 | 추가: screen.app.model.terminal.as_ref().unwrap().publication, | |
| 296 | 추가: Publication::None | |
| 297 | 추가: ); | |
| 298 | 추가: assert_eq!(screen.app.model.terminal.as_ref().unwrap().created_count, 0); | |
| 299 | 추가: assert_eq!( | |
| 300 | 추가: screen | |
| 301 | 추가: .app | |
| 302 | 추가: .model | |
| 303 | 추가: .terminal | |
| 304 | 추가: .as_ref() | |
| 305 | 추가: .unwrap() | |
| 306 | 추가: .retained_partial_count, | |
| 307 | 추가: 0 | |
| 308 | 추가: ); | |
| 309 | 추가: assert!(!archive.exists()); | |
| 310 | 추가: assert_eq!(fs::read(&source).unwrap(), b"preserve"); | |
| 311 | 추가: assert_eq!(fs::read_dir(&scratch.0).unwrap().count(), 1); | |
| 312 | 추가: assert_reaped(&observed); | |
| 313 | 추가: if close { | |
| 314 | 추가: assert_eq!(screen.app.model.close, Close::Review); | |
| 315 | 추가: screen.app.model.acknowledge_close(); | |
| 316 | 추가: assert_eq!(screen.app.model.close, Close::Allowed); | |
| 317 | 추가: } else { | |
| 318 | 추가: screen.open(&encrypted_fixture(&scratch, "aes2-store.zip")); | |
| 319 | 추가: assert_reaped(&observed); | |
| 320 | 추가: } | |
| 321 | 추가: } | |
| 322 | 추가: #[test] | |
| 323 | 추가: fn empty_password_then_cancel_confirms_worker_exit() { | |
| 324 | 추가: invalid_password_then_cancel("", false); | |
| 325 | 추가: } | |
| 326 | 추가: #[test] | |
| 327 | 추가: fn oversized_password_then_cancel_confirms_worker_exit() { | |
| 328 | 추가: invalid_password_then_cancel(&"가".repeat(342), false); | |
| 329 | 추가: } | |
| 330 | 추가: #[test] | |
| 331 | 추가: fn invalid_password_then_close_confirms_worker_exit() { | |
| 332 | 추가: invalid_password_then_cancel("", true); | |
| 333 | 추가: } |
| @@ -807,3 +807,42 @@ fn error_cleanup_requires_child_wait_without_fabricating_terminal() { | ||
| 807 | 807 | assert_eq!(model.error.as_deref(), Some("pipe error")); |
| 808 | 808 | assert_eq!(model.close, Close::Review); |
| 809 | 809 | } |
| 810 | 추가: | |
| 811 | 추가: #[test] | |
| 812 | 추가: fn password_validation_and_retry_do_not_erase_transport_failure() { | |
| 813 | 추가: let mut factory = FakeFactory::default(); | |
| 814 | 추가: let mut model = Model::default(); | |
| 815 | 추가: assert!(model.begin( | |
| 816 | 추가: Start::List { | |
| 817 | 추가: archive: path("locked.zip") | |
| 818 | 추가: }, | |
| 819 | 추가: &mut factory | |
| 820 | 추가: )); | |
| 821 | 추가: for _ in 0..10 { | |
| 822 | 추가: model.poll(); | |
| 823 | 추가: if model.challenge.is_some() { | |
| 824 | 추가: break; | |
| 825 | 추가: } | |
| 826 | 추가: } | |
| 827 | 추가: assert!(model.challenge.is_some()); | |
| 828 | 추가: factory | |
| 829 | 추가: .state | |
| 830 | 추가: .borrow_mut() | |
| 831 | 추가: .queue | |
| 832 | 추가: .push_back(HostEvent::Fault("pipe error".into())); | |
| 833 | 추가: for _ in 0..10 { | |
| 834 | 추가: model.poll(); | |
| 835 | 추가: if model.error.is_some() { | |
| 836 | 추가: break; | |
| 837 | 추가: } | |
| 838 | 추가: } | |
| 839 | 추가: assert_eq!(model.error.as_deref(), Some("pipe error")); | |
| 840 | 추가: assert!(!model.password(String::new())); | |
| 841 | 추가: assert!(model.input_error.as_ref().unwrap().contains("1~1024바이트")); | |
| 842 | 추가: assert_eq!(model.error.as_deref(), Some("pipe error")); | |
| 843 | 추가: assert!(model.password("synthetic password".into())); | |
| 844 | 추가: pump(&mut model); | |
| 845 | 추가: assert!(model.input_error.is_none()); | |
| 846 | 추가: assert_eq!(model.error.as_deref(), Some("pipe error")); | |
| 847 | 추가: assert!(!model.confirmed); | |
| 848 | 추가: } |
| @@ -1,23 +1,22 @@ | ||
| 1 | 1 | { |
| 2 | 2 | "command": "python3 tests/ci/run_rust.py local", |
| 3 | 3 | "platform": "linux-desktop-2", |
| 4 | 삭제: "base_remote_main": "4160fcc4e80070b6ab9ea50c78705c0458b2384a", | |
| 5 | 삭제: "local_baseline_head": "b8811fa1bcb169c1ec8e5b14dbe6a46c510da0d1", | |
| 6 | 삭제: "source_state": "최신 PR69와 기존 SevenZip 앱 변환 및 암호 의존성 lockfile을 통합한 커밋에서 전체 검증함. 검증 후 이 증거 JSON만 갱신함.", | |
| 4 | 추가: "base_remote_main": "e497fac4309018a2824b2f296a366a648f4429bf", | |
| 5 | 추가: "local_baseline_head": "a1f6e48dfbff07d853a590a610d8673e72075661", | |
| 6 | 추가: "source_state": "승인된 암호창과 main의 7z 구현을 동작 변경 없이 병합한 커밋에서 전체 검증함. 검증 후 이 증거 JSON만 갱신함.", | |
| 7 | 7 | "linux_build_crates": 19, |
| 8 | 8 | "linux_test_targets": 19, |
| 9 | 삭제: "rust_tests_passed": 895, | |
| 10 | 삭제: "new_archive_ui_tests_passed": 22, | |
| 9 | 추가: "rust_tests_passed": 906, | |
| 10 | 추가: "new_archive_ui_tests_passed": 23, | |
| 11 | 11 | "windows_cross_build_crates": 19, |
| 12 | 12 | "windows_runtime_tested": false, |
| 13 | 13 | "native_visual_check": "Headless egui Context used actual widget pointer/key events and the real OS worker process on Linux. Native OS window/input automation and Windows execution were not performed.", |
| 14 | 삭제: "prior_failures": "최초 실행은 공유 캐시의 기존 7z 미지원 작업자로 화면 시험 1개가 실패함. 추출 소스의 타임스탬프를 갱신하여 다시 빌드한 뒤 LZMA/LZMA2 화면 시험과 전체 실행이 통과함.", | |
| 14 | 추가: "prior_failures": "Retained locally: first build drop API/legacy harness references; second and third egui renderer harness texture/first-frame setup; final runner passed.", | |
| 15 | 15 | "limitations": [ |
| 16 | 삭제: "Normal ZIP/TAR.GZ/7z listing and extraction plus ZIP creation/reopen/extraction use the actual worker executable and OS pipes.", | |
| 17 | 삭제: "Four successful screen tests run headless egui widgets, including LZMA/LZMA2 7z fixtures, not native OS GUI automation.", | |
| 18 | 삭제: "Malformed, wrong-action, early-exit and disposal fault cases use a separate test-only probe; serialization failure and late cancellation use the actual worker.", | |
| 19 | 삭제: "No Windows runtime, encryption ZIP, large-file performance, OS sandbox or exhaustive malicious-input validation in this frontend integration.", | |
| 20 | 삭제: "Manual path text is UTF-8; native archive CLI/drop paths retain PathBuf and NativePath." | |
| 16 | 추가: "Headless egui widgets with actual Linux child processes and OS pipes; no native OS window/input automation or Windows runtime.", | |
| 17 | 추가: "Passwords are public synthetic fixture data. The tests verify masking and lifecycle cleanup, not an exhaustive process-memory audit.", | |
| 18 | 추가: "No backend cryptography, wire contract, installer or 7z changes in this branch.", | |
| 19 | 추가: "The UI and probe lockfiles include the existing PR67 crypto dependencies. Existing package versions remain unchanged." | |
| 21 | 20 | ], |
| 22 | 21 | "tested_files": [ |
| 23 | 22 | { |
| @@ -34,11 +33,11 @@ | ||
| 34 | 33 | }, |
| 35 | 34 | { |
| 36 | 35 | "path": "experiments/rust-ui-memory-app/src/archive_screen.rs", |
| 37 | 삭제: "sha256": "04b7a55c7405d89467fc821db27e0714fb0aa00612e614835b5fee901e5ca940" | |
| 36 | 추가: "sha256": "3f8858d5fb18f329b6e3a1753a45e909f1caf973f1019402e93d97077b1d96fd" | |
| 38 | 37 | }, |
| 39 | 38 | { |
| 40 | 39 | "path": "experiments/rust-ui-memory-app/src/archive_ui.rs", |
| 41 | 삭제: "sha256": "f26557645cea07350843c7e88225e07bb4316ab673dc2581b036567f01d66d6e" | |
| 40 | 추가: "sha256": "438beb387c57c6b0da206066f76a1d7349dae95eb9f33be006338af7cf1ac2ef" | |
| 42 | 41 | }, |
| 43 | 42 | { |
| 44 | 43 | "path": "experiments/rust-ui-memory-app/src/desktop.rs", |
| @@ -62,7 +61,7 @@ | ||
| 62 | 61 | }, |
| 63 | 62 | { |
| 64 | 63 | "path": "tests/rust-app-real-worker/README.md", |
| 65 | 삭제: "sha256": "7253cd2a765dc594e3a27970fd3811eb50645d1179c2728b57eee2d440b3e367" | |
| 64 | 추가: "sha256": "9924a1dbb6b687c3c08ec9785835ae73628867bbfa5deec8db0f8504f8de859a" | |
| 66 | 65 | }, |
| 67 | 66 | { |
| 68 | 67 | "path": "tests/rust-app-real-worker/fixtures/sample.tar.gz", |
| @@ -74,7 +73,7 @@ | ||
| 74 | 73 | }, |
| 75 | 74 | { |
| 76 | 75 | "path": "tests/rust-app-real-worker/flows.rs", |
| 77 | 삭제: "sha256": "23501dfcfcefa5404d1587d5295915a227a18ba53ccbdf56eaa35b101011d115" | |
| 76 | 추가: "sha256": "bda6f27f50b8a332444de63463f3194b3ee75a2a897a495cc384d55e40f7279f" | |
| 78 | 77 | }, |
| 79 | 78 | { |
| 80 | 79 | "path": "tests/rust-app-real-worker/generate.py", |
| @@ -98,7 +97,11 @@ | ||
| 98 | 97 | }, |
| 99 | 98 | { |
| 100 | 99 | "path": "tests/rust-app-ui/regressions.rs", |
| 101 | 삭제: "sha256": "a4c3685a380cb73fd506a290270b2a5308529ef4f843c203127c2bc9a2df2a80" | |
| 100 | 추가: "sha256": "9ddea054018426523bbbd8d913141244455aef32a40553ef5f76a42e3d0854c6" | |
| 101 | 추가: }, | |
| 102 | 추가: { | |
| 103 | 추가: "path": "tests/rust-app-real-worker/password_flows.rs", | |
| 104 | 추가: "sha256": "2617f66bc85a889aab1d2c98466b67e949628f830d47a578db2635474ccb7898" | |
| 102 | 105 | }, |
| 103 | 106 | { |
| 104 | 107 | "path": "tests/rust-app-real-worker/formats.rs", |
| @@ -113,17 +116,22 @@ | ||
| 113 | 116 | "오류 후 명시적 정리는 child wait 전에 닫기를 허용하지 않음", |
| 114 | 117 | "정상 정리 신호는 EOF를 대신하지 않음", |
| 115 | 118 | "정상 종료 뒤 채널 닫힘과 늦은 취소가 최종 결과를 오류로 바꾸지 않음", |
| 116 | 삭제: "child 회수 전 늦은 취소의 실제 작업자 경합 100회와 Terminal 없는 종료의 실패 유지" | |
| 119 | 추가: "child 회수 전 늦은 취소의 실제 작업자 경합 100회와 Terminal 없는 종료의 실패 유지", | |
| 120 | 추가: "빈 암호 입력 뒤 취소와 정상 종료 확인", | |
| 121 | 추가: "UTF-8 1024바이트 초과 입력 뒤 취소와 출력 없음", | |
| 122 | 추가: "입력 오류 뒤 창 닫기 시 child 회수 후 종료 허용", | |
| 123 | 추가: "입력 오류와 암호 재입력이 기존 통신 오류를 지우지 않음" | |
| 117 | 124 | ], |
| 118 | 삭제: "before_review_fix": "Earlier PR62 fixes reproduced 3 failures before repair. Integration tests additionally reproduced normal channel shutdown and late-cancel races before repair. PR68 review race reproduced with the new test before repair; all 100 iterations passed after repair.", | |
| 125 | 추가: "before_review_fix": "Earlier PR62 fixes reproduced 3 failures before repair. Integration tests additionally reproduced normal channel shutdown and late-cancel races before repair. PR68 review race reproduced with the new test before repair; all 100 iterations passed after repair. PR72 수정 전 동일 화면 회귀 시험의 빈 암호 뒤 취소, 초과 길이 뒤 취소, 오류 뒤 창 닫기 3개가 confirmed assertion에서 실패했고 수정 뒤 통과함.", | |
| 119 | 126 | "approved_ui_head": "423a7c80c9d7182e07d29adee03a97d09a19b11f", |
| 120 | 삭제: "tested_local_head": "496415fbd6fa6bc359f85775a88ed56cd71fa2e5", | |
| 121 | 삭제: "real_worker_tests_passed": 11, | |
| 127 | 추가: "tested_local_head": "dfb1e3848fae714d3716f14000f3a4ae434f98d3", | |
| 128 | 추가: "real_worker_tests_passed": 21, | |
| 122 | 129 | "runner_tests_passed": 23, |
| 130 | 추가: "password_screen_tests_passed": 10, | |
| 131 | 추가: "password_flow": "Actual widget input and real worker validated ZipCrypto, AES-256 AE-1/AE-2 Store/Deflate extraction, retry, three failures, cancel, UTF-8 byte limits and cold-start AES ZIP creation/reopen/extraction.", | |
| 123 | 132 | "format_contract_tests_passed": 2, |
| 124 | 삭제: "prerequisite_heads": { | |
| 125 | 삭제: "PR69": "8614f8431a6d7f1967822c233a812d383e574000" | |
| 126 | 삭제: }, | |
| 127 | 삭제: "format_extension": "Existing tags 0..3 unchanged; SevenZip=4. Full ListEnd golden frame, both platform identities and Extract codec roundtrip verified.", | |
| 128 | 삭제: "lockfile_update": "PR71 159d51a의 앱 및 probe 암호 의존성 고정과 동일함. 기존 패키지 버전을 변경하지 않음." | |
| 133 | 추가: "merge_heads": { | |
| 134 | 추가: "password_pr72": "ff86e6ddb7100781c4d3dc0dd388d10e86d2025c", | |
| 135 | 추가: "main": "e497fac4309018a2824b2f296a366a648f4429bf" | |
| 136 | 추가: } | |
| 129 | 137 | } |