Files
usenet-indexer/tests/unit/release/readable.spec.ts
T
Daan MeijerandClaude Fable 5.1 81a5dce45a
Test and deploy / test (push) Successful in 3m36s
Test and deploy / deploy (push) Skipped
Readable names: a token-by-token classifier for the readable flag
Searches with the readable filter on returned scrambles: with a random
4-letter query nearly every hit was one ("Zx5AjNaK-mh7CFg6Hf8uu",
"Description - Lt5nHjlo3RiuBb3C", "PsNdnYiugfZ", "bd5b...-addon"), and
15% of a 6,000-row sample of the catalog's readable names were. looksRandom
knows single-token shapes only; separators, spaces, a random "extension"
of any length and a packaging word hid the rest.

isUnreadableName (lib/release/readable.ts) and names::is_unreadable_name
read a name token by token: words (one case or Capitalized), scrambles
(letter/digit and case switches, lone letters between capitals, inner
capital runs, few vowels, hex) and neutral tokens (digits, codes like
S02E10 and 1080p, CamelCase, packaging words); a name is unreadable when
its scrambles outweigh its words. Scene tags' "i" for "I" and the
NZBSPLIT hash are read as such. On the evaluation sets: 554 of 559
random-search names caught, 0 of 630 real names flagged (LOG.md (129)).

The edge's readable flag and the prober's inner names use it; the drop
rules keep looksRandom, which is narrower. An unnamed release goes to the
pending store (decision f), so more of the obfuscated groups' releases
wait for a probe now. releases:readable clears the flag on the existing
catalog's rows by name (a dry run by default).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-02 10:01:31 +01:00

73 lines
2.6 KiB
TypeScript

import { test } from '@japa/runner'
import { isUnreadableName, tokenKind } from '#lib/release/index'
test.group('release / isUnreadableName', () => {
test('scrambles with separators, spaces, random extensions, packaging words and hex with an addon are unreadable', ({
assert,
}) => {
for (const n of [
'Zx5AjNaK-mh7CFg6Hf8uu.part01.rar',
'yWjfnT2ujG4wJj3fG46o0FLzsgkvhmrTsAfW2.E0WsOU',
'PsNdnYiugfZ.rar',
'phfplC9y07U2yrj',
'n5d1ueIf34X',
'tJqr1tq7xK',
'Description - Lt5nHjlo3RiuBb3C.par2',
'bd5b4a59f3aa87114dcf75c0-addon.rar',
'mrrtmzrzmi4dgmrzmyytqmlbztczbx',
'AA-NaR16302830434zxP32108309f3Ab',
'_QBs01_MqZYnYwM_iAyRquhc-',
'sgkra vU7u2yuw9LDLCjDu04pOez',
'Jk5Pud.zQdNj',
'7uKsD_NRgT-G_Uc_p8',
'NtpUgCmS_Xa1B2Pk',
'{E11BF8E9-E2C9-4DAE-A1B2-8027BC465F3F}',
'IkYovjrtZrItjQ.mkv',
'ff75ce3f16c746c18b2d78cf.6c52f',
'prvjr7hapd0i1ny14pz4',
]) {
assert.isTrue(isUnreadableName(n), n)
}
})
test('scene tags, CamelCase, codes, leet, acronyms and a hash beside words are readable', ({
assert,
}) => {
for (const n of [
'Dark.Matter.2024.S02E10.No.Quiet.Life.1080p.ATVP.WEB-DL.DDP5.1.Atmos.H.264-Kitsune',
'Paul McCartney - Band on the Run',
'ShesSoWild - Ester Ana 1080p',
'MyDadsHotGirlfriend.13.02.01.Luna.Star.XXX.1080p.x264-SEXORS',
'cFosSpeed 11.0 Build 2420 x86 x64 incl Patch.rar',
'Rocketship-Hurt_Feelings-WEB-2026-PreMaxXxing',
'Drum-and-BassDJ_Samurai-Sound_With_Fire_Artemis-(FQY026)-WEB-2006-PRESCRiPTiON',
'Kleverig-H4rd-N12uk3b18-luc16037-720p-smpwr',
'Eclipse_IDE_2023-12_R_win32_x86_64.zip',
'PartsHPGL 1.06c',
'Go4Customer Fax Machine v1.2b',
'AdBeGone 1.2',
'3DMark03 320',
'COD4MW2REMASTERED',
'Movie.2020.1080p-GRP [a3f9e2b1]',
'EPL__NZBSPLIT__f1fdb433772a1a7771d6b73c875009ff__NZBSPLIT__EPL.2026.Liverpool.vs.Brighton.1080pEN50fps',
'iPhone',
'Some.Show.S01E01.1080p.mkv',
]) {
assert.isFalse(isUnreadableName(n), n)
}
})
test('token kinds', ({ assert }) => {
assert.equal(tokenKind('Champions'), 'word')
assert.equal(tokenKind('PRESCRiPTiON'), 'word')
assert.equal(tokenKind('GarciaLive'), null)
assert.equal(tokenKind('S02E10'), null)
assert.equal(tokenKind('1080p'), null)
assert.equal(tokenKind('addon'), null)
assert.equal(tokenKind('NtpUgCmS'), 'random')
assert.equal(tokenKind('tBWTuz'), 'random')
assert.equal(tokenKind('Lt5nHjlo3RiuBb3C'), 'random')
assert.equal(tokenKind('a3f9e2b1'), 'random')
})
})