补充 #599 自审回归用例:用户已切到别的工作区时后台改名不劫持上下文
Project CI / Backend tests (pull_request) Failing after 22s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 3m5s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 4m14s
Project CI / Repository checks (pull_request) Failing after 15s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 4m46s
Project CI / Frontend tests (pull_request) Successful in 2m7s
Project CI / Native shell tests (pull_request) Successful in 7m10s
Project CI / AI game creator shell web tests (pull_request) Successful in 3m3s
Project CI / Backend tests (pull_request) Failing after 22s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 3m5s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 4m14s
Project CI / Repository checks (pull_request) Failing after 15s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 4m46s
Project CI / Frontend tests (pull_request) Successful in 2m7s
Project CI / Native shell tests (pull_request) Successful in 7m10s
Project CI / AI game creator shell web tests (pull_request) Successful in 3m3s
- 新增用例 does not hijack the project the user already moved to when the AI name lands:后台 AI 名称落定时若当前项目上下文已是另一个工作区(看门狗解围后打开别项目走同一条「上下文已被接管」判据),只重检刚建工作区的最近项目行,不把用户切走的上下文换成刚建的工作区。 - 该用例经反向证伪:临时去掉 applyAutomaticProjectName 的项目路径守卫后失败(projectName 由 另一个项目 变成 星河远征),随后已还原源码。 - 自审复核结论(无代码改动):entrySettled 在预检失败、建项失败、看门狗让位、进项目失败、成功五条路径都由建项主体的 finally 落定;看门狗与后台 creation 竞速没有重复 rememberRecentWorkspace、没有未捕获拒绝;expectedName 取建项回传的 manifest.name(与宿主落盘同源,宿主侧 trim 为 no-op);新命令已注册且旧 rename_local_game_project 的调用方未受影响。 - 定向验证:homeProjectNamingAsync 10 passed;appSurface 两条相关用例 passed;cargo conditional_project_rename_tests 5 passed;cargo fmt --check 与 npm run agc:typecheck 通过。
This commit is contained in:
@@ -318,3 +318,50 @@ it('never starts automatic naming for the 做方案 flow', async () => {
|
||||
await naming.promise;
|
||||
});
|
||||
});
|
||||
|
||||
it('does not hijack the project the user already moved to when the AI name lands', async () => {
|
||||
const naming = deferred<string | null>();
|
||||
const { result, refreshRecentWorkspace } = mount({
|
||||
naming: naming.promise,
|
||||
conditionalRename: async () => ({
|
||||
renamed: true,
|
||||
manifest: createGameCreationAppManifest(PROJECT_ID, SUGGESTED_NAME),
|
||||
revision: 1,
|
||||
}),
|
||||
});
|
||||
|
||||
await act(async () => {
|
||||
await createAutomatically(result);
|
||||
});
|
||||
|
||||
// 用户已经切到另一个工作区(看门狗解围后打开别项目走的是同一条「上下文已被别人接管」判据)。
|
||||
await act(async () => {
|
||||
result.current.setCurrentProjectContext({
|
||||
projectPath: 'C:/test/other-project',
|
||||
projectName: '另一个项目',
|
||||
projectKind: 'web',
|
||||
manifest: createGameCreationAppManifest('other-project', '另一个项目'),
|
||||
projectRevision: 3,
|
||||
creationType: null,
|
||||
startMode: null,
|
||||
initialPrompt: '',
|
||||
attachments: [],
|
||||
recentRunStatus: null,
|
||||
recentRunStopReason: null,
|
||||
createdAt: 1,
|
||||
});
|
||||
});
|
||||
|
||||
await act(async () => {
|
||||
naming.resolve(SUGGESTED_NAME);
|
||||
await naming.promise;
|
||||
});
|
||||
|
||||
// 后台改名不能把用户当前所在的项目上下文换成刚建好的那个工作区。
|
||||
expect(result.current.currentProjectContext?.projectPath).toBe(
|
||||
'C:/test/other-project',
|
||||
);
|
||||
expect(result.current.currentProjectContext?.projectName).toBe('另一个项目');
|
||||
// 但刚刚建好的工作区确实改名了:最近项目行照旧按目录重检。
|
||||
expect(refreshRecentWorkspace).toHaveBeenCalledWith(PROJECT_PATH);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user