The prober names 6% of the unnamed releases it finishes and the pending queue (44M) grows eleven times faster than it probes. A sample of 44,530 finished pending rows shows the headers predict a name: size bucket, name shape, completeness, tool and group separate 0% classes from 95% ones, while the learner keyed on tool and group alone (LOG.md (130)). - lib/release/classes.ts, names::pending_class, SQL pending_class(): a release's class (size × shape × partial, 1..70), the three in step. - Migration 6800: pending_releases.klass and target_bytes (the first target's article; candidates carry bytes now), pending_classes with each class's climbs, names, waiting and verdict, the claim's index. - The ladder claims the classes with the best record first (a prior for the unexplored, at most a quarter of a claim from one), the cheapest target first within one, then the oldest of the rest; records classes like signatures and drops them at the same thresholds; discards their waiting releases. Claimed rows sorted in code: an UPDATE returns none. - The rule set's droppedClasses: the edge keeps unnamed releases of a dropped class out of the pending store (counted as garbage), the explored sample excepted. - hash_twins.ts: a probed file whose first 16 KiB and size match a named catalog release's names a pending release the probe didn't, and sets the inner name of a catalog release without one. - pending:classes classes the rows from before and seeds the record from the finished ones; rules:classes publishes the dropped classes; releases:readable also marks the rows' candidates unreadable. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { test } from '@japa/runner'
|
|
import db from '@adonisjs/lucid/services/db'
|
|
import { pendingClass } from '#lib/release/index'
|
|
|
|
test.group('Pending classes / SQL pending_class()', () => {
|
|
test('the SQL function agrees with pendingClass', async ({ assert }) => {
|
|
const cases: [string, number, boolean][] = [
|
|
['c04212a389cf69edc54767355ab5285f', 5_000_000, false],
|
|
['c04212a389cf69edc54767355ab5285f', 5_000_000, true],
|
|
['Zx5AjNaK-mh7CFg6Hf8uu', 500_000_000, false],
|
|
['1650777167', 100, false],
|
|
['mrrtmzrzmi4dgmrzmyytqmlbztczbx', 2_000_000_000, false],
|
|
['PsNdnYiugfZ.rar', 20_000_000, false],
|
|
['n5d1ueIf34X', 20_000_000, true],
|
|
['sgkra vU7u2yuw9LDLCjDu04pOez', 999, false],
|
|
['Description - Lt5nHjlo3RiuBb3C', 40_000_000, false],
|
|
['ABCDEFGHIJKLMNOP', 0, false],
|
|
]
|
|
for (const [name, bytes, partial] of cases) {
|
|
const { rows } = await db.rawQuery(`SELECT pending_class(?, ?::bigint, ?) AS k`, [
|
|
name,
|
|
bytes,
|
|
partial,
|
|
])
|
|
assert.equal(Number(rows[0].k), pendingClass(name, bytes, partial), name)
|
|
}
|
|
})
|
|
})
|