From 030ecfcff6b61c598e0fde39e554d6fc588d569f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 15 Oct 2026 03:27:17 -0400 Subject: [PATCH] R6.3 round 2 fix: an explicit open of a shown file joins the list Opening a file a tab already shows only focuses it; the recent list now learns it too. The restart regression reopens the restored file. Co-Authored-By: Claude Opus 5.5 (1M context) --- apps/ely-mark/src/places.rs | 11 ++++++++--- apps/ely-mark/src/restore/tests.rs | 16 +++++++++++++--- tasks/reviews/R6.3-r2.md | 3 +++ 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 tasks/reviews/R6.3-r2.md diff --git a/apps/ely-mark/src/places.rs b/apps/ely-mark/src/places.rs index b7b8e0c..7324cab 100644 --- a/apps/ely-mark/src/places.rs +++ b/apps/ely-mark/src/places.rs @@ -13,9 +13,14 @@ use crate::folder::{Folder, markdown_under}; impl Desk { /// A folder lists beside; a file opens in a tab. pub fn open_path(&mut self, path: PathBuf, cx: &mut Context) { - match path.is_dir() { - true => self.open_folder(path, cx), - false => self.open_file(path, cx), + if path.is_dir() { + return self.open_folder(path, cx); + } + // A shown file only takes focus; the list still learns. + let shown = self.tab_of(&path).is_some(); + self.open_file(path.clone(), cx); + if shown { + self.remember(&path, cx); } } diff --git a/apps/ely-mark/src/restore/tests.rs b/apps/ely-mark/src/restore/tests.rs index 9591ed4..00d3978 100644 --- a/apps/ely-mark/src/restore/tests.rs +++ b/apps/ely-mark/src/restore/tests.rs @@ -472,9 +472,19 @@ mod window { assert!(desk.read_with(cx, |desk, _| desk.recent.is_empty())); let list = data.path().join("recent.json"); assert_eq!(std::fs::read_to_string(&list).expect("the list"), "[]"); - // An explicit open still joins the list. + // Explicit opens still join it, the restored file too. + open(&desk, &a, cx); open(&desk, &b, cx); - let real = dunce::canonicalize(&b).expect("real"); - assert_eq!(desk.read_with(cx, |desk, _| desk.recent.clone()), [real]); + assert_eq!(names(&desk, cx), ["a.md", "b.md"]); + let real = |path: &std::path::Path| dunce::canonicalize(path).expect("real"); + let (a, b) = (real(&a), real(&b)); + assert_eq!( + desk.read_with(cx, |desk, _| desk.recent.clone()), + [b.clone(), a.clone()] + ); + let kept: Vec = + serde_json::from_str(&std::fs::read_to_string(&list).expect("the list")) + .expect("a list"); + assert_eq!(kept, [b, a]); } } diff --git a/tasks/reviews/R6.3-r2.md b/tasks/reviews/R6.3-r2.md new file mode 100644 index 0000000..11b1726 --- /dev/null +++ b/tasks/reviews/R6.3-r2.md @@ -0,0 +1,3 @@ +FAIL + +- apps/ely-mark/src/desk.rs:234 — [P2] Explicitly reopening a restored file does not put it back in the recent list. Open `private.md`, click **Clear Recent Files**, quit with its tab open, restart, then choose that same file through Open. The restart correctly preserves the empty history, but the explicit open only focuses the existing tab (`crates/ely-office/src/open.rs:81`); its prefilled `remembered` entry also prevents subsequent observations from recording it. Both the sidebar and `recent.json` remain empty. The isolated probe reproduced this twice; closing the tab before reopening passes (`.work/R6.3-r2/probes.log`, `.work/R6.3-r2/reopen-isolated.log`). All 99 ely-files and 141 ElyMark tests pass, including the fixed round-1 restart case, because the new regression explicitly opens only a different file (`apps/ely-mark/src/restore/tests.rs:476`). Preserve suppression for automatic restoration, but update recent history when an explicit open successfully activates an existing tab. Cover reopening the same restored file and assert both the displayed list and persisted history.