입력 검증 오류와 통신 오류를 분리해 암호 취소 종료 확인 복구
- 작성자
- 호시노 히나타
- 작성 시각
- 커밋
ff86e6ddb7100781c4d3dc0dd388d10e86d2025c- 부모
- da21a84
변경된 파일 5개
+131-19| @@ -66,7 +66,7 @@ impl ArchiveApp { | ||
| 66 | 66 | .join("\n"); |
| 67 | 67 | self.create = true; |
| 68 | 68 | } else { |
| 69 | 삭제: self.model.error = Some("ZIP 생성 경로는 현재 UTF-8 입력만 지원합니다".into()); | |
| 69 | 추가: self.model.input_error = Some("ZIP 생성 경로는 현재 UTF-8 입력만 지원합니다".into()); | |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
| @@ -269,6 +269,7 @@ pub struct Model { | ||
| 269 | 269 | pub outputs: Vec<(String, Disposition)>, |
| 270 | 270 | pub cancel: Option<CancelStatus>, |
| 271 | 271 | pub error: Option<String>, |
| 272 | 추가: pub input_error: Option<String>, | |
| 272 | 273 | pub encryption: bool, |
| 273 | 274 | pub close: Close, |
| 274 | 275 | pub confirmed: bool, |
| @@ -334,7 +335,7 @@ impl Model { | ||
| 334 | 335 | } |
| 335 | 336 | }; |
| 336 | 337 | if !validation { |
| 337 | 삭제: self.error = Some("입력 경로, 출력명과 선택한 목록을 확인하세요".into()); | |
| 338 | 추가: self.input_error = Some("입력 경로, 출력명과 선택한 목록을 확인하세요".into()); | |
| 338 | 339 | return false; |
| 339 | 340 | } |
| 340 | 341 | let Some(id) = self.next_id.checked_add(1) else { |
| @@ -370,6 +371,7 @@ impl Model { | ||
| 370 | 371 | self.progress = None; |
| 371 | 372 | self.outputs.clear(); |
| 372 | 373 | self.cancel = None; |
| 374 | 추가: self.input_error = None; | |
| 373 | 375 | self.error = send_error; |
| 374 | 376 | self.confirmed = false; |
| 375 | 377 | self.running = Some(Running { |
| @@ -422,7 +424,7 @@ impl Model { | ||
| 422 | 424 | let secret = match Secret::new(text) { |
| 423 | 425 | Ok(s) => s, |
| 424 | 426 | Err(e) => { |
| 425 | 삭제: self.error = Some(e.into()); | |
| 427 | 추가: self.input_error = Some(e.into()); | |
| 426 | 428 | return false; |
| 427 | 429 | } |
| 428 | 430 | }; |
| @@ -434,7 +436,7 @@ impl Model { | ||
| 434 | 436 | .is_some() |
| 435 | 437 | { |
| 436 | 438 | self.challenge = None; |
| 437 | 삭제: self.error = None; | |
| 439 | 추가: self.input_error = None; | |
| 438 | 440 | true |
| 439 | 441 | } else { |
| 440 | 442 | false |
| @@ -474,6 +476,7 @@ impl Model { | ||
| 474 | 476 | if let Some(seq) = self.send(Command::Cancel) { |
| 475 | 477 | self.running.as_mut().unwrap().cancel_sequence = Some(seq); |
| 476 | 478 | self.challenge = None; |
| 479 | 추가: self.input_error = None; | |
| 477 | 480 | } |
| 478 | 481 | } |
| 479 | 482 | } |
| @@ -555,6 +558,7 @@ impl Model { | ||
| 555 | 558 | self.selected.clear(); |
| 556 | 559 | } |
| 557 | 560 | self.challenge = None; |
| 561 | 추가: self.input_error = None; | |
| 558 | 562 | if matches!(self.close, Close::Waiting | Close::Confirm) { |
| 559 | 563 | self.close = Close::Review; |
| 560 | 564 | } |
| @@ -667,7 +671,7 @@ impl Model { | ||
| 667 | 671 | } |
| 668 | 672 | } |
| 669 | 673 | pub fn status(&self) -> String { |
| 670 | 삭제: if let Some(error) = &self.error { | |
| 674 | 추가: if let Some(error) = self.error.as_ref().or(self.input_error.as_ref()) { | |
| 671 | 675 | return error.clone(); |
| 672 | 676 | } |
| 673 | 677 | if self.busy() { |
| @@ -45,7 +45,9 @@ impl Screen { | ||
| 45 | 45 | }, |
| 46 | 46 | egui::Event::Text(text.into()), |
| 47 | 47 | ]); |
| 48 | 삭제: assert!(!rendered.iter().any(|(value, _)| value.contains(text))); | |
| 48 | 추가: if !text.is_empty() { | |
| 49 | 추가: assert!(!rendered.iter().any(|(value, _)| value.contains(text))); | |
| 50 | 추가: } | |
| 49 | 51 | self.click("암호 전달"); |
| 50 | 52 | } |
| 51 | 53 | fn start_password_extract(&mut self, output: &Path) { |
| @@ -135,7 +137,7 @@ fn wrong_password_retry_clears_input_and_succeeds_without_partial_output() { | ||
| 135 | 137 | screen |
| 136 | 138 | .app |
| 137 | 139 | .model |
| 138 | 삭제: .error | |
| 140 | 추가: .input_error | |
| 139 | 141 | .as_ref() |
| 140 | 142 | .unwrap() |
| 141 | 143 | .contains("1~1024바이트") |
| @@ -256,7 +258,7 @@ fn oversized_utf8_password_stays_in_dialog_then_accepts_valid_input() { | ||
| 256 | 258 | screen |
| 257 | 259 | .app |
| 258 | 260 | .model |
| 259 | 삭제: .error | |
| 261 | 추가: .input_error | |
| 260 | 262 | .as_ref() |
| 261 | 263 | .unwrap() |
| 262 | 264 | .contains("1~1024바이트") |
| @@ -266,3 +268,66 @@ fn oversized_utf8_password_stays_in_dialog_then_accepts_valid_input() { | ||
| 266 | 268 | screen.finish_password_job(Outcome::Completed); |
| 267 | 269 | assert_reaped(&observed); |
| 268 | 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 | 추가: } |
| @@ -6,8 +6,8 @@ | ||
| 6 | 6 | "source_state": "Tested committed integration source. Only this evidence JSON was updated after the full runner completed; hashes identify the tested code and fixtures.", |
| 7 | 7 | "linux_build_crates": 19, |
| 8 | 8 | "linux_test_targets": 19, |
| 9 | 삭제: "rust_tests_passed": 889, | |
| 10 | 삭제: "new_archive_ui_tests_passed": 22, | |
| 9 | 추가: "rust_tests_passed": 893, | |
| 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.", |
| @@ -33,11 +33,11 @@ | ||
| 33 | 33 | }, |
| 34 | 34 | { |
| 35 | 35 | "path": "experiments/rust-ui-memory-app/src/archive_screen.rs", |
| 36 | 삭제: "sha256": "5eb6fb41a79cf0997804e2a2d689b2cbf393efa421f5ad82afe900663bd5f45d" | |
| 36 | 추가: "sha256": "3f8858d5fb18f329b6e3a1753a45e909f1caf973f1019402e93d97077b1d96fd" | |
| 37 | 37 | }, |
| 38 | 38 | { |
| 39 | 39 | "path": "experiments/rust-ui-memory-app/src/archive_ui.rs", |
| 40 | 삭제: "sha256": "78bb576ea372739450bef8d135db69b9ba66b16191b377cf4996b97fbe46ae75" | |
| 40 | 추가: "sha256": "ef7d8c6f2b51a899a0240358234de6f81483c2e056a9847cb0b7a553a3dce8f2" | |
| 41 | 41 | }, |
| 42 | 42 | { |
| 43 | 43 | "path": "experiments/rust-ui-memory-app/src/desktop.rs", |
| @@ -97,11 +97,11 @@ | ||
| 97 | 97 | }, |
| 98 | 98 | { |
| 99 | 99 | "path": "tests/rust-app-ui/regressions.rs", |
| 100 | 삭제: "sha256": "a4c3685a380cb73fd506a290270b2a5308529ef4f843c203127c2bc9a2df2a80" | |
| 100 | 추가: "sha256": "9ddea054018426523bbbd8d913141244455aef32a40553ef5f76a42e3d0854c6" | |
| 101 | 101 | }, |
| 102 | 102 | { |
| 103 | 103 | "path": "tests/rust-app-real-worker/password_flows.rs", |
| 104 | 삭제: "sha256": "0faca27cc8952df4026d544c503a166bde4c0676af3716f70a748aa44c7b7ce1" | |
| 104 | 추가: "sha256": "2617f66bc85a889aab1d2c98466b67e949628f830d47a578db2635474ccb7898" | |
| 105 | 105 | } |
| 106 | 106 | ], |
| 107 | 107 | "review_regressions": [ |
| @@ -112,13 +112,17 @@ | ||
| 112 | 112 | "오류 후 명시적 정리는 child wait 전에 닫기를 허용하지 않음", |
| 113 | 113 | "정상 정리 신호는 EOF를 대신하지 않음", |
| 114 | 114 | "정상 종료 뒤 채널 닫힘과 늦은 취소가 최종 결과를 오류로 바꾸지 않음", |
| 115 | 삭제: "child 회수 전 늦은 취소의 실제 작업자 경합 100회와 Terminal 없는 종료의 실패 유지" | |
| 115 | 추가: "child 회수 전 늦은 취소의 실제 작업자 경합 100회와 Terminal 없는 종료의 실패 유지", | |
| 116 | 추가: "빈 암호 입력 뒤 취소와 정상 종료 확인", | |
| 117 | 추가: "UTF-8 1024바이트 초과 입력 뒤 취소와 출력 없음", | |
| 118 | 추가: "입력 오류 뒤 창 닫기 시 child 회수 후 종료 허용", | |
| 119 | 추가: "입력 오류와 암호 재입력이 기존 통신 오류를 지우지 않음" | |
| 116 | 120 | ], |
| 117 | 삭제: "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.", | |
| 121 | 추가: "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에서 실패했고 수정 뒤 통과함.", | |
| 118 | 122 | "approved_ui_head": "423a7c80c9d7182e07d29adee03a97d09a19b11f", |
| 119 | 삭제: "tested_local_head": "7bf3d4107005a36c1e8ed0619b6d09343b27f494", | |
| 120 | 삭제: "real_worker_tests_passed": 17, | |
| 123 | 추가: "tested_local_head": "fd4ad94bb5f0046831037b742f3a25a8735431ae", | |
| 124 | 추가: "real_worker_tests_passed": 20, | |
| 121 | 125 | "runner_tests_passed": 23, |
| 122 | 삭제: "password_screen_tests_passed": 7, | |
| 126 | 추가: "password_screen_tests_passed": 10, | |
| 123 | 127 | "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." |
| 124 | 128 | } |