Files
Genarrative/apps/ai-game-creator-shell/tests/recentProjectsModel.test.ts
T
kdletters 991b2a1104
Project CI / Repository checks (push) Successful in 3m43s
Project CI / Backend tests (push) Successful in 6m16s
Project CI / Frontend tests (push) Successful in 3m54s
Project CI / Native shell tests (push) Successful in 20m0s
修复 AGC 异步操作恢复闭环 (#346)
## 变更内容

AGC 登录、Runner 会话、最近项目检查和首页自动创建原先各自维护异步状态,响应体卡住、单目录变慢或切页会导致按钮长期 busy、项目列表整体不可用或重复创建项目。本 PR 将这些入口收口到可恢复的生命周期边界:

- 认证响应体读取增加独立超时,refresh singleflight 在失败后释放;
- Runner 会话安装/清除移到 blocking worker,登录/退出增加 45 秒 UI fence;
- 最近项目逐项检查并设置单项目超时,已完成行不受其它慢目录阻塞;
- 首页自动创建锁提升到 WorkspaceLauncher,切页后仍防重并保留状态;
- 新增异步闭环技术方案、body 卡住测试、逐行项目测试和跨页创建测试。

## 验证

- `npm --prefix apps/ai-game-creator-shell run typecheck`
- `npm --prefix apps/ai-game-creator-shell exec -- vitest run tests/clientHttp.test.ts tests/clientApi.test.ts tests/recentProjectsModel.test.ts --reporter=dot`
- `npm --prefix apps/ai-game-creator-shell exec -- vitest run tests/appSurface.test.ts --reporter=dot`
- `cargo check --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml`
- `npm run check:doc-index`
- `npm run check:encoding`
- `git diff --check`

`appSurface.test.ts` 390/390 通过;保留仓库既有 act/jsdom media warning。本 PR 未触发真实 Provider 或发布安装包。

Reviewed-on: #346
Co-authored-by: kdletters <kdletters@qq.com>
Co-committed-by: kdletters <kdletters@qq.com>
2026-09-14 13:19:13 +08:00

40 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { buildRecentProjectRows } from '../src/features/app-shell/model';
describe('最近项目行状态', () => {
it('已完成的项目不受其它慢目录的全局刷新状态阻塞', () => {
const rows = buildRecentProjectRows(
['C:\\projects\\ready', 'C:\\projects\\slow'],
{
'C:\\projects\\ready': {
projectPath: 'C:\\projects\\ready',
exists: true,
isDirectory: true,
isGameCreatorProject: true,
isGodotProject: false,
isCocosProject: false,
godotProjectRoot: null,
cocosProjectRoot: null,
projectName: '可打开项目',
recentRunStatus: null,
recentRunStopReason: null,
},
},
true,
);
expect(rows[0]).toMatchObject({
name: '可打开项目',
status: '本地项目',
canOpen: true,
canReveal: true,
});
expect(rows[1]).toMatchObject({
status: '检查中',
canOpen: false,
canReveal: false,
});
});
});