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: align stranded Lead cleanup assertions with authority guards

Dash4c83c0e0d4cb
diff --git a/apps/desktop/src/main/__tests__/disableOrcaStrandedLead.test.ts b/apps/desktop/src/main/__tests__/disableOrcaStrandedLead.test.ts
index c4686d5dfb..d36b742cba 100644
--- a/apps/desktop/src/main/__tests__/disableOrcaStrandedLead.test.ts
+++ b/apps/desktop/src/main/__tests__/disableOrcaStrandedLead.test.ts
@@ -14,7 +14,7 @@ const registerSource = readFileSync(resolve(__dirname, '..', 'maker-ipc', 'regis
describe('disableOrcaInternal stranded-lead recovery', () => {
it('extracts a shared clearLeadOrcaRoleState helper', () => {
expect(registerSource).toContain(
- 'async function clearLeadOrcaRoleState(leadSessionId: string)',
+ 'async function clearLeadOrcaRoleState(leadSessionId: string, assertCurrent?: () => Promise<void>)',
);
});
@@ -28,7 +28,7 @@ describe('disableOrcaInternal stranded-lead recovery', () => {
// If the prior disable was interrupted before archiveWorkersByTeam, the lead's worker
// sessions stay active+hidden+unreachable; the recovery must reconcile them too.
const reconcileIndex = registerSource.indexOf(
- 'await reconcileInactiveTeamWorkersForLead(leadSessionId)',
+ 'await reconcileInactiveTeamWorkersForLead(leadSessionId, assertCurrent)',
);
const recycleIndex = registerSource.indexOf(
"await recycleSessionWorktreeForStatusChange(sid, 'archived', workerRecycleScope)",
@@ -47,7 +47,7 @@ describe('disableOrcaInternal stranded-lead recovery', () => {
it('fully cleans Host-owned worker runtimes after normal team archival', () => {
expect(registerSource).toContain('await cancelIOSSimulatorSessionOperations(w.sessionId)');
const archiveIndex = registerSource.indexOf(
- 'const archivedWorkerSessionIds = await archiveWorkersByTeam(team.id)',
+ 'const archivedWorkerSessionIds = await archiveWorkersByTeam(team.id, assertCurrent)',
);
const recycleIndex = registerSource.indexOf(
"recycleSessionWorktreeForStatusChange(sessionId, 'archived', workerRecycleScope)",
@@ -64,7 +64,7 @@ describe('disableOrcaInternal stranded-lead recovery', () => {
});
it('runs full removed-session cleanup after archiving one worker', () => {
- const archiveIndex = registerSource.indexOf('await archiveSingleWorkerSession(sessionId);');
+ const archiveIndex = registerSource.indexOf('await archiveSingleWorkerSession(sessionId, beforeMutation);');
const recycleIndex = registerSource.indexOf(
"await recycleSessionWorktreeForStatusChange(sessionId, 'archived', workerRecycleScope);",
archiveIndex,
@@ -80,7 +80,7 @@ describe('disableOrcaInternal stranded-lead recovery', () => {
});
it('reuses clearLeadOrcaRoleState on BOTH the normal-close and stranded-recovery paths', () => {
- const calls = registerSource.match(/await clearLeadOrcaRoleState\(leadSessionId\)/g) ?? [];
+ const calls = registerSource.match(/await clearLeadOrcaRoleState\(leadSessionId, assertCurrent\)/g) ?? [];
expect(calls.length).toBeGreaterThanOrEqual(2);
});
});