Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test: stabilize client CI after syncing upstream/main

JiangJiahao52c91798d094
diff --cc apps/desktop/src/main/skillhub/__tests__/sharedMutationLease.test.ts
index 17f0fbbaad,17f0fbbaad..377a9bb6c8
--- a/apps/desktop/src/main/skillhub/__tests__/sharedMutationLease.test.ts
+++ b/apps/desktop/src/main/skillhub/__tests__/sharedMutationLease.test.ts
@@@ -1,4 -1,4 +1,5 @@@
import fs from 'node:fs';
++import fsp from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import { createHash, randomUUID } from 'node:crypto';
@@@ -53,19 -53,19 +54,48 @@@ describe('shared Skill mutation lease'
} finally { await successor(); }
});
-- it('honors a bounded wait while another profile releases the same Skill', async () => {
++ it.each([
++ { outcome: 'acquires after the owner releases within the wait budget', elapsedMs: 50, releaseOwner: true },
++ { outcome: 'times out without disturbing an owner that still holds the lease', elapsedMs: 500, releaseOwner: false },
++ ])('$outcome', async ({ elapsedMs, releaseOwner }) => {
const first = (await acquireSharedSkillMutationLease(['startup-projection']))!;
-- const released = new Promise<void>((resolve) => {
-- setTimeout(() => { void first().then(resolve); }, 50);
++ const key = createHash('sha256').update('startup-projection').digest('hex');
++ const lockPath = path.join(root, 'Cindy', 'shared-skill-mutation-locks', `${key}.lock`);
++ const ownerRecord = fs.readFileSync(lockPath, 'utf8');
++ // Real filesystem exclusion, controlled deadline: Windows CI I/O can exceed
++ // 500 ms even when the owner's release is scheduled after only 50 ms.
++ let now = Date.now();
++ const clock = vi.spyOn(Date, 'now').mockImplementation(() => now);
++ const originalOpen = fsp.open;
++ let contended = false;
++ const open = vi.spyOn(fsp, 'open').mockImplementation(async (...args) => {
++ try {
++ return await originalOpen(...args);
++ } catch (error) {
++ if (args[0] === lockPath && (error as NodeJS.ErrnoException).code === 'EEXIST' && !contended) {
++ contended = true;
++ now += elapsedMs;
++ if (releaseOwner) await first();
++ }
++ throw error;
++ }
});
-- const next = await acquireSharedSkillMutationLease(
-- ['startup-projection'],
-- undefined,
-- { waitMs: 500 },
-- );
-- await released;
-- expect(next).not.toBeNull();
-- await next!();
++ let next: Awaited<ReturnType<typeof acquireSharedSkillMutationLease>> = null;
++ try {
++ next = await acquireSharedSkillMutationLease(['startup-projection'], undefined, { waitMs: 500 });
++ expect(contended).toBe(true);
++ if (releaseOwner) {
++ expect(next).not.toBeNull();
++ } else {
++ expect(next).toBeNull();
++ expect(fs.readFileSync(lockPath, 'utf8')).toBe(ownerRecord);
++ }
++ } finally {
++ open.mockRestore();
++ clock.mockRestore();
++ await next?.();
++ await first();
++ }
});
it('contains a damaged durable barrier to its own resource name', async () => {
diff --cc apps/desktop/src/renderer/__tests__/newMakerOrcaCreateOrder.test.ts
index 97e740258d,97e740258d..4bf8909ddd
--- a/apps/desktop/src/renderer/__tests__/newMakerOrcaCreateOrder.test.ts
+++ b/apps/desktop/src/renderer/__tests__/newMakerOrcaCreateOrder.test.ts
@@@ -218,13 -218,13 +218,13 @@@ describe('NewMakerDraftRoute Orca worke
expect(body.indexOf('void refreshRemoteDeviceSessions(')).toBeGreaterThan(finallyAt);
});
-- it('narrows the device-link worker source against the controlled device catalog', () => {
-- // 草稿里持久化的来源/模型按**目标设备**的目录收窄:device-link 分支必须用
-- // deviceProviders,拿控制端的 localProviders 收窄等于用错机器的目录。
++ it('narrows the device-link worker source against the agent execution device catalog', () => {
++ // Worker 来源/模型按运行 Agent 的电脑收窄:普通远控用被控端目录,选择第三台电脑时
++ // agentCatalogProviders 只含那台开放远程调用的供应商,不能用控制端的 localProviders。
const collapsed = source.replace(/\s+/g, ' ');
expect(
collapsed.match(
-- /draftEnableOrcaOptions\( effectiveCollab, deviceProviders, !deviceProvidersLoading, true, \)/g,
++ /draftEnableOrcaOptions\( effectiveCollab, agentCatalogProviders, !deviceProvidersLoading, true, \)/g,
) ?? [],
).toHaveLength(2);
// 本机 / SSH 仍按控制端目录收窄。五条创建即发送/目标路径都要求 deferred handoff;