team-ljyzipelo

공개

압축 형식별 출력명과 전송 실패 종료 대기를 수정함

작성자
호시노 히나타
작성 시각
커밋
423a7c80c9d7182e07d29adee03a97d09a19b11f
부모
7e2d752
이 시점의 파일 보기

변경된 파일 6개

+309-29
수정experiments/rust-ui-memory-app/src/archive_screen.rs+5-1
@@ -175,7 +175,11 @@ impl ArchiveApp {
175175 self.model.extract(
176176 PathBuf::from(&self.destination),
177177 self.selected_only,
178삭제: Some(self.gzip_name.clone()),
178추가: self.model
179추가: .list_id
180추가: .as_ref()
181추가: .filter(|id| id.format == Format::Gzip)
182추가: .map(|_| self.gzip_name.clone()),
179183 self.factory.as_mut(),
180184 );
181185 }
수정experiments/rust-ui-memory-app/src/archive_ui.rs+21-14
@@ -212,6 +212,7 @@ pub enum HostEvent {
212212 },
213213}
214214// 바이트 codec과 프로세스 소유는 작업자 어댑터에서 담당함.
215추가: // 전송 실패 후에도 poll로 양쪽 EOF와 자식 회수 결과를 전달함.
215216pub trait Connection {
216217 fn send(&mut self, request: Request) -> Result<(), String>;
217218 fn poll(&mut self) -> Option<HostEvent>;
@@ -230,6 +231,7 @@ struct Running {
230231 outgoing: u64,
231232 incoming: u64,
232233 accepted: bool,
234추가: start_failed: bool,
233235 start: Start,
234236 connection: Box<dyn Connection>,
235237 entries: Vec<Entry>,
@@ -296,8 +298,10 @@ impl Model {
296298 && destination.is_absolute()
297299 && self.archive.as_ref() == Some(archive)
298300 && self.list_id.as_ref() == Some(list_id)
299삭제: && (list_id.format != Format::Gzip
300삭제: || gzip_output_name.as_ref().is_some_and(|s| valid_leaf(s)))
301추가: && match list_id.format {
302추가: Format::Gzip => gzip_output_name.as_ref().is_some_and(|s| valid_leaf(s)),
303추가: _ => gzip_output_name.is_none(),
304추가: }
301305 && match selection {
302306 Selection::All => true,
303307 Selection::EntryIds(ids) => {
@@ -341,15 +345,17 @@ impl Model {
341345 return false;
342346 }
343347 };
344삭제: if let Err(e) = connection.send(Request {
345삭제: job_id: id,
346삭제: sequence: 0,
347삭제: command: Command::Start(start.clone()),
348삭제: }) {
349삭제: self.error = Some(e);
350삭제: return false;
351삭제: }
352삭제: if let Start::List { archive } = &start {
348추가: let send_error = connection
349추가: .send(Request {
350추가: job_id: id,
351추가: sequence: 0,
352추가: command: Command::Start(start.clone()),
353추가: })
354추가: .err();
355추가: let started = send_error.is_none();
356추가: if let Start::List { archive } = &start
357추가: && started
358추가: {
353359 self.archive = Some(archive.clone());
354360 self.list_id = None;
355361 self.entries.clear();
@@ -361,13 +367,14 @@ impl Model {
361367 self.progress = None;
362368 self.outputs.clear();
363369 self.cancel = None;
364삭제: self.error = None;
370추가: self.error = send_error;
365371 self.confirmed = false;
366372 self.running = Some(Running {
367373 id,
368374 outgoing: 1,
369375 incoming: 0,
370376 accepted: false,
377추가: start_failed: !started,
371378 start,
372379 connection,
373380 entries: Vec::new(),
@@ -377,7 +384,7 @@ impl Model {
377384 exit: None,
378385 cancel_sequence: None,
379386 });
380삭제: true
387추가: started
381388 }
382389 pub fn extract(
383390 &mut self,
@@ -431,7 +438,7 @@ impl Model {
431438 }
432439 fn send(&mut self, command: Command) -> Option<u64> {
433440 let run = self.running.as_mut()?;
434삭제: if self.terminal.is_some() || run.exit.is_some() {
441추가: if run.start_failed || self.terminal.is_some() || run.exit.is_some() {
435442 return None;
436443 }
437444 let seq = run.outgoing;
수정tests/rust-app-ui/README.md+2-0
@@ -15,3 +15,5 @@ cargo +1.99.1 run --locked --manifest-path experiments/rust-ui-memory-app/Cargo.
1515범위는 목록 확인, 선택 해제, GZ 출력명, ZIP 생성, 암호 요청, 진행률, 취소와 닫기 철회, Terminal/EOF/child wait 분리, 오래된 ID/sequence 거부, SourceChanged 재열람, 부분 출력과 불확실 게시 보존임. 구성한 이벤트 시험은 실제 OS 종료나 파일 보안 검증의 증거가 아님.
1616
1717디자인은 흰 바탕 #FFFFFF, 글자 #182739, 선택 #D3E6F6, 강조 #174C7C를 사용함. 기존 한글 시스템 폰트와 본문/버튼 18px, 제목 26px를 유지함. 상단 작업 버튼, 가운데 파일 목록, 하단 진행/결과의 왼쪽 정렬 구조이며 작은 부가 설명, 장식 카드와 새 아이콘을 추가하지 않음.
18추가:
19추가: 풀기 버튼은 raw GZ에만 출력명을 보내며 ZIP/TAR/TAR.GZ에는 None을 보냄. 모델과 가짜 작업자도 이 계약을 검증함. Start 전송 실패 시에는 연결을 보존하고 추가 요청을 막으며, 양쪽 EOF와 child wait가 모두 올 때까지 교체와 닫기를 허용하지 않음. 이때 Terminal이 없어도 종료 후 오류 확인 화면으로 이동하며 성공으로 표시하지 않음.
수정tests/rust-app-ui/fake.rs+32-5
@@ -10,6 +10,9 @@ pub struct State {
1010 sequence: u64,
1111 pub queue: VecDeque<HostEvent>,
1212 pub manual: bool,
13추가: pub list_format: Option<Format>,
14추가: pub fail_start: bool,
15추가: pub dropped_connections: usize,
1316 pause: bool,
1417}
1518#[derive(Default, Clone)]
@@ -62,11 +65,13 @@ impl State {
6265 packed: Some(54),
6366 encrypted: false,
6467 }));
65삭제: let format = if archive.extension().is_some_and(|x| x == "gz") {
66삭제: Format::Gzip
67삭제: } else {
68삭제: Format::Zip
69삭제: };
68추가: let format = self.list_format.unwrap_or_else(|| {
69추가: if archive.extension().is_some_and(|x| x == "gz") {
70추가: Format::Gzip
71추가: } else {
72추가: Format::Zip
73추가: }
74추가: });
7075 self.frame(Event::ListEnd {
7176 entry_count: 1,
7277 list_id: ListId {
@@ -102,6 +107,11 @@ impl State {
102107struct FakeConnection {
103108 state: Rc<RefCell<State>>,
104109}
110추가: impl Drop for FakeConnection {
111추가: fn drop(&mut self) {
112추가: self.state.borrow_mut().dropped_connections += 1;
113추가: }
114추가: }
105115impl Factory for FakeFactory {
106116 fn connect(&mut self, job: u64) -> Result<Box<dyn Connection>, String> {
107117 let mut s = self.state.borrow_mut();
@@ -120,8 +130,25 @@ impl Connection for FakeConnection {
120130 assert_eq!(s.job, request.job_id);
121131 match request.command {
122132 Command::Start(start) => {
133추가: if let Start::Extract {
134추가: list_id,
135추가: gzip_output_name,
136추가: ..
137추가: } = &start
138추가: {
139추가: let valid = match list_id.format {
140추가: Format::Gzip => gzip_output_name.as_deref().is_some_and(valid_leaf),
141추가: _ => gzip_output_name.is_none(),
142추가: };
143추가: if !valid {
144추가: return Err("형식에 맞지 않는 GZIP 출력명".into());
145추가: }
146추가: }
123147 s.requests.push((request.sequence, "start"));
124148 s.starts.push(start.clone());
149추가: if s.fail_start {
150추가: return Err("Start 전송 실패".into());
151추가: }
125152 if !s.manual {
126153 s.frame(Event::Accepted { encryption: false });
127154 s.frame(Event::Progress {
수정tests/rust-app-ui/regressions.rs+233-0
@@ -493,3 +493,236 @@ fn dropped_native_file_opens_without_ui_reading_contents() {
493493 pump(&mut app.model);
494494 assert!(app.model.can_extract());
495495}
496추가:
497추가: #[test]
498추가: fn failed_start_retains_connection_until_both_eofs_and_child_wait() {
499추가: for missing in 0..3 {
500추가: let mut factory = FakeFactory::manual();
501추가: factory.state.borrow_mut().fail_start = true;
502추가: let mut model = Model::default();
503추가: assert!(!model.begin(
504추가: Start::List {
505추가: archive: path("failed.zip")
506추가: },
507추가: &mut factory
508추가: ));
509추가: assert!(model.busy());
510추가: assert_eq!(factory.state.borrow().dropped_connections, 0);
511추가: assert_eq!(model.job_id(), Some(1));
512추가: model.request_close();
513추가: model.confirm_close();
514추가: assert_eq!(model.close, Close::Waiting);
515추가: assert_eq!(factory.state.borrow().requests, vec![(0, "start")]);
516추가: let event = |index| match index {
517추가: 0 => HostEvent::StdoutEof,
518추가: 1 => HostEvent::StderrEof,
519추가: _ => HostEvent::Exited { success: false },
520추가: };
521추가: for index in 0..3 {
522추가: if index != missing {
523추가: factory.state.borrow_mut().queue.push_back(event(index));
524추가: }
525추가: }
526추가: for _ in 0..20 {
527추가: model.poll();
528추가: }
529추가: assert!(model.busy());
530추가: assert!(!model.can_extract());
531추가: assert_eq!(factory.state.borrow().dropped_connections, 0);
532추가: model.acknowledge_close();
533추가: assert_eq!(model.close, Close::Waiting);
534추가: assert!(!model.begin(
535추가: Start::List {
536추가: archive: path("replacement.zip")
537추가: },
538추가: &mut factory
539추가: ));
540추가: factory.state.borrow_mut().queue.push_back(event(missing));
541추가: pump(&mut model);
542추가: assert!(!model.confirmed);
543추가: assert!(model.terminal.is_none());
544추가: assert_eq!(model.error.as_deref(), Some("Start 전송 실패"));
545추가: assert_eq!(factory.state.borrow().dropped_connections, 1);
546추가: assert_eq!(model.close, Close::Review);
547추가: if missing == 0 {
548추가: model.acknowledge_close();
549추가: assert_eq!(model.close, Close::Allowed);
550추가: } else {
551추가: model.keep_open();
552추가: factory.state.borrow_mut().fail_start = false;
553추가: assert!(model.begin(
554추가: Start::List {
555추가: archive: path("replacement.zip")
556추가: },
557추가: &mut factory
558추가: ));
559추가: assert_eq!(model.job_id(), Some(2));
560추가: }
561추가: }
562추가: }
563추가:
564추가: #[test]
565추가: fn non_gzip_formats_reject_a_gzip_output_name_before_connect() {
566추가: for format in [Format::Zip, Format::Tar, Format::TarGzip] {
567추가: let mut factory = FakeFactory::default();
568추가: factory.state.borrow_mut().list_format = Some(format);
569추가: let mut model = Model::default();
570추가: list(&mut model, &mut factory);
571추가: let count = factory.state.borrow().starts.len();
572추가: assert!(!model.extract(path("out"), false, Some("stale.txt".into()), &mut factory));
573추가: assert!(!model.busy());
574추가: assert_eq!(factory.state.borrow().starts.len(), count);
575추가: assert!(model.extract(path("out"), false, None, &mut factory));
576추가: pump(&mut model);
577추가: }
578추가: }
579추가:
580추가: #[cfg(feature = "ui")]
581추가: #[test]
582추가: fn extract_button_sends_gzip_name_only_for_raw_gzip() {
583추가: use eframe::egui::{self, epaint::Shape};
584추가: use zipelo_ui_memory_app::archive_screen::ArchiveApp;
585추가: for format in [Format::Zip, Format::Tar, Format::TarGzip, Format::Gzip] {
586추가: let ctx = egui::Context::default();
587추가: let factory = FakeFactory::default();
588추가: factory.state.borrow_mut().list_format = Some(format);
589추가: let mut app = ArchiveApp::new(Box::new(factory.clone()), Some(path("input.archive")), true);
590추가: pump(&mut app.model);
591추가: let render = |app: &mut ArchiveApp, events| {
592추가: fn walk(shape: &Shape, output: &mut Vec<(String, egui::Pos2)>) {
593추가: match shape {
594추가: Shape::Text(text) => output.push((
595추가: text.galley.job.text.clone(),
596추가: text.pos + text.galley.rect.size() / 2.0,
597추가: )),
598추가: Shape::Vec(shapes) => {
599추가: for shape in shapes {
600추가: walk(shape, output);
601추가: }
602추가: }
603추가: _ => {}
604추가: }
605추가: }
606추가: let mut frame = ctx.run_ui(
607추가: egui::RawInput {
608추가: screen_rect: Some(egui::Rect::from_min_size(
609추가: egui::Pos2::ZERO,
610추가: egui::vec2(1060.0, 720.0),
611추가: )),
612추가: events,
613추가: ..Default::default()
614추가: },
615추가: |ui| app.show(ui),
616추가: );
617추가: frame.textures_delta.clear();
618추가: let mut output = Vec::new();
619추가: for shape in frame.shapes {
620추가: walk(&shape.shape, &mut output);
621추가: }
622추가: output
623추가: };
624추가: let click = |app: &mut ArchiveApp, point| {
625추가: render(
626추가: app,
627추가: vec![
628추가: egui::Event::PointerMoved(point),
629추가: egui::Event::PointerButton {
630추가: pos: point,
631추가: button: egui::PointerButton::Primary,
632추가: pressed: true,
633추가: modifiers: Default::default(),
634추가: },
635추가: ],
636추가: );
637추가: render(
638추가: app,
639추가: vec![egui::Event::PointerButton {
640추가: pos: point,
641추가: button: egui::PointerButton::Primary,
642추가: pressed: false,
643추가: modifiers: Default::default(),
644추가: }],
645추가: );
646추가: };
647추가: render(&mut app, vec![]);
648추가: let texts = render(&mut app, vec![]);
649추가: let folder = texts
650추가: .iter()
651추가: .find(|(text, _)| text == "출력 폴더")
652추가: .unwrap()
653추가: .1;
654추가: click(&mut app, folder + egui::vec2(100.0, 0.0));
655추가: render(
656추가: &mut app,
657추가: vec![egui::Event::Text(
658추가: path("button-output").to_string_lossy().into_owned(),
659추가: )],
660추가: );
661추가: if format == Format::Gzip {
662추가: let texts = render(&mut app, vec![]);
663추가: let name = texts
664추가: .iter()
665추가: .find(|(text, _)| text == "출력 파일명")
666추가: .unwrap()
667추가: .1;
668추가: click(&mut app, name + egui::vec2(100.0, 0.0));
669추가: render(&mut app, vec![egui::Event::Text("plain.txt".into())]);
670추가: }
671추가: let texts = render(&mut app, vec![]);
672추가: let button = texts.iter().find(|(text, _)| text == "풀기").unwrap().1;
673추가: click(&mut app, button);
674추가: let state = factory.state.borrow();
675추가: assert_eq!(
676추가: state.starts.len(),
677추가: 2,
678추가: "풀기 버튼의 Start 요청 누락: {format:?}"
679추가: );
680추가: match state.starts.last().unwrap() {
681추가: Start::Extract {
682추가: gzip_output_name, ..
683추가: } => assert_eq!(
684추가: gzip_output_name,
685추가: &if format == Format::Gzip {
686추가: Some("plain.txt".into())
687추가: } else {
688추가: None
689추가: }
690추가: ),
691추가: _ => panic!("Extract 요청 누락"),
692추가: }
693추가: }
694추가: }
695추가:
696추가: #[test]
697추가: fn fake_worker_rejects_invalid_format_specific_output_names() {
698추가: for (format, name) in [
699추가: (Format::Zip, Some("stale.txt".into())),
700추가: (Format::Tar, Some(String::new())),
701추가: (Format::TarGzip, Some("stale.txt".into())),
702추가: (Format::Gzip, None),
703추가: (Format::Gzip, Some("../escape".into())),
704추가: ] {
705추가: let mut factory = FakeFactory::default();
706추가: factory.state.borrow_mut().list_format = Some(format);
707추가: let mut model = Model::default();
708추가: list(&mut model, &mut factory);
709추가: let mut connection = factory.connect(2).unwrap();
710추가: let previous = factory.state.borrow().starts.len();
711추가: assert!(
712추가: connection
713추가: .send(Request {
714추가: job_id: 2,
715추가: sequence: 0,
716추가: command: Command::Start(Start::Extract {
717추가: archive: model.archive.clone().unwrap(),
718추가: destination: path("output"),
719추가: selection: Selection::All,
720추가: list_id: model.list_id.clone().unwrap(),
721추가: gzip_output_name: name,
722추가: }),
723추가: })
724추가: .is_err()
725추가: );
726추가: assert_eq!(factory.state.borrow().starts.len(), previous);
727추가: }
728추가: }
수정tests/rust-app-ui/validation.json+16-9
@@ -3,11 +3,11 @@
33 "platform": "linux-desktop-2",
44 "base_remote_main": "486fe9ae64a73f999cc5122c2eb9bbeb62fb2fb3",
55 "local_baseline_head": "6ea0b8b3b7444c35bb0845b58bf5638ac58f5e58",
6삭제: "source_state": "Run on edited working tree over local baseline whose tree equals remote main; file hashes below identify tested source, not a claim that local baseline head contains changes.",
6추가: "source_state": "Committed frontend review fixes over the existing local baseline whose tree equals remote main. Tested file hashes identify the reviewed implementation.",
77 "linux_build_crates": 17,
88 "linux_test_targets": 17,
9삭제: "rust_tests_passed": 823,
10삭제: "new_archive_ui_tests_passed": 16,
9추가: "rust_tests_passed": 827,
10추가: "new_archive_ui_tests_passed": 20,
1111 "windows_cross_build_crates": 17,
1212 "windows_runtime_tested": false,
1313 "native_visual_check": "Owned Xvfb screen displayed Korean synthetic file list; initial capture missed Xvfb because inherited Wayland selected host backend; corrected capture removes Wayland only in owned process environment. Not complete native interaction coverage.",
@@ -33,19 +33,19 @@
3333 },
3434 {
3535 "path": "experiments/rust-ui-memory-app/src/archive_ui.rs",
36삭제: "sha256": "19b1c36a4cc34139d1e854d249bfecf6da90891d91617f3565e21b88b4f1d2a1"
36추가: "sha256": "f06fd50c557e178cb5cb98cb39e3ba5e04088a774f60ec92774bc37ed3323b87"
3737 },
3838 {
3939 "path": "experiments/rust-ui-memory-app/src/archive_screen.rs",
40삭제: "sha256": "63362b49b5cd51ecaf9c50f10a8f45e60192e6a55cc45eacd81ad04915335de7"
40추가: "sha256": "04b7a55c7405d89467fc821db27e0714fb0aa00612e614835b5fee901e5ca940"
4141 },
4242 {
4343 "path": "tests/rust-app-ui/regressions.rs",
44삭제: "sha256": "f9f8d0179ee0a3218d6d8168b1ad07c4b4ec3ca42923d8a434bd2e6bcdf8ff46"
44추가: "sha256": "461e9a36bc5b742bf523fe0f1bfb7900c1b97a884e3e8f6040f85fe474efdf4e"
4545 },
4646 {
4747 "path": "tests/rust-app-ui/fake.rs",
48삭제: "sha256": "be59b676d71786915f6bf399009233ba052ddfea3139bff39ec5965f38ce9a89"
48추가: "sha256": "f0d7fc88a1399f12f95aa045c2c55e3ff2d8057625a6d615d88f9bee10a36b51"
4949 },
5050 {
5151 "path": "tests/rust-app-ui/native_smoke.py",
@@ -53,7 +53,14 @@
5353 },
5454 {
5555 "path": "tests/rust-app-ui/README.md",
56삭제: "sha256": "bc78864dbbe50e99f3fbfa2ace1479fe1988b313884fe064f05114a8f73a2009"
56추가: "sha256": "942e108820d43ba9a70ba013cd7f1683d8bb90699315bda179ca95c4a15a736e"
5757 }
58삭제: ]
58추가: ],
59추가: "review_regressions": [
60추가: "실제 풀기 버튼의 ZIP/TAR/TAR.GZ/GZIP 출력명 계약",
61추가: "비 GZIP 출력명 요청의 연결 전 거부",
62추가: "가짜 작업자의 형식별 출력명 검증",
63추가: "Start 전송 실패 시 양쪽 EOF/child wait까지 연결 보존과 닫기/교체 차단"
64추가: ],
65추가: "before_review_fix": "Targeted regressions reproduced 3 failures with 16 existing tests passing before the product fix; final targeted suite passed 20 tests."
5966}