Repository navigation
Main keeps editor tabs under owned ids and in-place re-owns in step (dark, layout-owner build only) - #30206
Conversation
…dark, layout-owner build only) A restored tab re-owned inside its own workspace now tells main through renameEditorFiles with the file's new record; main skips it for paired servers. Main's load, save, close and tab-host read an editor tab's file by its owned id as well as its path, behind the layout-owner switch.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
…lder 分頁開啟時已綁到 repo,讀取時不需要重新歸屬
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
withFolderFileGitOwner 會把 folder workspace 編輯分頁的 relativePath 改寫成 repo 相對路徑, worktreeId 卻仍是 folder,上游的 overflow reload、runtime 讀檔、quick-open 歷史與 mobile 投影都因此 對不到檔案。 - 編輯分頁的 relativePath 一律相對 worktreeId;Explorer/quick-open 開檔只綁 gitWorktreeId - 絕對路徑開啟的分頁不綁 owner,讓上游 stablyai#30206 的同 workspace re-own 照常運作,測試退回 v1.4.250 版 - SC 帶 owner 開檔(含 conflict 兩個入口)時把 repo 相對路徑換成 folder 相對;folder root 外的檔案維持 repo 相對 - 還原 session 時把舊格式的 repo 相對路徑遷移成 folder 相對,owner 保留 - SC 清單的「目前開啟」高亮改從 filePath 推算 repo 相對路徑 - FORK.md 新增「刻意偏離上游的行為」一節;新測試加入 seam 清單
ELI5
In the build where the main process keeps the tab layout (off in every shipped build), main could lose track of two kinds of editor tab:
Both are now kept in step with the window. Shipped builds behave exactly as before.
What Changed
Re-own inside one workspace. A restored tab can switch to a new owner without leaving its workspace. The window then gives it a new id and a new file record (for example, the relative path is fixed). Until now, main heard about this only for paired-server workspaces, and main does not own those layouts. A test shows a local workspace can also get here: a git workspace's conflict review reads a path whose bare id belongs to a tab in a folder workspace nested inside it. The window now sends
renameEditorFileswith the file's new record, the same command it already sends for a rename on disk. Main replaces the tab id and the record. For a paired server's workspace the send is skipped as before, because main does not own that layout. With the switch off, nothing changes: this code only runs in the layout-owner build.Tabs whose id names their workspace. Main's load, save, tab close and tab host lookup all matched an editor tab to its file with
tab.entityId === file.filePath. They now share one check,editorTabShowsFile, which also accepts the file's owned id, built with the existingownedEditorFileIdthat the window's ids use. Before, in the layout-owner build: a preview tab under an owned id saved its file without the preview flag, its tab entry named the partition's host instead of the file's, and closing it left its file record behind. After: all three follow the file.Why
Linked Issue
N/A (maintainer follow-up to the layout-owner editor census)
Visual Proof
N/A: no UI or interaction change in shipped builds. The layout-owner build only changes which commands and records main keeps.
Testing
Failing first, then passing:
restored-editor-same-workspace-reown.test.tsx: drives the real file loader. A folder workspace nested in a git workspace, with a tab opened by absolute path, re-owns in place when the parent's conflict review reads that path. Before the fix no command was sent; nowrenameEditorFilesgoes out with the new record. Also covers: no re-own and no send for the tab's own read, and no send for a paired server's in-place re-own.restored-editor-owner-layout-owner.test.ts: an in-place re-own applied to main's model leaves main's tabs and file record matching the window's.workspace-layout-owned-editor-id.test.ts: load, save, load with a preview tab under an owned id (floating and git workspace), a stored disagreement still demotes the tab, the tab names its file's host, closing it drops its record, the active file id survives, and with the switch off the path-only match is unchanged.Gates (all local, in the PR lane):
pnpm tcclean;pnpm run check:code-quality:changed0 findings; layout-writer ratchets OK (main 211, renderer 651); focus-read ratchet OK (1082); anti-slop lint clean; vitest (--maxWorkers=4) onsrc/shared/workspace-layout, the editor slices and components,src/main/persistenceand the touched main runtime layout files: 679 files, 5996 tests passed.Switch-off bundle diff (unminified, base
aff4ee7ac71vs this branch, hashes normalized):editorTabShowsFilecompiles toentityId === file.filePath || false, and every changed call site (load preview demotion, save preview flag, tab close, tab host for saved and published tabs) now calls it. Same result as the old path-only comparisons. The only other change is the build commit stamp.ownedEditorFileIdnow appears as an unused export in one chunk. Everything else is import and export alias renames and the commit stamp. Chunks that share a name were compared as sets and are identical.Layout save check, switch on, before (base build) and after (this branch), same specs (
golden-quit-relaunch-session,workspace-layout-oracle,cli-floating-file-open-position,tab-close-navigation): 26 passed and 0 reports on both.Platforms: macOS. The change is path-agnostic: ids are built by the shared helper that already encodes every part.
AI Disclosure
Review
Flip capability list: none. No new
layout.applycommand or field; the window sends the existingrenameEditorFileswith its existing optionalrecord. In the layout-owner build, main now publishes the file's host on an editor tab under an owned id, where it named the partition's host before. That is a corrected value in an existing field, and only in that build.Follow-ups for review (not changed here, shipped behaviour):
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
SSH and paired servers: the re-own send is skipped for paired-server workspaces by the existing owner test. SSH workspaces main owns now stay in step. Folder workspaces are covered by the new loader test.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)