team-ljyzipelo

공개

입력 검증 오류와 통신 오류를 분리해 암호 취소 종료 확인 복구

작성자
호시노 히나타
작성 시각
커밋
ff86e6ddb7100781c4d3dc0dd388d10e86d2025c
부모
da21a84
이 시점의 파일 보기

변경된 파일 5개

+131-19
수정experiments/rust-ui-memory-app/src/archive_screen.rs+1-1
@@ -66,7 +66,7 @@ impl ArchiveApp {
6666 .join("\n");
6767 self.create = true;
6868 } else {
69삭제: self.model.error = Some("ZIP 생성 경로는 현재 UTF-8 입력만 지원합니다".into());
69추가: self.model.input_error = Some("ZIP 생성 경로는 현재 UTF-8 입력만 지원합니다".into());
7070 }
7171 }
7272}
수정experiments/rust-ui-memory-app/src/archive_ui.rs+8-4
@@ -269,6 +269,7 @@ pub struct Model {
269269 pub outputs: Vec<(String, Disposition)>,
270270 pub cancel: Option<CancelStatus>,
271271 pub error: Option<String>,
272추가: pub input_error: Option<String>,
272273 pub encryption: bool,
273274 pub close: Close,
274275 pub confirmed: bool,
@@ -334,7 +335,7 @@ impl Model {
334335 }
335336 };
336337 if !validation {
337삭제: self.error = Some("입력 경로, 출력명과 선택한 목록을 확인하세요".into());
338추가: self.input_error = Some("입력 경로, 출력명과 선택한 목록을 확인하세요".into());
338339 return false;
339340 }
340341 let Some(id) = self.next_id.checked_add(1) else {
@@ -370,6 +371,7 @@ impl Model {
370371 self.progress = None;
371372 self.outputs.clear();
372373 self.cancel = None;
374추가: self.input_error = None;
373375 self.error = send_error;
374376 self.confirmed = false;
375377 self.running = Some(Running {
@@ -422,7 +424,7 @@ impl Model {
422424 let secret = match Secret::new(text) {
423425 Ok(s) => s,
424426 Err(e) => {
425삭제: self.error = Some(e.into());
427추가: self.input_error = Some(e.into());
426428 return false;
427429 }
428430 };
@@ -434,7 +436,7 @@ impl Model {
434436 .is_some()
435437 {
436438 self.challenge = None;
437삭제: self.error = None;
439추가: self.input_error = None;
438440 true
439441 } else {
440442 false
@@ -474,6 +476,7 @@ impl Model {
474476 if let Some(seq) = self.send(Command::Cancel) {
475477 self.running.as_mut().unwrap().cancel_sequence = Some(seq);
476478 self.challenge = None;
479추가: self.input_error = None;
477480 }
478481 }
479482 }
@@ -555,6 +558,7 @@ impl Model {
555558 self.selected.clear();
556559 }
557560 self.challenge = None;
561추가: self.input_error = None;
558562 if matches!(self.close, Close::Waiting | Close::Confirm) {
559563 self.close = Close::Review;
560564 }
@@ -667,7 +671,7 @@ impl Model {
667671 }
668672 }
669673 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()) {
671675 return error.clone();
672676 }
673677 if self.busy() {
수정tests/rust-app-real-worker/password_flows.rs+68-3
@@ -45,7 +45,9 @@ impl Screen {
4545 },
4646 egui::Event::Text(text.into()),
4747 ]);
48삭제: assert!(!rendered.iter().any(|(value, _)| value.contains(text)));
48추가: if !text.is_empty() {
49추가: assert!(!rendered.iter().any(|(value, _)| value.contains(text)));
50추가: }
4951 self.click("암호 전달");
5052 }
5153 fn start_password_extract(&mut self, output: &Path) {
@@ -135,7 +137,7 @@ fn wrong_password_retry_clears_input_and_succeeds_without_partial_output() {
135137 screen
136138 .app
137139 .model
138삭제: .error
140추가: .input_error
139141 .as_ref()
140142 .unwrap()
141143 .contains("1~1024바이트")
@@ -256,7 +258,7 @@ fn oversized_utf8_password_stays_in_dialog_then_accepts_valid_input() {
256258 screen
257259 .app
258260 .model
259삭제: .error
261추가: .input_error
260262 .as_ref()
261263 .unwrap()
262264 .contains("1~1024바이트")
@@ -266,3 +268,66 @@ fn oversized_utf8_password_stays_in_dialog_then_accepts_valid_input() {
266268 screen.finish_password_job(Outcome::Completed);
267269 assert_reaped(&observed);
268270}
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추가: }
수정tests/rust-app-ui/regressions.rs+39-0
@@ -807,3 +807,42 @@ fn error_cleanup_requires_child_wait_without_fabricating_terminal() {
807807 assert_eq!(model.error.as_deref(), Some("pipe error"));
808808 assert_eq!(model.close, Close::Review);
809809}
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추가: }
수정tests/rust-app-ui/validation.json+15-11
@@ -6,8 +6,8 @@
66 "source_state": "Tested committed integration source. Only this evidence JSON was updated after the full runner completed; hashes identify the tested code and fixtures.",
77 "linux_build_crates": 19,
88 "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,
1111 "windows_cross_build_crates": 19,
1212 "windows_runtime_tested": false,
1313 "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 @@
3333 },
3434 {
3535 "path": "experiments/rust-ui-memory-app/src/archive_screen.rs",
36삭제: "sha256": "5eb6fb41a79cf0997804e2a2d689b2cbf393efa421f5ad82afe900663bd5f45d"
36추가: "sha256": "3f8858d5fb18f329b6e3a1753a45e909f1caf973f1019402e93d97077b1d96fd"
3737 },
3838 {
3939 "path": "experiments/rust-ui-memory-app/src/archive_ui.rs",
40삭제: "sha256": "78bb576ea372739450bef8d135db69b9ba66b16191b377cf4996b97fbe46ae75"
40추가: "sha256": "ef7d8c6f2b51a899a0240358234de6f81483c2e056a9847cb0b7a553a3dce8f2"
4141 },
4242 {
4343 "path": "experiments/rust-ui-memory-app/src/desktop.rs",
@@ -97,11 +97,11 @@
9797 },
9898 {
9999 "path": "tests/rust-app-ui/regressions.rs",
100삭제: "sha256": "a4c3685a380cb73fd506a290270b2a5308529ef4f843c203127c2bc9a2df2a80"
100추가: "sha256": "9ddea054018426523bbbd8d913141244455aef32a40553ef5f76a42e3d0854c6"
101101 },
102102 {
103103 "path": "tests/rust-app-real-worker/password_flows.rs",
104삭제: "sha256": "0faca27cc8952df4026d544c503a166bde4c0676af3716f70a748aa44c7b7ce1"
104추가: "sha256": "2617f66bc85a889aab1d2c98466b67e949628f830d47a578db2635474ccb7898"
105105 }
106106 ],
107107 "review_regressions": [
@@ -112,13 +112,17 @@
112112 "오류 후 명시적 정리는 child wait 전에 닫기를 허용하지 않음",
113113 "정상 정리 신호는 EOF를 대신하지 않음",
114114 "정상 종료 뒤 채널 닫힘과 늦은 취소가 최종 결과를 오류로 바꾸지 않음",
115삭제: "child 회수 전 늦은 취소의 실제 작업자 경합 100회와 Terminal 없는 종료의 실패 유지"
115추가: "child 회수 전 늦은 취소의 실제 작업자 경합 100회와 Terminal 없는 종료의 실패 유지",
116추가: "빈 암호 입력 뒤 취소와 정상 종료 확인",
117추가: "UTF-8 1024바이트 초과 입력 뒤 취소와 출력 없음",
118추가: "입력 오류 뒤 창 닫기 시 child 회수 후 종료 허용",
119추가: "입력 오류와 암호 재입력이 기존 통신 오류를 지우지 않음"
116120 ],
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에서 실패했고 수정 뒤 통과함.",
118122 "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,
121125 "runner_tests_passed": 23,
122삭제: "password_screen_tests_passed": 7,
126추가: "password_screen_tests_passed": 10,
123127 "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."
124128}