fix(properties): harden torrent diagnostics lifecycle

This commit is contained in:
NimBold
2026-08-04 18:09:07 +03:30
parent 2ab292dd5d
commit c86eb1838c
13 changed files with 176 additions and 56 deletions
+9
View File
@@ -15,6 +15,7 @@ import {
beginExclusivePropertiesAction,
createFrameCoalescer,
getPropertiesLifecycleAction,
isExpectedPropertiesDiagnosticUnavailable,
sanitizePropertiesSnapshot,
} from './propertiesBridge';
@@ -135,6 +136,14 @@ describe('Properties window bridge', () => {
expect(getPropertiesLifecycleAction('completed')).toBeNull();
});
it('recognizes expected diagnostics gaps without hiding real RPC failures', () => {
expect(isExpectedPropertiesDiagnosticUnavailable(new Error('live Torrent file progress is unavailable'))).toBe(true);
expect(isExpectedPropertiesDiagnosticUnavailable(new Error('active Torrent transfer has no current gid mapping'))).toBe(true);
expect(isExpectedPropertiesDiagnosticUnavailable(new Error('Torrent lifecycle changed while reading peer diagnostics'))).toBe(true);
expect(isExpectedPropertiesDiagnosticUnavailable(new Error('aria2.getPeers failed: unavailable response'))).toBe(false);
expect(isExpectedPropertiesDiagnosticUnavailable(new Error('aria2.getFiles failed: connection refused'))).toBe(false);
});
it('keeps the first action locked when a duplicate request is rejected', () => {
const inFlight = new Set<string>();
const release = beginExclusivePropertiesAction(inFlight, 'window:download');