Improve attachment memory safety, downloads, and high-memory alert UX.
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
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>
This commit is contained in:
+61
@@ -0,0 +1,61 @@
|
||||
import {
|
||||
describe,
|
||||
expect,
|
||||
it
|
||||
} from 'vitest';
|
||||
|
||||
import {
|
||||
buildAttachmentDisplayPinKey,
|
||||
canRevokeAttachmentDisplayBlob,
|
||||
shouldRevokeDisplayBlobForAttachment
|
||||
} from './attachment-blob-eviction.rules';
|
||||
|
||||
describe('attachment-blob-eviction rules', () => {
|
||||
it('builds a stable pin key from message and attachment ids', () => {
|
||||
expect(buildAttachmentDisplayPinKey('msg-1', 'att-1')).toBe('msg-1:att-1');
|
||||
});
|
||||
|
||||
it('allows revoking blob urls when a disk path can rehydrate the attachment', () => {
|
||||
expect(canRevokeAttachmentDisplayBlob({
|
||||
objectUrl: 'blob:http://localhost/abc',
|
||||
savedPath: '/appdata/photo.png',
|
||||
receivedBytes: 0,
|
||||
available: true
|
||||
})).toBe(true);
|
||||
});
|
||||
|
||||
it('refuses to revoke blobs that are the only local copy', () => {
|
||||
expect(canRevokeAttachmentDisplayBlob({
|
||||
objectUrl: 'blob:http://localhost/abc',
|
||||
receivedBytes: 0,
|
||||
available: true
|
||||
})).toBe(false);
|
||||
});
|
||||
|
||||
it('refuses to revoke blobs while a download is still in progress', () => {
|
||||
expect(canRevokeAttachmentDisplayBlob({
|
||||
objectUrl: 'blob:http://localhost/abc',
|
||||
savedPath: '/appdata/photo.png',
|
||||
receivedBytes: 1024,
|
||||
available: false
|
||||
})).toBe(false);
|
||||
});
|
||||
|
||||
it('skips revocation for pinned attachments', () => {
|
||||
const attachment = {
|
||||
id: 'att-1',
|
||||
objectUrl: 'blob:http://localhost/abc',
|
||||
savedPath: '/appdata/photo.png',
|
||||
receivedBytes: 0,
|
||||
available: true
|
||||
};
|
||||
|
||||
expect(shouldRevokeDisplayBlobForAttachment(
|
||||
'msg-1',
|
||||
attachment,
|
||||
new Set([buildAttachmentDisplayPinKey('msg-1', 'att-1')])
|
||||
)).toBe(false);
|
||||
|
||||
expect(shouldRevokeDisplayBlobForAttachment('msg-1', attachment, new Set())).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user