Visual Studio Code, rebuilt in Rust
Rust
feat(update): block the unattended restart on a window's own command line
rokartur71f5a99d690a
diff --git a/native/crates/app/src/launch.rs b/native/crates/app/src/launch.rsindex 6d711081b77..b2c9b26fa0b 100644--- a/native/crates/app/src/launch.rs+++ b/native/crates/app/src/launch.rs@@ -10,10 +10,11 @@ use futures::channel::mpsc::{UnboundedReceiver, unbounded};use gpui::App;use serde_json::{Value, json};-/// What a second instance sends: its command line and working directory, or a `--status` request answered with the+/// What a second instance sends: its command line, working directory and whether a terminal's `code` started it+/// (`isLaunchedFromCli` of its `userEnv`), or a `--status` request answered with the/// main process diagnostics (main.ts asks the `diagnostics` channel of the same socket).pub enum Launch {- Open { args: Vec<String>, cwd: PathBuf },+ Open { args: Vec<String>, cwd: PathBuf, launched_from_cli: bool },Status(futures::channel::oneshot::Sender<crate::diagnostics::MainDiagnostics>),}@@ -28,7 +29,8 @@ pub fn send_to_running_instance(socket: &Path, args: &[String], cwd: &Path) -> blet _ = std::fs::remove_file(socket);return false;};- let message = json!({ "args": args, "cwd": cwd });+ let launched_from_cli = std::env::var("VSCODE_CLI").is_ok_and(|cli| cli == "1");+ let message = json!({ "args": args, "cwd": cwd, "launchedFromCli": launched_from_cli });if writeln!(stream, "{message}").is_err() {return false;}@@ -71,7 +73,8 @@ pub fn listen(socket: &Path) -> Option<UnboundedReceiver<Launch>> {}let args = message["args"].as_array().into_iter().flatten().filter_map(|arg| arg.as_str().map(str::to_owned)).collect();let cwd = PathBuf::from(message["cwd"].as_str().unwrap_or_default());- if sender.unbounded_send(Launch::Open { args, cwd }).is_err() {+ let launched_from_cli = message["launchedFromCli"] == true;+ if sender.unbounded_send(Launch::Open { args, cwd, launched_from_cli }).is_err() {return;}let _ = (&stream).write_all(b"ok\n");@@ -86,7 +89,7 @@ pub fn handle_launches(mut launches: UnboundedReceiver<Launch>, cx: &mut App) {cx.spawn(async move |cx| {while let Some(launch) = launches.next().await {let _ = cx.update(|cx| match launch {- Launch::Open { args, cwd } => crate::workbench::host::start_open_window(args, cwd, false, cx),+ Launch::Open { args, cwd, launched_from_cli } => crate::workbench::host::start_open_window(args, cwd, false, launched_from_cli, cx),Launch::Status(reply) => drop(reply.send(main_diagnostics(cx))),});}@@ -128,7 +131,7 @@ mod tests {let mut launches = listen(&socket).unwrap();let args = vec!["vsrustium".to_owned(), "folder".to_owned()];assert!(send_to_running_instance(&socket, &args, Path::new("/tmp")));- let Some(Launch::Open { args: sent, cwd }) = futures::executor::block_on(launches.next()) else { panic!("an open launch") };+ let Some(Launch::Open { args: sent, cwd, .. }) = futures::executor::block_on(launches.next()) else { panic!("an open launch") };assert_eq!((sent, cwd), (args, PathBuf::from("/tmp")));let request = std::thread::spawn({let socket = socket.clone();diff --git a/native/crates/app/src/main.rs b/native/crates/app/src/main.rsindex 165cc00886c..b64f1fa80df 100644--- a/native/crates/app/src/main.rs+++ b/native/crates/app/src/main.rs@@ -257,7 +257,7 @@ fn main() -> anyhow::Result<()> {true => Arc::new(Mutex::new(storage::Storage::in_memory())),false => Arc::new(Mutex::new(open_shared_storage(flag_value("--shared-data-dir").map(PathBuf::from))?)),};- let cli_profile = CliProfile::from_args(&args);+ let cli_profile = CliProfile::from_args(&args, std::env::var("VSCODE_CLI").is_ok_and(|cli| cli == "1"));// app.ts: a start with a forced profile opens only its new empty window.let restores = !(development.is_some() || cli_profile.is_forced() || screenshot.is_some() || export_default_keybindings.is_some() || open_url.is_some());let app = AppState { args: args.clone(), runtime, user_data, app_root, builtins, user_extensions_folder: extensions_folder, shared_storage };@@ -364,17 +364,25 @@ pub(crate) struct WindowRequest {}/// `--profile <name>` and `--profile-temp`: windowsMainService.ts `forceProfile` and `forceTempProfile`, given only-/// to the windows a command line opens, never to the ones opened later from the menu.+/// to the windows a command line opens, never to the ones opened later from the menu. With what the window's+/// `config` tells unattendedRestartScheduler.ts `getWindowBlockers` of that command line.#[derive(Default, Clone)]pub(crate) struct CliProfile {pub name: Option<String>,pub temp: bool,+ /// `hasSessionArguments(window.config)`.+ pub session_arguments: bool,+ /// `isLaunchedFromCli(window.config.userEnv)`.+ pub launched_from_cli: bool,}impl CliProfile {- pub fn from_args(args: &[String]) -> CliProfile {+ /// `args` with the program first, as `std::env::args`.+ pub fn from_args(args: &[String], launched_from_cli: bool) -> CliProfile {let name = args.iter().position(|arg| arg == "--profile").and_then(|i| args.get(i + 1)).cloned();- CliProfile { name, temp: args.iter().any(|arg| arg == "--profile-temp") }+ let parsed = argv::parse_and_validate(args.get(1..).unwrap_or_default()).map(|(parsed, _)| parsed).unwrap_or_default();+ let session_arguments = workbench::unattended_restart::SESSION_ARGUMENTS.iter().any(|id| parsed.flag(id));+ CliProfile { name, temp: args.iter().any(|arg| arg == "--profile-temp"), session_arguments, launched_from_cli }}pub fn is_forced(&self) -> bool {diff --git a/native/crates/app/src/workbench/host.rs b/native/crates/app/src/workbench/host.rsindex 756b980a052..15978fafc29 100644--- a/native/crates/app/src/workbench/host.rs+++ b/native/crates/app/src/workbench/host.rs@@ -102,7 +102,7 @@ impl Workbench {// resolves its own.let transient = workbench.user_data_profiles.state.as_ref().map(|state| &state.current).filter(|current| current.is_transient);let profile = match (reason == ShutdownReason::Reload, transient) {- (true, Some(current)) => CliProfile { name: Some(current.name.clone()), temp: false },+ (true, Some(current)) => CliProfile { name: Some(current.name.clone()), temp: false, ..workbench.cli_profile.clone() },(true, None) => workbench.cli_profile.clone(),(false, _) => Default::default(),};@@ -227,12 +227,12 @@ impl Workbench {/// files open in the window whose folder holds them (`findWindowOnFile`), else there, folders and workspaces in new windows unless `--reuse-window`,/// `--wait` or `window.openFoldersInNewWindow` keep the first one in the last active window. `from_dock` is the/// `DOCK` context of Finder and the Dock, where files open in a new window too.-pub(crate) fn start_open_window(args: Vec<String>, cwd: PathBuf, from_dock: bool, cx: &mut App) {+pub(crate) fn start_open_window(args: Vec<String>, cwd: PathBuf, from_dock: bool, launched_from_cli: bool, cx: &mut App) {let parsed = match crate::argv::parse_and_validate(&args[1..]) {Ok((parsed, _)) => parsed,Err(error) => return eprintln!("[windows] {error}"),};- let profile = CliProfile::from_args(&args);+ let profile = CliProfile::from_args(&args, launched_from_cli);let CommandLine { workspaces, folders_to_add, files, new_window, reuse_window } = CommandLine::from_args(&parsed, &cwd);let last_active = cx.window_stack().unwrap_or_else(|| cx.windows()).into_iter().find_map(|window| window.downcast::<Workbench>());let setting = |key: &str, cx: &App| last_active.and_then(|handle| handle.read(cx).ok()).map(|workbench| workbench.setting(key));diff --git a/native/crates/app/src/workbench/host/tests.rs b/native/crates/app/src/workbench/host/tests.rsindex d5970382f69..2ac7659fc73 100644--- a/native/crates/app/src/workbench/host/tests.rs+++ b/native/crates/app/src/workbench/host/tests.rs@@ -178,7 +178,7 @@ fn a_file_opens_in_the_window_whose_folder_holds_it(cx: &mut TestAppContext) {cx.update(|cx| open_request_window(crate::WindowRequest { workspace: Some(config::workspace::Workspace::open(dir.join(folder))), ..Default::default() }, cx));}let top = dir.join("PROJECT/top.txt").to_string_lossy().into_owned();- cx.update(|cx| super::start_open_window(vec![String::new(), top], "/".into(), false, cx));+ cx.update(|cx| super::start_open_window(vec![String::new(), top], "/".into(), false, false, cx));cx.update(|cx| crate::workbench::url_handler::open_system_urls(vec![format!("file://{}", dir.join("project/sub/deep.txt").display())], cx));cx.run_until_parked();let opened: Vec<(Option<PathBuf>, Option<String>)> = cx.update(|cx| {diff --git a/native/crates/app/src/workbench/profiles_editor_view.rs b/native/crates/app/src/workbench/profiles_editor_view.rsindex 980c2b7acba..7b3c9543c80 100644--- a/native/crates/app/src/workbench/profiles_editor_view.rs+++ b/native/crates/app/src/workbench/profiles_editor_view.rs@@ -278,7 +278,7 @@ impl Workbench {new_profile.preview = Some(profile.clone());}self.profiles_changed(cx);- super::user_data_profile::open_profile_window(crate::CliProfile { name: Some(profile.name.clone()), temp: false }, cx);+ super::user_data_profile::open_profile_window(crate::CliProfile { name: Some(profile.name.clone()), ..Default::default() }, cx);cx.notify();}@@ -829,7 +829,7 @@ impl Workbench {.flex().justify_end().mr(px(10.))- .child(self.icon("empty-window", 22., 16., foreground).id(("profile-open-window", profile.id.len())).cursor_pointer().on_click(move |_, _, cx| super::user_data_profile::open_profile_window(crate::CliProfile { name: Some(open_name.clone()), temp: false }, cx)))+ .child(self.icon("empty-window", 22., 16., foreground).id(("profile-open-window", profile.id.len())).cursor_pointer().on_click(move |_, _, cx| super::user_data_profile::open_profile_window(crate::CliProfile { name: Some(open_name.clone()), ..Default::default() }, cx))).when(!active, |actions| {actions.child(self.icon("window", 22., 16., foreground).id(("profile-use", profile.id.len())).cursor_pointer().on_click(cx.listener(move |workbench, _, window, cx| workbench.switch_profile(&switch_to, window, cx))))})diff --git a/native/crates/app/src/workbench/unattended_restart.rs b/native/crates/app/src/workbench/unattended_restart.rsindex 62d21b9186b..0560bdf892f 100644--- a/native/crates/app/src/workbench/unattended_restart.rs+++ b/native/crates/app/src/workbench/unattended_restart.rs@@ -176,7 +176,7 @@ fn failed_update_version(user_data: &Path, commit: &str) -> Option<String> {}/// unattendedRestartScheduler.ts `SESSION_ARGUMENTS`: the relaunch drops them or discards the saved layout.-const SESSION_ARGUMENTS: [&str; 9] = ["disable-extensions", "disable-extension", "disable-layout-restore", "enable-proposed-api", "inspect-extensions", "inspect-brk-extensions", "profile", "profile-temp", "use-inmemory-secretstorage"];+pub(crate) const SESSION_ARGUMENTS: [&str; 9] = ["disable-extensions", "disable-extension", "disable-layout-restore", "enable-proposed-api", "inspect-extensions", "inspect-brk-extensions", "profile", "profile-temp", "use-inmemory-secretstorage"];/// updateRelaunchArguments.ts `RELAUNCH_STRING_ARGUMENTS` and `RELAUNCH_FLAG_ARGUMENTS`, which the macOS updater's/// relaunch drops (it passes no arguments).@@ -210,10 +210,12 @@ fn window_blockers(workbench: &Workbench) -> Vec<&'static str> {if workbench.user_data_profiles.state.as_ref().is_some_and(|state| state.current.is_transient) {blockers.push("window.temporaryProfile");}- // The window's own `SESSION_ARGUMENTS`: the port's windows keep only `--profile` and `--profile-temp`.- if workbench.cli_profile.name.is_some() || workbench.cli_profile.temp {+ if workbench.cli_profile.session_arguments {blockers.push("window.launchArguments");}+ if workbench.cli_profile.launched_from_cli {+ blockers.push("window.launchedFromCli");+ }blockers}@@ -497,10 +499,14 @@ mod tests {fn windows_that_do_not_come_back_as_they_are_block(cx: &mut gpui::TestAppContext) {let (workbench, cx) = workbench(cx);workbench.update(cx, |workbench, _| {+ assert_eq!(window_blockers(workbench), Vec::<&str>::new());+ // NewWindowWithProfileAction: a profile picked in the window is no argument of a command line.+ workbench.cli_profile = crate::CliProfile { name: Some("Work".into()), ..Default::default() };assert_eq!(window_blockers(workbench), Vec::<&str>::new());workbench.extension_development = true;- workbench.cli_profile.temp = true;- assert_eq!(window_blockers(workbench), ["window.extensionDevelopment", "window.launchArguments"]);+ let command_line = ["code", "--disable-extensions", "."].map(String::from);+ workbench.cli_profile = crate::CliProfile::from_args(&command_line, true);+ assert_eq!(window_blockers(workbench), ["window.extensionDevelopment", "window.launchArguments", "window.launchedFromCli"]);});}diff --git a/native/crates/app/src/workbench/url_handler.rs b/native/crates/app/src/workbench/url_handler.rsindex be8c12e2a8c..09ff8664574 100644--- a/native/crates/app/src/workbench/url_handler.rs+++ b/native/crates/app/src/workbench/url_handler.rs@@ -94,7 +94,7 @@ pub(crate) fn open_system_urls(urls: Vec<String>, cx: &mut gpui::App) {}}if args.len() > 1 {- super::host::start_open_window(args, PathBuf::from("/"), true, cx);+ super::host::start_open_window(args, PathBuf::from("/"), true, false, cx);}}diff --git a/native/crates/app/src/workbench/user_data_profile.rs b/native/crates/app/src/workbench/user_data_profile.rsindex c3df7ec1e63..91cb240d39f 100644--- a/native/crates/app/src/workbench/user_data_profile.rs+++ b/native/crates/app/src/workbench/user_data_profile.rs@@ -39,7 +39,7 @@ impl Workbench {self.commands.register("workbench.profiles.actions.deleteProfile", |workbench, _, window, cx| workbench.show_delete_profiles(window, cx));self.commands.register("workbench.profiles.actions.newWindowWithProfile", |workbench, _, window, cx| workbench.show_new_window_with_profile(window, cx));self.commands.register("workbench.profiles.actions.createTemporaryProfile", |_, _, _, cx| {- open_profile_window(CliProfile { name: None, temp: true }, cx);+ open_profile_window(CliProfile { temp: true, ..CliProfile::default() }, cx);Outcome::done()});self.commands.register("workbench.profiles.actions.cleanupProfiles", |workbench, _, _, cx| {@@ -181,7 +181,7 @@ impl Workbench {let open_id = open_profile_command(&profile.name);let name = profile.name.clone();let registration = self.commands.register(open_id.clone(), move |_, _, _, cx| {- open_profile_window(CliProfile { name: Some(name.clone()), temp: false }, cx);+ open_profile_window(CliProfile { name: Some(name.clone()), ..CliProfile::default() }, cx);Outcome::done()});registrations.push((open_id, registration));@@ -268,7 +268,7 @@ impl Workbench {cx.spawn_in(window, async move |workbench, cx| {let Ok(Ok(Value::Number(handle))) = picked.await else { return };let name = profiles[handle.as_u64().expect("a handle") as usize].name.clone();- let _ = workbench.update(cx, |_, cx| open_profile_window(CliProfile { name: Some(name), temp: false }, cx));+ let _ = workbench.update(cx, |_, cx| open_profile_window(CliProfile { name: Some(name), ..CliProfile::default() }, cx));}).detach();Outcome::done()diff --git a/port/ledger.md b/port/ledger.mdindex bcdd8e62aae..7fd8c3a6c75 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -408,7 +408,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/services/languageDetection | workbench service | M13 | ported | [3 S] workbench/language_detection.rs: 4 s after typing a Python snippet into a new untitled editor (Cmd+N in a ui-pair run, hc) the port's language entry shows Python, the reference's still Plain Text, also after 12 s; not yet known whether the reference build lacks the detection model or the port detects where upstream does not | language_detection.rs (languageDetectionWebWorker.ts `detectLanguagesImpl`, `adjustLanguageConfidence`, the 10000 char sample) and workbench/language_detection.rs (`LanguageDetectionWorkerClient`: the file name guess first, then @vscode/vscode-languagedetection 1.0.23 with its model in a Bun worker from the app's node_modules, model ids mapped as `getLanguageId`; `autoDetectLanguage` of textEditorModel.ts for untitled models and extensionless plain text files, 600 ms throttle, skipped after an explicit language and with `workbench.editor.languageDetection` off): cargo test -p app language_detection (the worker test runs the real model). The history biases only feed the regexp model, which 1.147.0 does not ship (`vscode-regexp-languagedetection` is not a dependency), so neither side has it; no telemetry || workbench/services/languageStatus | workbench service | M13 | verified | | `$setLanguageStatus` / `$removeLanguageStatus`, statuses matched by selector, ordered by severity, source, id (workbench/language_status.rs): cargo test -p app language_status || workbench/services/layout | workbench service | M11 | ported | [3 S] terminal_view.rs:1235: with Tab Focus Mode on, Tab in the terminal goes to the shell, where terminalInstance.ts:1204 leaves it to the browser's Tab order (port/notes.md Toggle Tab Key Moves Focus) <br> [3 S] action_bar.rs:45: an action bar item focused by Tab shows no hover, where the reference shows the command center's and Customize Layout's tooltips on focus, and the activity bar item's focus outline has square corners where the reference's are rounded (ui-pair Tab steps, port/notes.md Toggle Tab Key Moves Focus) <br> [3 L] workbench.rs:591: the Workbench is one GPUI view, so every scroll frame of any list renders and lays out every part again, where upstream's DOM updates only the scrolled list; the side bar, the editor area, the panel, the status bar, the activity bar and the title bar are cached part views (part_view.rs: a list scroll notifies only the view it was painted in, an editor scroll only the editor area's, a size measured while drawing redraws its view after the frame; the status bar gave no measurable change), the secondary side bar still renders with the Workbench; the Explorer's rows are absolutely placed 22px boxes as listView.ts's (workbench.rs Explorer rows; ~70% of the Explorer frame was the taffy layout of its rows in flow); `scroll_frame_time` median / p95 (two interleaved runs, the Studio shared): Explorer 3.7 / 15.5 and 3.6 / 14.7 ms (rows in flow: 10.9 / 18.6 and 11.0 / 21.4), Editor 8.6 / 24.3 and 8.8 / 26.3 ms, Settings 1.7 / 5.0 and 1.7 / 5.2 ms, Extensions 2.2 / 3.5 and 2.2 / 7.4 ms; each `key_context` caller clones every `config.*` key (keyboard.rs:400), the menubar and the timeline toolbar are rebuilt; the next steps are the Editor's median and every surface's p95 spikes (port/notes.md Scroll frame costs, cheap steps). GUI (Studio at load 33 to 57, 60 Hz display, 690 trackpad events in 7 s): main thread in `Window::draw` 86% scrolling the Explorer (800 files), 89% the Extensions @builtin list (port/notes.md Scroll frame costs) | layout.ts as a split-view tree (workbench/layout.rs): panel position (bottom, top, left, right) and alignment, primary side bar left or right, maximized panel with `panelMaximizationSupportedWhen`, hidden parts, persisted sizes and positions; zen mode (zen_mode.rs) with its settings and restore; centered layout (centered_layout.rs) with its sashes and stored margins; View > Appearance entries and the Panel Position and Align Panel submenus (cargo test -p app -- layout part_grid centered_layout zen_mode); layoutActions.ts Customize Layout quick pick (workbench/customize_layout.rs) with live items, Restore Defaults and Close, Toggle Activity Bar Visibility, Align Quick Input Top/Center (cargo test -p app -- customize_layout toggling_the_activity_bar; ui-pair m11/manage-menu.json, port/results/manage-menu.md; missing until then though the title bar showed its button); ui-pair layout-positions.json and layout-zen.json against the reference (port/results/layout.md). The pairs run with `zenMode.fullScreen` off. Maximize Secondary Side Bar (`workbench.action.maximizeAuxiliaryBar`, `restoreAuxiliaryBar`, `toggleMaximizedAuxiliaryBar`, the title's toggle) hides the other parts and restores them (workbench/panel.rs; cargo test -p app -- maximizing_the_secondary_side_bar_hides_the_other_parts_and_restore_brings_them_back). Zen mode enforces `zenMode.showTabs` on the main editor part until it ends (layout.ts `toggleZenMode` `enforcePartOptions`; workbench/zen_mode.rs `editor_show_tabs`; cargo test -p app -- show_tabs_picks_the_title_control_and_zen_mode_enforces_its_own); navigationActions.ts `workbench.action.focusNextPart`/`focusPreviousPart` (F6, Shift+F6) walk editor, panel, auxiliary bar, status bar, activity bar and side bar past the hidden ones with layout.ts `focusPart` (the pane container's first expanded view; workbench/part_navigation.rs; cargo test -p app f6_walks_the_visible_parts); in an editor window F6 goes between its editor and its own status bar, whose entry focus is kept per window (workbench/auxiliary_windows.rs `auxiliary_status_bar`, workbench/status_entries.rs; cargo test -p app f6_in_an_editor_window_reaches_its_own_status_bar) |-| workbench/services/lifecycle | workbench service | M11 | ported | [3 S] unattendedRestart.ts: the editor detail names the scheme where upstream names `typeId`, and `workbench.floatingWindowNotRestorable` cannot occur (the port's auxiliary windows are all editor parts) <br> [3 S] workbench/unattended_restart.rs `window_blockers`: a window keeps only `--profile` and `--profile-temp` of the command line that opened it, so `window.launchArguments` misses its other `SESSION_ARGUMENTS` and `window.launchedFromCli` its `VSCODE_CLI` environment | workbench/lifecycle.rs: ShutdownReason, onBeforeShutdown vetoes on quit, close button, closeWindow, reload and load (`window.confirmBeforeClose`, backup tracker auto save, hot exit, showSaveConfirm); cargo test -p app lifecycle; no phases or onWillShutdown joiners; workbench/unattended_restart.rs: `canRestartUnattended` with its blocker aggregation and change log, and the participants `workbench.starting` (2.5 s after restore), dialog, quick input, transient workspace, modal editor, editors not restored or not restorable, `debug.sessionActive`, `tasks.running`, the backup tracker's `workingCopy.*` and `cli.waitingForEditorClose`, terminalUnattendedRestart.ts with childProcessMonitor.ts `hasChildProcesses` (terminal/pty.rs, background jobs included: cargo test -p app a_background_job_is_a_child_process_of_the_shell), testingUnattendedRestart.ts, `testing.continuousRun`, webviewUnattendedRestart.ts and notebookUnattendedRestart.ts: cargo test -p app unattended_restart (unattendedRestart.test.ts, terminalUnattendedRestart.test.ts, testingUnattendedRestart.test.ts); update/unattended_restart.rs: unattendedRestartScheduler.ts's decisions (keep awake from the lock, restart once locked a minute, retry every minute, veto, a newer update postponing, battery and thermal pressure, resume restarting the clock, the update not installed last time) over injected time: cargo test -p app update::unattended_restart (13 of unattendedRestartScheduler.test.ts's cases, without the telemetry outcomes the port does not send); workbench/unattended_restart.rs `UnattendedRestart`: the scheduler's host on macOS (power events, window blur, update state, timers, the `prevent-app-suspension` blocker, `quitAndInstall` from a window), `getWindowBlockers`, `hasArgumentsLostOnRelaunch`, `app.launchedFromCli`, `app.dialogOpen` (dialog.rs `has_open_dialogs`: the NSAlert sheets and the open and save panels) and the failed update remembered across the restart: cargo test -p app unattended_restart (a_locked_screen_keeps_the_machine_awake, windows_that_do_not_come_back_as_they_are_block, launch_arguments_the_relaunch_drops_block, a_restart_that_came_back_on_the_same_commit_failed_to_install); windows_state.rs `setNextExactRestore`/`takeExactRestore` (minimized windows, hidden app): cargo test -p app windows_state; verified: cargo test -p app backup_tracker lifecycle (workingCopyBackupTracker.test.ts); ui-pair hot-exit.json `dirty`, `restored` vs the reference (port/results/windows.md, milestone 11 verification) |+| workbench/services/lifecycle | workbench service | M11 | ported | [3 S] unattendedRestart.ts: the editor detail names the scheme where upstream names `typeId`, and `workbench.floatingWindowNotRestorable` cannot occur (the port's auxiliary windows are all editor parts) | workbench/lifecycle.rs: ShutdownReason, onBeforeShutdown vetoes on quit, close button, closeWindow, reload and load (`window.confirmBeforeClose`, backup tracker auto save, hot exit, showSaveConfirm); cargo test -p app lifecycle; no phases or onWillShutdown joiners; workbench/unattended_restart.rs: `canRestartUnattended` with its blocker aggregation and change log, and the participants `workbench.starting` (2.5 s after restore), dialog, quick input, transient workspace, modal editor, editors not restored or not restorable, `debug.sessionActive`, `tasks.running`, the backup tracker's `workingCopy.*` and `cli.waitingForEditorClose`, terminalUnattendedRestart.ts with childProcessMonitor.ts `hasChildProcesses` (terminal/pty.rs, background jobs included: cargo test -p app a_background_job_is_a_child_process_of_the_shell), testingUnattendedRestart.ts, `testing.continuousRun`, webviewUnattendedRestart.ts and notebookUnattendedRestart.ts: cargo test -p app unattended_restart (unattendedRestart.test.ts, terminalUnattendedRestart.test.ts, testingUnattendedRestart.test.ts); update/unattended_restart.rs: unattendedRestartScheduler.ts's decisions (keep awake from the lock, restart once locked a minute, retry every minute, veto, a newer update postponing, battery and thermal pressure, resume restarting the clock, the update not installed last time) over injected time: cargo test -p app update::unattended_restart (13 of unattendedRestartScheduler.test.ts's cases, without the telemetry outcomes the port does not send); workbench/unattended_restart.rs `UnattendedRestart`: the scheduler's host on macOS (power events, window blur, update state, timers, the `prevent-app-suspension` blocker, `quitAndInstall` from a window), `getWindowBlockers` (`window.launchArguments` and `window.launchedFromCli` from the command line that opened the window, a second instance's `VSCODE_CLI` sent with its arguments), `hasArgumentsLostOnRelaunch`, `app.launchedFromCli`, `app.dialogOpen` (dialog.rs `has_open_dialogs`: the NSAlert sheets and the open and save panels) and the failed update remembered across the restart: cargo test -p app unattended_restart (a_locked_screen_keeps_the_machine_awake, windows_that_do_not_come_back_as_they_are_block, launch_arguments_the_relaunch_drops_block, a_restart_that_came_back_on_the_same_commit_failed_to_install); windows_state.rs `setNextExactRestore`/`takeExactRestore` (minimized windows, hidden app): cargo test -p app windows_state; verified: cargo test -p app backup_tracker lifecycle (workingCopyBackupTracker.test.ts); ui-pair hot-exit.json `dirty`, `restored` vs the reference (port/results/windows.md, milestone 11 verification) || workbench/services/localTranscription | workbench service | | removed | | no AI or Microsoft services by decision (port/notes.md); API stays inert || workbench/services/localization | workbench service | M18 | verified | | ui-pair port/fixtures/extensions/ui-display-language.json: picking Deutsch installs MS-CEINTL.vscode-language-pack-de with the "Installing Deutsch language support..." progress and asks "Restart VSRustium to switch to Deutsch?"; localeService.ts: argv.json `locale` written and cleared, restart dialog, install of an MS-CEINTL pack: cargo test -p app nls localization; Command Palette titles, categories and descriptions translate by the reference call's module and key (port/tools/ref-commands with ref-nls-clone.ts; cargo test -p app a_palette_title_two_modules), menu bar items, side bar titles and pane headers by the reference's `nlsKeys` per menu, view and container (cargo test -p app menu_bar_items_and_view_titles_resolve_per_scope); other surfaces stay English (port/notes.md) || workbench/services/log | workbench service | M6 | verified | | output/log_levels.rs: defaultLogLevels.ts argv.json `log-level` read and write, `getDefaultLogLevel`, `parseLogLevel`; logs_actions.rs `setDefaultLogLevel` (cargo test -p app set_default_log_level_writes_argv, reads_and_writes_argv_log_levels); the Window log as logConstants.ts `windowLogId`; electron-browser logService.ts in a test run: the host console reaches stdout/stderr through the session; output/log_levels.rs: defaultLogLevels.ts argv.json `log-level` read and write, `getDefaultLogLevel`, `parseLogLevel`; logs_actions.rs `setDefaultLogLevel` (cargo test -p app set_default_log_level_writes_argv, reads_and_writes_argv_log_levels); the Window log as logConstants.ts `windowLogId` |