Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions apps/desktop/e2e/session-workbar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,14 @@ test('Side Chat survives collapse, confirms close, and cleans up on source switc

const companion = page.locator('.maka-quote-companion');
await expect(companion).toBeVisible();

// The companion forks lazily on the first send, not when the panel opens.
const sideComposer = companion.locator(COMPOSER_INPUT);
await sideComposer.fill('inspect this source without changing it');
await sideComposer.press('Enter');
await expect(companion).toContainText(
'Fake backend received: inspect this source without changing it',
);
const firstForkId = await waitForCompanionForkId(page, sessionId);
await expect(sidebar.locator(`[data-session-id=${JSON.stringify(firstForkId)}]`)).toHaveCount(0);

Expand All @@ -416,13 +424,6 @@ test('Side Chat survives collapse, confirms close, and cleans up on source switc
await page.getByRole('button', { name: '展开任务工作栏' }).click();
await expect(companion).toBeVisible();

const sideComposer = companion.locator(COMPOSER_INPUT);
await sideComposer.fill('inspect this source without changing it');
await sideComposer.press('Enter');
await expect(companion).toContainText(
'Fake backend received: inspect this source without changing it',
);

const workbarToolbar = page.getByRole('toolbar', { name: '任务工作栏标签' }).first();
const closeActiveSideChat = () =>
workbarToolbar
Expand All @@ -449,6 +450,13 @@ test('Side Chat survives collapse, confirms close, and cleans up on source switc
await expect(page.getByRole('list', { name: '打开工具' })).toBeVisible();
await openSideChat.click();
await expect(companion).toBeVisible();
// Fork again on the reopened panel's first send.
const reopenedComposer = companion.locator(COMPOSER_INPUT);
await reopenedComposer.fill('inspect once more before switching away');
await reopenedComposer.press('Enter');
await expect(companion).toContainText(
'Fake backend received: inspect once more before switching away',
);
const secondForkId = await waitForCompanionForkId(page, sessionId);

await sidebar.getByRole('button', { name: '新任务', exact: true }).click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,28 @@ describe('permission response IPC boundary', () => {
sourceTurnId: 'turn-2',
turnId: 'turn-3',
});
// A through-turn branch keeps its sourceTurnId; a spurious copyId is dropped.
assert.deepEqual(
normalizeBranchFromTurnInput({ sourceTurnId: 'turn-legacy', copyId: 'ignored-here' }),
{ sourceTurnId: 'turn-legacy' },
);
assert.deepEqual(
normalizeBranchFromTurnInput({
sourceTurnId: 'turn-3',
name: ' Branch name ',
sideConversation: true,
ignored: 1,
}),
{ sourceTurnId: 'turn-3', name: 'Branch name', sideConversation: true },
{
sourceTurnId: 'turn-3',
name: 'Branch name',
sideConversation: true,
},
);
// An empty side-conversation branch omits sourceTurnId entirely.
assert.deepEqual(
normalizeBranchFromTurnInput({ sideConversation: true }),
{ sideConversation: true },
);
assert.deepEqual(
normalizeRuntimeHostBranchFromTurnInput({
Expand Down Expand Up @@ -130,11 +144,23 @@ describe('permission response IPC boundary', () => {

const invalidActions: Array<() => unknown> = [
() => normalizeRegenerateTurnInput({ sourceTurnId: 'turn-1', turnId: 1 }),
() => normalizeBranchFromTurnInput({ sourceTurnId: 'turn-1', name: 1 }),
() => normalizeBranchFromTurnInput({ sourceTurnId: 'turn-1', sideConversation: 'yes' }),
() => normalizeBranchFromTurnInput({ sourceTurnId: 'x'.repeat(129) }),
() =>
normalizeBranchFromTurnInput({
sourceTurnId: 'turn-1',
name: 1,
}),
() =>
normalizeBranchFromTurnInput({
sourceTurnId: 'turn-1',
sideConversation: 'yes',
}),
() =>
normalizeBranchFromTurnInput({ sourceTurnId: 'x'.repeat(129) }),
() => normalizeReviseBeforeTurnInput({ sourceTurnId: 1 }),
() => normalizeRuntimeHostBranchFromTurnInput({ sourceTurnId: 'turn-1' }),
() =>
normalizeRuntimeHostBranchFromTurnInput({
sourceTurnId: 'turn-1',
}),
() => normalizeRuntimeHostReviseBeforeTurnInput({ sourceTurnId: 'turn-1', copyId: '' }),
];
for (const action of invalidActions) assert.throws(action, /Invalid/);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
import { deferred } from '@maka/core/test-only/async-primitives';
import { strict as assert } from 'node:assert';
import { afterEach, describe, it } from 'node:test';
import type { SessionSummary, TurnRecord } from '@maka/core/session';
import type {
SessionSummary,
TurnRecord,
} from '@maka/core/session';
import {
abandonPendingCompanionCopy,
createFakeWorkbarServices,
Expand Down
Loading