refactor(desktop): extract Session Navigation feature slice - #3719
refactor(desktop): extract Session Navigation feature slice#3719chihumyum wants to merge 1 commit into
Conversation
Astro-Han
left a comment
There was a problem hiding this comment.
Approving on eff7627bdcb336d973125cf8ed1417d908c6fe32, with test terminal green on that exact head.
For a move of this size the only question worth answering is whether anything changed semantics under cover of changing location, so I checked it mechanically rather than by reading. Comparing each moved file against its original with the licence header stripped:
session-rail.ts,session-revisions.ts,session-nav-filter.ts,branch-banner.ts— byte-identical.session-list-layout.tsandsession-project-grouping.ts— import paths only.session-row-actions.ts— the one file with real edits, and every one is mechanical:window.maka.sessions.*becomes the injectedservice.*, andsetMessages([])becomesclearActiveMessages(), whichapp-shell.tsx:1660defines asuseCallback(() => setMessages([]), [setMessages]). TherevisionFamilysemantics, therequireArchivedandrestoredbranches, the pending de-duplication, and the list read-back verification are all unchanged.
The three persisted layout keys and the 200 ms trailing debounce moved without modification, and openSession keeps its original ordering — exit WorkHub, select, activate, then set or clear the scroll target — including the suppression of activeId while WorkHub is active.
One incidental fix worth calling out in the description. deriveBranchBanner's memo dependencies were [activeSession?.parentSessionId, sessions] and are now [activeSession, sessions]. The old list was incomplete: switching between two sessions that share a parentSessionId did not recompute, so the banner could keep showing the previous parent's name after it changed. The new list is correct. That is a behaviour change — a fix, not a regression — and it should be mentioned rather than left inside a refactor.
The boundary is clean: no imports of app-shell, preload or main from inside the feature, the Desktop bridge is touched only in platform/desktop/create-session-navigation-services.ts, and the new boundary tests pin the "external code enters through index/testing only" rule rather than leaving it as a convention.
On merge order, not a blocker: this PR rewrites large parts of app-shell.tsx and deletes six files from the renderer root. Two sibling slice extractions are open against the same code. Whichever lands first will force the others to redo path-level work, so they should go in one at a time with a rebase between, rather than in parallel.
简体中文
已在 eff7627bdcb336d973125cf8ed1417d908c6fe32 上 approve,该 exact head 的 test 为终态绿。
这种规模的搬运,唯一值得回答的问题是「有没有借着换位置改语义」,所以我用机械方式核对,而不是靠通读。把每个被移动的文件与其原文件在剥掉 licence 头后逐一比对:
session-rail.ts、session-revisions.ts、session-nav-filter.ts、branch-banner.ts——逐字节相同。session-list-layout.ts与session-project-grouping.ts——只改了 import 路径。session-row-actions.ts——唯一有实际改动的文件,而每一处都是机械的:window.maka.sessions.*换成注入的service.*;setMessages([])换成clearActiveMessages(),后者在app-shell.tsx:1660定义为useCallback(() => setMessages([]), [setMessages])。revisionFamily语义、requireArchived与restored分支、pending 去重、list 回读校验,全部未变。
三个持久化布局键与 200 ms trailing debounce 原样搬入;openSession 保持原有顺序——退出 WorkHub、选中、激活、再设置或清除 scroll target——包括 WorkHub 激活时对 activeId 的抑制。
有一处顺带的修复,建议写进正文。 deriveBranchBanner 的 memo 依赖由 [activeSession?.parentSessionId, sessions] 改为 [activeSession, sessions]。旧的依赖列表是不完整的:在两个共享同一 parentSessionId 的 session 之间切换时不会重算,因此父级名称变化后横幅可能仍显示旧名字。新的依赖是对的。这是一处行为变化——是修复而非回归——应当明说,而不是留在重构里。
边界是干净的:feature 内部没有对 app-shell、preload、main 的导入;Desktop bridge 只在 platform/desktop/create-session-navigation-services.ts 触碰;新增的边界测试把「外部只能经 index/testing 进入」这条规则用机器锁住,而不是留作约定。
关于合并顺序,不构成阻塞:本 PR 重写了 app-shell.tsx 的大段内容,并删除了 renderer 根目录下的六个文件。另有两个同类切片 PR 正对着同一片代码开着。谁先合,都会迫使其余两个重做路径级的调整,因此应当串行合并、中间让作者 rebase,而不是并行推进。
Generated-by: Codex
eff7627 to
8ee8545
Compare
Summary
features/session-navigation.Refs #3439
Verification
npm cinpm run check:asf-headersnpm run lintnpm run format:checknpm run typechecknpm run buildnpm run astryx:theme -- --checknpm run astryx:surface-inventorygit merge-tree --write-tree upstream/main HEADReview focus
Session catalog authority remains in the existing AppShell session-list boundary. The feature owns rail/view/mutation behavior; AppShell keeps explicit cross-feature intents.
AI use
Select exactly one:
Tool(s) and scope: Codex implemented the renderer feature extraction, tests, and red/blue review under human direction.
Checklist
Does this PR entail a change in behavior?