-
Notifications
You must be signed in to change notification settings - Fork 2.9k
test(web-shell): prevent nested session render loop #8934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -423,7 +423,14 @@ vi.mock('@qwen-code/webui/daemon-react-sdk', () => { | |||||||||||||||
| }; | ||||||||||||||||
| return { | ||||||||||||||||
| DAEMON_APPROVAL_MODES: ['default', 'plan', 'auto-edit', 'auto', 'yolo'], | ||||||||||||||||
| DaemonSessionProvider: ({ children }: { children: ReactNode }) => children, | ||||||||||||||||
| // This harness only models the parent session connection. | ||||||||||||||||
| DaemonSessionProvider: ({ | ||||||||||||||||
| children, | ||||||||||||||||
| clientId, | ||||||||||||||||
| }: { | ||||||||||||||||
| children: ReactNode; | ||||||||||||||||
| clientId?: string; | ||||||||||||||||
| }) => (clientId?.startsWith('side-task:') ? null : children), | ||||||||||||||||
|
Comment on lines
+432
to
+433
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] Mock's
Suggested change
中文说明Mock 的 建议添加一个测试来显式验证 mock 对 — deepseek-v4-flash via Qwen Code /review (v0.21.8) |
||||||||||||||||
| useActions: () => mockSessionActions, | ||||||||||||||||
| useConnection: () => mockConnection, | ||||||||||||||||
| useDaemonSessionOwnerGuard: () => ownerGuard, | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] Hardcoded string literal
'side-task:'should be extracted to a named constant to prevent production/test drift — Failure scenario: If the side-task clientId prefix is changed in production code (e.g.,SideTaskPanel.tsx) without updating the test mock, the mock silently stops matching — it returnschildreninstead ofnull— and the infinite React render loop / OOM reappears in CI. The failure mode is a crash or timeout, not a clear assertion error, making it hard to diagnose.中文说明
硬编码的字符串字面量
'side-task:'应该提取为命名常量,防止生产代码与测试之间的漂移。如果SideTaskPanel.tsx中的clientId前缀在未来被修改,而测试 mock 未同步更新,mock 将静默失效——返回children而非null——导致无限渲染循环 / OOM 在 CI 中重现。建议从
packages/web-shell/client/constants/sessions.ts导出一个常量(如export const SIDE_TASK_CLIENT_ID_PREFIX = 'side-task:'),并在SideTaskPanel.tsx(clientId模板字面量)和App.test.tsx(mock 的.startsWith()检查)中引用它。— deepseek-v4-flash via Qwen Code /review (v0.21.8)