fix: strengthen live recovery and support diagnostics

Apply account and key changes to active queues without a restart and isolate provider attempt cancellation so fallback accounts remain usable. Preserve pause ownership, bound persisted HTTP 416 recovery, reconcile resets with authoritative state, and stabilize package ordering and live update cadence. Correlate rotation, conversion, resume, disk, queue-control, clipboard, and support-export events while redacting sensitive data at every persistent boundary and again in generated bundles. Release as v2.0.31 with updated English documentation and regression coverage.
This commit is contained in:
Sucukdeluxe
2026-08-13 11:36:51 +02:00
parent 88399c5dd0
commit 25ebc55f4f
44 changed files with 5223 additions and 959 deletions
+83 -1
View File
@@ -1,6 +1,10 @@
import { describe, expect, it } from "vitest";
import type { PackageEntry } from "../src/shared/types";
import { preservePackageOrderForDisplay } from "../src/renderer/package-order";
import {
preservePackageOrderForDisplay,
reconcileCollapsedPackageState,
reconcileOptimisticPackageOrder
} from "../src/renderer/package-order";
function createPackage(id: string, itemIds: string[], downloadStartedAt = 0): PackageEntry {
const now = Date.now();
@@ -39,3 +43,81 @@ describe("preservePackageOrderForDisplay", () => {
expect(preservePackageOrderForDisplay(packages).map((pkg) => pkg.id)).toEqual(["pkg-first", "pkg-second", "pkg-third"]);
});
});
describe("reconcileCollapsedPackageState", () => {
it("keeps user collapse choices stable while package metadata and order change", () => {
const previous = { "pkg-first": true, "pkg-second": false };
const packages = {
"pkg-first": { ...createPackage("pkg-first", ["first-item"], 300), status: "downloading" as const },
"pkg-second": { ...createPackage("pkg-second", ["second-item"], 100), status: "completed" as const }
};
const next = reconcileCollapsedPackageState(previous, ["pkg-second", "pkg-first"], packages, true);
expect(next).toBe(previous);
expect(next).toEqual({ "pkg-first": true, "pkg-second": false });
});
it("defaults only new packages and removes packages that disappeared", () => {
const previous = { "pkg-old": false, "pkg-stale": true };
const packages = {
"pkg-old": createPackage("pkg-old", ["old-item"]),
"pkg-new": createPackage("pkg-new", ["new-item"])
};
expect(reconcileCollapsedPackageState(previous, ["pkg-old", "pkg-new"], packages, true)).toEqual({
"pkg-old": false,
"pkg-new": true
});
});
});
describe("reconcileOptimisticPackageOrder", () => {
it("keeps the optimistic order visible while an older state event arrives", () => {
const pending = ["pkg-a", "pkg-c", "pkg-b"];
expect(reconcileOptimisticPackageOrder(
["pkg-a", "pkg-b", "pkg-c"],
pending,
1_000,
1_500
)).toEqual({
displayOrder: pending,
pendingOrder: pending,
pendingAt: 1_000,
status: "pending"
});
});
it("accepts the authoritative order once it acknowledges the optimistic change", () => {
const pending = ["pkg-a", "pkg-c", "pkg-b"];
expect(reconcileOptimisticPackageOrder(
pending,
pending,
1_000,
1_500
)).toEqual({
displayOrder: pending,
pendingOrder: null,
pendingAt: 0,
status: "acknowledged"
});
});
it("returns to the authoritative order after the optimistic hold times out", () => {
const authoritative = ["pkg-a", "pkg-b", "pkg-c"];
expect(reconcileOptimisticPackageOrder(
authoritative,
["pkg-a", "pkg-c", "pkg-b"],
1_000,
2_500
)).toEqual({
displayOrder: authoritative,
pendingOrder: null,
pendingAt: 0,
status: "timed-out"
});
});
});