test(e2e): check memory isolation between real workspaces and the chat-scoped erase (P1.5, UF-039)
- The isolation journeys (B2.4, U2.3, U2.4, U9.3) create their workspaces first. They used made-up workspace ids, which the sidecar silently turned into personal memory, so they never compared two workspaces; such writes are now refused (UF-039). - J3f follows the Memory Center on the memory contract: Erase removes every memory saved from the same chat and is offered only for memories with a chat session; the erased-sources panel is gone.
This commit is contained in:
@@ -235,8 +235,7 @@ test.describe('User Journey Tests', () => {
|
||||
test('J3f: memory destructive trust actions use in-app confirmations', async ({ page }) => {
|
||||
const nativeDialogs: string[] = [];
|
||||
let deleteCalled = false;
|
||||
let eraseCalled = false;
|
||||
let allowCalled = false;
|
||||
let eraseBody: unknown = null;
|
||||
const memory = {
|
||||
id: 'memory-research-note',
|
||||
kind: 'fact',
|
||||
@@ -247,21 +246,16 @@ test.describe('User Journey Tests', () => {
|
||||
source: 'user_stated',
|
||||
sourceId: null,
|
||||
sourceUrl: null,
|
||||
// Saved from a chat, so the Memory Center offers to erase that chat's memories.
|
||||
sessionId: 'chat-research-1',
|
||||
importance: 'normal',
|
||||
status: 'active',
|
||||
confidence: 91,
|
||||
tags: ['research'],
|
||||
evidence: [],
|
||||
hasOriginalSource: false,
|
||||
createdAt: '2026-07-08T08:00:00.000Z',
|
||||
updatedAt: '2026-07-08T09:00:00.000Z',
|
||||
};
|
||||
const suppression = {
|
||||
source: 'chatgpt',
|
||||
sourceRef: 'research-export.json',
|
||||
erasedAt: '2026-07-08T09:30:00.000Z',
|
||||
reason: 'GDPR Art.17 erasure',
|
||||
};
|
||||
|
||||
await page.route('**/api/memory**', route => {
|
||||
const request = route.request();
|
||||
@@ -278,36 +272,11 @@ test.describe('User Journey Tests', () => {
|
||||
return route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ ok: true }) });
|
||||
}
|
||||
if (url.pathname === '/api/memory/erase' && request.method() === 'POST') {
|
||||
eraseCalled = true;
|
||||
eraseBody = request.postDataJSON();
|
||||
return route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({
|
||||
erased: true,
|
||||
mind: 'personal',
|
||||
result: {
|
||||
framesDeleted: 1,
|
||||
archiveRedacted: 1,
|
||||
chunkVectorsPurged: 0,
|
||||
entitiesErased: 1,
|
||||
relationsErased: 0,
|
||||
},
|
||||
}),
|
||||
});
|
||||
}
|
||||
if (url.pathname === '/api/memory/suppression' && request.method() === 'GET') {
|
||||
return route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ mind: 'personal', suppressed: [suppression] }),
|
||||
});
|
||||
}
|
||||
if (url.pathname === '/api/memory/suppression/allow' && request.method() === 'POST') {
|
||||
allowCalled = true;
|
||||
return route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ removed: true, mind: 'personal' }),
|
||||
body: JSON.stringify({ erased: true, deleted: 2 }),
|
||||
});
|
||||
}
|
||||
return route.continue();
|
||||
@@ -331,22 +300,13 @@ test.describe('User Journey Tests', () => {
|
||||
await expect.poll(() => deleteCalled).toBe(true);
|
||||
|
||||
await memoryCard.click();
|
||||
await page.getByRole('button', { name: /^erase$/i }).click();
|
||||
await page.getByRole('button', { name: /^erase chat memories$/i }).click();
|
||||
expect(nativeDialogs).toEqual([]);
|
||||
await expect(page.getByTestId('approval-modal')).toContainText(/erase memory and derived data/i);
|
||||
await expect(page.getByTestId('approval-modal')).toContainText(/erase everything remembered from this chat/i);
|
||||
await expect(page.getByTestId('approval-modal')).toContainText(/cannot be undone/i);
|
||||
await page.getByTestId('approval-modal-approve').click();
|
||||
await expect.poll(() => eraseCalled).toBe(true);
|
||||
await expect(page.getByText(/erased "research note"/i)).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
await page.getByRole('button', { name: /erased sources/i }).click();
|
||||
await expect(page.getByText('research-export.json')).toBeVisible({ timeout: 5_000 });
|
||||
await page.getByRole('button', { name: /allow re-import/i }).click();
|
||||
expect(nativeDialogs).toEqual([]);
|
||||
await expect(page.getByTestId('approval-modal')).toContainText(/allow source to be re-imported/i);
|
||||
await expect(page.getByTestId('approval-modal')).toContainText(/re-consented/i);
|
||||
await page.getByTestId('approval-modal-approve').click();
|
||||
await expect.poll(() => allowCalled).toBe(true);
|
||||
await expect.poll(() => eraseBody).toMatchObject({ sessionId: 'chat-research-1' });
|
||||
await expect(page.getByText(/erased 2 memories from that chat/i)).toBeVisible({ timeout: 5_000 });
|
||||
});
|
||||
|
||||
// The wiki is hidden in v1 by the memory feature map (ADR-0002,
|
||||
|
||||
Reference in New Issue
Block a user