다른 작업의 완료 결과 적용을 차단함
- 작성자
- 호시노 히나타
- 작성 시각
- 커밋
f6aa3879c4690ac63afd21ec231b460f42ae7aee- 부모
- d188493
변경된 파일 4개
+136-14| @@ -27,6 +27,8 @@ pub struct Controller { | ||
| 27 | 27 | pub task: Option<Task>, |
| 28 | 28 | receiver: Option<core::Receiver>, |
| 29 | 29 | pub terminal: Option<Completion>, |
| 30 | 추가: pub terminal_delivery: Option<core::Delivery>, | |
| 31 | 추가: terminal_accepted: bool, | |
| 30 | 32 | pub close: CloseState, |
| 31 | 33 | pub status: Status, |
| 32 | 34 | pub generation: u64, |
| @@ -43,6 +45,8 @@ impl Default for Controller { | ||
| 43 | 45 | task: None, |
| 44 | 46 | receiver: None, |
| 45 | 47 | terminal: None, |
| 48 | 추가: terminal_delivery: None, | |
| 49 | 추가: terminal_accepted: false, | |
| 46 | 50 | close: CloseState::Open, |
| 47 | 51 | status: Status::Idle, |
| 48 | 52 | generation: 0, |
| @@ -81,6 +85,8 @@ impl Controller { | ||
| 81 | 85 | self.generation = generation; |
| 82 | 86 | self.selected = None; |
| 83 | 87 | self.terminal = None; |
| 88 | 추가: self.terminal_delivery = None; | |
| 89 | 추가: self.terminal_accepted = false; | |
| 84 | 90 | self.delivery_error = None; |
| 85 | 91 | self.panic = None; |
| 86 | 92 | self.spawn_error = None; |
| @@ -175,12 +181,30 @@ impl Controller { | ||
| 175 | 181 | } |
| 176 | 182 | } |
| 177 | 183 | if let Some(completion) = &self.terminal { |
| 178 | 삭제: if let Err(error) = completion.outcome.validate(self.receiver.as_mut().unwrap()) { | |
| 179 | 삭제: self.delivery_error.get_or_insert(error); | |
| 184 | 추가: self.terminal_accepted = false; | |
| 185 | 추가: match self | |
| 186 | 추가: .receiver | |
| 187 | 추가: .as_mut() | |
| 188 | 추가: .map(|receiver| completion.outcome.validate(receiver)) | |
| 189 | 추가: { | |
| 190 | 추가: Some(Ok(core::Delivery::Accepted)) => { | |
| 191 | 추가: self.terminal_delivery = Some(core::Delivery::Accepted); | |
| 192 | 추가: self.terminal_accepted = true; | |
| 193 | 추가: } | |
| 194 | 추가: Some(Ok(core::Delivery::IgnoredStale)) => { | |
| 195 | 추가: self.terminal_delivery = Some(core::Delivery::IgnoredStale); | |
| 196 | 추가: } | |
| 197 | 추가: Some(Err(error)) => { | |
| 198 | 추가: self.delivery_error.get_or_insert(error); | |
| 199 | 추가: } | |
| 200 | 추가: None => {} | |
| 180 | 201 | } |
| 181 | 202 | self.status = if self.panic.is_some() { |
| 182 | 203 | Status::Panicked |
| 183 | 삭제: } else if completion.delivery.is_some() || self.delivery_error.is_some() { | |
| 204 | 추가: } else if !self.terminal_accepted | |
| 205 | 추가: || completion.delivery.is_some() | |
| 206 | 추가: || self.delivery_error.is_some() | |
| 207 | 추가: { | |
| 184 | 208 | Status::DeliveryFailure |
| 185 | 209 | } else if completion.outcome.is_ok() { |
| 186 | 210 | Status::Completed |
| @@ -198,7 +222,7 @@ impl Controller { | ||
| 198 | 222 | } |
| 199 | 223 | } |
| 200 | 224 | pub fn rows(&self) -> Vec<&str> { |
| 201 | 삭제: if self.status != Status::Completed { | |
| 225 | 추가: if self.status != Status::Completed || !self.terminal_accepted { | |
| 202 | 226 | return Vec::new(); |
| 203 | 227 | } |
| 204 | 228 | match self.terminal.as_ref().map(|c| &c.outcome) { |
| @@ -222,7 +246,7 @@ impl Controller { | ||
| 222 | 246 | true |
| 223 | 247 | } |
| 224 | 248 | pub fn selected_bytes(&self) -> Option<&[u8]> { |
| 225 | 삭제: if self.status != Status::Completed { | |
| 249 | 추가: if self.status != Status::Completed || !self.terminal_accepted { | |
| 226 | 250 | return None; |
| 227 | 251 | } |
| 228 | 252 | let (operation, generation, index) = self.selected?; |
| @@ -3,11 +3,11 @@ d591ec67b8f1a1ea448b6bdd971e0b8c039a33a492c8f068b085bdd20b3a64ae experiments/ru | ||
| 3 | 3 | 0714945e52a4d5b560c02c9a18478519f8c4e2572cbf87bd6d52adcfb2b63c62 experiments/rust-ui-memory-app/LICENSE |
| 4 | 4 | 5b98107ae51806d6d4cb4337bea3b979f55070eba6dc7c0c294e13e7686ab4c6 experiments/rust-ui-memory-app/THIRD-PARTY-NOTICES.txt |
| 5 | 5 | 1cddb84c6a8c5e4188be79220c92532351e51979d7ad0edbc0a12ac5381ed72c experiments/rust-ui-memory-app/src/app.rs |
| 6 | 삭제: fbe8d8f80267ac20ddd1cff47b5f75b14a680de4935e32472813183183a34019 experiments/rust-ui-memory-app/src/controller.rs | |
| 6 | 추가: 51dc979b88e395c209444900511aa7d56bcc8ccc31205fca22191f25dc6468e2 experiments/rust-ui-memory-app/src/controller.rs | |
| 7 | 7 | 58d303d44c6b8580168f14c3ceb0eb878fc7a003f197f162584286873a904ddc experiments/rust-ui-memory-app/src/lib.rs |
| 8 | 8 | c1c1dde16263ea7ed4cf5808b3182e21878b8ffadfe8850974a8cbdbd4607b3f experiments/rust-ui-memory-app/src/runtime.rs |
| 9 | 9 | 7aef227ed4424e13cfa750373a9e1f32bebae12308589c81d051f41ea84991ac experiments/rust-ui-memory-app/src/transport.rs |
| 10 | 삭제: d68f3ba20d8f392a2df38ac2faf785e197d023e86356c45eb7bebb7ce572c9e1 tests/rust-ui-memory-app/contract.json | |
| 10 | 추가: 5a9a48f08dea0d3b103a359251bde06dd82e2568be02bdb905f5b0ceb7bb6dd9 tests/rust-ui-memory-app/contract.json | |
| 11 | 11 | 5ee41a973a0e976fbb6fe36d4a3fcb0ed026e638e997042a0bef8c2f238f0599 tests/rust-ui-memory-app/dependencies.json |
| 12 | 12 | 8536779d3551eb86a82f4c8b814bb26ddeaff04f992d3e080ae06321f10e3453 tests/rust-ui-memory-app/dependency_audit.py |
| 13 | 13 | 97c0bc5c804d85fb523da4c76abff2bec3aed3ae1e02b68db1c19792e9843808 tests/rust-ui-memory-app/files.json |
| @@ -16,6 +16,6 @@ ce7c1973b4eab97e4e49257ce4dbc5cb35c5a1eaae7c666a04b548fe1fd41dba tests/rust-ui- | ||
| 16 | 16 | 910cb4573b57fd26f122376f3f4eae0e4397163b83e32a3c850758d42f88dc55 tests/rust-ui-memory-app/fixtures/sample.tar |
| 17 | 17 | 09aca74cb3f20f1ed5b3e03fd647c80ef8e872f6ff97e17882cf2fda8b108b2c tests/rust-ui-memory-app/license-supplement.json |
| 18 | 18 | 865d69b95660fefe8c9ad6129d2692cff8007ecc3d55de1a049fe162173f434d tests/rust-ui-memory-app/reference-ui.lock |
| 19 | 삭제: 3d6e73d481755bcf8d42f1574a5f4b669f38f9e5ae61ddfcfc4c55af07e6aace tests/rust-ui-memory-app/regressions.rs | |
| 19 | 추가: 4eec2f9e036bc0fc04a1ff0af31aa28e593c185f8d1d230c8105a8fefc92fc4d tests/rust-ui-memory-app/regressions.rs | |
| 20 | 20 | f6a7b3df44869c206ff517f32653885c5fcd2f335ef4e8eff94d6ab626ca4119 tests/rust-ui-memory-app/sources.json |
| 21 | 21 | 6a756de6da66731b1ea9eaaacedfbe32096bd6a918eab591a392bc45529184f5 tests/rust-ui-memory-app/static_check.py |
| @@ -19,14 +19,16 @@ | ||
| 19 | 19 | "raw": "모든 checkpoint Event를 순번 변경 없이 try_send함. 최초 전달 실패 이후 suffix는 보내지 않고 first_missing_sequence로 시작 위치를 보존함. 원래 observer Err를 반환 우선순위로 유지하며 전달 실패는 별도임", |
| 20 | 20 | "receiver": "원본 연속 stream을 PR42 Receiver로 검증함. 누락/중복 오류는 sticky로 보존하고 재생성하지 않음. terminal은 원형 보존하되 transport 오류가 있으면 payload 목록/내용에 적용하지 않음", |
| 21 | 21 | "completion": "용량 1 별도 채널로 Terminal 소유 이동. Full/Disconnected이면 반환된 값을 작업 스레드 반환값으로 소유하여 join으로 회수함. 복제하지 않음", |
| 22 | 삭제: "mutex": "추가 공유 mutex를 사용하지 않아 자체 poison 경로 없음. 표준 채널 내부 구현 전체의 panic 회수를 주장하지 않음" | |
| 22 | 추가: "mutex": "추가 공유 mutex를 사용하지 않아 자체 poison 경로 없음. 표준 채널 내부 구현 전체의 panic 회수를 주장하지 않음", | |
| 23 | 추가: "terminal_acceptance": "Accepted만 실제 현재 결과의 완료/오류 분류와 payload 적용을 허용함. IgnoredStale는 원형 진단용 보존만 하며 현재 작업은 DeliveryFailure임. terminal 누락/Receiver 누락/검증 오류도 성공으로 처리하지 않음. payload 조회는 내부 accepted latch도 요구함" | |
| 23 | 24 | }, |
| 24 | 25 | "lifecycle": { |
| 25 | 26 | "frame": "poll/try_recv/try_iter/is_finished만 사용하며 실행 중 join하지 않음. 완료 수신과 join 상태를 분리하고 원본 결과를 한 번 소유함", |
| 26 | 27 | "close": "확인/취소 요청 후 대기/철회 구분. 철회해도 전송한 취소는 남음. 종료 확인 전 시작/재시작/실제 닫기 금지. 확인 중 먼저 완료돼도 선택은 유지함", |
| 27 | 삭제: "drop": "정상 GUI frame은 busy Task를 제거하지 않음. 비정상 owner 폐기의 Drop은 취소 요청 후 동기 join하여 조용한 detach를 피함. 이 비정상 fallback은 기다릴 수 있으며 비선점 callback/OOM/강제 프로세스 종료에서 유한 종료를 보장하지 않음", | |
| 28 | 추가: "drop": "정상 GUI frame은 busy Task를 제거하지 않음. 비정상 소유권 폐기나 앱 종료에서 Task::Drop은 취소 요청 후 동기 join하므로 blocking할 수 있음. 비차단 보장은 정상 poll/닫기 전이 범위임. 강제 종료/비선점 callback/OOM에서 유한 종료나 안전한 회수를 보장하지 않음", | |
| 28 | 29 | "panic": "JoinError 원형을 별도로 소유하며 Terminal이나 cleanup 성공을 합성하지 않음", |
| 29 | 삭제: "cancel": "요청과 실제 native 반환을 구분함. 이미 완료된 성공을 뒤늦은 취소로 바꾸지 않음. 마지막 checkpoint와 Terminal 생성 사이 경합은 확정 검증하지 않음" | |
| 30 | 추가: "cancel": "요청과 실제 native 반환을 구분함. 이미 완료된 성공을 뒤늦은 취소로 바꾸지 않음. 마지막 checkpoint와 Terminal 생성 사이 경합은 확정 검증하지 않음", | |
| 31 | 추가: "normal_frame_regression": "gate로 실행 중인 스레드를 유지하고 poll/반복 시작/취소/닫기 확인/철회 뒤에도 같은 미join 핸들이 보존됨을 직접 회귀로 작성함. gate 해제 후 panic 종료와 명시적 poll_join을 확인함. 아직 실행하지 않았음" | |
| 30 | 32 | }, |
| 31 | 33 | "payload": { |
| 32 | 34 | "ownership": "원본 typed Terminal이 bytes/목록/Usage/원래 오류를 소유함. GUI 문자열은 별도 제한된 표시임", |
| @@ -65,7 +67,7 @@ | ||
| 65 | 67 | }, |
| 66 | 68 | "validation": { |
| 67 | 69 | "toolchain": "기존 Rust/Cargo/rustfmt 1.99.1 및 cache만 사용함", |
| 68 | 삭제: "rust_tests_declared": 28, | |
| 70 | 추가: "rust_tests_declared": 31, | |
| 69 | 71 | "names": [ |
| 70 | 72 | "zip_default_queue_fits_without_ui_drain", |
| 71 | 73 | "ustar_default_queue_fits_without_ui_drain", |
| @@ -94,7 +96,10 @@ | ||
| 94 | 96 | "oversized_queue_is_rejected_without_spawning", |
| 95 | 97 | "gzip_preview_preserves_original_bytes", |
| 96 | 98 | "ui_event_wrapper_excludes_old_operation_before_current_sequence", |
| 97 | 삭제: "native_gzip_callback_error_survives_simultaneous_queue_full" | |
| 99 | 추가: "native_gzip_callback_error_survives_simultaneous_queue_full", | |
| 100 | 추가: "controller_rejects_real_foreign_terminal_without_applying_payload", | |
| 101 | 추가: "joined_task_without_received_terminal_is_delivery_failure", | |
| 102 | 추가: "normal_frame_controls_retain_running_handle_until_explicit_join" | |
| 98 | 103 | ], |
| 99 | 104 | "rust_tests_compiled": false, |
| 100 | 105 | "rust_tests_discovered": false, |
| @@ -105,7 +110,8 @@ | ||
| 105 | 110 | "headless_lib": "Linux locked/offline exit 0", |
| 106 | 111 | "gui": "Linux ui feature binary locked/offline exit 0", |
| 107 | 112 | "rustfmt": "1.99.1 check exit 0", |
| 108 | 삭제: "metadata": "Linux headless/GUI locked/offline exit 0. Windows 두 target headless/GUI 선택 감사 완료. 미캐시 iOS를 포함한 무필터 metadata는 offline 실패로 보존함" | |
| 113 | 추가: "metadata": "Linux headless/GUI locked/offline exit 0. Windows 두 target headless/GUI 선택 감사 완료. 미캐시 iOS를 포함한 무필터 metadata는 offline 실패로 보존함", | |
| 114 | 추가: "previous_head": "d188493ff6b82f4aef4c648405be07316da36eb0의 빌드와 이번 보완 source 빌드는 별도 로그로 구분함" | |
| 109 | 115 | } |
| 110 | 116 | }, |
| 111 | 117 | "preservation": "새 두 디렉터리만 추가함. 기존 core/60개 원본/PR34/39/main/C# 수정 없음. 공유 로컬 Git 브랜치 전환/스테이징 없음" |
| @@ -419,3 +419,95 @@ fn native_gzip_callback_error_survives_simultaneous_queue_full() { | ||
| 419 | 419 | assert!(terminal.cancellation_requested()); |
| 420 | 420 | assert!(!terminal.cancellation_forwarded()); |
| 421 | 421 | } |
| 422 | 추가: | |
| 423 | 추가: #[test] | |
| 424 | 추가: fn controller_rejects_real_foreign_terminal_without_applying_payload() { | |
| 425 | 추가: let (foreign, _) = core::Operation::start().unwrap(); | |
| 426 | 추가: let (sender, _events) = mpsc::sync_channel(DEFAULT_CAPACITY); | |
| 427 | 추가: let foreign_terminal = runtime::execute(foreign, Action::Gzip, sender); | |
| 428 | 추가: assert!(foreign_terminal.outcome.is_ok()); | |
| 429 | 추가: let mut c = Controller::default(); | |
| 430 | 추가: assert!(c.start(Action::Gzip)); | |
| 431 | 추가: finish(c.task.as_ref().unwrap()); | |
| 432 | 추가: c.terminal = Some(foreign_terminal); | |
| 433 | 추가: c.poll(); | |
| 434 | 추가: assert_eq!(c.terminal_delivery, Some(core::Delivery::IgnoredStale)); | |
| 435 | 추가: assert_eq!(c.status, Status::DeliveryFailure); | |
| 436 | 추가: assert!(c.rows().is_empty()); | |
| 437 | 추가: assert!(!c.select(c.task.as_ref().unwrap().id, c.generation, 0)); | |
| 438 | 추가: assert!(c.selected_bytes().is_none()); | |
| 439 | 추가: assert!(c.terminal.as_ref().unwrap().outcome.is_ok()); | |
| 440 | 추가: assert!(c.task.as_ref().unwrap().joined()); | |
| 441 | 추가: } | |
| 442 | 추가: | |
| 443 | 추가: #[test] | |
| 444 | 추가: fn joined_task_without_received_terminal_is_delivery_failure() { | |
| 445 | 추가: let mut c = Controller::default(); | |
| 446 | 추가: assert!(c.start(Action::Gzip)); | |
| 447 | 추가: finish(c.task.as_ref().unwrap()); | |
| 448 | 추가: let withheld = c | |
| 449 | 추가: .task | |
| 450 | 추가: .as_ref() | |
| 451 | 추가: .unwrap() | |
| 452 | 추가: .completion | |
| 453 | 추가: .as_ref() | |
| 454 | 추가: .unwrap() | |
| 455 | 추가: .try_recv() | |
| 456 | 추가: .unwrap(); | |
| 457 | 추가: assert!(withheld.outcome.is_ok()); | |
| 458 | 추가: c.poll(); | |
| 459 | 추가: assert_eq!(c.status, Status::DeliveryFailure); | |
| 460 | 추가: assert!(c.terminal.is_none()); | |
| 461 | 추가: assert!(c.terminal_delivery.is_none()); | |
| 462 | 추가: assert!(c.rows().is_empty()); | |
| 463 | 추가: assert!(c.selected_bytes().is_none()); | |
| 464 | 추가: } | |
| 465 | 추가: | |
| 466 | 추가: #[test] | |
| 467 | 추가: fn normal_frame_controls_retain_running_handle_until_explicit_join() { | |
| 468 | 추가: use std::sync::{ | |
| 469 | 추가: Arc, | |
| 470 | 추가: atomic::{AtomicBool, Ordering}, | |
| 471 | 추가: }; | |
| 472 | 추가: struct RunningProbe(Arc<AtomicBool>); | |
| 473 | 추가: impl Drop for RunningProbe { | |
| 474 | 추가: fn drop(&mut self) { | |
| 475 | 추가: self.0.store(true, Ordering::SeqCst); | |
| 476 | 추가: } | |
| 477 | 추가: } | |
| 478 | 추가: let dropped = Arc::new(AtomicBool::new(false)); | |
| 479 | 추가: let worker_probe = dropped.clone(); | |
| 480 | 추가: let (ready, entered) = mpsc::sync_channel(1); | |
| 481 | 추가: let (release, gate) = mpsc::sync_channel(1); | |
| 482 | 추가: let task = Task::spawn_with(DEFAULT_CAPACITY, move |_, _| { | |
| 483 | 추가: let _probe = RunningProbe(worker_probe); | |
| 484 | 추가: ready.try_send(()).unwrap(); | |
| 485 | 추가: gate.recv_timeout(Duration::from_secs(5)).unwrap(); | |
| 486 | 추가: panic!("수명 회귀의 종료 경로"); | |
| 487 | 추가: }) | |
| 488 | 추가: .unwrap(); | |
| 489 | 추가: entered.recv_timeout(Duration::from_secs(5)).unwrap(); | |
| 490 | 추가: let id = task.id; | |
| 491 | 추가: let mut c = Controller::default(); | |
| 492 | 추가: c.task = Some(task); | |
| 493 | 추가: c.poll(); | |
| 494 | 추가: assert!(!c.start(Action::Zip)); | |
| 495 | 추가: assert!(c.cancel()); | |
| 496 | 추가: c.request_close(); | |
| 497 | 추가: c.confirm_close(); | |
| 498 | 추가: assert_eq!(c.close, CloseState::Waiting); | |
| 499 | 추가: c.poll(); | |
| 500 | 추가: c.keep_open(); | |
| 501 | 추가: c.poll(); | |
| 502 | 추가: assert!(c.busy()); | |
| 503 | 추가: assert_eq!(c.task.as_ref().unwrap().id, id); | |
| 504 | 추가: assert!(!c.task.as_ref().unwrap().joined()); | |
| 505 | 추가: assert!(!dropped.load(Ordering::SeqCst)); | |
| 506 | 추가: release.try_send(()).unwrap(); | |
| 507 | 추가: finish(c.task.as_ref().unwrap()); | |
| 508 | 추가: c.poll(); | |
| 509 | 추가: assert!(dropped.load(Ordering::SeqCst)); | |
| 510 | 추가: assert!(c.task.as_ref().unwrap().joined()); | |
| 511 | 추가: assert_eq!(c.status, Status::Panicked); | |
| 512 | 추가: assert_eq!(c.close, CloseState::Open); | |
| 513 | 추가: } |