All checks were successful
Queue Release Build / prepare (push) Successful in 20s
Deploy Web Apps / deploy (push) Successful in 9m2s
Queue Release Build / build-windows (push) Successful in 28m8s
Queue Release Build / build-linux (push) Successful in 47m26s
Queue Release Build / build-android (push) Successful in 19m52s
Queue Release Build / finalize (push) Successful in 4m42s
Stream large receives to disk with chunk acks to cap renderer RAM, evict off-screen display blobs, and route exports through a disk-aware download service. Fix the high-memory dialog (backdrop dismiss, copy, log actions), allow diagnostics paths in the path jail, and restore persisted image hydration after reload. Co-authored-by: Cursor <cursoragent@cursor.com>
58 lines
1.4 KiB
TypeScript
58 lines
1.4 KiB
TypeScript
import {
|
|
beforeEach,
|
|
describe,
|
|
expect,
|
|
it,
|
|
vi
|
|
} from 'vitest';
|
|
import * as os from 'os';
|
|
import * as path from 'path';
|
|
import * as fsp from 'fs/promises';
|
|
|
|
import { captureHighMemoryDiagnostics } from './high-memory-capture';
|
|
|
|
vi.mock('./immediate-renderer-samples.collector', () => ({
|
|
collectImmediateRendererSamples: vi.fn(async () => [])
|
|
}));
|
|
|
|
vi.mock('./session-context.collector', () => ({
|
|
collectSessionContext: vi.fn(() => ({
|
|
platform: 'linux',
|
|
userDataPath: '/tmp/user-data'
|
|
}))
|
|
}));
|
|
|
|
describe('captureHighMemoryDiagnostics', () => {
|
|
let userDataPath = '';
|
|
|
|
beforeEach(async () => {
|
|
userDataPath = await fsp.mkdtemp(path.join(os.tmpdir(), 'metoyou-high-memory-capture-'));
|
|
});
|
|
|
|
it('writes a diagnostics snapshot and returns an alert record', async () => {
|
|
const record = await captureHighMemoryDiagnostics({
|
|
userDataPath,
|
|
sessionStartedAt: Date.now() - 60_000,
|
|
metrics: {
|
|
collectedAt: Date.now(),
|
|
processes: [
|
|
{
|
|
pid: 1,
|
|
type: 'Browser',
|
|
workingSetKb: 2_200_000
|
|
}
|
|
]
|
|
},
|
|
totalWorkingSetKb: 2_200_000,
|
|
writer: null,
|
|
mainWindow: null,
|
|
reason: 'manual'
|
|
});
|
|
|
|
expect(record.peakWorkingSetKb).toBe(2_200_000);
|
|
expect(record.reason).toBe('manual');
|
|
expect(record.logFilePath).toContain(userDataPath);
|
|
await expect(fsp.stat(record.logFilePath)).resolves.toBeDefined();
|
|
});
|
|
});
|