test(desktop): cover new-session model selection regression - #4014
Merged
MagicLizi merged 1 commit intoSep 20, 2026
Merged
Conversation
|
| Filename | Overview |
|---|---|
| apps/desktop/src/renderer/tests/chatInputModelSelectorRouting.test.ts | Adds focused source-contract assertions that preserve draft-only model selection before a session exists. |
Reviews (1): Last reviewed commit: "test(desktop): cover new-session model s..." | Re-trigger Greptile
MsNBBc3R
force-pushed
the
fix/issue-4003-new-session-model-switch
branch
from
September 6, 2026 15:49
39dbce1 to
3912b46
Compare
Contributor
|
@MsNBBc3R 👋 这个 PR 已经有 6 天没有 rebase 了。 为了避免合入后出现 CI 未曾验证过的新问题,请在本地 rebase 最新的 |
MsNBBc3R
force-pushed
the
fix/issue-4003-new-session-model-switch
branch
from
September 20, 2026 18:12
3912b46 to
5b2cf62
Compare
Signed-off-by: MsNBBc3R <MsNBBc3R@users.noreply.github.com>
MsNBBc3R
force-pushed
the
fix/issue-4003-new-session-model-switch
branch
from
September 20, 2026 18:14
5b2cf62 to
1fc0526
Compare
MagicLizi
approved these changes
Sep 20, 2026
MagicLizi
left a comment
Contributor
There was a problem hiding this comment.
Findings
无 P0/P1。
Rule coverage
AGENTS.md:仓库边界、PR-first、DCO、提交前门禁。本 PR 只改 Desktop 测试,未跨仓、未改生产代码;HEAD commit 带与 author 一致的Signed-off-by。docs/dev-rules/development-workflow.md:P0/P1 口径、验证真实性。diff 与 PR 描述一致(仅回归测试);未发现红线、崩溃、数据丢失、安全或明显 bug。.github/PULL_REQUEST_TEMPLATE.md:lighttest模板;摘要、范围、验证、风险齐全,且与单文件测试 diff 吻合。docs/dev-rules/engineering-conventions.mdReview 清单:新增测试为源码契约扫描,无外网、固定端口、共享临时路径或真实子进程;沿用文件既有normalizeSourceText,不引入跨平台行尾问题;无 IPC/i18n/UI/日志改动。docs/dev-rules/electron-security-and-process-boundaries.mdReview 清单:未改 Renderer 特权、preload、IPC、CSP、窗口生命周期。- 对照生产接线:
ChatInput.tsx中handleUnifiedDraftSelect在sessionId || settingsLocked时直接 return,经onUnifiedDraftSelect落草稿;ModelSelector.onUnifiedSelect仅在!sessionId && unifiedPanelActive && onUnifiedDraftSelect时接到该 handler。新增断言与现码一致,且不把已建会话的maker.setModel/confirmModelSwitchContextGuard绑到草稿路径。 - PR 描述吻合度:无夹带私货。无维护者讨论 issue,无需落实讨论要求。
- 未适用:UI/
DESIGN.md、pluginBase、冷更、凭证落盘、协议、数据库。
Verification
pnpm install --frozen-lockfile --prefer-offline --prod=false:EXIT=0(审查 worktree 无 node_modules,为跑测试安装)。pnpm --filter desktop exec vitest run src/renderer/__tests__/chatInputModelSelectorRouting.test.ts:EXIT=0;1 file / 27 tests passed。日志:verify-pr-4014/vitest-routing.log。pnpm --filter desktop run --if-present typecheck:EXIT=0。日志:verify-pr-4014/typecheck.log。- CI(context
gate.ci.status=pass):全绿。 - 未执行:
pnpm test:unit:related全量相关单测(定向文件已覆盖本 diff;CI 已绿);Electron 实机(无生产/UI 改动)。
Overall
pass — 没有 P0/P1。
Contributor
|
合了。新建对话选模型这条路以前很容易误接到已建会话的切换逻辑,现在测试把草稿直通钉死了——这种接线回归以后再踩会立刻响。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这次改了什么
摘要
为新建对话时选择模型的路由增加回归测试,锁定草稿态应走
handleUnifiedDraftSelect,避免误用已建会话的maker.setModel和上下文窗口切换守卫。变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
UI 变化
不涉及 UI 变化,无需截图或录屏。
怎么验证的
自动验证
手工验证
不涉及:本 PR 只增加源码契约回归测试,不修改运行时行为。
未执行的验证
未执行 Electron 实机验证;本 PR 不修改生产代码或 UI。
风险
风险分类
影响与回滚
提交前检查
git commit -s,见 DCO)