team-ljyzipelo

공개

앱의 7z 형식 변환과 프로토콜 왕복 시험을 추가함

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

변경된 파일 19개

+1,804-33
수정experiments/rust-ui-memory-app/Cargo.lock+9-0
@@ -3948,6 +3948,14 @@ dependencies = [
39483948 "zipelo-rust-memory-zip-create",
39493949]
39503950
3951추가: [[package]]
3952추가: name = "zipelo-archive-worker"
3953추가: version = "0.1.0"
3954추가: dependencies = [
3955추가: "sha2",
3956추가: "zlib-rs",
3957추가: ]
3958추가:
39513959[[package]]
39523960name = "zipelo-memory-gzip-reader"
39533961version = "0.1.0"
@@ -3976,6 +3984,7 @@ version = "0.1.0"
39763984dependencies = [
39773985 "eframe",
39783986 "zipelo-app-core-memory",
3987추가: "zipelo-archive-worker",
39793988]
39803989
39813990[[package]]
수정experiments/rust-ui-memory-app/Cargo.toml+9-0
@@ -18,6 +18,7 @@ ui = ["dep:eframe"]
1818ui-fixture = ["ui"]
1919
2020[dependencies]
21추가: worker_protocol = { package = "zipelo-archive-worker", path = "../rust-archive-worker" }
2122core_memory = { package = "zipelo-app-core-memory", path = "../rust-app-core-memory" }
2223eframe = { version = "=0.37.0", optional = true, default-features = false, features = ["accesskit", "clipboard", "glow", "system_fonts", "wayland", "x11"] }
2324
@@ -33,3 +34,11 @@ path = "../../tests/rust-ui-memory-app/regressions.rs"
3334[[test]]
3435name = "archive_ui"
3536path = "../../tests/rust-app-ui/regressions.rs"
37추가:
38추가: [[test]]
39추가: name = "real_worker"
40추가: path = "../../tests/rust-app-real-worker/flows.rs"
41추가:
42추가: [[test]]
43추가: name = "format_contract"
44추가: path = "../../tests/rust-app-real-worker/formats.rs"
추가experiments/rust-ui-memory-app/src/archive_process.rs+677-0
@@ -0,0 +1,677 @@
1추가: use crate::archive_ui as ui;
2추가: use std::{
3추가: cell::RefCell,
4추가: io::{self, Read, Write},
5추가: path::PathBuf,
6추가: process::{Command, Stdio},
7추가: rc::Rc,
8추가: sync::{
9추가: Arc, Mutex,
10추가: atomic::{AtomicBool, Ordering},
11추가: mpsc::{self, Receiver, SyncSender},
12추가: },
13추가: thread::{self, JoinHandle},
14추가: time::{Duration, Instant},
15추가: };
16추가: use worker_protocol::{protocol as wire, wire as codec};
17추가:
18추가: macro_rules! convert_enum {
19추가: ($name:ident, $from:ty, $to:ty, $($variant:ident),+) => {
20추가: fn $name(value: $from) -> $to {
21추가: match value { $(<$from>::$variant => <$to>::$variant),+ }
22추가: }
23추가: };
24추가: }
25추가: convert_enum!(
26추가: format_to_wire,
27추가: ui::Format,
28추가: wire::Format,
29추가: Zip,
30추가: Tar,
31추가: Gzip,
32추가: TarGzip,
33추가: SevenZip
34추가: );
35추가: convert_enum!(
36추가: format_to_ui,
37추가: wire::Format,
38추가: ui::Format,
39추가: Zip,
40추가: Tar,
41추가: Gzip,
42추가: TarGzip,
43추가: SevenZip
44추가: );
45추가: convert_enum!(
46추가: kind_to_ui,
47추가: wire::EntryKind,
48추가: ui::Kind,
49추가: File,
50추가: Directory,
51추가: Link,
52추가: Other
53추가: );
54추가: convert_enum!(
55추가: stage_to_ui,
56추가: wire::Stage,
57추가: ui::Stage,
58추가: Scan,
59추가: Read,
60추가: Decode,
61추가: Write,
62추가: Verify,
63추가: Commit
64추가: );
65추가: convert_enum!(
66추가: disposition_to_ui,
67추가: wire::Disposition,
68추가: ui::Disposition,
69추가: Created,
70추가: PartialRetained,
71추가: Removed,
72추가: CommitUncertain
73추가: );
74추가: convert_enum!(
75추가: outcome_to_ui,
76추가: wire::Outcome,
77추가: ui::Outcome,
78추가: Completed,
79추가: Failed,
80추가: Cancelled
81추가: );
82추가: convert_enum!(
83추가: publication_to_ui,
84추가: wire::Publication,
85추가: ui::Publication,
86추가: None,
87추가: Partial,
88추가: Complete,
89추가: Uncertain
90추가: );
91추가: convert_enum!(
92추가: durability_to_ui,
93추가: wire::Durability,
94추가: ui::Durability,
95추가: NotApplicable,
96추가: Synced,
97추가: Unconfirmed,
98추가: Failed
99추가: );
100추가: convert_enum!(
101추가: cleanup_to_ui,
102추가: wire::Cleanup,
103추가: ui::Cleanup,
104추가: Complete,
105추가: Failed,
106추가: Unconfirmed
107추가: );
108추가: convert_enum!(
109추가: cancel_to_ui,
110추가: wire::CancelStatus,
111추가: ui::CancelStatus,
112추가: Requested,
113추가: AlreadyRequested,
114추가: TooLate,
115추가: Finished
116추가: );
117추가: fn list_to_wire(id: ui::ListId) -> wire::ListId {
118추가: wire::ListId {
119추가: catalog_version: id.catalog_version,
120추가: format: format_to_wire(id.format),
121추가: source_object: match id.source_object {
122추가: ui::SourceObject::Unix { device, inode } => wire::SourceObject::Unix { device, inode },
123추가: ui::SourceObject::Windows { volume, file_id } => wire::SourceObject::Windows {
124추가: volume_serial: volume,
125추가: file_id,
126추가: },
127추가: },
128추가: archive_bytes: id.archive_bytes,
129추가: archive_sha256: id.archive_sha256,
130추가: }
131추가: }
132추가: fn list_to_ui(id: wire::ListId) -> ui::ListId {
133추가: ui::ListId {
134추가: catalog_version: id.catalog_version,
135추가: format: format_to_ui(id.format),
136추가: source_object: match id.source_object {
137추가: wire::SourceObject::Unix { device, inode } => ui::SourceObject::Unix { device, inode },
138추가: wire::SourceObject::Windows {
139추가: volume_serial,
140추가: file_id,
141추가: } => ui::SourceObject::Windows {
142추가: volume: volume_serial,
143추가: file_id,
144추가: },
145추가: },
146추가: archive_bytes: id.archive_bytes,
147추가: archive_sha256: id.archive_sha256,
148추가: }
149추가: }
150추가: fn start_to_wire(start: ui::Start) -> wire::Start {
151추가: let action = match start {
152추가: ui::Start::List { archive } => wire::Action::List {
153추가: archive: wire::NativePath::from_path(&archive),
154추가: },
155추가: ui::Start::Extract {
156추가: archive,
157추가: destination,
158추가: selection,
159추가: list_id,
160추가: gzip_output_name,
161추가: } => wire::Action::Extract {
162추가: archive: wire::NativePath::from_path(&archive),
163추가: destination: wire::NativePath::from_path(&destination),
164추가: selection: match selection {
165추가: ui::Selection::All => wire::Selection::All,
166추가: ui::Selection::EntryIds(ids) => wire::Selection::EntryIds(ids),
167추가: },
168추가: list_id: Some(list_to_wire(list_id)),
169추가: gzip_output_name,
170추가: },
171추가: ui::Start::CreateZip {
172추가: sources,
173추가: output_file,
174추가: method,
175추가: aes256,
176추가: } => wire::Action::CreateZip {
177추가: sources: sources
178추가: .into_iter()
179추가: .map(|(path, archive_name)| wire::Source {
180추가: path: wire::NativePath::from_path(&path),
181추가: archive_name,
182추가: })
183추가: .collect(),
184추가: output_file: wire::NativePath::from_path(&output_file),
185추가: method: match method {
186추가: ui::Method::Store => wire::Method::Store,
187추가: ui::Method::Deflate => wire::Method::Deflate,
188추가: },
189추가: encryption: if aes256 {
190추가: wire::Encryption::Aes256
191추가: } else {
192추가: wire::Encryption::None
193추가: },
194추가: },
195추가: };
196추가: wire::Start {
197추가: action,
198추가: limits: wire::Limits::default(),
199추가: }
200추가: }
201추가: fn error_to_ui(error: wire::ErrorCode) -> Option<ui::ErrorCode> {
202추가: Some(match error {
203추가: wire::ErrorCode::None => return None,
204추가: wire::ErrorCode::Integrity => ui::ErrorCode::Integrity,
205추가: wire::ErrorCode::UnsupportedFormat => ui::ErrorCode::UnsupportedFormat,
206추가: wire::ErrorCode::UnsupportedFeature => ui::ErrorCode::UnsupportedFeature,
207추가: wire::ErrorCode::WrongPassword => ui::ErrorCode::WrongPassword,
208추가: wire::ErrorCode::UnsafePath => ui::ErrorCode::UnsafePath,
209추가: wire::ErrorCode::Conflict => ui::ErrorCode::Conflict,
210추가: wire::ErrorCode::Limit => ui::ErrorCode::Limit,
211추가: wire::ErrorCode::Io => ui::ErrorCode::Io,
212추가: wire::ErrorCode::Protocol => ui::ErrorCode::Protocol,
213추가: wire::ErrorCode::Internal => ui::ErrorCode::Internal,
214추가: wire::ErrorCode::SourceChanged => ui::ErrorCode::SourceChanged,
215추가: wire::ErrorCode::InvalidRequest => ui::ErrorCode::InvalidRequest,
216추가: })
217추가: }
218추가: fn event_to_ui(
219추가: message: wire::Message,
220추가: expected: Option<wire::ActionKind>,
221추가: ) -> Result<ui::Event, ()> {
222추가: Ok(match message {
223추가: wire::Message::Accepted { action, encryption } if expected == Some(action) => {
224추가: ui::Event::Accepted { encryption }
225추가: }
226추가: wire::Message::Entry(entry) => ui::Event::Entry(ui::Entry {
227추가: id: entry.entry_id,
228추가: name: entry.name,
229추가: kind: kind_to_ui(entry.kind),
230추가: bytes: Some(entry.size),
231추가: packed: Some(entry.compressed_size),
232추가: encrypted: entry.encrypted,
233추가: }),
234추가: wire::Message::ListEnd {
235추가: entry_count,
236추가: list_id,
237추가: } => ui::Event::ListEnd {
238추가: entry_count,
239추가: list_id: list_to_ui(list_id),
240추가: },
241추가: wire::Message::PasswordRequired {
242추가: challenge_id,
243추가: attempt,
244추가: purpose,
245추가: } => ui::Event::PasswordRequired {
246추가: challenge_id,
247추가: attempt,
248추가: encrypt: purpose == wire::PasswordPurpose::Encrypt,
249추가: },
250추가: wire::Message::Progress {
251추가: stage,
252추가: processed_bytes,
253추가: total_bytes,
254추가: completed_entries,
255추가: } => ui::Event::Progress {
256추가: stage: stage_to_ui(stage),
257추가: processed: processed_bytes,
258추가: total: total_bytes,
259추가: completed_entries: completed_entries.into(),
260추가: },
261추가: wire::Message::Output {
262추가: entry_id,
263추가: relative_name,
264추가: disposition,
265추가: } => ui::Event::Output {
266추가: entry_id,
267추가: relative_name,
268추가: disposition: disposition_to_ui(disposition),
269추가: },
270추가: wire::Message::CancelAck {
271추가: request_sequence,
272추가: status,
273추가: } => ui::Event::CancelAck {
274추가: request_sequence,
275추가: status: cancel_to_ui(status),
276추가: },
277추가: wire::Message::Terminal(terminal) => ui::Event::Terminal(ui::Terminal {
278추가: outcome: outcome_to_ui(terminal.outcome),
279추가: error: error_to_ui(terminal.error),
280추가: publication: publication_to_ui(terminal.publication),
281추가: created_count: terminal.created_count,
282추가: retained_partial_count: terminal.retained_partial_count,
283추가: durability: durability_to_ui(terminal.durability),
284추가: cleanup: cleanup_to_ui(terminal.cleanup),
285추가: }),
286추가: _ => return Err(()),
287추가: })
288추가: }
289추가:
290추가: // 실제 파이프 쓰기는 백그라운드에서 수행하고 UI에서는 한 프레임만 직렬화함.
291추가: #[derive(Clone, Default)]
292추가: struct FrameBuffer(Rc<RefCell<Vec<u8>>>);
293추가: impl Write for FrameBuffer {
294추가: fn write(&mut self, bytes: &[u8]) -> io::Result<usize> {
295추가: let mut buffer = self.0.borrow_mut();
296추가: if buffer.len().saturating_add(bytes.len()) > codec::MAX_BODY + 32 {
297추가: return Err(io::Error::other("요청 프레임 한도 초과"));
298추가: }
299추가: buffer.extend_from_slice(bytes);
300추가: Ok(bytes.len())
301추가: }
302추가: fn flush(&mut self) -> io::Result<()> {
303추가: Ok(())
304추가: }
305추가: }
306추가: struct Frame(Vec<u8>, bool);
307추가: impl Drop for Frame {
308추가: fn drop(&mut self) {
309추가: self.0.fill(0);
310추가: }
311추가: }
312추가: fn notify(events: &SyncSender<ui::HostEvent>, event: ui::HostEvent) -> bool {
313추가: events.send(event).is_ok()
314추가: }
315추가: fn fault(events: &SyncSender<ui::HostEvent>, stop: &AtomicBool, message: &str) {
316추가: stop.store(true, Ordering::Release);
317추가: notify(events, ui::HostEvent::Fault(message.into()));
318추가: }
319추가:
320추가: pub struct ProcessFactory {
321추가: worker: PathBuf,
322추가: }
323추가: impl ProcessFactory {
324추가: pub fn new(worker: PathBuf) -> Self {
325추가: Self { worker }
326추가: }
327추가: pub fn sibling() -> Result<Self, String> {
328추가: let executable =
329추가: std::env::current_exe().map_err(|_| "앱 실행 위치를 확인하지 못했습니다")?;
330추가: let parent = executable.parent().ok_or("앱 실행 폴더가 없습니다")?;
331추가: Ok(Self::new(parent.join(if cfg!(windows) {
332추가: "zipelo-archive-worker.exe"
333추가: } else {
334추가: "zipelo-archive-worker"
335추가: })))
336추가: }
337추가: }
338추가: impl ui::Factory for ProcessFactory {
339추가: fn connect(&mut self, job_id: u64) -> Result<Box<dyn ui::Connection>, String> {
340추가: if !self.worker.is_absolute() || job_id == 0 {
341추가: return Err("작업자 경로 또는 작업 ID가 올바르지 않습니다".into());
342추가: }
343추가: let (send, requests) = mpsc::sync_channel::<Frame>(8);
344추가: let (events, receive) = mpsc::sync_channel(64);
345추가: let (ready, started) = mpsc::sync_channel(1);
346추가: let stop = Arc::new(AtomicBool::new(false));
347추가: let done = Arc::new(AtomicBool::new(false));
348추가: let expected = Arc::new(Mutex::new(None));
349추가: let worker = self.worker.clone();
350추가: let worker_stop = stop.clone();
351추가: let worker_done = done.clone();
352추가: let worker_expected = expected.clone();
353추가: let supervisor = thread::Builder::new()
354추가: .name("zipelo-worker-owner".into())
355추가: .spawn(move || {
356추가: let mut command = Command::new(worker);
357추가: command
358추가: .stdin(Stdio::piped())
359추가: .stdout(Stdio::piped())
360추가: .stderr(Stdio::piped());
361추가: #[cfg(windows)]
362추가: {
363추가: use std::os::windows::process::CommandExt;
364추가: command.creation_flags(0x08000000);
365추가: }
366추가: let child = match command.spawn() {
367추가: Ok(child) => child,
368추가: Err(_) => {
369추가: let _ = ready.send(Err(
370추가: "작업자를 실행하지 못했습니다. 앱과 작업자를 함께 설치하세요"
371추가: .to_string(),
372추가: ));
373추가: return;
374추가: }
375추가: };
376추가: if ready.send(Ok(())).is_err() {
377추가: let mut child = child;
378추가: let _ = child.kill();
379추가: let _ = child.wait();
380추가: return;
381추가: }
382추가: supervise(
383추가: child,
384추가: job_id,
385추가: requests,
386추가: events,
387추가: worker_stop,
388추가: worker_done,
389추가: worker_expected,
390추가: );
391추가: })
392추가: .map_err(|_| "작업자 관리 스레드를 시작하지 못했습니다")?;
393추가: match started.recv() {
394추가: Ok(Ok(())) => {
395추가: let buffer = FrameBuffer::default();
396추가: Ok(Box::new(ProcessConnection {
397추가: job_id,
398추가: next: 0,
399추가: writer: codec::Writer::new(buffer.clone(), job_id),
400추가: buffer,
401추가: send: Some(send),
402추가: receive: Some(receive),
403추가: stop,
404추가: supervisor: Some(supervisor),
405추가: expected,
406추가: done,
407추가: disconnected: false,
408추가: reaped: false,
409추가: }))
410추가: }
411추가: result => {
412추가: stop.store(true, Ordering::Release);
413추가: drop(send);
414추가: drop(receive);
415추가: let _ = supervisor.join();
416추가: Err(result
417추가: .ok()
418추가: .and_then(Result::err)
419추가: .unwrap_or_else(|| "작업자 시작 결과가 없습니다".into()))
420추가: }
421추가: }
422추가: }
423추가: }
424추가: struct ProcessConnection {
425추가: job_id: u64,
426추가: next: u64,
427추가: writer: codec::Writer<FrameBuffer>,
428추가: buffer: FrameBuffer,
429추가: send: Option<SyncSender<Frame>>,
430추가: receive: Option<Receiver<ui::HostEvent>>,
431추가: stop: Arc<AtomicBool>,
432추가: supervisor: Option<JoinHandle<()>>,
433추가: expected: Arc<Mutex<Option<wire::ActionKind>>>,
434추가: done: Arc<AtomicBool>,
435추가: disconnected: bool,
436추가: reaped: bool,
437추가: }
438추가: impl ui::Connection for ProcessConnection {
439추가: fn send(&mut self, request: ui::Request) -> Result<(), String> {
440추가: if self.stop.load(Ordering::Acquire)
441추가: || request.job_id != self.job_id
442추가: || request.sequence != self.next
443추가: || self.next >= codec::MAX_FRAMES
444추가: {
445추가: self.stop.store(true, Ordering::Release);
446추가: return Err("작업자 요청 채널이 닫혔거나 순서가 올바르지 않습니다".into());
447추가: }
448추가: let is_cancel = matches!(request.command, ui::Command::Cancel);
449추가: let message = match request.command {
450추가: ui::Command::Start(start) => {
451추가: let start = start_to_wire(start);
452추가: *self.expected.lock().map_err(|_| {
453추가: self.stop.store(true, Ordering::Release);
454추가: "작업자 요청 상태 오류"
455추가: })? = Some(start.action.kind());
456추가: wire::Message::Start(start)
457추가: }
458추가: ui::Command::Cancel => wire::Message::Cancel,
459추가: ui::Command::Password {
460추가: challenge_id,
461추가: secret,
462추가: } => wire::Message::Password {
463추가: challenge_id,
464추가: secret: wire::Secret(secret.as_bytes().to_vec()),
465추가: },
466추가: };
467추가: if self.writer.send(&message).is_err() {
468추가: self.buffer.0.borrow_mut().fill(0);
469추가: self.buffer.0.borrow_mut().clear();
470추가: self.stop.store(true, Ordering::Release);
471추가: return Err("작업자 요청을 직렬화하지 못했습니다".into());
472추가: }
473추가: let bytes = Frame(std::mem::take(&mut *self.buffer.0.borrow_mut()), is_cancel);
474추가: if self.send.as_ref().unwrap().try_send(bytes).is_err() {
475추가: if is_cancel && self.done.load(Ordering::Acquire) {
476추가: self.next += 1;
477추가: return Ok(());
478추가: }
479추가: self.stop.store(true, Ordering::Release);
480추가: return Err("작업자 요청 대기열이 닫혔거나 가득 찼습니다".into());
481추가: }
482추가: self.next += 1;
483추가: Ok(())
484추가: }
485추가: fn poll(&mut self) -> Option<ui::HostEvent> {
486추가: match self.receive.as_ref()?.try_recv() {
487추가: Ok(event) => {
488추가: if matches!(event, ui::HostEvent::Exited { .. }) {
489추가: self.reaped = true;
490추가: }
491추가: Some(event)
492추가: }
493추가: Err(mpsc::TryRecvError::Empty) => None,
494추가: Err(mpsc::TryRecvError::Disconnected) if !self.reaped && !self.disconnected => {
495추가: self.disconnected = true;
496추가: Some(ui::HostEvent::Fault(
497추가: "작업자 통신 스레드가 종료됐습니다".into(),
498추가: ))
499추가: }
500추가: Err(_) => None,
501추가: }
502추가: }
503추가: }
504추가: impl Drop for ProcessConnection {
505추가: fn drop(&mut self) {
506추가: self.stop.store(true, Ordering::Release);
507추가: self.send.take();
508추가: self.receive.take();
509추가: if let Some(supervisor) = self.supervisor.take() {
510추가: let _ = supervisor.join();
511추가: }
512추가: }
513추가: }
514추가:
515추가: fn supervise(
516추가: mut child: std::process::Child,
517추가: job_id: u64,
518추가: requests: Receiver<Frame>,
519추가: events: SyncSender<ui::HostEvent>,
520추가: stop: Arc<AtomicBool>,
521추가: done: Arc<AtomicBool>,
522추가: expected: Arc<Mutex<Option<wire::ActionKind>>>,
523추가: ) {
524추가: let mut input = child.stdin.take().unwrap();
525추가: let mut output = child.stdout.take().unwrap();
526추가: let mut errors = child.stderr.take().unwrap();
527추가: let mut threads = Vec::new();
528추가: let cancel_write_failed = Arc::new(AtomicBool::new(false));
529추가: let terminal_received = Arc::new(AtomicBool::new(false));
530추가: let failed_cancel = cancel_write_failed.clone();
531추가: let tx = events.clone();
532추가: let abort = stop.clone();
533추가: let finished = done.clone();
534추가: threads.push(
535추가: thread::Builder::new()
536추가: .name("zipelo-worker-input".into())
537추가: .spawn(move || {
538추가: while !finished.load(Ordering::Acquire) && !abort.load(Ordering::Acquire) {
539추가: match requests.recv_timeout(Duration::from_millis(10)) {
540추가: Ok(frame) => {
541추가: if input
542추가: .write_all(&frame.0)
543추가: .and_then(|_| input.flush())
544추가: .is_err()
545추가: {
546추가: if frame.1 {
547추가: // 취소 쓰기 실패는 응답과 실제 종료 결과를 확인한 뒤 판단함.
548추가: failed_cancel.store(true, Ordering::Release);
549추가: } else {
550추가: fault(&tx, &abort, "작업자 요청 파이프 쓰기에 실패했습니다");
551추가: }
552추가: break;
553추가: }
554추가: }
555추가: Err(mpsc::RecvTimeoutError::Timeout) => {}
556추가: Err(_) => break,
557추가: }
558추가: }
559추가: }),
560추가: );
561추가: let tx = events.clone();
562추가: let abort = stop.clone();
563추가: let received_terminal = terminal_received.clone();
564추가: threads.push(
565추가: thread::Builder::new()
566추가: .name("zipelo-worker-output".into())
567추가: .spawn(move || {
568추가: let eof;
569추가: {
570추가: let mut reader = codec::Reader::new(&mut output);
571추가: eof = loop {
572추가: match reader.read() {
573추가: Ok(Some((job, sequence, message))) => {
574추가: let action = expected.lock().ok().and_then(|value| *value);
575추가: let event = event_to_ui(message, action);
576추가: if job != job_id || event.is_err() {
577추가: fault(&tx, &abort, "작업자 응답이 요청과 일치하지 않습니다");
578추가: break false;
579추가: }
580추가: if matches!(event, Ok(ui::Event::Terminal(_))) {
581추가: received_terminal.store(true, Ordering::Release);
582추가: }
583추가: if !notify(
584추가: &tx,
585추가: ui::HostEvent::Frame {
586추가: job_id: job,
587추가: sequence,
588추가: event: event.unwrap(),
589추가: },
590추가: ) {
591추가: return;
592추가: }
593추가: }
594추가: Ok(None) => break true,
595추가: Err(_) => {
596추가: fault(&tx, &abort, "작업자 응답 프레임을 읽지 못했습니다");
597추가: break false;
598추가: }
599추가: }
600추가: };
601추가: }
602추가: if eof || io::copy(&mut output, &mut io::sink()).is_ok() {
603추가: notify(&tx, ui::HostEvent::StdoutEof);
604추가: }
605추가: }),
606추가: );
607추가: let tx = events.clone();
608추가: let abort = stop.clone();
609추가: threads.push(
610추가: thread::Builder::new()
611추가: .name("zipelo-worker-errors".into())
612추가: .spawn(move || {
613추가: let mut bytes = [0u8; 4096];
614추가: loop {
615추가: match errors.read(&mut bytes) {
616추가: Ok(0) => {
617추가: notify(&tx, ui::HostEvent::StderrEof);
618추가: break;
619추가: }
620추가: Ok(_) => {}
621추가: Err(error) if error.kind() == io::ErrorKind::Interrupted => {}
622추가: Err(_) => {
623추가: fault(&tx, &abort, "작업자 오류 파이프를 읽지 못했습니다");
624추가: break;
625추가: }
626추가: }
627추가: }
628추가: }),
629추가: );
630추가: let mut handles = Vec::new();
631추가: for result in threads {
632추가: match result {
633추가: Ok(handle) => handles.push(handle),
634추가: Err(_) => fault(&events, &stop, "작업자 통신 스레드를 시작하지 못했습니다"),
635추가: }
636추가: }
637추가: let started = Instant::now();
638추가: let status = loop {
639추가: if started.elapsed() >= Duration::from_secs(310) {
640추가: fault(&events, &stop, "작업자 처리 제한 시간을 초과했습니다");
641추가: }
642추가: if stop.load(Ordering::Acquire) {
643추가: let _ = child.kill();
644추가: }
645추가: match child.try_wait() {
646추가: Ok(Some(status)) => break Some(status),
647추가: Ok(None) => thread::sleep(Duration::from_millis(10)),
648추가: Err(_) => {
649추가: fault(&events, &stop, "작업자 종료 상태를 확인하지 못했습니다");
650추가: let _ = child.kill();
651추가: break child.wait().ok();
652추가: }
653추가: }
654추가: };
655추가: done.store(true, Ordering::Release);
656추가: for handle in handles {
657추가: if handle.join().is_err() {
658추가: fault(&events, &stop, "작업자 통신 스레드 회수에 실패했습니다");
659추가: }
660추가: }
661추가: if cancel_write_failed.load(Ordering::Acquire)
662추가: && !(terminal_received.load(Ordering::Acquire)
663추가: && status.as_ref().is_some_and(|status| status.success()))
664추가: {
665추가: fault(&events, &stop, "작업자 요청 파이프 쓰기에 실패했습니다");
666추가: }
667추가: if let Some(status) = status {
668추가: // 회수와 모든 파이프 핸들 정리가 끝난 뒤에만 닫기 허용 근거를 전달함.
669추가: notify(&events, ui::HostEvent::CleanupComplete);
670추가: notify(
671추가: &events,
672추가: ui::HostEvent::Exited {
673추가: success: status.success(),
674추가: },
675추가: );
676추가: }
677추가: }
수정experiments/rust-ui-memory-app/src/archive_ui.rs+11-4
@@ -6,6 +6,7 @@ pub enum Format {
66 Tar,
77 Gzip,
88 TarGzip,
9추가: SevenZip,
910}
1011#[derive(Clone, Debug, Eq, PartialEq)]
1112pub enum SourceObject {
@@ -200,6 +201,8 @@ pub enum Event {
200201 Terminal(Terminal),
201202}
202203pub enum HostEvent {
204추가: Fault(String),
205추가: CleanupComplete,
203206 Frame {
204207 job_id: u64,
205208 sequence: u64,
@@ -237,6 +240,7 @@ struct Running {
237240 entries: Vec<Entry>,
238241 list_end: Option<(u32, ListId)>,
239242 stdout_eof: bool,
243추가: transport_closed: bool,
240244 stderr_eof: bool,
241245 exit: Option<bool>,
242246 cancel_sequence: Option<u64>,
@@ -380,6 +384,7 @@ impl Model {
380384 entries: Vec::new(),
381385 list_end: None,
382386 stdout_eof: false,
387추가: transport_closed: false,
383388 stderr_eof: false,
384389 exit: None,
385390 cancel_sequence: None,
@@ -509,10 +514,10 @@ impl Model {
509514 };
510515 self.receive(event);
511516 }
512삭제: let complete = self
513삭제: .running
514삭제: .as_ref()
515삭제: .is_some_and(|r| r.stdout_eof && r.stderr_eof && r.exit.is_some());
517추가: let complete = self.running.as_ref().is_some_and(|r| {
518추가: r.exit.is_some()
519추가: && ((r.stdout_eof && r.stderr_eof) || (r.transport_closed && self.error.is_some()))
520추가: });
516521 if complete {
517522 let run = self.running.take().unwrap();
518523 self.confirmed =
@@ -559,6 +564,8 @@ impl Model {
559564 fn receive(&mut self, host: HostEvent) {
560565 let run = self.running.as_mut().unwrap();
561566 match host {
567추가: HostEvent::Fault(message) => self.error = Some(message),
568추가: HostEvent::CleanupComplete => run.transport_closed = true,
562569 HostEvent::StdoutEof => run.stdout_eof = true,
563570 HostEvent::StderrEof => run.stderr_eof = true,
564571 HostEvent::Exited { success } => run.exit = Some(success),
수정experiments/rust-ui-memory-app/src/desktop.rs+4-1
@@ -58,7 +58,10 @@ fn main() -> eframe::Result {
5858 )));
5959 }
6060 } else {
61삭제: Box::new(zipelo_ui_memory_app::archive_ui::Unavailable)
61추가: Box::new(
62추가: zipelo_ui_memory_app::archive_process::ProcessFactory::sibling()
63추가: .map_err(std::io::Error::other)?,
64추가: )
6265 };
6366 Ok(Box::new(
6467 zipelo_ui_memory_app::archive_screen::ArchiveApp::new(factory, startup, fixture),
수정experiments/rust-ui-memory-app/src/lib.rs+2-0
@@ -9,3 +9,5 @@ pub mod archive_ui;
99
1010#[cfg(feature = "ui")]
1111pub mod archive_screen;
12추가:
13추가: pub mod archive_process;
추가tests/rust-app-real-worker/.gitignore+1-0
@@ -0,0 +1 @@
1추가: runs/
추가tests/rust-app-real-worker/Cargo.lock+107-0
@@ -0,0 +1,107 @@
1추가: # This file is automatically @generated by Cargo.
2추가: # It is not intended for manual editing.
3추가: version = 4
4추가:
5추가: [[package]]
6추가: name = "block-buffer"
7추가: version = "0.10.4"
8추가: source = "registry+https://github.com/rust-lang/crates.io-index"
9추가: checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
10추가: dependencies = [
11추가: "generic-array",
12추가: ]
13추가:
14추가: [[package]]
15추가: name = "cfg-if"
16추가: version = "1.0.5"
17추가: source = "registry+https://github.com/rust-lang/crates.io-index"
18추가: checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
19추가:
20추가: [[package]]
21추가: name = "cpufeatures"
22추가: version = "0.2.17"
23추가: source = "registry+https://github.com/rust-lang/crates.io-index"
24추가: checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
25추가: dependencies = [
26추가: "libc",
27추가: ]
28추가:
29추가: [[package]]
30추가: name = "crypto-common"
31추가: version = "0.1.7"
32추가: source = "registry+https://github.com/rust-lang/crates.io-index"
33추가: checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
34추가: dependencies = [
35추가: "generic-array",
36추가: "typenum",
37추가: ]
38추가:
39추가: [[package]]
40추가: name = "digest"
41추가: version = "0.10.7"
42추가: source = "registry+https://github.com/rust-lang/crates.io-index"
43추가: checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
44추가: dependencies = [
45추가: "block-buffer",
46추가: "crypto-common",
47추가: ]
48추가:
49추가: [[package]]
50추가: name = "generic-array"
51추가: version = "0.14.7"
52추가: source = "registry+https://github.com/rust-lang/crates.io-index"
53추가: checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
54추가: dependencies = [
55추가: "typenum",
56추가: "version_check",
57추가: ]
58추가:
59추가: [[package]]
60추가: name = "libc"
61추가: version = "0.2.191"
62추가: source = "registry+https://github.com/rust-lang/crates.io-index"
63추가: checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
64추가:
65추가: [[package]]
66추가: name = "sha2"
67추가: version = "0.10.9"
68추가: source = "registry+https://github.com/rust-lang/crates.io-index"
69추가: checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
70추가: dependencies = [
71추가: "cfg-if",
72추가: "cpufeatures",
73추가: "digest",
74추가: ]
75추가:
76추가: [[package]]
77추가: name = "typenum"
78추가: version = "1.20.1"
79추가: source = "registry+https://github.com/rust-lang/crates.io-index"
80추가: checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
81추가:
82추가: [[package]]
83추가: name = "version_check"
84추가: version = "0.9.5"
85추가: source = "registry+https://github.com/rust-lang/crates.io-index"
86추가: checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
87추가:
88추가: [[package]]
89추가: name = "zipelo-archive-worker"
90추가: version = "0.1.0"
91추가: dependencies = [
92추가: "sha2",
93추가: "zlib-rs",
94추가: ]
95추가:
96추가: [[package]]
97추가: name = "zipelo-real-worker-probe"
98추가: version = "0.1.0"
99추가: dependencies = [
100추가: "zipelo-archive-worker",
101추가: ]
102추가:
103추가: [[package]]
104추가: name = "zlib-rs"
105추가: version = "0.6.8"
106추가: source = "registry+https://github.com/rust-lang/crates.io-index"
107추가: checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"
추가tests/rust-app-real-worker/Cargo.toml+19-0
@@ -0,0 +1,19 @@
1추가: [package]
2추가: name = "zipelo-real-worker-probe"
3추가: version = "0.1.0"
4추가: edition = "2024"
5추가: rust-version = "1.99"
6추가: license = "MIT"
7추가: publish = false
8추가: autotests = false
9추가:
10추가: [workspace]
11추가:
12추가: [dependencies]
13추가: worker_protocol = { package = "zipelo-archive-worker", path = "../../experiments/rust-archive-worker" }
14추가:
15추가: [[bin]]
16추가: name = "zipelo-real-worker-probe"
17추가: path = "probe.rs"
18추가: test = false
19추가: bench = false
추가tests/rust-app-real-worker/README.md+58-0
@@ -0,0 +1,58 @@
1추가: # 실제 작업자와 화면 연결 시험
2추가:
3추가: 기본 앱은 실행 파일과 같은 폴더의 zipelo-archive-worker(Windows는 .exe)를 실행함.
4추가: PATH나 현재 작업 폴더에서 임의 작업자를 검색하지 않음. ui-fixture와 --ui-fixture가
5추가: 모두 지정된 경우에만 기존 가짜 작업자를 사용함.
6추가:
7추가: 클라이언트는 작업자 crate의 protocol과 wire codec을 재사용하며 압축 처리와 파일 접근은
8추가: 별도 작업자 프로세스에서 수행함. UI에서 파이프 쓰기를 기다리지 않도록 8프레임 요청 큐와
9추가: 64이벤트 응답 큐를 사용함. 파이프 입출력과 child wait는 백그라운드에서 처리함.
10추가: 정상 종료에는 Terminal, 양쪽 EOF와 child wait를 모두 확인함. 통신 오류는 성공으로
11추가: 표시하지 않으며, 오류 경로에서는 child 회수와 모든 파이프 스레드/핸들 정리가 끝났다는
12추가: 명시적 완료 신호까지 확인함. 연결이 예외적으로 폐기돼도 소유한 자식을 종료하고 회수함.
13추가: 310초 제한 시간을 넘긴 작업자도 종료와 회수를 시도하며 완료 여부가 불명확하면 닫기를 허용하지 않음.
14추가:
15추가: ## 실행
16추가:
17추가: 저장소 루트에서 로컬 실행기를 사용하면 실제 작업자와 probe 빌드가 화면 시험보다 먼저 수행됨.
18추가:
19추가: ```sh
20추가: python3 tests/ci/run_rust.py local
21추가: ```
22추가:
23추가: 단독 시험에서는 같은 target 디렉터리에 먼저 두 실행 파일을 빌드할 것.
24추가:
25추가: ```sh
26추가: export CARGO_TARGET_DIR="$PWD/tests/ci/target"
27추가: cargo +1.99.1 build --locked --manifest-path experiments/rust-archive-worker/Cargo.toml
28추가: cargo +1.99.1 build --locked --manifest-path tests/rust-app-real-worker/Cargo.toml
29추가: cargo +1.99.1 test --locked --all-features --manifest-path experiments/rust-ui-memory-app/Cargo.toml --test real_worker
30추가: ```
31추가:
32추가: 기본 앱의 직접 실행도 같은 target 디렉터리를 사용할 것.
33추가:
34추가: ```sh
35추가: cargo +1.99.1 run --locked --manifest-path experiments/rust-ui-memory-app/Cargo.toml --features ui -- /absolute/sample.zip
36추가: ```
37추가:
38추가: ## 확인 범위
39추가:
40추가: - 합성 ZIP과 TAR.GZ를 실제 파일 열기 위젯으로 열고 목록을 확인한 뒤 풀기 버튼으로 해제함.
41추가: - ZIP 만들기 위젯으로 합성 파일을 압축하고, 결과를 다시 열고 풀어 바이트가 같은지 확인함.
42추가: - 위 세 흐름은 실제 작업자 EXE와 OS 파이프를 사용하며 Terminal, 양쪽 EOF, child wait와 연결 정리 순서를 관측함.
43추가: - 누락된 작업자, 잘린 프레임, 잘못된 action 승인, Terminal 없는 조기 종료를 오류로 처리함.
44추가: - 첫 Start 직렬화 실패도 실제 작업자 회수까지 대기함. Linux에서는 실행 중인 probe 연결을 폐기한 후 /proc에서 소유 자식이 사라진 것도 확인함.
45추가: - flows.rs의 창은 egui Context에서 실제 위젯에 포인터와 키보드 이벤트를 전달함. 네이티브 OS 창/입력 자동화나 Windows 실행 검증은 아님.
46추가:
47추가: fixtures/는 generate.py의 Python 표준 라이브러리로 생성한 작은 합성 입력임.
48추가: 정상 흐름은 제품 작업자를 사용하고, probe.rs는 통신 실패와 생명주기 시험 전용임.
49추가: 사용자 자료를 읽거나 출력하지 않으며 모든 시험 출력은 이 폴더의 runs/ 안에만 생성함.
50추가: 암호 ZIP, 대용량 성능, OS sandbox, 악성 파일 전체 검증과 Windows 실기는 이 시험의 범위 밖임.
51추가:
52추가: 취소와 종료 경합 회귀 시험은 실제 작업자에 List를 보낸 뒤 화면 poll 전에 취소하는 흐름을 100회 확인함. 취소 파이프 쓰기가 실패해도 검증된 Terminal과 성공 종료가 있으면 원래 결과를 보존하며, Terminal이 없는 조기 종료는 계속 실패로 처리함. 취소 쓰기 오류 판단을 미루어도 EOF와 child wait 전에는 닫기나 작업 교체를 허용하지 않음.
53추가:
54추가: 7z 앱 연동은 revision 2의 기존 Format 값 0~3을 유지하고 SevenZip 값 4를 추가함.
55추가: formats.rs는 전체 ListEnd 프레임을 고정 바이트와 비교하고 Unix/Windows 식별자가
56추가: 목록 응답과 해제 요청 사이에서 보존되는지 확인함. 화면 흐름 시험은 PR69의 LZMA와
57추가: LZMA2 표본을 실제 작업자로 열고, 받은 ListId로 풀어 원본 바이트를 확인함.
58추가: 구버전 앱은 새 형식 값을 해석할 수 없으므로 앱과 작업자를 함께 갱신해야 함.
추가tests/rust-app-real-worker/fixtures/sample.tar.gz

바이너리 파일이라 Diff를 표시하지 않아요.

파일 내려받기
추가tests/rust-app-real-worker/fixtures/sample.zip

바이너리 파일이라 Diff를 표시하지 않아요.

파일 내려받기
추가tests/rust-app-real-worker/flows.rs+552-0
@@ -0,0 +1,552 @@
1추가: use std::{
2추가: cell::RefCell,
3추가: fs,
4추가: path::{Path, PathBuf},
5추가: rc::Rc,
6추가: sync::atomic::{AtomicU64, Ordering},
7추가: time::{Duration, Instant},
8추가: };
9추가: use zipelo_ui_memory_app::{archive_process::ProcessFactory, archive_ui::*};
10추가: static NEXT: AtomicU64 = AtomicU64::new(0);
11추가: struct Scratch(PathBuf);
12추가: impl Scratch {
13추가: fn new() -> Self {
14추가: let root =
15추가: Path::new(env!("CARGO_MANIFEST_DIR")).join("../../tests/rust-app-real-worker/runs");
16추가: fs::create_dir_all(&root).unwrap();
17추가: let path = root.join(format!(
18추가: "{}-{}",
19추가: std::process::id(),
20추가: NEXT.fetch_add(1, Ordering::Relaxed)
21추가: ));
22추가: Self(make_directory(&path))
23추가: }
24추가: fn path(&self, name: &str) -> PathBuf {
25추가: self.0.join(name)
26추가: }
27추가: }
28추가: impl Drop for Scratch {
29추가: fn drop(&mut self) {
30추가: fs::remove_dir_all(&self.0).unwrap();
31추가: }
32추가: }
33추가: fn make_directory(path: &Path) -> PathBuf {
34추가: let mut builder = fs::DirBuilder::new();
35추가: #[cfg(unix)]
36추가: {
37추가: use std::os::unix::fs::DirBuilderExt;
38추가: builder.mode(0o700);
39추가: }
40추가: builder.create(path).unwrap();
41추가: path.canonicalize().unwrap()
42추가: }
43추가: fn binary(name: &str) -> PathBuf {
44추가: let current = std::env::current_exe().unwrap();
45추가: let path = current
46추가: .parent()
47추가: .unwrap()
48추가: .parent()
49추가: .unwrap()
50추가: .join(format!("{name}{}", std::env::consts::EXE_SUFFIX));
51추가: assert!(
52추가: path.is_file(),
53추가: "실제 작업자와 시험 probe를 먼저 빌드해야 함: {}",
54추가: path.display()
55추가: );
56추가: path
57추가: }
58추가: #[derive(Default)]
59추가: struct Observation {
60추가: jobs: Vec<Vec<&'static str>>,
61추가: }
62추가: struct ObservedFactory {
63추가: process: ProcessFactory,
64추가: observed: Rc<RefCell<Observation>>,
65추가: }
66추가: struct ObservedConnection {
67추가: connection: Box<dyn Connection>,
68추가: index: usize,
69추가: observed: Rc<RefCell<Observation>>,
70추가: }
71추가: impl Factory for ObservedFactory {
72추가: fn connect(&mut self, job: u64) -> Result<Box<dyn Connection>, String> {
73추가: let connection = self.process.connect(job)?;
74추가: let index = self.observed.borrow().jobs.len();
75추가: self.observed.borrow_mut().jobs.push(Vec::new());
76추가: Ok(Box::new(ObservedConnection {
77추가: connection,
78추가: index,
79추가: observed: self.observed.clone(),
80추가: }))
81추가: }
82추가: }
83추가: impl Connection for ObservedConnection {
84추가: fn send(&mut self, request: Request) -> Result<(), String> {
85추가: self.connection.send(request)
86추가: }
87추가: fn poll(&mut self) -> Option<HostEvent> {
88추가: let event = self.connection.poll()?;
89추가: let label = match &event {
90추가: HostEvent::StdoutEof => "stdout",
91추가: HostEvent::StderrEof => "stderr",
92추가: HostEvent::Exited { .. } => "wait",
93추가: HostEvent::CleanupComplete => "cleanup",
94추가: HostEvent::Fault(_) => "fault",
95추가: HostEvent::Frame {
96추가: event: Event::Terminal(_),
97추가: ..
98추가: } => "terminal",
99추가: _ => "frame",
100추가: };
101추가: self.observed.borrow_mut().jobs[self.index].push(label);
102추가: Some(event)
103추가: }
104추가: }
105추가: impl Drop for ObservedConnection {
106추가: fn drop(&mut self) {
107추가: self.observed.borrow_mut().jobs[self.index].push("drop");
108추가: }
109추가: }
110추가: fn observed_factory() -> (ObservedFactory, Rc<RefCell<Observation>>) {
111추가: let observed = Rc::new(RefCell::new(Observation::default()));
112추가: (
113추가: ObservedFactory {
114추가: process: ProcessFactory::new(binary("zipelo-archive-worker")),
115추가: observed: observed.clone(),
116추가: },
117추가: observed,
118추가: )
119추가: }
120추가: fn assert_reaped(observed: &Rc<RefCell<Observation>>) {
121추가: for events in &observed.borrow().jobs {
122추가: for label in ["terminal", "stdout", "stderr", "cleanup", "wait", "drop"] {
123추가: assert_eq!(
124추가: events.iter().filter(|value| **value == label).count(),
125추가: 1,
126추가: "{events:?}"
127추가: );
128추가: }
129추가: assert!(!events.contains(&"fault"));
130추가: assert_eq!(&events[events.len() - 2..], &["wait", "drop"]);
131추가: }
132추가: }
133추가: fn wait(model: &mut Model) {
134추가: let deadline = Instant::now() + Duration::from_secs(10);
135추가: while model.busy() {
136추가: model.poll();
137추가: assert!(
138추가: Instant::now() < deadline,
139추가: "작업자 종료 시간 초과: {}",
140추가: model.status()
141추가: );
142추가: std::thread::sleep(Duration::from_millis(2));
143추가: }
144추가: }
145추가: fn completed(model: &Model) {
146추가: assert!(model.confirmed, "{}", model.status());
147추가: assert_eq!(model.terminal.as_ref().unwrap().outcome, Outcome::Completed);
148추가: }
149추가: #[cfg(feature = "ui")]
150추가: mod screen {
151추가: use super::*;
152추가: use eframe::egui::{self, epaint::Shape};
153추가: use zipelo_ui_memory_app::archive_screen::ArchiveApp;
154추가: struct Screen {
155추가: context: egui::Context,
156추가: app: ArchiveApp,
157추가: }
158추가: impl Screen {
159추가: fn new(factory: ObservedFactory) -> Self {
160추가: Self {
161추가: context: egui::Context::default(),
162추가: app: ArchiveApp::new(Box::new(factory), None, false),
163추가: }
164추가: }
165추가: fn render(&mut self, events: Vec<egui::Event>) -> Vec<(String, egui::Pos2)> {
166추가: fn text(shape: &Shape, output: &mut Vec<(String, egui::Pos2)>) {
167추가: match shape {
168추가: Shape::Text(value) => output.push((
169추가: value.galley.job.text.clone(),
170추가: value.pos + value.galley.rect.size() / 2.0,
171추가: )),
172추가: Shape::Vec(values) => {
173추가: for value in values {
174추가: text(value, output);
175추가: }
176추가: }
177추가: _ => {}
178추가: }
179추가: }
180추가: let mut frame = self.context.run_ui(
181추가: egui::RawInput {
182추가: screen_rect: Some(egui::Rect::from_min_size(
183추가: egui::Pos2::ZERO,
184추가: egui::vec2(1060.0, 720.0),
185추가: )),
186추가: events,
187추가: ..Default::default()
188추가: },
189추가: |ui| self.app.show(ui),
190추가: );
191추가: frame.textures_delta.clear();
192추가: let mut output = Vec::new();
193추가: for shape in frame.shapes {
194추가: text(&shape.shape, &mut output);
195추가: }
196추가: output
197추가: }
198추가: fn locate(&mut self, label: &str) -> egui::Pos2 {
199추가: self.render(vec![]);
200추가: self.render(vec![])
201추가: .into_iter()
202추가: .filter(|(text, _)| text == label)
203추가: .max_by(|a, b| a.1.y.total_cmp(&b.1.y))
204추가: .unwrap_or_else(|| panic!("화면 항목 누락: {label}"))
205추가: .1
206추가: }
207추가: fn click_at(&mut self, point: egui::Pos2) {
208추가: self.render(vec![
209추가: egui::Event::PointerMoved(point),
210추가: egui::Event::PointerButton {
211추가: pos: point,
212추가: button: egui::PointerButton::Primary,
213추가: pressed: true,
214추가: modifiers: Default::default(),
215추가: },
216추가: ]);
217추가: self.render(vec![egui::Event::PointerButton {
218추가: pos: point,
219추가: button: egui::PointerButton::Primary,
220추가: pressed: false,
221추가: modifiers: Default::default(),
222추가: }]);
223추가: }
224추가: fn click(&mut self, label: &str) {
225추가: let point = self.locate(label);
226추가: self.click_at(point);
227추가: }
228추가: fn fill(&mut self, label: &str, offset: egui::Vec2, value: &Path) {
229추가: let point = self.locate(label) + offset;
230추가: self.click_at(point);
231추가: self.render(vec![
232추가: egui::Event::Key {
233추가: key: egui::Key::A,
234추가: physical_key: None,
235추가: pressed: true,
236추가: repeat: false,
237추가: modifiers: egui::Modifiers::COMMAND,
238추가: },
239추가: egui::Event::Text(value.to_str().unwrap().to_string()),
240추가: ]);
241추가: }
242추가: fn settle(&mut self) {
243추가: let deadline = Instant::now() + Duration::from_secs(10);
244추가: while self.app.model.busy() {
245추가: self.render(vec![]);
246추가: assert!(Instant::now() < deadline, "{}", self.app.model.status());
247추가: std::thread::sleep(Duration::from_millis(2));
248추가: }
249추가: completed(&self.app.model);
250추가: }
251추가: fn open(&mut self, archive: &Path) {
252추가: self.click("파일 열기");
253추가: self.fill("압축파일 절대 경로", egui::vec2(0.0, 22.0), archive);
254추가: self.click("열기");
255추가: assert!(self.app.model.busy());
256추가: self.settle();
257추가: }
258추가: fn extract(&mut self, destination: &Path) {
259추가: self.fill("출력 폴더", egui::vec2(100.0, 0.0), destination);
260추가: self.click("풀기");
261추가: assert!(self.app.model.busy());
262추가: self.settle();
263추가: assert_eq!(
264추가: self.app.model.terminal.as_ref().unwrap().publication,
265추가: Publication::Complete
266추가: );
267추가: }
268추가: }
269추가: fn archive_flow(name: &str, format: Format) {
270추가: let scratch = Scratch::new();
271추가: let fixture = Path::new(env!("CARGO_MANIFEST_DIR"))
272추가: .join("../../tests/rust-app-real-worker/fixtures")
273추가: .join(name);
274추가: let archive = scratch.path(name);
275추가: fs::copy(fixture, &archive).unwrap();
276추가: let original = fs::read(&archive).unwrap();
277추가: let output = make_directory(&scratch.path("output"));
278추가: let (factory, observed) = observed_factory();
279추가: let mut screen = Screen::new(factory);
280추가: screen.open(&archive);
281추가: assert_eq!(screen.app.model.list_id.as_ref().unwrap().format, format);
282추가: assert_eq!(screen.app.model.entries[0].name, "content.txt");
283추가: screen.extract(&output);
284추가: assert_eq!(
285추가: fs::read(output.join("content.txt")).unwrap(),
286추가: b"Zipelo real worker flow\n"
287추가: );
288추가: assert_eq!(fs::read(archive).unwrap(), original);
289추가: assert_eq!(observed.borrow().jobs.len(), 2);
290추가: assert_reaped(&observed);
291추가: }
292추가: #[test]
293추가: fn seven_zip_open_and_extract_via_actual_widgets_and_worker() {
294추가: for name in ["lzma.7z", "lzma2.7z"] {
295추가: let scratch = Scratch::new();
296추가: let archive = scratch.path(name);
297추가: fs::copy(
298추가: Path::new(env!("CARGO_MANIFEST_DIR"))
299추가: .join("../../tests/rust-archive-worker/fixtures/7z")
300추가: .join(name),
301추가: &archive,
302추가: )
303추가: .unwrap();
304추가: let original = fs::read(&archive).unwrap();
305추가: let output = make_directory(&scratch.path("output"));
306추가: let (factory, observed) = observed_factory();
307추가: let mut screen = Screen::new(factory);
308추가: screen.open(&archive);
309추가: assert_eq!(
310추가: screen.app.model.list_id.as_ref().unwrap().format,
311추가: Format::SevenZip
312추가: );
313추가: assert!(screen.app.model.can_extract());
314추가: screen.extract(&output);
315추가: assert_eq!(
316추가: fs::read(output.join("folder/hello.txt")).unwrap(),
317추가: b"Zipelo 7z interoperability\n".repeat(100)
318추가: );
319추가: assert_eq!(fs::read(archive).unwrap(), original);
320추가: assert_eq!(observed.borrow().jobs.len(), 2);
321추가: assert_reaped(&observed);
322추가: }
323추가: }
324추가: #[test]
325추가: fn zip_open_and_extract_via_actual_widgets_and_worker() {
326추가: archive_flow("sample.zip", Format::Zip);
327추가: }
328추가: #[test]
329추가: fn targz_open_and_extract_via_actual_widgets_and_worker() {
330추가: archive_flow("sample.tar.gz", Format::TarGzip);
331추가: }
332추가: #[test]
333추가: fn create_zip_reopen_and_extract_via_actual_widgets_and_worker() {
334추가: let scratch = Scratch::new();
335추가: let source = scratch.path("one.txt");
336추가: fs::write(&source, b"ZIP creation through real worker\n").unwrap();
337추가: let archive = scratch.path("new.zip");
338추가: let output = make_directory(&scratch.path("output"));
339추가: let (factory, observed) = observed_factory();
340추가: let mut screen = Screen::new(factory);
341추가: screen.click("ZIP 만들기");
342추가: screen.fill(
343추가: "원본 파일 절대 경로 / 한 줄에 하나",
344추가: egui::vec2(0.0, 25.0),
345추가: &source,
346추가: );
347추가: screen.fill("저장할 ZIP 절대 경로", egui::vec2(0.0, 22.0), &archive);
348추가: screen.click("ZIP 만들기");
349추가: assert!(screen.app.model.busy());
350추가: screen.settle();
351추가: assert!(archive.is_file());
352추가: screen.open(&archive);
353추가: assert_eq!(screen.app.model.entries[0].name, "one.txt");
354추가: screen.extract(&output);
355추가: assert_eq!(
356추가: fs::read(output.join("one.txt")).unwrap(),
357추가: fs::read(source).unwrap()
358추가: );
359추가: assert_eq!(observed.borrow().jobs.len(), 3);
360추가: assert_reaped(&observed);
361추가: }
362추가: }
363추가: #[test]
364추가: fn missing_worker_is_an_error_without_a_fake_result() {
365추가: let scratch = Scratch::new();
366추가: let mut factory = ProcessFactory::new(scratch.path("not-installed"));
367추가: let mut model = Model::default();
368추가: assert!(!model.begin(
369추가: Start::List {
370추가: archive: scratch.path("sample.zip")
371추가: },
372추가: &mut factory
373추가: ));
374추가: assert!(!model.busy());
375추가: assert!(model.error.is_some());
376추가: assert!(!model.confirmed);
377추가: }
378추가: #[test]
379추가: fn broken_or_incomplete_worker_output_is_not_success() {
380추가: for name in ["truncated", "wrong-action", "early-exit"] {
381추가: let scratch = Scratch::new();
382추가: let probe = scratch.path(&format!("{name}{}", std::env::consts::EXE_SUFFIX));
383추가: fs::copy(binary("zipelo-real-worker-probe"), &probe).unwrap();
384추가: let mut factory = ProcessFactory::new(probe);
385추가: let mut model = Model::default();
386추가: assert!(model.begin(
387추가: Start::List {
388추가: archive: scratch.path("sample.zip")
389추가: },
390추가: &mut factory
391추가: ));
392추가: model.request_close();
393추가: model.confirm_close();
394추가: assert_eq!(model.close, Close::Waiting);
395추가: wait(&mut model);
396추가: assert!(!model.confirmed);
397추가: assert!(model.error.is_some());
398추가: assert_eq!(model.close, Close::Review);
399추가: model.acknowledge_close();
400추가: assert_eq!(model.close, Close::Allowed);
401추가: }
402추가: }
403추가: #[cfg(target_os = "linux")]
404추가: #[test]
405추가: fn dropping_live_connection_kills_and_reaps_owned_child() {
406추가: let scratch = Scratch::new();
407추가: let probe = scratch.path("hang");
408추가: fs::copy(binary("zipelo-real-worker-probe"), &probe).unwrap();
409추가: let mut factory = ProcessFactory::new(probe);
410추가: let mut model = Model::default();
411추가: assert!(model.begin(
412추가: Start::List {
413추가: archive: scratch.path("sample.zip")
414추가: },
415추가: &mut factory
416추가: ));
417추가: let deadline = Instant::now() + Duration::from_secs(5);
418추가: while !scratch.path("probe.pid").exists() {
419추가: assert!(Instant::now() < deadline);
420추가: std::thread::sleep(Duration::from_millis(2));
421추가: }
422추가: let pid = fs::read_to_string(scratch.path("probe.pid")).unwrap();
423추가: drop(model);
424추가: assert!(!Path::new("/proc").join(pid).exists());
425추가: }
426추가:
427추가: #[test]
428추가: fn failed_start_serialization_reaps_the_real_worker_without_terminal() {
429추가: let scratch = Scratch::new();
430추가: let mut factory = ProcessFactory::new(binary("zipelo-archive-worker"));
431추가: let mut model = Model::default();
432추가: let archive = scratch.path(&"a".repeat(40000));
433추가: assert!(!model.begin(Start::List { archive }, &mut factory));
434추가: assert!(model.busy());
435추가: model.request_close();
436추가: model.confirm_close();
437추가: assert_eq!(model.close, Close::Waiting);
438추가: wait(&mut model);
439추가: assert!(!model.confirmed);
440추가: assert!(model.terminal.is_none());
441추가: assert!(model.error.is_some());
442추가: assert_eq!(model.close, Close::Review);
443추가: }
444추가:
445추가: #[test]
446추가: fn late_cancel_after_child_reap_keeps_the_original_terminal_result() {
447추가: let scratch = Scratch::new();
448추가: let archive = scratch.path("sample.zip");
449추가: fs::copy(
450추가: Path::new(env!("CARGO_MANIFEST_DIR"))
451추가: .join("../../tests/rust-app-real-worker/fixtures/sample.zip"),
452추가: &archive,
453추가: )
454추가: .unwrap();
455추가: let mut factory = ProcessFactory::new(binary("zipelo-archive-worker"));
456추가: let mut connection = factory.connect(1).unwrap();
457추가: connection
458추가: .send(Request {
459추가: job_id: 1,
460추가: sequence: 0,
461추가: command: Command::Start(Start::List { archive }),
462추가: })
463추가: .unwrap();
464추가: let deadline = Instant::now() + Duration::from_secs(10);
465추가: let mut terminal = false;
466추가: loop {
467추가: assert!(Instant::now() < deadline);
468추가: match connection.poll() {
469추가: Some(HostEvent::CleanupComplete) => break,
470추가: Some(HostEvent::Frame {
471추가: event: Event::Terminal(value),
472추가: ..
473추가: }) => {
474추가: assert_eq!(value.outcome, Outcome::Completed);
475추가: terminal = true;
476추가: }
477추가: Some(HostEvent::Fault(message)) => panic!("{message}"),
478추가: _ => std::thread::sleep(Duration::from_millis(1)),
479추가: }
480추가: }
481추가: assert!(terminal);
482추가: assert!(
483추가: connection
484추가: .send(Request {
485추가: job_id: 1,
486추가: sequence: 1,
487추가: command: Command::Cancel
488추가: })
489추가: .is_ok()
490추가: );
491추가: loop {
492추가: assert!(Instant::now() < deadline);
493추가: match connection.poll() {
494추가: Some(HostEvent::Exited { success }) => {
495추가: assert!(success);
496추가: break;
497추가: }
498추가: Some(HostEvent::Fault(message)) => panic!("{message}"),
499추가: _ => std::thread::sleep(Duration::from_millis(1)),
500추가: }
501추가: }
502추가: assert!(connection.poll().is_none());
503추가: }
504추가:
505추가: #[test]
506추가: fn cancel_racing_child_exit_preserves_completed_result_before_poll() {
507추가: let archive = Path::new(env!("CARGO_MANIFEST_DIR"))
508추가: .join("../../tests/rust-app-real-worker/fixtures/sample.zip")
509추가: .canonicalize()
510추가: .unwrap();
511추가: for iteration in 0..100 {
512추가: let mut factory = ProcessFactory::new(binary("zipelo-archive-worker"));
513추가: let mut model = Model::default();
514추가: assert!(model.begin(
515추가: Start::List {
516추가: archive: archive.clone()
517추가: },
518추가: &mut factory
519추가: ));
520추가: std::thread::sleep(Duration::from_millis(2));
521추가: model.cancel();
522추가: wait(&mut model);
523추가: assert!(model.confirmed, "iteration={iteration}: {:?}", model.error);
524추가: assert_eq!(model.terminal.as_ref().unwrap().outcome, Outcome::Completed);
525추가: assert!(model.error.is_none());
526추가: }
527추가: }
528추가:
529추가: #[test]
530추가: fn cancel_racing_exit_without_terminal_remains_unconfirmed() {
531추가: let scratch = Scratch::new();
532추가: let probe = scratch.path("early-exit");
533추가: fs::copy(binary("zipelo-real-worker-probe"), &probe).unwrap();
534추가: let mut factory = ProcessFactory::new(probe);
535추가: let mut model = Model::default();
536추가: assert!(model.begin(
537추가: Start::List {
538추가: archive: scratch.path("sample.zip")
539추가: },
540추가: &mut factory
541추가: ));
542추가: std::thread::sleep(Duration::from_millis(2));
543추가: model.cancel();
544추가: model.request_close();
545추가: model.confirm_close();
546추가: assert_eq!(model.close, Close::Waiting);
547추가: wait(&mut model);
548추가: assert!(!model.confirmed);
549추가: assert!(model.terminal.is_none());
550추가: assert!(model.error.is_some());
551추가: assert_eq!(model.close, Close::Review);
552추가: }
추가tests/rust-app-real-worker/formats.rs+130-0
@@ -0,0 +1,130 @@
1추가: #![allow(dead_code)]
2추가: #[path = "../../experiments/rust-ui-memory-app/src/archive_ui.rs"]
3추가: mod archive_ui;
4추가: mod adapter {
5추가: include!("../../experiments/rust-ui-memory-app/src/archive_process.rs");
6추가:
7추가: fn token(format: ui::Format, source_object: ui::SourceObject) -> ui::ListId {
8추가: ui::ListId {
9추가: catalog_version: 1,
10추가: format,
11추가: source_object,
12추가: archive_bytes: 33,
13추가: archive_sha256: [44; 32],
14추가: }
15추가: }
16추가: fn formats() -> [ui::Format; 5] {
17추가: [
18추가: ui::Format::Zip,
19추가: ui::Format::Tar,
20추가: ui::Format::Gzip,
21추가: ui::Format::TarGzip,
22추가: ui::Format::SevenZip,
23추가: ]
24추가: }
25추가: #[test]
26추가: fn list_end_preserves_existing_tags_and_assigns_four_to_seven_zip() {
27추가: for (tag, format) in formats().into_iter().enumerate() {
28추가: let id = token(
29추가: format,
30추가: ui::SourceObject::Unix {
31추가: device: 11,
32추가: inode: 22,
33추가: },
34추가: );
35추가: let mut actual = Vec::new();
36추가: codec::Writer::new(&mut actual, 99)
37추가: .send(&wire::Message::ListEnd {
38추가: entry_count: 7,
39추가: list_id: list_to_wire(id.clone()),
40추가: })
41추가: .unwrap();
42추가: let mut body = Vec::new();
43추가: body.extend(7u32.to_le_bytes());
44추가: body.extend(1u16.to_le_bytes());
45추가: body.push(tag as u8);
46추가: body.push(1);
47추가: body.extend(11u64.to_le_bytes());
48추가: body.extend(22u64.to_le_bytes());
49추가: body.extend(33u64.to_le_bytes());
50추가: body.extend([44; 32]);
51추가: let mut expected = Vec::from(*b"ZAW1");
52추가: expected.extend(1u16.to_le_bytes());
53추가: expected.extend(102u16.to_le_bytes());
54추가: expected.extend((body.len() as u32).to_le_bytes());
55추가: expected.extend([0; 4]);
56추가: expected.extend(99u64.to_le_bytes());
57추가: expected.extend(0u64.to_le_bytes());
58추가: expected.extend(body);
59추가: assert_eq!(actual, expected);
60추가: let (_, _, message) = codec::Reader::new(actual.as_slice())
61추가: .read()
62추가: .unwrap()
63추가: .unwrap();
64추가: match event_to_ui(message, None).unwrap() {
65추가: ui::Event::ListEnd {
66추가: entry_count,
67추가: list_id,
68추가: } => {
69추가: assert_eq!(entry_count, 7);
70추가: assert_eq!(list_id, id);
71추가: }
72추가: _ => panic!("목록 완료 응답이 아님"),
73추가: }
74추가: }
75추가: }
76추가: #[test]
77추가: fn extraction_roundtrip_preserves_both_platform_identities_and_all_formats() {
78추가: for source in [
79추가: ui::SourceObject::Unix {
80추가: device: 11,
81추가: inode: 22,
82추가: },
83추가: ui::SourceObject::Windows {
84추가: volume: 55,
85추가: file_id: [66; 16],
86추가: },
87추가: ] {
88추가: for format in formats() {
89추가: let id = token(format, source.clone());
90추가: assert_eq!(list_to_ui(list_to_wire(id.clone())), id);
91추가: let start = start_to_wire(ui::Start::Extract {
92추가: archive: PathBuf::from("input.7z"),
93추가: destination: PathBuf::from("output"),
94추가: selection: ui::Selection::EntryIds(vec![7]),
95추가: list_id: id.clone(),
96추가: gzip_output_name: if format == ui::Format::Gzip {
97추가: Some("content".into())
98추가: } else {
99추가: None
100추가: },
101추가: });
102추가: let mut bytes = Vec::new();
103추가: codec::Writer::new(&mut bytes, 99)
104추가: .send(&wire::Message::Start(start))
105추가: .unwrap();
106추가: assert_eq!(&bytes[6..8], &1u16.to_le_bytes());
107추가: match codec::Reader::new(bytes.as_slice())
108추가: .read()
109추가: .unwrap()
110추가: .unwrap()
111추가: .2
112추가: {
113추가: wire::Message::Start(wire::Start {
114추가: action:
115추가: wire::Action::Extract {
116추가: list_id: Some(decoded),
117추가: selection,
118추가: ..
119추가: },
120추가: ..
121추가: }) => {
122추가: assert_eq!(list_to_ui(decoded), id);
123추가: assert_eq!(selection, wire::Selection::EntryIds(vec![7]));
124추가: }
125추가: _ => panic!("압축 해제 요청이 아님"),
126추가: }
127추가: }
128추가: }
129추가: }
130추가: }
추가tests/rust-app-real-worker/generate.py+24-0
@@ -0,0 +1,24 @@
1추가: import gzip
2추가: from io import BytesIO
3추가: from pathlib import Path
4추가: import tarfile
5추가: import zipfile
6추가:
7추가: ROOT = Path(__file__).resolve().parent / "fixtures"
8추가: PAYLOAD = b"Zipelo real worker flow\n"
9추가: ROOT.mkdir(exist_ok=True)
10추가: stream = BytesIO()
11추가: with zipfile.ZipFile(stream, "w") as archive:
12추가: info = zipfile.ZipInfo("content.txt", (1980, 1, 1, 0, 0, 0))
13추가: info.compress_type = zipfile.ZIP_DEFLATED
14추가: archive.writestr(info, PAYLOAD)
15추가: (ROOT / "sample.zip").write_bytes(stream.getvalue())
16추가: stream = BytesIO()
17추가: with tarfile.open(fileobj=stream, mode="w", format=tarfile.USTAR_FORMAT) as archive:
18추가: info = tarfile.TarInfo("content.txt")
19추가: info.size = len(PAYLOAD)
20추가: info.mode = 0o600
21추가: archive.addfile(info, BytesIO(PAYLOAD))
22추가: compressed = bytearray(gzip.compress(stream.getvalue(), mtime=0))
23추가: compressed[9] = 255
24추가: (ROOT / "sample.tar.gz").write_bytes(compressed)
추가tests/rust-app-real-worker/probe.rs+29-0
@@ -0,0 +1,29 @@
1추가: use std::{io::Write, path::PathBuf, time::Duration};
2추가: use worker_protocol::{
3추가: protocol::*,
4추가: wire::{Reader, Writer},
5추가: };
6추가:
7추가: fn main() {
8추가: let executable = PathBuf::from(std::env::args_os().next().unwrap());
9추가: let mode = executable.file_stem().unwrap().to_string_lossy();
10추가: if mode.starts_with("hang") {
11추가: let parent = executable.parent().unwrap();
12추가: std::fs::write(parent.join("probe.pid.tmp"), std::process::id().to_string()).unwrap();
13추가: std::fs::rename(parent.join("probe.pid.tmp"), parent.join("probe.pid")).unwrap();
14추가: std::thread::sleep(Duration::from_secs(30));
15추가: return;
16추가: }
17추가: let mut reader = Reader::new(std::io::stdin());
18추가: let (job, _, _) = reader.read().unwrap().unwrap();
19추가: if mode.starts_with("wrong-action") {
20추가: Writer::new(std::io::stdout(), job)
21추가: .send(&Message::Accepted {
22추가: action: ActionKind::Extract,
23추가: encryption: false,
24추가: })
25추가: .unwrap();
26추가: } else if !mode.starts_with("early-exit") {
27추가: std::io::stdout().write_all(b"ZAW1").unwrap();
28추가: }
29추가: }
수정tests/rust-app-ui/README.md+1-1
@@ -10,7 +10,7 @@
1010cargo +1.99.1 run --locked --manifest-path experiments/rust-ui-memory-app/Cargo.toml --features ui-fixture -- --ui-fixture /absolute/example.zip
1111```
1212
13삭제: `locked.zip` 이름은 가짜 암호 요청을 만듦. 아무 비어 있지 않은 합성 암호를 받으며 암호를 기록하거나 저장하지 않음. 실제 암호나 사용자 자료를 입력할 필요가 없음. 시험 모드는 화면에 명시되고 실제 파일을 만들지 않음. `ui-fixture` 없이 실행하면 작업자 미연결 오류를 표시하며 가짜 성공으로 대체하지 않음.
13추가: `locked.zip` 이름은 가짜 암호 요청을 만듦. 아무 비어 있지 않은 합성 암호를 받으며 암호를 기록하거나 저장하지 않음. 실제 암호나 사용자 자료를 입력할 필요가 없음. 시험 모드는 화면에 명시되고 실제 파일을 만들지 않음. `ui-fixture` 없이 실행하면 앱과 같은 폴더의 실제 zipelo-archive-worker를 실행함. Windows에서는 .exe 확장자를 사용함. 작업자가 누락되면 오류를 표시하며 가짜 성공으로 대체하지 않음. 실제 작업자 연결 시험은 ../rust-app-real-worker/README.md를 참고할 것.
1414
1515범위는 목록 확인, 선택 해제, GZ 출력명, ZIP 생성, 암호 요청, 진행률, 취소와 닫기 철회, Terminal/EOF/child wait 분리, 오래된 ID/sequence 거부, SourceChanged 재열람, 부분 출력과 불확실 게시 보존임. 구성한 이벤트 시험은 실제 OS 종료나 파일 보안 검증의 증거가 아님.
1616
수정tests/rust-app-ui/regressions.rs+81-0
@@ -726,3 +726,84 @@ fn fake_worker_rejects_invalid_format_specific_output_names() {
726726 assert_eq!(factory.state.borrow().starts.len(), previous);
727727 }
728728}
729추가:
730추가: #[test]
731추가: fn cleanup_marker_without_error_does_not_replace_eofs() {
732추가: let mut factory = FakeFactory::manual();
733추가: let mut model = Model::default();
734추가: assert!(model.begin(
735추가: Start::List {
736추가: archive: path("sample.zip")
737추가: },
738추가: &mut factory
739추가: ));
740추가: factory
741추가: .state
742추가: .borrow_mut()
743추가: .queue
744추가: .push_back(HostEvent::CleanupComplete);
745추가: factory
746추가: .state
747추가: .borrow_mut()
748추가: .queue
749추가: .push_back(HostEvent::Exited { success: true });
750추가: for _ in 0..10 {
751추가: model.poll();
752추가: }
753추가: assert!(model.busy());
754추가: factory
755추가: .state
756추가: .borrow_mut()
757추가: .queue
758추가: .push_back(HostEvent::StdoutEof);
759추가: for _ in 0..10 {
760추가: model.poll();
761추가: }
762추가: assert!(model.busy());
763추가: factory
764추가: .state
765추가: .borrow_mut()
766추가: .queue
767추가: .push_back(HostEvent::StderrEof);
768추가: pump(&mut model);
769추가: assert!(!model.confirmed);
770추가: }
771추가:
772추가: #[test]
773추가: fn error_cleanup_requires_child_wait_without_fabricating_terminal() {
774추가: let mut factory = FakeFactory::manual();
775추가: let mut model = Model::default();
776추가: assert!(model.begin(
777추가: Start::List {
778추가: archive: path("sample.zip")
779추가: },
780추가: &mut factory
781추가: ));
782추가: factory
783추가: .state
784추가: .borrow_mut()
785추가: .queue
786추가: .push_back(HostEvent::Fault("pipe error".into()));
787추가: factory
788추가: .state
789추가: .borrow_mut()
790추가: .queue
791추가: .push_back(HostEvent::CleanupComplete);
792추가: model.request_close();
793추가: model.confirm_close();
794추가: for _ in 0..10 {
795추가: model.poll();
796추가: }
797추가: assert!(model.busy());
798추가: assert_eq!(model.close, Close::Waiting);
799추가: factory
800추가: .state
801추가: .borrow_mut()
802추가: .queue
803추가: .push_back(HostEvent::Exited { success: false });
804추가: pump(&mut model);
805추가: assert!(!model.confirmed);
806추가: assert!(model.terminal.is_none());
807추가: assert_eq!(model.error.as_deref(), Some("pipe error"));
808추가: assert_eq!(model.close, Close::Review);
809추가: }
수정tests/rust-app-ui/validation.json+90-27
@@ -1,47 +1,92 @@
11{
22 "command": "python3 tests/ci/run_rust.py local",
33 "platform": "linux-desktop-2",
4삭제: "base_remote_main": "486fe9ae64a73f999cc5122c2eb9bbeb62fb2fb3",
5삭제: "local_baseline_head": "6ea0b8b3b7444c35bb0845b58bf5638ac58f5e58",
6삭제: "source_state": "Committed frontend review fixes over the existing local baseline whose tree equals remote main. Tested file hashes identify the reviewed implementation.",
7삭제: "linux_build_crates": 17,
8삭제: "linux_test_targets": 17,
9삭제: "rust_tests_passed": 827,
10삭제: "new_archive_ui_tests_passed": 20,
11삭제: "windows_cross_build_crates": 17,
4추가: "base_remote_main": "3f51510fcc613c3f72e29c3b421aab178bf94186",
5추가: "local_baseline_head": "c2fba601990de3b0ad660342fdd9762e35b35147",
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추가: "linux_build_crates": 19,
8추가: "linux_test_targets": 19,
9추가: "rust_tests_passed": 883,
10추가: "new_archive_ui_tests_passed": 22,
11추가: "windows_cross_build_crates": 19,
1212 "windows_runtime_tested": false,
13삭제: "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.",
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.",
1414 "prior_failures": "Retained locally: first build drop API/legacy harness references; second and third egui renderer harness texture/first-frame setup; final runner passed.",
1515 "limitations": [
16삭제: "Fake transport projects agreed revision2 semantics; no binary codec, actual worker process, filesystem extraction or encryption in this frontend PR.",
17삭제: "Default executable explicitly reports unavailable worker. ui-fixture feature AND --ui-fixture flag select test-only fake; UI labels it.",
18삭제: "Entry listing is metadata, not integrity proof. Partial publication/durability/cleanup remain separate.",
19삭제: "UTF-8 text fields for manual paths; native CLI/drop archive paths stay PathBuf. ZIP multi-source manual entry is UTF-8 only."
16추가: "Normal ZIP/TAR.GZ/7z listing and extraction plus ZIP creation/reopen/extraction use the actual worker executable and OS pipes.",
17추가: "Four successful screen tests run headless egui widgets, including LZMA/LZMA2 7z fixtures, not native OS GUI automation.",
18추가: "Malformed, wrong-action, early-exit and disposal fault cases use a separate test-only probe; serialization failure and late cancellation use the actual worker.",
19추가: "No Windows runtime, encryption ZIP, large-file performance, OS sandbox or exhaustive malicious-input validation in this frontend integration.",
20추가: "Manual path text is UTF-8; native archive CLI/drop paths retain PathBuf and NativePath."
2021 ],
2122 "tested_files": [
23추가: {
24추가: "path": "experiments/rust-ui-memory-app/Cargo.lock",
25추가: "sha256": "791935d3b7eb17f68ccd08e35e6839e3ff42fecf9fd51cce4ce69fb7bb717197"
26추가: },
2227 {
2328 "path": "experiments/rust-ui-memory-app/Cargo.toml",
24삭제: "sha256": "1b161c74260b64de926b37528d61fd73de4074d250f711d8458ed770c0af69d8"
29추가: "sha256": "d2ba4202c0920af4b090fb59245f92b59c14f0590930ca4c6d8874d77057a577"
2530 },
2631 {
27삭제: "path": "experiments/rust-ui-memory-app/src/lib.rs",
28삭제: "sha256": "335104e14b4fd69fd20e29941a1cc40c7c123bd7b853c09206c39d10b55fda2c"
32추가: "path": "experiments/rust-ui-memory-app/src/archive_process.rs",
33추가: "sha256": "a75457134618ba7c8b0e8ee7800e14ec5c77fadac5c62fdac2ccf1fa663bd142"
2934 },
3035 {
31삭제: "path": "experiments/rust-ui-memory-app/src/desktop.rs",
32삭제: "sha256": "5d0e14f72cdebc6fe02952539db55c682cb5978fd883e072bd08d461807c8106"
36추가: "path": "experiments/rust-ui-memory-app/src/archive_screen.rs",
37추가: "sha256": "04b7a55c7405d89467fc821db27e0714fb0aa00612e614835b5fee901e5ca940"
3338 },
3439 {
3540 "path": "experiments/rust-ui-memory-app/src/archive_ui.rs",
36삭제: "sha256": "f06fd50c557e178cb5cb98cb39e3ba5e04088a774f60ec92774bc37ed3323b87"
41추가: "sha256": "f26557645cea07350843c7e88225e07bb4316ab673dc2581b036567f01d66d6e"
3742 },
3843 {
39삭제: "path": "experiments/rust-ui-memory-app/src/archive_screen.rs",
40삭제: "sha256": "04b7a55c7405d89467fc821db27e0714fb0aa00612e614835b5fee901e5ca940"
44추가: "path": "experiments/rust-ui-memory-app/src/desktop.rs",
45추가: "sha256": "c829ec00ae84a8b695af65edb2665c0308e2af14cf26c4a2736364452a99795c"
4146 },
4247 {
43삭제: "path": "tests/rust-app-ui/regressions.rs",
44삭제: "sha256": "461e9a36bc5b742bf523fe0f1bfb7900c1b97a884e3e8f6040f85fe474efdf4e"
48추가: "path": "experiments/rust-ui-memory-app/src/lib.rs",
49추가: "sha256": "bf7d61f41973d3811b868959786a74873bcd320a36445f9cb1e6034813add7df"
50추가: },
51추가: {
52추가: "path": "tests/rust-app-real-worker/.gitignore",
53추가: "sha256": "247681cefffa8448d973f21147c92b38b63f492a98a50aca3b3c490bc97499e1"
54추가: },
55추가: {
56추가: "path": "tests/rust-app-real-worker/Cargo.lock",
57추가: "sha256": "6fce2f154d57e28e975582755ca13d9ebb4d2d6927a53c42f03e8a9b5f78f78c"
58추가: },
59추가: {
60추가: "path": "tests/rust-app-real-worker/Cargo.toml",
61추가: "sha256": "2247dcbfa35d791f95ab0cbd509646da3af1744ba0066ada98366f10cab3e2fa"
62추가: },
63추가: {
64추가: "path": "tests/rust-app-real-worker/README.md",
65추가: "sha256": "7253cd2a765dc594e3a27970fd3811eb50645d1179c2728b57eee2d440b3e367"
66추가: },
67추가: {
68추가: "path": "tests/rust-app-real-worker/fixtures/sample.tar.gz",
69추가: "sha256": "5589f9bec624071d0d90b595d0283da82c1516fced9a13246a9bb9e7e951e372"
70추가: },
71추가: {
72추가: "path": "tests/rust-app-real-worker/fixtures/sample.zip",
73추가: "sha256": "21e6ac2989f40ac485b2eb5e9f2a5adc7c8aeb7feabbd55a74f0cdc33f71cc3d"
74추가: },
75추가: {
76추가: "path": "tests/rust-app-real-worker/flows.rs",
77추가: "sha256": "a6ae9c4c56860f572667465c657c2167e619d5892469d986d6c8615ee9c2ae6d"
78추가: },
79추가: {
80추가: "path": "tests/rust-app-real-worker/generate.py",
81추가: "sha256": "480f5503ee0aa537f24506964c07ae84a7696cc8ffdb6ba8907b2912913bb6ce"
82추가: },
83추가: {
84추가: "path": "tests/rust-app-real-worker/probe.rs",
85추가: "sha256": "cf8eadd227d507469ecf71ece9f02efb95a208d677f107cf03fd107f67e1bd56"
86추가: },
87추가: {
88추가: "path": "tests/rust-app-ui/README.md",
89추가: "sha256": "c4642f094f643bf18fcc324e04a66b663dd668198d960fa324d30c9bdb8dd1b5"
4590 },
4691 {
4792 "path": "tests/rust-app-ui/fake.rs",
@@ -52,15 +97,33 @@
5297 "sha256": "303cff6a9452b43db62af21ad906aef49279f7bf23136e2166793d4118d951dc"
5398 },
5499 {
55삭제: "path": "tests/rust-app-ui/README.md",
56삭제: "sha256": "942e108820d43ba9a70ba013cd7f1683d8bb90699315bda179ca95c4a15a736e"
100추가: "path": "tests/rust-app-ui/regressions.rs",
101추가: "sha256": "a4c3685a380cb73fd506a290270b2a5308529ef4f843c203127c2bc9a2df2a80"
102추가: },
103추가: {
104추가: "path": "tests/rust-app-real-worker/formats.rs",
105추가: "sha256": "50532a4ee144ab533a43e1fefa5d1baf1131638892b585c20c9d4715a904e006"
57106 }
58107 ],
59108 "review_regressions": [
60109 "실제 풀기 버튼의 ZIP/TAR/TAR.GZ/GZIP 출력명 계약",
61110 "비 GZIP 출력명 요청의 연결 전 거부",
62111 "가짜 작업자의 형식별 출력명 검증",
63삭제: "Start 전송 실패 시 양쪽 EOF/child wait까지 연결 보존과 닫기/교체 차단"
112추가: "Start 전송 실패 시 양쪽 EOF/child wait까지 연결 보존과 닫기/교체 차단",
113추가: "오류 후 명시적 정리는 child wait 전에 닫기를 허용하지 않음",
114추가: "정상 정리 신호는 EOF를 대신하지 않음",
115추가: "정상 종료 뒤 채널 닫힘과 늦은 취소가 최종 결과를 오류로 바꾸지 않음",
116추가: "child 회수 전 늦은 취소의 실제 작업자 경합 100회와 Terminal 없는 종료의 실패 유지"
64117 ],
65삭제: "before_review_fix": "Targeted regressions reproduced 3 failures with 16 existing tests passing before the product fix; final targeted suite passed 20 tests."
118추가: "before_review_fix": "Earlier PR62 fixes reproduced 3 failures before repair. Integration tests additionally reproduced normal channel shutdown and late-cancel races before repair. PR68 review race reproduced with the new test before repair; all 100 iterations passed after repair.",
119추가: "approved_ui_head": "423a7c80c9d7182e07d29adee03a97d09a19b11f",
120추가: "tested_local_head": "0f26ed65d784b9cfb332168f3f3c619d53566325",
121추가: "real_worker_tests_passed": 11,
122추가: "runner_tests_passed": 17,
123추가: "format_contract_tests_passed": 2,
124추가: "prerequisite_heads": {
125추가: "PR68": "d2db6625c50376de363670ee5658060445b433d1",
126추가: "PR69": "745c62b746bb1546cdcbe0440a1446b6d3004b80"
127추가: },
128추가: "format_extension": "Existing tags 0..3 unchanged; SevenZip=4. Full ListEnd golden frame, both platform identities and Extract codec roundtrip verified."
66129}