Par2 merge: a set held by many releases, or a merge far larger than its set, isn't one upload
Test and deploy / test (push) Successful in 48s
Test and deploy / edge (push) Successful in 1m59s
Test and deploy / deploy (push) Successful in 1m34s

Every kantodoNNN.bin test upload carries the same par2 set: 64 releases held
it nearby and became one release of 631 files for a set of 10. A set held by
more than 4 releases nearby isn't merged, nor members with more than 3x the
set's files plus 10.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daan MeijerandClaude Opus 5.5 committed 2026-10-12 22:29:48 +02:00
1 parent c72bf68fd2
commit 942c4901fa
2 files changed
+32 -1

No files matched your search

+18
View File
@@ -86,6 +86,24 @@ test.group('Par2Merger', (group) => {
assert.deepEqual(held.map((r) => Number(r.release_id)), [ids[2]])
})
test('a set held by many releases nearby is posted again and again: not merged', async ({ assert }) => {
const at = new Date('2022-07-08T03:46:00Z')
const setId = hash('4')
const ids: number[] = []
for (let i = 1; i <= 6; i++) {
const key = `cc00000${i}`
const [row] = await db
.table('releases')
.insert({ release_key: key.padEnd(40, '0'), identity_key: key.padEnd(40, '0'), name: `kantodo${i}`, source: 'stem', groups: '[]', group_id: 1, files: 11, posted_at: at, readable: true })
.returning('id')
ids.push(Number(row.id))
await db.table('par2_sets').insert({ set_id: setId, release_id: row.id, files: 1 })
}
await db.table('par2_files').insert({ set_id: setId, file_id: hash('3'), hash16k: hash('2'), length: 1073741824, name: 'kantodo.bin' })
assert.equal(await new Par2Merger().mergeSet(setId), 0)
assert.equal((await db.from('releases').whereIn('id', ids).select('id')).length, 6)
})
test('a set file that matches several releases nearby is ambiguous: not merged', async ({ assert }) => {
const at = new Date('2022-07-08T03:46:00Z')
const ids: number[] = []