Skip to content

A full-featured download manager.

fix(engine): bundle aria2 motrix.22 with safe session recovery (#2491)

Dr_rOot963ff18d92a7
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e4d810f8..25926808 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -425,10 +425,14 @@ jobs:
- name: Native runtime integration
env:
+ MOTRIX_ARIA2_TEST_BIN: ${{ github.workspace }}/extra/${{ matrix.platform }}/${{ matrix.arch }}/${{ matrix.platform == 'win32' && 'aria2c.exe' || 'aria2c' }}
+ MOTRIX_REQUIRE_HTTP_RETRY_TEST: '1'
MOTRIX_LEGACY_CHECKPOINT_ENGINE: ${{ github.workspace }}/extra/${{ matrix.platform }}/${{ matrix.arch }}/${{ matrix.platform == 'win32' && 'aria2c.exe' || 'aria2c' }}
MOTRIX_FINALIZE_FS_TEST_BIN: packages/finalize-fs/dist/${{ matrix.platform }}-${{ matrix.arch }}/${{ matrix.platform == 'win32' && 'motrix-finalize-fs.exe' || 'motrix-finalize-fs' }}
run: >-
pnpm exec vitest run
+ src/core/task/direct-task-retry.integration.test.ts
+ src/core/engine/aria2/aria2-session-identity-recovery.integration.test.ts
src/core/engine/aria2/aria2-parent-lifecycle.integration.test.ts
src/core/legacy-import/http-activation.integration.test.ts
src/core/plugin/finalize/native-artifact-operations.integration.test.ts
diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml
index 1075aab5..a44686dc 100644
--- a/.github/workflows/flatpak.yml
+++ b/.github/workflows/flatpak.yml
@@ -301,7 +301,7 @@ jobs:
-path "*/native-messaging-hosts/*" \
\) -print -quit)"
output="$("$aria2c" --version)"
- printf "%s\n" "$output" | grep -qF "aria2 version 1.37.0-motrix.21"
+ printf "%s\n" "$output" | grep -qF "aria2 version 1.37.0-motrix.22"
printf "%s\n" "$output" | grep -qF "Async DNS"
printf "%s\n" "$output" | grep -qF "BitTorrent"
printf "%s\n" "$output" | grep -qF "HTTPS"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 3bf6c573..10324c4c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -256,10 +256,14 @@ jobs:
- name: Native runtime integration
env:
+ MOTRIX_ARIA2_TEST_BIN: ${{ github.workspace }}/extra/${{ matrix.platform }}/${{ matrix.arch }}/${{ matrix.platform == 'win32' && 'aria2c.exe' || 'aria2c' }}
+ MOTRIX_REQUIRE_HTTP_RETRY_TEST: '1'
MOTRIX_LEGACY_CHECKPOINT_ENGINE: ${{ github.workspace }}/extra/${{ matrix.platform }}/${{ matrix.arch }}/${{ matrix.platform == 'win32' && 'aria2c.exe' || 'aria2c' }}
MOTRIX_FINALIZE_FS_TEST_BIN: packages/finalize-fs/dist/${{ matrix.platform }}-${{ matrix.arch }}/${{ matrix.platform == 'win32' && 'motrix-finalize-fs.exe' || 'motrix-finalize-fs' }}
run: >-
pnpm exec vitest run
+ src/core/task/direct-task-retry.integration.test.ts
+ src/core/engine/aria2/aria2-session-identity-recovery.integration.test.ts
src/core/legacy-import/http-activation.integration.test.ts
src/core/plugin/finalize/native-artifact-operations.integration.test.ts
src/core/plugin/finalize/finalize-adversarial.integration.test.ts
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
index 6afb82dc..11ea48f5 100644
--- a/THIRD_PARTY_NOTICES.md
+++ b/THIRD_PARTY_NOTICES.md
@@ -102,8 +102,8 @@ must obtain permission or replace the font before distributing the build.
Desktop builds bundle an `aria2c` executable pinned by
`scripts/engine.lock.json`:
-- **Version:** 1.37.0-motrix.21
-- **Source:** <https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.21>
+- **Version:** 1.37.0-motrix.22
+- **Source:** <https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.22>
- **License:** GNU General Public License v2.0 or later (`GPL-2.0-or-later`)
- **Full license text:** `THIRD_PARTY_LICENSES/aria2-COPYING`
- **OpenSSL exception / notice:**
diff --git a/THIRD_PARTY_NOTICES.zh-CN.md b/THIRD_PARTY_NOTICES.zh-CN.md
index af064f15..444db5a5 100644
--- a/THIRD_PARTY_NOTICES.zh-CN.md
+++ b/THIRD_PARTY_NOTICES.zh-CN.md
@@ -87,8 +87,8 @@ Safari 图标是从 macOS 27.0(26A428)自带的 Safari 27.0 中 `Safari.app/
桌面版随应用打包 `aria2c` 可执行文件,版本由 `scripts/engine.lock.json` 固定:
-- **版本:** 1.37.0-motrix.21
-- **对应源码:** <https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.21>
+- **版本:** 1.37.0-motrix.22
+- **对应源码:** <https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.22>
- **许可证:** GNU General Public License v2.0 or later(`GPL-2.0-or-later`)
- **完整许可证文本:** `THIRD_PARTY_LICENSES/aria2-COPYING`
- **OpenSSL 例外条款 / 声明:**
diff --git a/flatpak/app.motrix.native.yml b/flatpak/app.motrix.native.yml
index 43c562d1..aacb90b7 100644
--- a/flatpak/app.motrix.native.yml
+++ b/flatpak/app.motrix.native.yml
@@ -101,7 +101,7 @@ modules:
set -e
output="$(src/aria2c --version)"
printf '%s\n' "$output"
- printf '%s\n' "$output" | grep -qF 'aria2 version 1.37.0-motrix.21'
+ printf '%s\n' "$output" | grep -qF 'aria2 version 1.37.0-motrix.22'
for feature in \
'Async DNS' \
'BitTorrent' \
@@ -123,8 +123,8 @@ modules:
sources:
- type: git
url: https://github.com/motrixapp/aria2.git
- tag: v1.37.0-motrix.21
- commit: 7ce56e48a8b372fc199b5b88e8d1185cbab49f06
+ tag: v1.37.0-motrix.22
+ commit: 96b49bb471c82d414c760bb67dd6085607174d7e
x-checker-data:
type: git
tag-pattern: ^v([\d.]+-motrix\.\d+)$
@@ -136,9 +136,9 @@ modules:
commands:
- |
sed -i -E \
- 's/AC_INIT\(\[aria2\],\[[^]]+\]/AC_INIT([aria2],[1.37.0-motrix.21]/' \
+ 's/AC_INIT\(\[aria2\],\[[^]]+\]/AC_INIT([aria2],[1.37.0-motrix.22]/' \
configure.ac
- grep -qF 'AC_INIT([aria2],[1.37.0-motrix.21]' configure.ac
+ grep -qF 'AC_INIT([aria2],[1.37.0-motrix.22]' configure.ac
- type: script
dest-filename: autogen.sh
commands:
diff --git a/scripts/engine.lock.json b/scripts/engine.lock.json
index 61a7e2fc..a73c1890 100644
--- a/scripts/engine.lock.json
+++ b/scripts/engine.lock.json
@@ -1,56 +1,56 @@
{
"engine": "aria2",
"repo": "motrixapp/aria2",
- "tag": "v1.37.0-motrix.21",
- "version": "1.37.0-motrix.21",
+ "tag": "v1.37.0-motrix.22",
+ "version": "1.37.0-motrix.22",
"assets": {
"darwin-arm64": {
- "file": "aria2c-1.37.0-motrix.21-darwin-arm64.tar.gz",
+ "file": "aria2c-1.37.0-motrix.22-darwin-arm64.tar.gz",
"bin": "aria2c",
- "archiveSha256": "dc66702acd0afc6b68a94399e65122af1fae7fa9e1ca2e8522823ddf38caa59f",
- "binarySha256": "8f1f6b6fef4e37aed4c3291f8e8bf8f90dc26b91b1278e1e08be0cee0de32857"
+ "archiveSha256": "a64ccdd642ba5b28d638c8202c224b8d04c5750945bc292845119bfe30676ce3",
+ "binarySha256": "120b87705dc3fbf7ad75241e50243a48a6fa854001f03b3d1adff8a3715cd8d2"
},
"darwin-x64": {
- "file": "aria2c-1.37.0-motrix.21-darwin-x64.tar.gz",
+ "file": "aria2c-1.37.0-motrix.22-darwin-x64.tar.gz",
"bin": "aria2c",
- "archiveSha256": "3ce605170a76d54df90b5d18b81e6a935539f1c78015681de5b3d919d93a9244",
- "binarySha256": "14f02373ec4cba9a4c9304b89d22bb52e61dbbf2ba81fcbdb2cdfb1f40712e3a"
+ "archiveSha256": "28467f11ee0f89469214119236ee6640ff6f7fdc5ea99b89b6be081581f29fd5",
+ "binarySha256": "a3657c91607e0aacf02d49ba2a35270fb89afcaebbbd666bda4873dec68f561d"
},
"win32-arm64": {
- "file": "aria2c-1.37.0-motrix.21-win32-arm64.zip",
+ "file": "aria2c-1.37.0-motrix.22-win32-arm64.zip",
"bin": "aria2c.exe",
- "archiveSha256": "623516b4f9961ad31e336beb4dc488557a31a957a47a3f6063e08d98999449f3",
- "binarySha256": "dd680702b87acf84d4c8cb2e9c9e66d72a477b113ac6a5c4bec50d2bcea5abfd"
+ "archiveSha256": "17b3b651ed636d2e2d24557d6c9a190ad130bc930b6ed17c0bb6f2e0119c847e",
+ "binarySha256": "b4a0c774b9ea3f6b035541dd82a37fb46e0ad7cd505ead7e51cfa4542bc8ee4d"
},
"win32-x64": {
- "file": "aria2c-1.37.0-motrix.21-win32-x64.zip",
+ "file": "aria2c-1.37.0-motrix.22-win32-x64.zip",
"bin": "aria2c.exe",
- "archiveSha256": "cc3925dba967b6a5fc5c33c5f5bbe81f14ca436f5970b03a5043a11741b5c41c",
- "binarySha256": "0e692a88146d5eb12ec0c3fe3de2055812b01c5c80147a6e88ecd51985ab5dd6"
+ "archiveSha256": "c078ce68ee38bf07e297c3930d6ed721e9acaff8826b2464a5fc22a8e7279058",
+ "binarySha256": "8692cb34ebfba1ebddd693caf36f124d68cfa1b8489400e03b0a4aad1d9555bb"
},
"win32-ia32": {
- "file": "aria2c-1.37.0-motrix.21-win32-ia32.zip",
+ "file": "aria2c-1.37.0-motrix.22-win32-ia32.zip",
"bin": "aria2c.exe",
- "archiveSha256": "e0d84ca98be8da3e6c095e7084127c866fe7e2df015f2410294da44f13b66d40",
- "binarySha256": "7ae685fef829e86a8cb6c16c06183aaf5541736075a0d1f79a8d673b0e2f5867"
+ "archiveSha256": "0406abe25e94a3f376a36cf61ca294f9ab19505e2ec0acb28a9f8a2f313642c4",
+ "binarySha256": "1196116e6c3856f6674459193227e99d1ddd99db1187bb9aab382fb5bc4c4250"
},
"linux-x64": {
- "file": "aria2c-1.37.0-motrix.21-linux-x64.tar.gz",
+ "file": "aria2c-1.37.0-motrix.22-linux-x64.tar.gz",
"bin": "aria2c",
- "archiveSha256": "7809f8116959160b04e1dc848b201c966b2f37486d57087a9a2486572e6f8266",
- "binarySha256": "04516664a8fa85427bb6d649604361135a619860a1ac743b38808f49abc82d4c"
+ "archiveSha256": "b4ef94ba6843c4ef445365174219478a79e8f87a3f9f06de4a5081da04814505",
+ "binarySha256": "6896a9cc11471711260cc8e9a06f1ab6fe215de2084ad99ad5a28cee68e776a8"
},
"linux-arm64": {
- "file": "aria2c-1.37.0-motrix.21-linux-arm64.tar.gz",
+ "file": "aria2c-1.37.0-motrix.22-linux-arm64.tar.gz",
"bin": "aria2c",
- "archiveSha256": "ae60f163d768c4045702c04b576de8c5d422dcd7408ea89d0f971cd996369604",
- "binarySha256": "ee728fd45cf401b8ac066d90b4edc6e0f1bca44ea71679282b955bb612121eb1"
+ "archiveSha256": "c064e5b0e55092dbf98e5d810cf185b96164483230e20b29c1f51dbaf01e2b53",
+ "binarySha256": "d04d1c45957171df28b38a5422a67477b11a623ea4c2f9fe0ee158e7993d9da3"
},
"linux-arm": {
- "file": "aria2c-1.37.0-motrix.21-linux-armv7l.tar.gz",
+ "file": "aria2c-1.37.0-motrix.22-linux-armv7l.tar.gz",
"bin": "aria2c",
- "archiveSha256": "ab1cf67ed4823908d2daa952969209080df545542ab2d6d6a78a5add6d721c7a",
- "binarySha256": "c80b2080c2de249e46157649cb4c7db96ffb25bf94cc4d217fe679aa7ecc1291"
+ "archiveSha256": "a6017e41333606c3b757d4425f7fd2cb75cad62905151b7a388026bc7d532685",
+ "binarySha256": "26e92762af4483660779b5d515443bb800b5938c0a067f539dd9cc6961d38c9b"
}
}
}
diff --git a/scripts/verify-flatpak-packaging.mjs b/scripts/verify-flatpak-packaging.mjs
index ecf0e393..fd9f7585 100644
--- a/scripts/verify-flatpak-packaging.mjs
+++ b/scripts/verify-flatpak-packaging.mjs
@@ -18,8 +18,8 @@ export const FLATPAK_BUILDER_TOOLS_COMMIT =
// tag resolves to is pinned by hand (and cross-checked against the manifest).
export const ARIA2_SOURCE = Object.freeze({
url: 'https://github.com/motrixapp/aria2.git',
- // v1.37.0-motrix.21 — current Motrix aria2 fork release
- commit: '7ce56e48a8b372fc199b5b88e8d1185cbab49f06',
+ // v1.37.0-motrix.22 — current Motrix aria2 fork release
+ commit: '96b49bb471c82d414c760bb67dd6085607174d7e',
})
const PNPM_SOURCE = Object.freeze({
diff --git a/src/core/engine/aria2/aria2-session-identity-recovery.integration.test.ts b/src/core/engine/aria2/aria2-session-identity-recovery.integration.test.ts
index 3d729242..c1296ef8 100644
--- a/src/core/engine/aria2/aria2-session-identity-recovery.integration.test.ts
+++ b/src/core/engine/aria2/aria2-session-identity-recovery.integration.test.ts
@@ -62,6 +62,9 @@ function snapshot(file: string) {
progress: db
.prepare('SELECT gid, bitfield FROM task_progress')
.all() as Array<{ gid: string; bitfield: Buffer }>,
+ history: db
+ .prepare('SELECT id, gid, status FROM download_history ORDER BY id')
+ .all() as Array<{ id: number; gid: string; status: string }>,
integrity: db.pragma('integrity_check', { simple: true }),
}
} finally {
@@ -297,6 +300,12 @@ describe.skipIf(!bundledAria2Exists() || !canBindLoopbackTcp())(
expect(snapshot(dbPath).rows.map((row) => row.gid)).toEqual([
healthyGid,
])
+ expect(snapshot(recovery!.backupPath).history).toEqual(
+ before.history
+ )
+ expect(snapshot(dbPath).history).toEqual(
+ before.history.filter((row) => row.gid !== metadataGid)
+ )
for (let boot = 0; boot < 2; boot++) {
expect(
await recoverAria2SessionIdentity(
diff --git a/src/core/engine/aria2/aria2-session-identity-recovery.test.ts b/src/core/engine/aria2/aria2-session-identity-recovery.test.ts
index 52c66359..a1e9503c 100644
--- a/src/core/engine/aria2/aria2-session-identity-recovery.test.ts
+++ b/src/core/engine/aria2/aria2-session-identity-recovery.test.ts
@@ -116,6 +116,12 @@ describe('aria2 persisted task identity recovery', () => {
try {
await unlink(h.metadataPath)
const before = h.rows()
+ h.db
+ .prepare('INSERT INTO download_history VALUES (?, ?, ?, ?)')
+ .run(2, CHILD, 'error', null)
+ h.db
+ .prepare('INSERT INTO download_history VALUES (?, ?, ?, ?)')
+ .run(3, OTHER, 'complete', '[]')
const history = h.db.prepare('SELECT * FROM download_history').all()
const store = recoveryStore()
store.quarantine = vi.fn(async (tasks) => {
@@ -144,6 +150,9 @@ describe('aria2 persisted task identity recovery', () => {
expect(
backup.prepare('SELECT * FROM task_cookie_context').all()
).toHaveLength(1)
+ expect(
+ backup.prepare('SELECT * FROM download_history').all()
+ ).toEqual(history)
} finally {
backup.close()
}
@@ -161,7 +170,7 @@ describe('aria2 persisted task identity recovery', () => {
[]
)
expect(h.db.prepare('SELECT * FROM download_history').all()).toEqual(
- history
+ history.filter((row) => (row as { gid: string }).gid !== PARENT)
)
expect(
await recoverAria2SessionIdentity(h.file, () => true, store)
@@ -491,7 +500,77 @@ describe('aria2 persisted task identity recovery', () => {
h.db.prepare('DELETE FROM task WHERE gid = ?').run(PARENT)
const result = await recoverAria2SessionIdentity(h.file)
expect(result?.repairedGids).toEqual([CHILD])
+ expect(result?.retiredMetadataGids).toEqual([PARENT])
+ expect(h.db.prepare('SELECT * FROM download_history').all()).toEqual([])
+ } finally {
+ h.db.close()
+ }
+ })
+
+ it('preserves history without a verified metadata link when the ancestor task is absent', async () => {
+ const h = await setup()
+ try {
+ h.db.prepare('DELETE FROM task WHERE gid = ?').run(PARENT)
+ h.db
+ .prepare('UPDATE download_history SET followed_by = ?')
+ .run(JSON.stringify([OTHER]))
+ const before = h.db.prepare('SELECT * FROM download_history').all()
+ const result = await recoverAria2SessionIdentity(h.file)
+ expect(result?.repairedGids).toEqual([CHILD])
expect(result?.retiredMetadataGids).toEqual([])
+ expect(h.db.prepare('SELECT * FROM download_history').all()).toEqual(
+ before
+ )
+ } finally {
+ h.db.close()
+ }
+ })
+
+ it('removes duplicate verified ancestor histories and their dependent records only', async () => {
+ const h = await setup()
+ try {
+ h.db.exec(`
+ CREATE TABLE download_history_files(history_id INTEGER REFERENCES download_history(id) ON DELETE CASCADE, path TEXT);
+ INSERT INTO download_history_files VALUES (1, 'metadata.torrent');
+ `)
+ h.db
+ .prepare('INSERT INTO download_history VALUES (0, ?, ?, ?)')
+ .run(PARENT, 'error', '[]')
+ h.db
+ .prepare('INSERT INTO download_history VALUES (2, ?, ?, ?)')
+ .run(PARENT, 'complete', JSON.stringify([CHILD]))
+ h.db
+ .prepare('INSERT INTO download_history_files VALUES (?, ?)')
+ .run(2, 'metadata-copy.torrent')
+ const result = await recoverAria2SessionIdentity(h.file)
+ expect(result?.retiredMetadataGids).toEqual([PARENT])
+ expect(h.db.prepare('SELECT * FROM download_history').all()).toEqual([
+ { id: 0, gid: PARENT, status: 'error', followed_by: '[]' },
+ ])
+ expect(
+ h.db.prepare('SELECT * FROM download_history_files').all()
+ ).toEqual([])
+ } finally {
+ h.db.close()
+ }
+ })
+
+ it('rolls back task and progress retirement when verified history cleanup fails', async () => {
+ const h = await setup()
+ try {
+ h.db.exec(
+ `CREATE TRIGGER refuse_history_delete BEFORE DELETE ON download_history BEGIN SELECT RAISE(ABORT, 'injected history failure'); END`
+ )
+ const before = h.rows()
+ const history = h.db.prepare('SELECT * FROM download_history').all()
+ await expect(recoverAria2SessionIdentity(h.file)).rejects.toThrow(
+ 'injected history failure'
+ )
+ expect(h.rows()).toEqual(before)
+ expect(h.db.prepare('SELECT * FROM task_progress').all()).toHaveLength(1)
+ expect(h.db.prepare('SELECT * FROM download_history').all()).toEqual(
+ history
+ )
} finally {
h.db.close()
}
diff --git a/src/core/engine/aria2/aria2-session-identity-recovery.ts b/src/core/engine/aria2/aria2-session-identity-recovery.ts
index bbd724e7..41cae25f 100644
--- a/src/core/engine/aria2/aria2-session-identity-recovery.ts
+++ b/src/core/engine/aria2/aria2-session-identity-recovery.ts
@@ -96,7 +96,7 @@ async function readMatchingMetadata(
}
/**
- * Repair the fork's metadata-ancestor GID serialization (schema v1–v5) before spawn.
+ * Repair the fork's metadata-ancestor GID serialization (schema v1–v6) before spawn.
* The actual row key remains the owner of progress, cookies and app identity.
* A verified local torrent replaces the magnet so aria2 recreates that exact
* payload task directly. Unrecoverable tasks are backed up and retained in the
@@ -147,37 +147,50 @@ export async function recoverAria2SessionIdentity(
throw new Error('aria2 session recovery requires a stopped engine')
const retiredMetadataGids = new Set<string>()
+ const retiredHistoryIds = new Set<number>()
const plans: Array<{ row: Row; entry: Entry; bytes: Buffer }> = []
const quarantined: EngineSessionTaskFailure[] = []
for (const { row, entry } of candidates) {
if (!['waiting', 'paused'].includes(row.state))
throw failure(row.gid, 'unsupported task state')
const parent = rows.find((candidate) => candidate.gid === entry.gid)
- if (parent) {
- const parentEntry = parseEntry(parent.serialized)
- const history = db
- .prepare(
- 'SELECT status, followed_by FROM download_history WHERE gid = ? ORDER BY id DESC LIMIT 1'
- )
- .get(parent.gid) as
- | { status: string; followed_by: string | null }
- | undefined
- let children: string[] = []
+ const history = db
+ .prepare(
+ 'SELECT id, status, followed_by FROM download_history WHERE gid = ? ORDER BY id DESC'
+ )
+ .all(entry.gid) as Array<{
+ id: number
+ status: string
+ followed_by: string | null
+ }>
+ const confirmsChild = (record: (typeof history)[number]): boolean => {
+ if (record.status !== 'complete') return false
try {
- children = z
+ return z
.array(gidSchema)
- .parse(JSON.parse(history?.followed_by ?? 'null'))
+ .parse(JSON.parse(record.followed_by ?? 'null'))
+ .includes(row.gid)
} catch {
- // Retire only a proven completed metadata ancestor.
+ return false
}
+ }
+ const verifiedAncestor = history[0] && confirmsChild(history[0])
+ if (parent) {
+ const parentEntry = parseEntry(parent.serialized)
if (
parentEntry?.source !== entry.source ||
parentEntry.gid !== parent.gid ||
- history?.status !== 'complete' ||
- !children.includes(row.gid)
+ !verifiedAncestor
)
throw failure(row.gid, 'metadata ancestry could not be verified')
- retiredMetadataGids.add(parent.gid)
+ }
+ if (verifiedAncestor) {
+ retiredMetadataGids.add(entry.gid)
+ // Stopped history can otherwise be adopted as a separate download even
+ // after its task row is gone. Retire only individually proven ancestors;
+ // a reused GID does not authorize deleting unrelated history.
+ for (const record of history)
+ if (confirmsChild(record)) retiredHistoryIds.add(record.id)
}
let infoHash: string
@@ -318,6 +331,10 @@ export async function recoverAria2SessionIdentity(
remove.run(gid)
removeProgress?.run(gid)
}
+ const removeHistory = db.prepare(
+ 'DELETE FROM download_history WHERE id = ?'
+ )
+ for (const id of retiredHistoryIds) removeHistory.run(id)
}).immediate()
return {
backupPath,
diff --git a/src/core/task/direct-task-retry.integration.test.ts b/src/core/task/direct-task-retry.integration.test.ts
index 5c1e8987..b93819c4 100644
--- a/src/core/task/direct-task-retry.integration.test.ts
+++ b/src/core/task/direct-task-retry.integration.test.ts
@@ -14,7 +14,7 @@ import {
spawnAria2ForTest,
} from '@test-utils/aria2'
import { directTaskUpdatePublication } from '@test-utils/task-update'
-import { describe, expect, it, vi } from 'vitest'
+import { beforeAll, describe, expect, it, vi } from 'vitest'
import { type ReAddTaskDeps, reAddTask } from './actions/re-add-task'
import { handleCreateTask } from './create-task-handler'
import { createGetTaskHttpRetryAvailabilityHandler } from './direct-task-retry'
@@ -22,9 +22,20 @@ import { mergeEngineTask } from './merge-engine-task'
import { shouldEvictFromEngine } from './should-evict-from-engine'
import { TaskManager } from './task-manager'
-describe.skipIf(!bundledAria2Exists() || !canBindLoopbackTcp())(
+const requireNativeHttpRetry =
+ process.env.MOTRIX_REQUIRE_HTTP_RETRY_TEST === '1'
+const nativeRetryEnvironmentAvailable =
+ bundledAria2Exists() && canBindLoopbackTcp()
+
+describe.skipIf(!requireNativeHttpRetry && !nativeRetryEnvironmentAvailable)(
'native authenticated HTTP continuation',
() => {
+ beforeAll(() => {
+ if (!nativeRetryEnvironmentAvailable)
+ throw new Error(
+ 'Native HTTP retry tests require the target engine and loopback TCP access'
+ )
+ })
it.for([
{ empty: false, restart: false },
{ empty: true, restart: false },
@@ -89,7 +100,7 @@ describe.skipIf(!bundledAria2Exists() || !canBindLoopbackTcp())(
'aria2.retryHttpDownloadV1'
)
) {
- if (process.env.MOTRIX_REQUIRE_HTTP_RETRY_TEST === '1')
+ if (requireNativeHttpRetry)
throw new Error('Native HTTP retry engine required')
context.skip()
return
diff --git a/tests/check-third-party-notices.test.ts b/tests/check-third-party-notices.test.ts
index 36c175dc..bdf61aef 100644
--- a/tests/check-third-party-notices.test.ts
+++ b/tests/check-third-party-notices.test.ts
@@ -460,9 +460,9 @@ describe('third-party graph dependency notices', () => {
expect(notice).toContain('SFNS-Regular.ttf')
expect(notice).toContain('https://developer.apple.com/fonts/')
- expect(notice).toContain('1.37.0-motrix.21')
+ expect(notice).toContain('1.37.0-motrix.22')
expect(notice).toContain(
- 'https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.21'
+ 'https://github.com/motrixapp/aria2/tree/v1.37.0-motrix.22'
)
expect(notice).toContain('GPL-2.0-or-later')
expect(notice).toContain('THIRD_PARTY_LICENSES/aria2-COPYING')
diff --git a/tests/generate-third-party-notices.test.ts b/tests/generate-third-party-notices.test.ts
index 54a39a60..4a618318 100644
--- a/tests/generate-third-party-notices.test.ts
+++ b/tests/generate-third-party-notices.test.ts
@@ -171,7 +171,7 @@ describe('third-party notice generator', () => {
expect(bundle.packageCount).toBeGreaterThan(100)
expect(inventory).toContain('| @xyflow/react | 12.12.0 |')
- expect(inventory).toContain('| aria2 | 1.37.0-motrix.21 |')
+ expect(inventory).toContain('| aria2 | 1.37.0-motrix.22 |')
expect(inventory).toContain('| motrix.filename-template | 1.1.1 |')
expect(inventory).toContain('Apple San Francisco tray font')
expect(licenses).toContain('GNU GENERAL PUBLIC LICENSE')
@@ -282,7 +282,7 @@ describe('third-party notice generator', () => {
expect(licenses).toContain('GNU GENERAL PUBLIC LICENSE')
}
const serverInventory = server.files['THIRD_PARTY_DEPENDENCIES.md']
- expect(serverInventory).toContain('| aria2 | 1.37.0-motrix.21 |')
+ expect(serverInventory).toContain('| aria2 | 1.37.0-motrix.22 |')
expect(serverInventory).toContain('| motrix.filename-template | 1.1.1 |')
expect(serverInventory).not.toContain('| Electron |')