fix(web,gateway): 修复工作会话切换竞态并收敛文件预览工作区边界#653
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@xgopilot 补充测试,提高CI测试的覆盖率到85以上,并且把更改提交个PR到我的fork仓库 |
完成情况已补充
本地验证已完成:
补充说明:我本地按 已提交并推送到当前分支: Fork PR已同步推到你的 fork 分支,并创建了 fork 内 PR: |
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Yumiue <188874804+Yumiue@users.noreply.github.com>
test(cli): improve file preview boundary coverage
|
@xgopilot 补充测试,提高CI测试的覆盖率到85以上,并且把更改提交个PR到我的fork仓库 |
已完成已补充并推送以下测试:
本地验证:
代码已推送到当前 PR 分支: |
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Yumiue <188874804+Yumiue@users.noreply.github.com>
test(cli,web): raise coverage for workspace switch paths
背景
本 PR 解决 Web 工作会话/工作区切换中的竞态覆盖问题,以及网关文件预览接口可能受客户端
workdir影响导致的边界风险。改动概览
1) 前端切换一致性修复
web/src/stores/useSessionStore.tsswitchSession顺序:先clearMessages(),再setTransitioning(true),确保切换窗口期事件过滤有效。fetchSessions增加请求代际序号,晚到旧响应不再覆盖新状态。resetForWorkspaceSwitch会使旧请求失效。web/src/stores/useWorkspaceStore.tsswitchWorkspace/createWorkspace增加switchSeq,仅最新切换可落状态。web/src/utils/eventBridge.tscurrentSessionId,否则丢弃。Error,以及会话对齐所需事件)。2) 网关工作区边界收敛
internal/cli/gateway_runtime_bridge.goresolveListFilesRoot不再信任客户端input.Workdir。ListFiles / ReadFile / ListGitDiffFiles / ReadGitDiffFile统一复用该策略。3) 文档更新
docs/reference/tui-gateway-contract-matrix.mdworkdir字段保留兼容但不作为越界覆盖入口。测试
已新增/更新测试
internal/cli/gateway_runtime_bridge_test.goworkdirweb/src/stores/useSessionStore.test.tsweb/src/stores/useWorkspaceStore.test.tsweb/src/utils/eventBridge.test.tsisTransitioning保持本地验证
go test ./internal/cli -run "ResolveListFilesRoot|ListFiles|ReadFile|GitDiff"✅npm test -- --run src/stores/useSessionStore.test.ts src/stores/useWorkspaceStore.test.ts src/utils/eventBridge.test.ts✅兼容性说明
workdir不再作为文件预览根目录覆盖来源。风险与回滚
workdir覆盖)的调用方将感知更严格边界。close #652