test: retain created knowledge bindings across polling
Cross-platform packages / Validate source (push) Canceled after 0s
Cross-platform packages / macos arm64 (push) Canceled after 0s
Cross-platform packages / windows arm64 (push) Canceled after 0s
Cross-platform packages / linux x64 (push) Canceled after 0s
Cross-platform packages / macos x64 (push) Canceled after 0s
Cross-platform packages / windows x64 (push) Canceled after 0s
Cross-platform packages / Publish GitHub and OSS release (push) Canceled after 0s
Cross-platform packages / Authorize desktop packaging (push) Canceled after 0s
Cross-platform packages / linux arm64 (push) Canceled after 0s

Model persisted library state in the external-binding fixture instead of returning pre-creation data to background refreshes. Keep all selected and excluded library assertions, without assuming the last snapshot request belongs to the new library. Windows App: 300 passed; complete frozen Linux suite: 5371 passed, 51 skipped. Typecheck, lint and bilingual notes validation passed.
This commit is contained in:
mesalogo
2026-09-28 04:22:13 +08:00
parent 706726bad6
commit 65a21390de
2 changed files with 21 additions and 5 deletions
@@ -185,6 +185,16 @@ Agent 产品源码及 Runtime 锁未因这四项改变,Agent
Windows 原生 Runtime 聚焦用例、类型检查和 lint 通过。 Windows 原生 Runtime 聚焦用例、类型检查和 lint 通过。
提交仅追加本段记录;仍须等待修正候选的主分支 CI 和生产构建。 提交仅追加本段记录;仍须等待修正候选的主分支 CI 和生产构建。
`706726b` 的桌面 [CI 36345672365](https://github.com/mesalogo/goodbuddy/actions/runs/36345672365)
已通过上述采集与 Runtime 用例,但另一个外部知识库测试失败:
5,370 通过、51 跳过、1 失败,生产构建未执行。
该 fixture 只在查询新库 ID 时返回包含已创建库的快照,普通轮询会返回创建前数据;
同时错误地要求最后一次请求必须属于新库,忽略后台轮询。
改为模拟已持久化的库列表,等待新库请求发生,保留原库与新增库选中、被排除库未选中的
全部界面断言,不修改产品代码。Windows 完整 App 300 项通过,类型、lint 和说明校验通过。
冻结 tree `42a92450ad7d9ebc50167c7946bff53cff2889e6` 的 Linux 全量为
**5,371 通过、51 跳过、0 失败**,耗时 748.67 秒。
## 数据、兼容与验收边界 ## 数据、兼容与验收边界
Desktop schema 48 新增魔法笔记会话来源元数据。升级前应备份完整用户数据, Desktop schema 48 新增魔法笔记会话来源元数据。升级前应备份完整用户数据,
+11 -5
View File
@@ -7391,13 +7391,18 @@ describe("App", () => {
const created = { ...existing, id: '33333333-3333-4333-8333-333333333333', name: 'Remote handbook', external: { knowledgeBaseId: '33333333-3333-4333-8333-333333333333', instanceId: instance.id, provider: 'dify' as const, remoteKnowledgeBaseId: 'remote-1', remoteName: 'Remote handbook', commonConfig: { resultLimit: 6, requestTimeoutMs: 15000, maxSnippetCharacters: 4000 }, providerConfig: { provider: 'dify' as const, useDatasetDefaults: true as const }, lastVerifiedAt: '2026-09-12' } }; const created = { ...existing, id: '33333333-3333-4333-8333-333333333333', name: 'Remote handbook', external: { knowledgeBaseId: '33333333-3333-4333-8333-333333333333', instanceId: instance.id, provider: 'dify' as const, remoteKnowledgeBaseId: 'remote-1', remoteName: 'Remote handbook', commonConfig: { resultLimit: 6, requestTimeoutMs: 15000, maxSnippetCharacters: 4000 }, providerConfig: { provider: 'dify' as const, useDatasetDefaults: true as const }, lastVerifiedAt: '2026-09-12' } };
const initial = { libraries: [existing, excluded], selectedLibraryId: existing.id, sources: [], documents: [], graphNodes: [], graphRelations: [], evidence: [] }; const initial = { libraries: [existing, excluded], selectedLibraryId: existing.id, sources: [], documents: [], graphNodes: [], graphRelations: [], evidence: [] };
const updated = { ...initial, libraries: [...initial.libraries, created], selectedLibraryId: created.id }; const updated = { ...initial, libraries: [...initial.libraries, created], selectedLibraryId: created.id };
vi.mocked(api.knowledge.getSnapshot).mockImplementation(async (libraryId) => let persistedSnapshot = initial;
libraryId === created.id ? updated : initial vi.mocked(api.knowledge.getSnapshot).mockImplementation(async (libraryId) => ({
); ...persistedSnapshot,
selectedLibraryId: libraryId ?? persistedSnapshot.selectedLibraryId,
}));
vi.mocked(api.knowledge.externalInstancesList).mockResolvedValue([instance]); vi.mocked(api.knowledge.externalInstancesList).mockResolvedValue([instance]);
vi.mocked(api.knowledge.externalCatalogList).mockResolvedValueOnce({ items: [{ id: 'remote-1', name: 'Remote handbook' }], hasMore: false }); vi.mocked(api.knowledge.externalCatalogList).mockResolvedValueOnce({ items: [{ id: 'remote-1', name: 'Remote handbook' }], hasMore: false });
vi.mocked(api.knowledge.externalCatalogGet).mockResolvedValueOnce({ id: 'remote-1', name: 'Remote handbook' }); vi.mocked(api.knowledge.externalCatalogGet).mockResolvedValueOnce({ id: 'remote-1', name: 'Remote handbook' });
vi.mocked(api.knowledge.externalBindingsCreate).mockResolvedValueOnce(updated); vi.mocked(api.knowledge.externalBindingsCreate).mockImplementationOnce(async () => {
persistedSnapshot = updated;
return updated;
});
vi.mocked(api.conversations.list).mockResolvedValueOnce([{ id: '44444444-4444-4444-8444-444444444444', projectId, title: 'External scope test', updatedAt: 200, messages: [], knowledgeLibraryIds: [existing.id] }]); vi.mocked(api.conversations.list).mockResolvedValueOnce([{ id: '44444444-4444-4444-8444-444444444444', projectId, title: 'External scope test', updatedAt: 200, messages: [], knowledgeLibraryIds: [existing.id] }]);
render(<App />); render(<App />);
await screen.findByRole('button', { name: /^External scope test/u }); await screen.findByRole('button', { name: /^External scope test/u });
@@ -7412,7 +7417,8 @@ describe("App", () => {
await waitFor(() => expect(screen.getByRole('button', { name: '添加知识库' })).toBeEnabled()); await waitFor(() => expect(screen.getByRole('button', { name: '添加知识库' })).toBeEnabled());
fireEvent.click(screen.getByRole('button', { name: '添加知识库' })); fireEvent.click(screen.getByRole('button', { name: '添加知识库' }));
await screen.findByRole('heading', { name: 'Remote handbook' }, { timeout: 5_000 }); await screen.findByRole('heading', { name: 'Remote handbook' }, { timeout: 5_000 });
await waitFor(() => expect(api.knowledge.getSnapshot).toHaveBeenLastCalledWith(created.id)); // Polling can also refresh another selection; every snapshot must retain the created binding.
await waitFor(() => expect(api.knowledge.getSnapshot).toHaveBeenCalledWith(created.id));
fireEvent.click(screen.getByRole('button', { name: /^External scope test/u })); fireEvent.click(screen.getByRole('button', { name: /^External scope test/u }));
openComposerOptions(); openComposerOptions();
fireEvent.click(await screen.findByRole('button', { name: '选择知识库,本次已启用 2 个' })); fireEvent.click(await screen.findByRole('button', { name: '选择知识库,本次已启用 2 个' }));