team-ljyzipelo

공개

큰 작업 승인 기능에 최신 main 변경을 병합한다

작성자
호시노 히나타
작성 시각
커밋
a4c344de45687a2207ff9fa532659a61b8c89462
이 시점의 파일 보기

변경된 파일 18개

+1,177-36
수정docs/ui-scenario-guide.md+13-0
@@ -96,6 +96,17 @@ python3 tests/ci/run_rust.py local
9696화면에 새 창, 버튼, 메시지, 상태 또는 오류를 추가하거나 바꾸면 같은 PR에서 상황, 시험과 이 가이드를 갱신한다. 화면 변화가 없으면 PR 본문에 "UI 변경 없음"이라고 적는다. 사용자가 직접 올린 UI 변경에서 빠진 상황은 병합 뒤 프론트엔드 담당이 보완한다.
9797
9898
99추가: ## 파일 충돌 선택과 결과
100추가:
101추가: - gzip-conflict-choice: 단일 GZ 파일의 충돌 선택 창. 저장 창에서 고른 이름과 세 선택을 확인한다.
102추가: - conflict-choice: 파일 경로와 기존 크기, 새 크기 및 덮어쓰기, 건너뛰기, 이름 바꿔 저장을 확인합니다. Tab으로 이동하고 Space로 선택할 수 있으며 Escape 또는 작업 취소는 전체 작업을 취소합니다.
103추가: - conflict-apply: "나머지 파일에도 같게 적용"이 켜진 상태입니다. 현재 작업의 남은 일반 파일 충돌에만 적용하며 이름 바꿔 저장은 같은 폴더에 번호를 붙입니다.
104추가: - extract-skipped: 모든 파일을 건너뛴 정상 완료입니다. 생성된 파일이 없으며 저장 실패 경고가 없어야 합니다.
105추가: - extract-renamed: 실제 저장된 새 이름을 표시합니다. 이름 변경 결과만으로 저장 성공을 판정하지 않고 별도의 생성 보고와 완료 집계가 일치해야 합니다.
106추가: - extract-rename-failed: 새 이름을 정한 뒤 실제 생성 보고 없이 I/O 오류가 난 결과입니다. 실패 원인과 "아무 파일도 풀지 않았습니다"를 표시하고 "이름 바꿔 저장" 완료 안내는 표시하지 않아야 합니다. 일부 파일이 저장된 뒤 실패한 경우에도 생성 보고가 있는 이름만 저장 완료로 표시합니다.
107추가:
108추가: 실제 추출은 revision 3의 StartGuarded에 interactive=true를 보내며 ZIP, 7z, TAR 계열과 단일 GZ의 파일 충돌에 같은 선택 창을 사용합니다. 목록 읽기와 ZIP 만들기도 StartGuarded로 자원을 감시하며 충돌 질문은 추출에만 사용합니다. 위 명령은 실제 파일을 쓰지 않는 개발용 화면 미리보기입니다. 파일 기반 버튼 연동은 tests/rust-app-real-worker/conflict_flows.rs에서 확인하며, 운영체제별 실제 창 확인은 별도입니다.
109추가:
99110TAR.BZ2와 TAR.XZ의 자동 해제 폴더 이름은 미리보기에 표시되지 않는다. tests/rust-app-ui/presentation.rs의 이름 시험과 tests/rust-app-real-worker/compressed_tar_flows.rs의 실제 작업자 시험에서 복합 확장자 제거와 해제 결과를 확인한다.
100111
101112## 큰 작업의 승인과 재시도
@@ -123,3 +134,5 @@ Enter만으로 허용하지 않습니다. 기존 작업자로 자동 재시도
123134기본 작업의 출력 기록 한도는 100,000개를 유지합니다. 이 기록 정책 수정은 화면 요소를 바꾸지 않습니다.
124135
125136한도 초과 결과는 별도 운영체제 창 대신 주 창 안의 모달로 표시합니다. Wayland에서도 파일 경로로 실행한 직후 Alt+Tab 없이 결과와 재시도 버튼이 보여야 합니다. "확인"으로 닫으며, 일부 출력이 남은 경우 확대 재시도는 제공하지 않습니다.
137추가:
138추가: 큰 작업을 허용한 뒤 파일 충돌이 발견되면 승인 창을 닫고 충돌 선택 창을 표시합니다. 승인과 충돌 질문은 동시에 표시하지 않으며, 같은 작업의 질문 번호를 이어서 검증합니다.
수정experiments/rust-ui-memory-app/src/archive_present.rs+28-1
@@ -1,6 +1,6 @@
11use crate::archive_ui::*;
22use std::{
3삭제: collections::BTreeSet,
3추가: collections::{BTreeMap, BTreeSet},
44 fs, io,
55 path::{Path, PathBuf},
66};
@@ -133,6 +133,31 @@ pub fn target_files(
133133 Some(names)
134134}
135135
136추가: pub fn resolved_targets(
137추가: targets: Option<&BTreeSet<String>>,
138추가: entries: &[Entry],
139추가: gzip: Option<&str>,
140추가: resolutions: &[Resolution],
141추가: ) -> Option<BTreeSet<String>> {
142추가: let mut names = targets?.clone();
143추가: let entries: BTreeMap<_, _> = entries.iter().map(|entry| (entry.id, entry)).collect();
144추가: for resolution in resolutions {
145추가: let entry = entries.get(&resolution.entry_id)?;
146추가: let original = gzip.unwrap_or(&entry.name).replace('\\', "/");
147추가: if !names.remove(&original) {
148추가: return None;
149추가: }
150추가: }
151추가: for resolution in resolutions {
152추가: if resolution.choice != ConflictChoice::Skip
153추가: && !names.insert(resolution.relative_name.replace('\\', "/"))
154추가: {
155추가: return None;
156추가: }
157추가: }
158추가: Some(names)
159추가: }
160추가:
136161pub fn target_directories(entries: &[Entry], selection: &Selection) -> BTreeSet<String> {
137162 let mut directories = BTreeSet::new();
138163 for entry in entries.iter().filter(|entry| {
@@ -355,6 +380,8 @@ pub fn activity_text(model: &Model, creating: bool) -> &'static str {
355380 "마무리하는 중"
356381 } else if model.cancellation_requested() || model.cancel.is_some() {
357382 "취소하는 중..."
383추가: } else if model.conflict.is_some() {
384추가: "파일 충돌 선택 대기 중"
358385 } else if model.challenge.is_some() {
359386 "암호를 입력하세요"
360387 } else {
수정experiments/rust-ui-memory-app/src/archive_process.rs+57-1
@@ -114,6 +114,22 @@ convert_enum!(
114114 TooLate,
115115 Finished
116116);
117추가: convert_enum!(
118추가: conflict_to_wire,
119추가: ui::ConflictChoice,
120추가: wire::ConflictChoice,
121추가: Overwrite,
122추가: Skip,
123추가: Rename
124추가: );
125추가: convert_enum!(
126추가: conflict_to_ui,
127추가: wire::ConflictChoice,
128추가: ui::ConflictChoice,
129추가: Overwrite,
130추가: Skip,
131추가: Rename
132추가: );
117133fn list_to_wire(id: ui::ListId) -> wire::ListId {
118134 wire::ListId {
119135 catalog_version: id.catalog_version,
@@ -267,6 +283,32 @@ fn event_to_ui(
267283 attempt,
268284 encrypt: purpose == wire::PasswordPurpose::Encrypt,
269285 },
286추가: wire::Message::ConflictRequired {
287추가: challenge_id,
288추가: entry_id,
289추가: relative_name,
290추가: incoming_size,
291추가: existing_size,
292추가: } if expected == Some(wire::ActionKind::Extract) => {
293추가: ui::Event::ConflictRequired(ui::Conflict {
294추가: challenge_id,
295추가: entry_id,
296추가: relative_name,
297추가: incoming_size,
298추가: existing_size,
299추가: })
300추가: }
301추가: wire::Message::ConflictResolved {
302추가: entry_id,
303추가: relative_name,
304추가: choice,
305추가: } if expected == Some(wire::ActionKind::Extract) => {
306추가: ui::Event::ConflictResolved(ui::Resolution {
307추가: entry_id,
308추가: relative_name,
309추가: choice: conflict_to_ui(choice),
310추가: })
311추가: }
270312 wire::Message::Progress {
271313 stage,
272314 processed_bytes,
@@ -494,10 +536,11 @@ impl ui::Connection for ProcessConnection {
494536 } else {
495537 wire::Limits::default()
496538 };
539추가: let interactive = start.action.kind() == wire::ActionKind::Extract;
497540 wire::Message::StartGuarded(wire::GuardedStart {
498541 start,
499542 ceiling,
500삭제: interactive: false,
543추가: interactive,
501544 })
502545 }
503546 ui::Command::ResourceReply {
@@ -509,6 +552,15 @@ impl ui::Connection for ProcessConnection {
509552 scope,
510553 allow,
511554 },
555추가: ui::Command::ConflictReply {
556추가: challenge_id,
557추가: choice,
558추가: apply_to_remaining,
559추가: } => wire::Message::ConflictReply {
560추가: challenge_id,
561추가: choice: conflict_to_wire(choice),
562추가: apply_to_remaining,
563추가: },
512564 ui::Command::Cancel => wire::Message::Cancel,
513565 ui::Command::Password {
514566 challenge_id,
@@ -759,3 +811,7 @@ fn supervise(
759811 );
760812 }
761813}
814추가:
815추가: #[cfg(test)]
816추가: #[path = "../../../tests/rust-app-ui/conflict_codec.rs"]
817추가: mod conflict_codec_tests;
수정experiments/rust-ui-memory-app/src/archive_screen.rs+102-2
@@ -202,6 +202,8 @@ pub struct ArchiveApp {
202202 password_confirm: String,
203203 password_visible: bool,
204204 password_challenge: Option<u64>,
205추가: conflict_challenge: Option<(u64, u64)>,
206추가: conflict_apply: bool,
205207 aes256: bool,
206208 create: bool,
207209 selected_only: bool,
@@ -263,6 +265,8 @@ impl ArchiveApp {
263265 password_confirm: String::new(),
264266 password_visible: false,
265267 password_challenge: None,
268추가: conflict_challenge: None,
269추가: conflict_apply: false,
266270 aes256: false,
267271 create: false,
268272 selected_only: false,
@@ -1014,6 +1018,9 @@ impl ArchiveApp {
10141018 self.password_dialog(&ctx, new_challenge);
10151019 }
10161020 self.resource_dialog(&ctx);
1021추가: if self.model.conflict.is_some() && self.model.close == Close::Open {
1022추가: self.conflict_dialog(&ctx);
1023추가: }
10171024 self.close_dialog(&ctx);
10181025 self.picker_notice(&ctx);
10191026 if self.custom_frame {
@@ -1616,6 +1623,7 @@ impl ArchiveApp {
16161623 || self.picker.is_some()
16171624 || self.model.challenge.is_some()
16181625 || self.model.resource.is_some()
1626추가: || self.model.conflict.is_some()
16191627 || self.model.close != Close::Open
16201628 }
16211629
@@ -1810,13 +1818,39 @@ impl ArchiveApp {
18101818 let t = self.model.terminal.clone();
18111819 let listing = matches!(self.last_request, Some(Start::List { .. }));
18121820 let creating = matches!(self.last_request, Some(Start::CreateZip { .. }));
1821추가: let resolved_targets = present::resolved_targets(
1822추가: self.targets.as_ref(),
1823추가: &self.model.entries,
1824추가: matches!(
1825추가: self.last_request,
1826추가: Some(Start::Extract {
1827추가: gzip_output_name: Some(_),
1828추가: ..
1829추가: })
1830추가: )
1831추가: .then_some(self.gzip_name.as_str()),
1832추가: &self.model.resolutions,
1833추가: );
1834추가: let skipped = self
1835추가: .model
1836추가: .resolutions
1837추가: .iter()
1838추가: .filter(|r| r.choice == ConflictChoice::Skip)
1839추가: .count();
1840추가: let created_names = self
1841추가: .model
1842추가: .outputs
1843추가: .iter()
1844추가: .filter(|(_, disposition)| *disposition == Disposition::Created)
1845추가: .map(|(name, _)| name.replace('\\', "/"))
1846추가: .collect::<BTreeSet<_>>();
18131847 let warnings = if listing {
18141848 Vec::new()
18151849 } else {
18161850 present::publication_warnings(
18171851 t.as_ref(),
18181852 self.model.confirmed,
1819삭제: self.targets.as_ref(),
1853추가: resolved_targets.as_ref(),
18201854 &self.directories,
18211855 &self.model.outputs,
18221856 )
@@ -1837,6 +1871,8 @@ impl ArchiveApp {
18371871 let title = if success {
18381872 if creating {
18391873 "ZIP 파일을 만들었습니다"
1874추가: } else if skipped > 0 && t.as_ref().is_some_and(|t| t.created_count == 0) {
1875추가: "모든 파일을 건너뛰었습니다"
18401876 } else {
18411877 "압축을 풀었습니다"
18421878 }
@@ -1881,7 +1917,7 @@ impl ArchiveApp {
18811917 .id_salt("result-message")
18821918 .max_height(max_height)
18831919 .show(ui, |ui| {
1884삭제: if success {
1920추가: if success && t.as_ref().is_some_and(|t| t.created_count > 0) {
18851921 let path = match self.last_request.as_ref() {
18861922 Some(Start::CreateZip { output_file, .. }) => {
18871923 output_file.display().to_string()
@@ -1901,6 +1937,19 @@ impl ArchiveApp {
19011937 creating,
19021938 ));
19031939 }
1940추가: if skipped > 0 {
1941추가: ui.label(format!("건너뛴 파일 {skipped}개"));
1942추가: }
1943추가: for resolution in self.model.resolutions.iter().filter(|r| {
1944추가: r.choice == ConflictChoice::Rename
1945추가: && created_names.contains(&r.relative_name.replace('\\', "/"))
1946추가: }) {
1947추가: theme::bounded_text(
1948추가: ui,
1949추가: &format!("이름 바꿔 저장: {}", resolution.relative_name),
1950추가: ui.available_width(),
1951추가: );
1952추가: }
19041953 for warning in warnings
19051954 .iter()
19061955 .copied()
@@ -2559,6 +2608,57 @@ impl ArchiveApp {
25592608 }
25602609 }
25612610
2611추가: fn conflict_dialog(&mut self, ctx: &egui::Context) {
2612추가: let conflict = self.model.conflict.clone().unwrap();
2613추가: let question = (self.model.job_id().unwrap_or(0), conflict.challenge_id);
2614추가: if self.conflict_challenge != Some(question) {
2615추가: self.conflict_challenge = Some(question);
2616추가: self.conflict_apply = false;
2617추가: }
2618추가: let mut choice = None;
2619추가: let mut cancel = false;
2620추가: let modal = egui::Modal::new(egui::Id::unique("archive-conflict")).show(ctx, |ui| {
2621추가: ui.set_width((ctx.content_rect().width() - 64.0).min(460.0));
2622추가: ui.heading("같은 이름의 파일이 있습니다");
2623추가: theme::bounded_text(ui, &conflict.relative_name, ui.available_width());
2624추가: ui.add_space(theme::SPACE);
2625추가: egui::Grid::new("conflict-sizes")
2626추가: .spacing([24.0, 8.0])
2627추가: .show(ui, |ui| {
2628추가: ui.label("기존 파일");
2629추가: ui.label(present::bytes_text(conflict.existing_size));
2630추가: ui.end_row();
2631추가: ui.label("압축파일 안의 파일");
2632추가: ui.label(present::bytes_text(conflict.incoming_size));
2633추가: ui.end_row();
2634추가: });
2635추가: ui.add_space(theme::SPACE);
2636추가: ui.checkbox(&mut self.conflict_apply, "나머지 파일에도 같게 적용");
2637추가: ui.add_space(theme::SPACE);
2638추가: ui.horizontal_wrapped(|ui| {
2639추가: for (label, value) in [
2640추가: ("덮어쓰기", ConflictChoice::Overwrite),
2641추가: ("건너뛰기", ConflictChoice::Skip),
2642추가: ("이름 바꿔 저장", ConflictChoice::Rename),
2643추가: ] {
2644추가: if theme::action(ui, label, false, self.model.error.is_none()).clicked() {
2645추가: choice = Some(value);
2646추가: }
2647추가: }
2648추가: });
2649추가: ui.label("이름 바꿔 저장하면 같은 폴더에 번호를 붙입니다.");
2650추가: if let Some(error) = &self.model.error {
2651추가: Self::error_notice(ui, present::client_error_text(error));
2652추가: }
2653추가: cancel = theme::action(ui, "작업 취소", false, true).clicked();
2654추가: });
2655추가: if modal.should_close() || cancel {
2656추가: self.model.cancel();
2657추가: } else if let Some(choice) = choice {
2658추가: self.model.resolve_conflict(choice, self.conflict_apply);
2659추가: }
2660추가: }
2661추가:
25622662 fn password_dialog(&mut self, ctx: &egui::Context, new_challenge: bool) {
25632663 let (_, attempt, encrypt) = self.model.challenge.unwrap();
25642664 let mut submit = false;
수정experiments/rust-ui-memory-app/src/archive_ui.rs+118-0
@@ -70,6 +70,26 @@ impl Drop for Secret {
7070 self.0.fill(0);
7171 }
7272}
73추가: #[derive(Clone, Copy, Debug, Eq, PartialEq)]
74추가: pub enum ConflictChoice {
75추가: Overwrite,
76추가: Skip,
77추가: Rename,
78추가: }
79추가: #[derive(Clone, Debug, Eq, PartialEq)]
80추가: pub struct Conflict {
81추가: pub challenge_id: u64,
82추가: pub entry_id: u32,
83추가: pub relative_name: String,
84추가: pub incoming_size: u64,
85추가: pub existing_size: u64,
86추가: }
87추가: #[derive(Clone, Debug, Eq, PartialEq)]
88추가: pub struct Resolution {
89추가: pub entry_id: u32,
90추가: pub relative_name: String,
91추가: pub choice: ConflictChoice,
92추가: }
7393pub enum Command {
7494 Start(Start),
7595 StartExpanded(Start),
@@ -82,6 +102,11 @@ pub enum Command {
82102 challenge_id: u64,
83103 secret: Secret,
84104 },
105추가: ConflictReply {
106추가: challenge_id: u64,
107추가: choice: ConflictChoice,
108추가: apply_to_remaining: bool,
109추가: },
85110 Cancel,
86111}
87112pub struct Request {
@@ -207,6 +232,8 @@ pub enum Event {
207232 attempt: u32,
208233 encrypt: bool,
209234 },
235추가: ConflictRequired(Conflict),
236추가: ConflictResolved(Resolution),
210237 Progress {
211238 stage: Stage,
212239 processed: u64,
@@ -272,6 +299,9 @@ struct Running {
272299 granted: ResourceScope,
273300 last_challenge: u64,
274301 estimated: ResourceUsage,
302추가: conflict_ids: BTreeSet<u64>,
303추가: resolved_ids: BTreeSet<u32>,
304추가: file_ids: BTreeSet<u32>,
275305}
276306#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
277307pub enum Close {
@@ -294,6 +324,8 @@ pub struct Model {
294324 pub challenge: Option<(u64, u32, bool)>,
295325 pub resource: Option<ResourceChallenge>,
296326 retry_start: Option<Start>,
327추가: pub conflict: Option<Conflict>,
328추가: pub resolutions: Vec<Resolution>,
297329 pub progress: Option<(Stage, u64, Option<u64>, u64)>,
298330 pub outputs: Vec<(String, Disposition)>,
299331 pub cancel: Option<CancelStatus>,
@@ -516,6 +548,8 @@ impl Model {
516548 self.retry_start = None;
517549 self.resource = None;
518550 self.challenge = None;
551추가: self.conflict = None;
552추가: self.resolutions.clear();
519553 self.progress = None;
520554 self.outputs.clear();
521555 self.cancel = None;
@@ -541,6 +575,14 @@ impl Model {
541575 granted: ResourceScope::default(),
542576 last_challenge: 0,
543577 estimated,
578추가: conflict_ids: BTreeSet::new(),
579추가: resolved_ids: BTreeSet::new(),
580추가: file_ids: self
581추가: .entries
582추가: .iter()
583추가: .filter(|e| e.kind == Kind::File)
584추가: .map(|e| e.id)
585추가: .collect(),
544586 });
545587 started
546588 }
@@ -589,6 +631,29 @@ impl Model {
589631 {
590632 self.challenge = None;
591633 self.resource = None;
634추가: self.conflict = None;
635추가: self.input_error = None;
636추가: true
637추가: } else {
638추가: false
639추가: }
640추가: }
641추가: pub fn resolve_conflict(&mut self, choice: ConflictChoice, apply_to_remaining: bool) -> bool {
642추가: let Some(conflict) = &self.conflict else {
643추가: return false;
644추가: };
645추가: if self.cancellation_requested() || self.error.is_some() || self.close != Close::Open {
646추가: return false;
647추가: }
648추가: if self
649추가: .send(Command::ConflictReply {
650추가: challenge_id: conflict.challenge_id,
651추가: choice,
652추가: apply_to_remaining,
653추가: })
654추가: .is_some()
655추가: {
656추가: self.conflict = None;
592657 self.input_error = None;
593658 true
594659 } else {
@@ -630,6 +695,7 @@ impl Model {
630695 self.running.as_mut().unwrap().cancel_sequence = Some(seq);
631696 self.challenge = None;
632697 self.resource = None;
698추가: self.conflict = None;
633699 self.input_error = None;
634700 }
635701 }
@@ -730,6 +796,7 @@ impl Model {
730796 };
731797 self.challenge = None;
732798 self.resource = None;
799추가: self.conflict = None;
733800 self.input_error = None;
734801 if matches!(self.close, Close::Waiting | Close::Confirm) {
735802 self.close = Close::Review;
@@ -812,6 +879,7 @@ impl Model {
812879 if self.challenge.is_some()
813880 || self.resource.is_some()
814881 || challenge_id <= run.last_challenge
882추가: || self.conflict.is_some()
815883 {
816884 self.error = Some("암호 요청이 유효하지 않습니다".into());
817885 } else {
@@ -840,6 +908,7 @@ impl Model {
840908 };
841909 if self.challenge.is_some()
842910 || self.resource.is_some()
911추가: || self.conflict.is_some()
843912 || question.id <= run.last_challenge
844913 || question.action != expected
845914 || !question.scope.any()
@@ -855,6 +924,51 @@ impl Model {
855924 self.resource = Some(question);
856925 }
857926 }
927추가: Event::ConflictRequired(conflict) => {
928추가: let valid_entry = self
929추가: .entries
930추가: .iter()
931추가: .any(|entry| entry.id == conflict.entry_id && entry.kind == Kind::File);
932추가: if !matches!(run.start, Start::Extract { .. })
933추가: || !valid_entry
934추가: || self.resource.is_some()
935추가: || conflict.challenge_id <= run.last_challenge
936추가: || self.challenge.is_some()
937추가: || self.conflict.is_some()
938추가: || run.conflict_ids.len()
939추가: >= if run.granted.entries {
940추가: 200_000
941추가: } else {
942추가: 100_000
943추가: }
944추가: || !valid_relative(&conflict.relative_name)
945추가: || conflict.relative_name.len() > 4096
946추가: || !run.conflict_ids.insert(conflict.challenge_id)
947추가: {
948추가: self.error = Some("파일 충돌 요청이 유효하지 않습니다".into());
949추가: } else if run.cancel_sequence.is_none() {
950추가: run.last_challenge = conflict.challenge_id;
951추가: self.conflict = Some(conflict);
952추가: }
953추가: }
954추가: Event::ConflictResolved(resolution) => {
955추가: if !matches!(run.start, Start::Extract { .. })
956추가: || !run.file_ids.contains(&resolution.entry_id)
957추가: || self.resolutions.len()
958추가: >= if run.granted.entries {
959추가: 200_000
960추가: } else {
961추가: 100_000
962추가: }
963추가: || !valid_relative(&resolution.relative_name)
964추가: || resolution.relative_name.len() > 4096
965추가: || !run.resolved_ids.insert(resolution.entry_id)
966추가: {
967추가: self.error = Some("파일 충돌 결과가 유효하지 않습니다".into());
968추가: } else {
969추가: self.resolutions.push(resolution);
970추가: }
971추가: }
858972 Event::Progress {
859973 stage,
860974 processed,
@@ -892,6 +1006,7 @@ impl Model {
8921006 }
8931007 Event::Terminal(t) => {
8941008 self.challenge = None;
1009추가: self.conflict = None;
8951010 self.terminal = Some(t);
8961011 }
8971012 }
@@ -909,6 +1024,9 @@ impl Model {
9091024 if self.resource.is_some() {
9101025 return "사용자 허용 대기".into();
9111026 }
1027추가: if self.conflict.is_some() {
1028추가: return "같은 이름의 파일을 처리할 방법을 선택하세요".into();
1029추가: }
9121030 if self.challenge.is_some() {
9131031 return "암호를 입력하세요".into();
9141032 }
수정packaging/ubuntu/rust/build.py+1-1
@@ -56,7 +56,7 @@ Architecture: amd64
5656Maintainer: Zipelo contributors <[email protected]>
5757Section: utils
5858Priority: optional
59삭제: Depends: libc6 (>= 2.39), libgcc-s1, libx11-6, libxkbcommon0, libwayland-client0, libegl1, libgl1, libfontconfig1, fonts-noto-cjk, xdg-utils, desktop-file-utils
59추가: Depends: libc6 (>= 2.39), libgcc-s1, libx11-6, libxkbcommon0, libxkbcommon-x11-0, libwayland-client0, libegl1, libgl1, libfontconfig1, fonts-noto-cjk, xdg-utils, desktop-file-utils
6060Description: Lightweight Rust archive application
6161 ZIP, 7z, TAR, GZ and TAR.GZ archive application with a separate worker.
6262""")
수정tests/rust-app-real-worker/README.md+2-0
@@ -69,3 +69,5 @@ LZMA2 표본을 실제 작업자로 열고, 받은 ListId로 풀어 원본 바
6969구버전 앱은 새 형식 값을 해석할 수 없으므로 앱과 작업자를 함께 갱신해야 함.
7070
7171가상 시계 회귀 approved_password_wait_is_not_killed_by_app_deadline은 정상 시계 대조군, 승인 뒤 관리 스레드의 311초 경과와 암호 대기, 승인하지 않은 작업의 기존 강제 종료를 실제 작업자 파이프로 검증함. 시계는 별도 시험 프로세스의 관리 스레드에만 적용하며 실제 310초를 기다리지 않음.
72추가:
73추가: approved_extract_continues_to_conflict_choices는 큰 작업 승인 뒤 실제 작업자의 파일 충돌 질문으로 이어져 나머지 파일 덮어쓰기와 종료 정리까지 완료되는지 확인함.
추가tests/rust-app-real-worker/conflict_flows.rs+264-0
@@ -0,0 +1,264 @@
1추가: fn conflict_fixture(scratch: &Scratch) -> (PathBuf, PathBuf) {
2추가: use worker_protocol::{archive, protocol};
3추가: let members = ["기록.txt", "사진.txt"]
4추가: .into_iter()
5추가: .enumerate()
6추가: .map(|(id, name)| archive::Member {
7추가: entry: protocol::Entry {
8추가: entry_id: id as u32,
9추가: name: name.into(),
10추가: kind: protocol::EntryKind::File,
11추가: size: 3,
12추가: compressed_size: 3,
13추가: encrypted: false,
14추가: },
15추가: data: b"new".to_vec(),
16추가: })
17추가: .collect::<Vec<_>>();
18추가: let archive = scratch.path("충돌.zip");
19추가: fs::write(
20추가: &archive,
21추가: archive::create_zip(
22추가: &members,
23추가: protocol::Method::Store,
24추가: protocol::Limits::default(),
25추가: &mut || Ok(()),
26추가: )
27추가: .unwrap(),
28추가: )
29추가: .unwrap();
30추가: let output = make_directory(&scratch.path("output"));
31추가: for name in ["기록.txt", "사진.txt"] {
32추가: fs::write(output.join(name), b"original").unwrap();
33추가: }
34추가: (archive, output)
35추가: }
36추가:
37추가: impl Screen {
38추가: fn start_conflicting_extract(&mut self, output: &Path) {
39추가: self.app.choose_destination(output.to_path_buf());
40추가: self.dialogs
41추가: .0
42추가: .borrow_mut()
43추가: .answers
44추가: .push_back(Some(vec![output.to_path_buf()]));
45추가: self.click("압축해제");
46추가: assert!(self.app.model.busy());
47추가: }
48추가:
49추가: fn await_conflict(&mut self) -> Conflict {
50추가: let deadline = Instant::now() + Duration::from_secs(10);
51추가: loop {
52추가: self.render(vec![]);
53추가: if let Some(conflict) = &self.app.model.conflict {
54추가: return conflict.clone();
55추가: }
56추가: assert!(
57추가: self.app.model.busy(),
58추가: "충돌 질문 전에 종료됨: {:?}",
59추가: self.app.model.terminal
60추가: );
61추가: assert!(Instant::now() < deadline, "충돌 질문 시간 초과");
62추가: std::thread::sleep(Duration::from_millis(2));
63추가: }
64추가: }
65추가:
66추가: fn settle_conflict_result(&mut self) {
67추가: let deadline = Instant::now() + Duration::from_secs(10);
68추가: while self.app.model.busy() {
69추가: self.render(vec![]);
70추가: assert!(Instant::now() < deadline, "충돌 결과 시간 초과");
71추가: std::thread::sleep(Duration::from_millis(2));
72추가: }
73추가: assert!(self.app.model.confirmed, "{}", self.app.model.status());
74추가: assert!(self.app.model.conflict.is_none());
75추가: }
76추가: }
77추가:
78추가: #[test]
79추가: fn real_conflicts_follow_widget_choices_and_apply_remaining() {
80추가: for (label, choice) in [
81추가: ("덮어쓰기", ConflictChoice::Overwrite),
82추가: ("건너뛰기", ConflictChoice::Skip),
83추가: ("이름 바꿔 저장", ConflictChoice::Rename),
84추가: ] {
85추가: for apply in [false, true] {
86추가: let scratch = Scratch::new();
87추가: let (archive, output) = conflict_fixture(&scratch);
88추가: let (factory, observed) = observed_factory();
89추가: let mut screen = Screen::new(factory);
90추가: screen.open(&archive);
91추가: screen.start_conflicting_extract(&output);
92추가: let first = screen.await_conflict();
93추가: assert_eq!(first.incoming_size, 3);
94추가: assert_eq!(first.existing_size, 8);
95추가: if apply {
96추가: screen.click("나머지 파일에도 같게 적용");
97추가: }
98추가: screen.click(label);
99추가: if !apply {
100추가: let second = screen.await_conflict();
101추가: assert_ne!(first.challenge_id, second.challenge_id);
102추가: assert_ne!(first.entry_id, second.entry_id);
103추가: screen.click(label);
104추가: }
105추가: screen.settle_conflict_result();
106추가: completed(&screen.app.model);
107추가: assert_eq!(screen.app.model.resolutions.len(), 2);
108추가: assert!(
109추가: screen
110추가: .app
111추가: .model
112추가: .resolutions
113추가: .iter()
114추가: .all(|r| r.choice == choice)
115추가: );
116추가: let terminal = screen.app.model.terminal.as_ref().unwrap();
117추가: assert_eq!(
118추가: terminal.created_count,
119추가: if choice == ConflictChoice::Skip { 0 } else { 2 }
120추가: );
121추가: assert_eq!(
122추가: terminal.publication,
123추가: if choice == ConflictChoice::Skip {
124추가: Publication::None
125추가: } else {
126추가: Publication::Complete
127추가: }
128추가: );
129추가: for name in ["기록.txt", "사진.txt"] {
130추가: assert_eq!(
131추가: fs::read(output.join(name)).unwrap(),
132추가: if choice == ConflictChoice::Overwrite {
133추가: b"new".as_slice()
134추가: } else {
135추가: b"original".as_slice()
136추가: }
137추가: );
138추가: }
139추가: for resolution in &screen.app.model.resolutions {
140추가: if choice == ConflictChoice::Rename {
141추가: assert_eq!(
142추가: fs::read(output.join(&resolution.relative_name)).unwrap(),
143추가: b"new"
144추가: );
145추가: assert!(resolution.relative_name.contains(" (1)"));
146추가: }
147추가: }
148추가: let shown = screen
149추가: .render(vec![])
150추가: .into_iter()
151추가: .map(|(t, _)| t)
152추가: .collect::<Vec<_>>()
153추가: .join("\n");
154추가: assert!(
155추가: shown.contains(if choice == ConflictChoice::Skip {
156추가: "모든 파일을 건너뛰었습니다"
157추가: } else {
158추가: "압축을 풀었습니다"
159추가: }),
160추가: "{shown}"
161추가: );
162추가: assert!(!shown.contains("저장이 끝났는지"), "{shown}");
163추가: assert_reaped(&observed);
164추가: }
165추가: }
166추가: }
167추가:
168추가: #[test]
169추가: fn real_conflict_cancel_button_and_escape_preserve_originals() {
170추가: for escape in [false, true] {
171추가: let scratch = Scratch::new();
172추가: let (archive, output) = conflict_fixture(&scratch);
173추가: let (factory, observed) = observed_factory();
174추가: let mut screen = Screen::new(factory);
175추가: screen.open(&archive);
176추가: screen.start_conflicting_extract(&output);
177추가: screen.await_conflict();
178추가: if escape {
179추가: screen.escape();
180추가: } else {
181추가: screen.click("작업 취소");
182추가: }
183추가: screen.settle_conflict_result();
184추가: assert_eq!(
185추가: screen.app.model.terminal.as_ref().unwrap().outcome,
186추가: Outcome::Cancelled
187추가: );
188추가: assert!(screen.app.model.outputs.is_empty());
189추가: for name in ["기록.txt", "사진.txt"] {
190추가: assert_eq!(fs::read(output.join(name)).unwrap(), b"original");
191추가: }
192추가: assert_reaped(&observed);
193추가: }
194추가: }
195추가:
196추가: #[test]
197추가: fn target_changed_during_real_question_fails_without_saved_name_notice() {
198추가: let scratch = Scratch::new();
199추가: let (archive, output) = conflict_fixture(&scratch);
200추가: let (factory, observed) = observed_factory();
201추가: let mut screen = Screen::new(factory);
202추가: screen.open(&archive);
203추가: screen.start_conflicting_extract(&output);
204추가: let conflict = screen.await_conflict();
205추가: fs::write(
206추가: output.join(&conflict.relative_name),
207추가: b"changed after question",
208추가: )
209추가: .unwrap();
210추가: screen.click("덮어쓰기");
211추가: screen.settle_conflict_result();
212추가: assert_eq!(
213추가: screen.app.model.terminal.as_ref().unwrap().outcome,
214추가: Outcome::Failed
215추가: );
216추가: assert_eq!(screen.app.model.terminal.as_ref().unwrap().created_count, 0);
217추가: assert!(screen.app.model.outputs.is_empty());
218추가: assert_eq!(
219추가: fs::read(output.join(&conflict.relative_name)).unwrap(),
220추가: b"changed after question"
221추가: );
222추가: let shown = screen
223추가: .render(vec![])
224추가: .into_iter()
225추가: .map(|(t, _)| t)
226추가: .collect::<Vec<_>>()
227추가: .join("\n");
228추가: assert!(shown.contains("압축을 풀지 못했습니다"), "{shown}");
229추가: assert!(!shown.contains("이름 바꿔 저장:"), "{shown}");
230추가: assert_reaped(&observed);
231추가: }
232추가:
233추가: #[test]
234추가: fn approved_extract_continues_to_conflict_choices() {
235추가: let scratch = Scratch::new();
236추가: let (archive, output) = conflict_fixture(&scratch);
237추가: let (factory, observed) = observed_factory();
238추가: let mut screen = Screen::new(factory);
239추가: screen.open(&archive);
240추가: screen.app.model.entries[0].bytes = Some(17 * 1024 * 1024 * 1024);
241추가: screen.start_conflicting_extract(&output);
242추가: let deadline = Instant::now() + Duration::from_secs(10);
243추가: while screen.app.model.resource.is_none() {
244추가: screen.render(vec![]);
245추가: assert!(screen.app.model.busy(), "{:?}", screen.app.model.error);
246추가: assert!(Instant::now() < deadline, "승인 질문 시간 초과");
247추가: std::thread::sleep(Duration::from_millis(2));
248추가: }
249추가: let approval = screen.app.model.resource.clone().unwrap();
250추가: assert!(screen.app.model.conflict.is_none());
251추가: screen.click("이 작업 허용");
252추가: let conflict = screen.await_conflict();
253추가: assert!(conflict.challenge_id > approval.id);
254추가: assert!(screen.app.model.resource.is_none());
255추가: screen.click("나머지 파일에도 같게 적용");
256추가: screen.click("덮어쓰기");
257추가: screen.settle_conflict_result();
258추가: completed(&screen.app.model);
259추가: assert_eq!(screen.app.model.resolutions.len(), 2);
260추가: for name in ["기록.txt", "사진.txt"] {
261추가: assert_eq!(fs::read(output.join(name)).unwrap(), b"new");
262추가: }
263추가: assert_reaped(&observed);
264추가: }
수정tests/rust-app-real-worker/flows.rs+6-1
@@ -304,12 +304,17 @@ mod screen {
304304 self.settle();
305305 assert_eq!(
306306 self.app.model.terminal.as_ref().unwrap().publication,
307삭제: Publication::Complete
307추가: if self.app.model.terminal.as_ref().unwrap().created_count == 0 {
308추가: Publication::None
309추가: } else {
310추가: Publication::Complete
311추가: }
308312 );
309313 }
310314 }
311315 include!("password_flows.rs");
312316 include!("selection_flows.rs");
317추가: include!("conflict_flows.rs");
313318 include!("native_dialog_flows.rs");
314319 include!("compressed_tar_flows.rs");
315320
수정tests/rust-app-real-worker/native_dialog_flows.rs+42-25
@@ -5,12 +5,13 @@ fn native_fixture(scratch: &Scratch, fixture: &str, name: &str) -> PathBuf {
55 .join("../../tests/rust-app-real-worker/fixtures")
66 .join(fixture),
77 &target,
8삭제: ).unwrap();
8추가: )
9추가: .unwrap();
910 target
1011}
1112
1213#[test]
13삭제: fn raw_gzip_save_dialog_corrects_names_and_preserves_cancel_and_conflict_retry() {
14추가: fn raw_gzip_save_dialog_corrects_names_and_preserves_cancel_and_conflict_choice() {
1415 use zipelo_ui_memory_app::archive_dialog::Purpose;
1516 let mut names = vec![".gz", "report.GZ", "report.Gz", "report.gz"];
1617 #[cfg(unix)]
@@ -23,41 +24,46 @@ fn raw_gzip_save_dialog_corrects_names_and_preserves_cancel_and_conflict_retry()
2324 let (factory, observed) = observed_factory();
2425 let mut screen = Screen::new(factory);
2526 screen.open(&archive);
26삭제: assert_eq!(screen.app.model.list_id.as_ref().unwrap().format, Format::Gzip);
27추가: assert_eq!(
28추가: screen.app.model.list_id.as_ref().unwrap().format,
29추가: Format::Gzip
30추가: );
2731 screen.click("압축해제");
2832 assert!(!screen.app.model.busy());
2933 assert_eq!(observed.borrow().jobs.len(), 1);
3034 let request = screen.dialogs.0.borrow().requests.last().unwrap().clone();
3135 assert_eq!(request.purpose, Purpose::SaveGzip);
3236 assert_eq!(request.directory, scratch.0);
33삭제: assert_eq!(request.file_name, if name == ".gz" || name.contains(':') { "압축 해제 파일" } else { "report" });
37추가: assert_eq!(
38추가: request.file_name,
39추가: if name == ".gz" || name.contains(':') {
40추가: "압축 해제 파일"
41추가: } else {
42추가: "report"
43추가: }
44추가: );
3445 let existing = output.join("기존 파일.txt");
3546 fs::write(&existing, b"preserve").unwrap();
36삭제: screen.dialogs.0.borrow_mut().answers.push_back(Some(vec![existing.clone()]));
47추가: screen
48추가: .dialogs
49추가: .0
50추가: .borrow_mut()
51추가: .answers
52추가: .push_back(Some(vec![existing.clone()]));
3753 screen.click("압축해제");
38삭제: let deadline = Instant::now() + Duration::from_secs(10);
39삭제: while screen.app.model.busy() {
40삭제: screen.render(vec![]);
41삭제: assert!(Instant::now() < deadline);
42삭제: std::thread::sleep(Duration::from_millis(2));
43삭제: }
44삭제: assert_eq!(screen.app.model.terminal.as_ref().unwrap().error, Some(ErrorCode::Conflict));
45삭제: assert_eq!(fs::read(&existing).unwrap(), b"preserve");
46삭제: screen.click("다른 이름으로 저장");
47삭제: assert!(!screen.app.model.busy());
48삭제: assert_eq!(observed.borrow().jobs.len(), 2);
49삭제: assert_eq!(screen.dialogs.0.borrow().requests.last().unwrap().purpose, Purpose::RetryGzip);
50삭제: let saved = output.join("사용자 이름.txt");
51삭제: screen.dialogs.0.borrow_mut().answers.push_back(Some(vec![saved.clone()]));
52삭제: screen.click("다른 이름으로 저장");
53삭제: screen.settle();
54추가: let conflict = screen.await_conflict();
55추가: assert_eq!(conflict.relative_name, "기존 파일.txt");
56추가: screen.click("이름 바꿔 저장");
57추가: screen.settle_conflict_result();
58추가: completed(&screen.app.model);
59추가: let saved = output.join("기존 파일 (1).txt");
5460 assert_eq!(fs::read(saved).unwrap(), b"Zipelo real worker flow\n");
5561 assert_eq!(fs::read(existing).unwrap(), b"preserve");
5662 assert_eq!(fs::read(&archive).unwrap(), original);
5763 assert!(matches!(
5864 observed.borrow().starts.last(),
5965 Some(Start::Extract { destination, gzip_output_name: Some(name), .. })
60삭제: if destination == &output && name == "사용자 이름.txt"
66추가: if destination == &output && name == "기존 파일.txt"
6167 ));
6268 assert_reaped(&observed);
6369 }
@@ -73,13 +79,24 @@ fn mixed_case_zip_names_open_and_extract_through_native_dialog_responses() {
7379 let output = make_directory(&scratch.path("output"));
7480 let (factory, observed) = observed_factory();
7581 let mut screen = Screen::new(factory);
76삭제: screen.dialogs.0.borrow_mut().answers.push_back(Some(vec![archive.clone()]));
82추가: screen
83추가: .dialogs
84추가: .0
85추가: .borrow_mut()
86추가: .answers
87추가: .push_back(Some(vec![archive.clone()]));
7788 screen.click("열기");
7889 screen.settle();
7990 assert_eq!(screen.dialogs.0.borrow().requests[0].purpose, Purpose::Open);
80삭제: assert_eq!(screen.app.model.list_id.as_ref().unwrap().format, Format::Zip);
91추가: assert_eq!(
92추가: screen.app.model.list_id.as_ref().unwrap().format,
93추가: Format::Zip
94추가: );
8195 screen.extract(&output);
82삭제: assert_eq!(fs::read(output.join("content.txt")).unwrap(), b"Zipelo real worker flow\n");
96추가: assert_eq!(
97추가: fs::read(output.join("content.txt")).unwrap(),
98추가: b"Zipelo real worker flow\n"
99추가: );
83100 assert_eq!(fs::read(archive).unwrap(), original);
84101 assert_reaped(&observed);
85102 }
수정tests/rust-app-ui/README.md+1-1
@@ -1,6 +1,6 @@
11# 앱 화면 흐름 시험
22
3삭제: 가짜 작업자는 계약 revision 2의 의미를 따르는 프론트엔드 어댑터임. 바이너리 codec, 실제 프로세스 실행, 파일 읽기와 쓰기, 암호 해독은 수행하지 않음. 실제 codec은 backend 소유이며 이 PR에서 중복 구현하지 않음.
3추가: 가짜 작업자는 합의된 계약의 의미를 따르는 프론트엔드 어댑터임. revision 3의 충돌 요청과 응답은 가짜 작업자로 검증함. 실제 StartGuarded의 interactive=true와 화면 버튼의 파일 기반 통합 시험은 tests/rust-app-real-worker/conflict_flows.rs에서 별도로 실행함. 바이너리 codec, 실제 프로세스 실행, 파일 읽기와 쓰기, 암호 해독은 수행하지 않음. 실제 codec은 backend 소유이며 이 PR에서 중복 구현하지 않음.
44
55`python3 tests/ci/run_rust.py local`은 기존 시험과 새 `archive_ui` 시험을 all-features로 실행함. Windows 결과는 교차 빌드이며 Windows 실제 실행은 별도 확인해야 함.
66
수정tests/rust-app-ui/capture.rs+1-0
@@ -246,6 +246,7 @@ impl Connection for CaptureConnection {
246246 }
247247 }
248248 }
249추가: Command::ConflictReply { .. } => return Err("충돌 선택은 상황 명령으로 확인함".into()),
249250 Command::Password { .. } => self.finish(false),
250251 Command::ResourceReply { .. } => {}
251252 Command::Cancel => {
추가tests/rust-app-ui/conflict_codec.rs+52-0
@@ -0,0 +1,52 @@
1추가: use super::*;
2추가:
3추가: #[test]
4추가: fn conflict_adapter_preserves_sizes_names_ids_and_choices() {
5추가: let required = || wire::Message::ConflictRequired {
6추가: challenge_id: 53,
7추가: entry_id: 7,
8추가: relative_name: "사진/기록.txt".into(),
9추가: incoming_size: u64::MAX,
10추가: existing_size: 1 << 34,
11추가: };
12추가: match event_to_ui(required(), Some(wire::ActionKind::Extract)).unwrap() {
13추가: ui::Event::ConflictRequired(c) => {
14추가: assert_eq!(c.challenge_id, 53);
15추가: assert_eq!(c.entry_id, 7);
16추가: assert_eq!(c.relative_name, "사진/기록.txt");
17추가: assert_eq!(c.incoming_size, u64::MAX);
18추가: assert_eq!(c.existing_size, 1 << 34);
19추가: }
20추가: _ => panic!("충돌 요청 변환 누락"),
21추가: }
22추가: for expected in [
23추가: None,
24추가: Some(wire::ActionKind::List),
25추가: Some(wire::ActionKind::CreateZip),
26추가: ] {
27추가: assert!(event_to_ui(required(), expected).is_err());
28추가: }
29추가: for choice in [
30추가: ui::ConflictChoice::Overwrite,
31추가: ui::ConflictChoice::Skip,
32추가: ui::ConflictChoice::Rename,
33추가: ] {
34추가: match event_to_ui(
35추가: wire::Message::ConflictResolved {
36추가: entry_id: 7,
37추가: relative_name: "사진/기록 (1).txt".into(),
38추가: choice: conflict_to_wire(choice),
39추가: },
40추가: Some(wire::ActionKind::Extract),
41추가: )
42추가: .unwrap()
43추가: {
44추가: ui::Event::ConflictResolved(r) => {
45추가: assert_eq!(r.choice, choice);
46추가: assert_eq!(r.entry_id, 7);
47추가: assert_eq!(r.relative_name, "사진/기록 (1).txt");
48추가: }
49추가: _ => panic!("충돌 결과 변환 누락"),
50추가: }
51추가: }
52추가: }
추가tests/rust-app-ui/conflicts.rs+291-0
@@ -0,0 +1,291 @@
1추가: use super::*;
2추가: use std::collections::BTreeSet;
3추가: use zipelo_ui_memory_app::archive_present as present;
4추가:
5추가: fn waiting() -> (Model, FakeFactory) {
6추가: let mut factory = FakeFactory::default();
7추가: let mut model = Model::default();
8추가: list(&mut model, &mut factory);
9추가: factory.state.borrow_mut().manual = true;
10추가: assert!(model.extract(path("output"), false, None, &mut factory));
11추가: factory
12추가: .state
13추가: .borrow_mut()
14추가: .frame(Event::Accepted { encryption: false });
15추가: ask(&mut model, &factory, 29);
16추가: (model, factory)
17추가: }
18추가:
19추가: fn ask(model: &mut Model, factory: &FakeFactory, challenge_id: u64) {
20추가: factory
21추가: .state
22추가: .borrow_mut()
23추가: .frame(Event::ConflictRequired(Conflict {
24추가: challenge_id,
25추가: entry_id: 0,
26추가: relative_name: "읽어주세요.txt".into(),
27추가: incoming_size: 31,
28추가: existing_size: 128,
29추가: }));
30추가: for _ in 0..8 {
31추가: model.poll();
32추가: }
33추가: }
34추가:
35추가: #[test]
36추가: fn each_choice_sends_one_scoped_reply_and_does_not_claim_a_saved_file() {
37추가: for choice in [
38추가: ConflictChoice::Overwrite,
39추가: ConflictChoice::Skip,
40추가: ConflictChoice::Rename,
41추가: ] {
42추가: for apply in [false, true] {
43추가: let (mut model, factory) = waiting();
44추가: assert_eq!(model.conflict.as_ref().unwrap().existing_size, 128);
45추가: assert!(model.resolve_conflict(choice, apply));
46추가: assert!(model.conflict.is_none());
47추가: assert!(model.outputs.is_empty());
48추가: assert!(!model.resolve_conflict(choice, apply));
49추가: assert_eq!(
50추가: factory.state.borrow().conflict_replies,
51추가: vec![(29, choice, apply)]
52추가: );
53추가: assert_eq!(
54추가: factory.state.borrow().requests.last(),
55추가: Some(&(1, "conflict"))
56추가: );
57추가: }
58추가: }
59추가: }
60추가:
61추가: #[test]
62추가: fn cancellation_clears_question_and_rejects_a_late_click() {
63추가: let (mut model, factory) = waiting();
64추가: model.cancel();
65추가: assert!(model.conflict.is_none());
66추가: assert!(!model.resolve_conflict(ConflictChoice::Overwrite, true));
67추가: ask(&mut model, &factory, 30);
68추가: assert!(model.conflict.is_none());
69추가: assert!(factory.state.borrow().conflict_replies.is_empty());
70추가: }
71추가:
72추가: #[test]
73추가: fn duplicate_challenge_and_duplicate_resolution_are_rejected() {
74추가: let (mut model, factory) = waiting();
75추가: assert!(model.resolve_conflict(ConflictChoice::Skip, false));
76추가: ask(&mut model, &factory, 29);
77추가: assert!(model.error.is_some());
78추가: let (mut model, factory) = waiting();
79추가: let resolution = Resolution {
80추가: entry_id: 0,
81추가: relative_name: "읽어주세요.txt".into(),
82추가: choice: ConflictChoice::Skip,
83추가: };
84추가: for _ in 0..2 {
85추가: factory
86추가: .state
87추가: .borrow_mut()
88추가: .frame(Event::ConflictResolved(resolution.clone()));
89추가: }
90추가: for _ in 0..8 {
91추가: model.poll();
92추가: }
93추가: assert!(model.error.is_some());
94추가: }
95추가:
96추가: fn completed(created_count: u64) -> Terminal {
97추가: Terminal {
98추가: outcome: Outcome::Completed,
99추가: error: None,
100추가: publication: if created_count == 0 {
101추가: Publication::None
102추가: } else {
103추가: Publication::Complete
104추가: },
105추가: created_count,
106추가: retained_partial_count: 0,
107추가: durability: if created_count == 0 {
108추가: Durability::NotApplicable
109추가: } else {
110추가: Durability::Synced
111추가: },
112추가: cleanup: Cleanup::Complete,
113추가: }
114추가: }
115추가:
116추가: #[test]
117추가: fn auto_applied_results_adjust_targets_but_created_reports_confirm_saves() {
118추가: for choice in [
119추가: ConflictChoice::Overwrite,
120추가: ConflictChoice::Skip,
121추가: ConflictChoice::Rename,
122추가: ] {
123추가: let (mut model, factory) = waiting();
124추가: assert!(model.resolve_conflict(choice, true));
125추가: let name = if choice == ConflictChoice::Rename {
126추가: "읽어주세요 (1).txt"
127추가: } else {
128추가: "읽어주세요.txt"
129추가: };
130추가: factory
131추가: .state
132추가: .borrow_mut()
133추가: .frame(Event::ConflictResolved(Resolution {
134추가: entry_id: 0,
135추가: relative_name: name.into(),
136추가: choice,
137추가: }));
138추가: for _ in 0..8 {
139추가: model.poll();
140추가: }
141추가: assert!(model.outputs.is_empty());
142추가: let targets = ["읽어주세요.txt".to_owned()].into_iter().collect();
143추가: let targets =
144추가: present::resolved_targets(Some(&targets), &model.entries, None, &model.resolutions)
145추가: .unwrap();
146추가: assert_eq!(targets.len(), usize::from(choice != ConflictChoice::Skip));
147추가: let count = u64::from(choice != ConflictChoice::Skip);
148추가: let terminal = completed(count);
149추가: if count != 0 {
150추가: assert!(
151추가: present::publication_warnings(
152추가: Some(&terminal),
153추가: true,
154추가: Some(&targets),
155추가: &BTreeSet::new(),
156추가: &[]
157추가: )
158추가: .contains(&present::UNCERTAIN)
159추가: );
160추가: factory.state.borrow_mut().frame(Event::Output {
161추가: entry_id: Some(0),
162추가: relative_name: name.into(),
163추가: disposition: Disposition::Created,
164추가: });
165추가: }
166추가: factory
167추가: .state
168추가: .borrow_mut()
169추가: .frame(Event::Terminal(terminal.clone()));
170추가: factory.state.borrow_mut().queue.extend([
171추가: HostEvent::StdoutEof,
172추가: HostEvent::StderrEof,
173추가: HostEvent::Exited { success: true },
174추가: ]);
175추가: pump(&mut model);
176추가: assert!(model.confirmed);
177추가: assert!(model.conflict.is_none());
178추가: assert!(
179추가: present::publication_warnings(
180추가: Some(&terminal),
181추가: model.confirmed,
182추가: Some(&targets),
183추가: &BTreeSet::new(),
184추가: &model.outputs
185추가: )
186추가: .is_empty()
187추가: );
188추가: }
189추가: }
190추가:
191추가: #[test]
192추가: fn skipped_files_still_allow_created_directories_to_be_counted() {
193추가: let terminal = completed(1);
194추가: assert!(
195추가: present::publication_warnings(
196추가: Some(&terminal),
197추가: true,
198추가: Some(&BTreeSet::new()),
199추가: &["사진".into()].into_iter().collect(),
200추가: &[("사진".into(), Disposition::Created)],
201추가: )
202추가: .is_empty()
203추가: );
204추가: }
205추가:
206추가: #[cfg(all(feature = "ui-fixture", debug_assertions))]
207추가: #[test]
208추가: fn conflict_modal_buttons_and_escape_use_the_pending_question() {
209추가: use eframe::egui::{self, epaint::Shape};
210추가: use zipelo_ui_memory_app::archive_screen::{ArchiveApp, scenarios};
211추가: for label in [
212추가: "덮어쓰기",
213추가: "건너뛰기",
214추가: "이름 바꿔 저장",
215추가: "작업 취소",
216추가: "escape",
217추가: ] {
218추가: let ctx = egui::Context::default();
219추가: let mut app = scenarios::parse("conflict-choice").unwrap().build();
220추가: let frame = |app: &mut ArchiveApp, events| {
221추가: let mut output = ctx.run_ui(
222추가: egui::RawInput {
223추가: screen_rect: Some(egui::Rect::from_min_size(
224추가: egui::Pos2::ZERO,
225추가: egui::vec2(760.0, 540.0),
226추가: )),
227추가: events,
228추가: ..Default::default()
229추가: },
230추가: |ui| app.show(ui),
231추가: );
232추가: output.textures_delta.clear();
233추가: output
234추가: };
235추가: fn labels(shape: &Shape, output: &mut Vec<(String, egui::Pos2)>) {
236추가: match shape {
237추가: Shape::Text(t) => {
238추가: output.push((t.galley.text().into(), t.pos + t.galley.rect.size() / 2.0))
239추가: }
240추가: Shape::Vec(shapes) => {
241추가: for shape in shapes {
242추가: labels(shape, output);
243추가: }
244추가: }
245추가: _ => {}
246추가: }
247추가: }
248추가: let mut texts = Vec::new();
249추가: for _ in 0..3 {
250추가: texts.clear();
251추가: for shape in frame(&mut app, vec![]).shapes {
252추가: labels(&shape.shape, &mut texts);
253추가: }
254추가: }
255추가: if label == "escape" {
256추가: frame(
257추가: &mut app,
258추가: vec![egui::Event::Key {
259추가: key: egui::Key::Escape,
260추가: physical_key: None,
261추가: pressed: true,
262추가: repeat: false,
263추가: modifiers: egui::Modifiers::NONE,
264추가: }],
265추가: );
266추가: } else {
267추가: let point = texts.iter().find(|(text, _)| text == label).unwrap().1;
268추가: for pressed in [true, false] {
269추가: frame(
270추가: &mut app,
271추가: vec![
272추가: egui::Event::PointerMoved(point),
273추가: egui::Event::PointerButton {
274추가: pos: point,
275추가: button: egui::PointerButton::Primary,
276추가: pressed,
277추가: modifiers: egui::Modifiers::NONE,
278추가: },
279추가: ],
280추가: );
281추가: }
282추가: }
283추가: assert!(app.model.conflict.is_none(), "{label}");
284추가: assert!(app.model.busy());
285추가: assert!(app.model.outputs.is_empty());
286추가: assert_eq!(
287추가: app.model.cancellation_requested(),
288추가: matches!(label, "작업 취소" | "escape")
289추가: );
290추가: }
291추가: }
수정tests/rust-app-ui/fake.rs+10-0
@@ -8,6 +8,7 @@ pub struct State {
88 pub password_seen: bool,
99 pub expanded: bool,
1010 pub resources: Vec<(u64, ResourceScope, bool)>,
11추가: pub conflict_replies: Vec<(u64, ConflictChoice, bool)>,
1112 /// 마지막으로 받은 암호 원문. 화면에서 입력한 암호가 그대로 전달됐는지 확인할 때 씀.
1213 pub password: Vec<u8>,
1314 pub job: u64,
@@ -196,6 +197,15 @@ impl Connection for FakeConnection {
196197 } => {
197198 s.resources.push((challenge_id, scope, allow));
198199 }
200추가: Command::ConflictReply {
201추가: challenge_id,
202추가: choice,
203추가: apply_to_remaining,
204추가: } => {
205추가: s.requests.push((request.sequence, "conflict"));
206추가: s.conflict_replies
207추가: .push((challenge_id, choice, apply_to_remaining));
208추가: }
199209 Command::Cancel => {
200210 s.requests.push((request.sequence, "cancel"));
201211 if !s.manual {
수정tests/rust-app-ui/regressions.rs+1-0
@@ -1,3 +1,4 @@
1추가: mod conflicts;
12#[cfg(feature = "ui")]
23mod dialogs;
34mod fake;
수정tests/rust-app-ui/scenario_tests.rs+97-0
@@ -100,6 +100,12 @@ fn every_listed_scenario_draws_and_keeps_its_expected_screen() {
100100 "resource-ratio" => "압축률이 매우 높습니다",
101101 "resource-retry" => "한도를 늘려 다시 시도",
102102 "resource-partial" => "저장 위치를 확인하세요",
103추가: "conflict-choice" | "conflict-apply" | "gzip-conflict-choice" => {
104추가: "나머지 파일에도 같게 적용"
105추가: }
106추가: "extract-skipped" => "모든 파일을 건너뛰었습니다",
107추가: "extract-rename-failed" => "아무 파일도 풀지 않았습니다",
108추가: "extract-renamed" => "이름 바꿔 저장: 읽어주세요 (1).txt",
103109 "empty" => "TAR.BZ2, TAR.XZ",
104110 "tar-bz2" | "tar-xz" => "읽어주세요.txt",
105111 "folder-empty" => "이 폴더는 비어 있습니다",
@@ -124,6 +130,10 @@ fn every_listed_scenario_draws_and_keeps_its_expected_screen() {
124130 _ => "읽어주세요.txt",
125131 };
126132 assert!(labels.contains(expected), "{}: {labels}", scenario.name);
133추가: if scenario.name == "extract-rename-failed" {
134추가: assert!(labels.contains("파일을 읽거나 쓰지 못했습니다"), "{labels}");
135추가: assert!(!labels.contains("이름 바꿔 저장:"), "{labels}");
136추가: }
127137 if matches!(scenario.name, "tar-bz2" | "tar-xz") {
128138 assert!(app.model.entries.iter().all(|entry| !entry.encrypted));
129139 assert_eq!(
@@ -202,6 +212,93 @@ fn preview_ignores_password_submission() {
202212 assert!(preview.0.model.busy());
203213}
204214
215추가: fn result_labels(
216추가: app: &mut zipelo_ui_memory_app::archive_screen::ArchiveApp,
217추가: size: egui::Vec2,
218추가: ) -> String {
219추가: let ctx = egui::Context::default();
220추가: let mut labels = String::new();
221추가: for _ in 0..3 {
222추가: let mut output = ctx.run_ui(
223추가: egui::RawInput {
224추가: screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, size)),
225추가: ..Default::default()
226추가: },
227추가: |ui| app.show(ui),
228추가: );
229추가: labels = text(&output.shapes);
230추가: output.textures_delta.clear();
231추가: }
232추가: labels
233추가: }
234추가:
235추가: #[test]
236추가: fn rename_without_created_output_never_claims_saved_name() {
237추가: use zipelo_ui_memory_app::archive_ui::*;
238추가: for size in [egui::vec2(1060.0, 720.0), egui::vec2(760.0, 540.0)] {
239추가: for disposition in [
240추가: None,
241추가: Some(Disposition::PartialRetained),
242추가: Some(Disposition::Removed),
243추가: Some(Disposition::CommitUncertain),
244추가: ] {
245추가: let mut app = scenarios::parse("extract-renamed").unwrap().build();
246추가: app.model.outputs = disposition
247추가: .into_iter()
248추가: .map(|d| ("읽어주세요 (1).txt".into(), d))
249추가: .collect();
250추가: app.model.terminal = Some(Terminal {
251추가: outcome: Outcome::Failed,
252추가: error: Some(ErrorCode::Io),
253추가: publication: if disposition.is_none() {
254추가: Publication::None
255추가: } else {
256추가: Publication::Uncertain
257추가: },
258추가: created_count: 0,
259추가: retained_partial_count: 0,
260추가: durability: Durability::NotApplicable,
261추가: cleanup: Cleanup::Complete,
262추가: });
263추가: let labels = result_labels(&mut app, size);
264추가: assert!(labels.contains("파일을 읽거나 쓰지 못했습니다"), "{labels}");
265추가: if disposition.is_none() {
266추가: assert!(labels.contains("아무 파일도 풀지 않았습니다"), "{labels}");
267추가: }
268추가: assert!(
269추가: !labels.contains("이름 바꿔 저장: 읽어주세요 (1).txt"),
270추가: "{labels}"
271추가: );
272추가: }
273추가: }
274추가: }
275추가:
276추가: #[test]
277추가: fn rename_saved_before_later_failure_remains_reported() {
278추가: use zipelo_ui_memory_app::archive_ui::*;
279추가: for size in [egui::vec2(1060.0, 720.0), egui::vec2(760.0, 540.0)] {
280추가: let mut app = scenarios::parse("extract-renamed").unwrap().build();
281추가: app.model.resolutions.push(Resolution {
282추가: entry_id: 2,
283추가: relative_name: "여행 일정 (1).pdf".into(),
284추가: choice: ConflictChoice::Rename,
285추가: });
286추가: app.model.terminal.as_mut().unwrap().outcome = Outcome::Failed;
287추가: app.model.terminal.as_mut().unwrap().error = Some(ErrorCode::Io);
288추가: app.model.terminal.as_mut().unwrap().publication = Publication::Partial;
289추가: let labels = result_labels(&mut app, size);
290추가: assert!(
291추가: labels.contains("이름 바꿔 저장: 읽어주세요 (1).txt"),
292추가: "{labels}"
293추가: );
294추가: assert!(
295추가: !labels.contains("이름 바꿔 저장: 여행 일정 (1).pdf"),
296추가: "{labels}"
297추가: );
298추가: assert!(labels.contains("파일을 읽거나 쓰지 못했습니다"), "{labels}");
299추가: }
300추가: }
301추가:
205302fn resource_frame(
206303 app: &mut zipelo_ui_memory_app::archive_screen::ArchiveApp,
207304 ctx: &egui::Context,
수정tests/rust-app-ui/scenarios.rs+91-4
@@ -25,6 +25,12 @@ catalog! {
2525 "resource-ratio" => "고압축 작업 경고와 미확인 값",
2626 "resource-retry" => "주 창 모달에서 출력 없는 한도 실패 후 확대 재시도",
2727 "resource-partial" => "주 창 모달에서 일부 출력 후 한도 중단",
28추가: "gzip-conflict-choice" => "단일 GZ 파일의 충돌 선택",
29추가: "conflict-choice" => "같은 이름 파일의 세 가지 처리 선택",
30추가: "conflict-apply" => "남은 충돌에 같은 선택 적용",
31추가: "extract-skipped" => "모든 파일을 건너뛴 정상 완료",
32추가: "extract-renamed" => "이름을 바꿔 저장한 완료 결과",
33추가: "extract-rename-failed" => "새 이름을 정한 뒤 저장 전 I/O 실패",
2834 "empty" => "빈 첫 화면",
2935 "archive" => "폴더와 파일이 있는 압축파일",
3036 "tar-bz2" => "TAR.BZ2 목록과 자동 해제 폴더",
@@ -169,7 +175,7 @@ impl Scenario {
169175 return app;
170176 }
171177 let archive = base.join(match self.name {
172삭제: "gzip-conflict" => "여행 자료.gz",
178추가: "gzip-conflict" | "gzip-conflict-choice" => "여행 자료.gz",
173179 "tar-bz2" => "여행 자료.TAR.BZ2",
174180 "tar-xz" => "여행 자료.TaR.Xz",
175181 _ => "여행 자료.zip",
@@ -247,7 +253,7 @@ impl Scenario {
247253 }
248254 let creating = self.name.starts_with("create-") || self.name == "password-create";
249255 let listing_error = matches!(self.name, "unsupported" | "damaged");
250삭제: if self.name == "gzip-conflict" {
256추가: if matches!(self.name, "gzip-conflict" | "gzip-conflict-choice") {
251257 app.model.list_id.as_mut().unwrap().format = Format::Gzip;
252258 app.model.entries = vec![Entry {
253259 id: 0,
@@ -274,12 +280,13 @@ impl Scenario {
274280 destination: app.destination.clone(),
275281 selection: Selection::All,
276282 list_id: app.model.list_id.clone().unwrap(),
277삭제: gzip_output_name: (self.name == "gzip-conflict").then(|| app.gzip_name.clone()),
283추가: gzip_output_name: (matches!(self.name, "gzip-conflict" | "gzip-conflict-choice"))
284추가: .then(|| app.gzip_name.clone()),
278285 }
279286 };
280287 app.targets = Some(if creating {
281288 BTreeSet::from(["여행 자료.zip".into()])
282삭제: } else if self.name == "gzip-conflict" {
289추가: } else if matches!(self.name, "gzip-conflict" | "gzip-conflict-choice") {
283290 BTreeSet::from(["여행 자료".into()])
284291 } else {
285292 BTreeSet::from([
@@ -289,6 +296,13 @@ impl Scenario {
289296 "사진/풍경.jpg".into(),
290297 ])
291298 });
299추가: if matches!(
300추가: self.name,
301추가: "extract-skipped" | "extract-renamed" | "extract-rename-failed"
302추가: ) {
303추가: app.targets = Some(["읽어주세요.txt".into()].into_iter().collect());
304추가: app.directories.clear();
305추가: }
292306 if self.name == "resource-approval" {
293307 app.model.entries[1].bytes = Some(17 * 1024 * 1024 * 1024);
294308 }
@@ -354,6 +368,75 @@ impl Scenario {
354368 HostEvent::Exited { success: true },
355369 ]);
356370 }
371추가: "conflict-choice" | "conflict-apply" | "gzip-conflict-choice" => {
372추가: state.frame(Event::ConflictRequired(Conflict {
373추가: challenge_id: 29,
374추가: entry_id: if self.name == "gzip-conflict-choice" {
375추가: 0
376추가: } else {
377추가: 1
378추가: },
379추가: relative_name: if self.name == "gzip-conflict-choice" {
380추가: "여행 자료"
381추가: } else {
382추가: "읽어주세요.txt"
383추가: }
384추가: .into(),
385추가: incoming_size: 1_287_952,
386추가: existing_size: 2048,
387추가: }));
388추가: }
389추가: "extract-skipped" | "extract-renamed" | "extract-rename-failed" => {
390추가: let failed = self.name == "extract-rename-failed";
391추가: let skip = self.name == "extract-skipped";
392추가: let name = if skip {
393추가: "읽어주세요.txt"
394추가: } else {
395추가: "읽어주세요 (1).txt"
396추가: };
397추가: state.frame(Event::ConflictResolved(Resolution {
398추가: entry_id: 1,
399추가: relative_name: name.into(),
400추가: choice: if skip {
401추가: ConflictChoice::Skip
402추가: } else {
403추가: ConflictChoice::Rename
404추가: },
405추가: }));
406추가: if !skip && !failed {
407추가: state.frame(Event::Output {
408추가: entry_id: Some(1),
409추가: relative_name: name.into(),
410추가: disposition: Disposition::Created,
411추가: });
412추가: }
413추가: state.frame(Event::Terminal(Terminal {
414추가: outcome: if failed {
415추가: Outcome::Failed
416추가: } else {
417추가: Outcome::Completed
418추가: },
419추가: error: failed.then_some(ErrorCode::Io),
420추가: publication: if skip || failed {
421추가: Publication::None
422추가: } else {
423추가: Publication::Complete
424추가: },
425추가: created_count: u64::from(!skip && !failed),
426추가: retained_partial_count: 0,
427추가: durability: if skip || failed {
428추가: Durability::NotApplicable
429추가: } else {
430추가: Durability::Synced
431추가: },
432추가: cleanup: Cleanup::Complete,
433추가: }));
434추가: state.queue.extend([
435추가: HostEvent::StdoutEof,
436추가: HostEvent::StderrEof,
437추가: HostEvent::Exited { success: true },
438추가: ]);
439추가: }
357440 "password" | "password-retry" | "password-create" => {
358441 state.frame(Event::PasswordRequired {
359442 challenge_id: 17,
@@ -456,6 +539,10 @@ impl Scenario {
456539 for _ in 0..64 {
457540 app.model.poll();
458541 }
542추가: if self.name == "conflict-apply" {
543추가: app.conflict_challenge = Some((app.model.job_id().unwrap(), 29));
544추가: app.conflict_apply = true;
545추가: }
459546 if self.name == "extract-unsynced" {
460547 app.details = true;
461548 }