fix(tokenizer): preserve known-word highlight when POS filters suppress

- Known-word cache matches now set isKnown=true even for tokens excluded by POS filters
- POS exclusion gate suppresses N+1, frequency, and JLPT only; known status is computed before the gate
- Jellyfin subtitle preload continues after cleanup failures instead of aborting
- Update config docs and option description to document the known-word bypass behavior
This commit is contained in:
2026-05-22 02:27:40 -07:00
parent 3de7ed8b54
commit 9ba7f909b5
9 changed files with 111 additions and 52 deletions
@@ -331,7 +331,8 @@ test('preload jellyfin subtitles cleans previous cached subtitles before a new p
assert.deepEqual(cleanupCalls, [['/tmp/subminer-jellyfin-subtitles-0']]);
});
test('preload jellyfin subtitles logs cleanup failures without rejecting', async () => {
test('preload jellyfin subtitles continues after cleanup failures', async () => {
const commands: Array<Array<string | number>> = [];
const logs: string[] = [];
let cleanupShouldFail = false;
const preload = createPreloadJellyfinExternalSubtitlesHandler(
@@ -344,6 +345,7 @@ test('preload jellyfin subtitles logs cleanup failures without rejecting', async
path: `/tmp/subminer-jellyfin-subtitles-${track.index}/track.srt`,
cleanupDir: `/tmp/subminer-jellyfin-subtitles-${track.index}`,
}),
sendMpvCommand: (command) => commands.push(command),
cleanupCachedSubtitles: () => {
if (cleanupShouldFail) {
throw new Error('cleanup failed');
@@ -357,7 +359,14 @@ test('preload jellyfin subtitles logs cleanup failures without rejecting', async
cleanupShouldFail = true;
await assert.doesNotReject(() => preload({ session, clientInfo, itemId: 'item-2' }));
assert.deepEqual(logs, ['Failed to preload Jellyfin external subtitles']);
assert.deepEqual(logs, ['Failed to cleanup Jellyfin cached subtitles']);
assert.deepEqual(
commands.filter((command) => command[0] === 'sub-add'),
[
['sub-add', '/tmp/subminer-jellyfin-subtitles-0/track.srt', 'auto', 'English', 'eng'],
['sub-add', '/tmp/subminer-jellyfin-subtitles-0/track.srt', 'auto', 'English', 'eng'],
],
);
});
test('preload jellyfin subtitles serializes overlapping preload runs', async () => {
@@ -246,7 +246,11 @@ export function createPreloadJellyfinExternalSubtitlesHandler(deps: {
itemId: string;
}): Promise<void> => {
try {
cleanupActiveCache();
try {
cleanupActiveCache();
} catch (error) {
deps.logDebug('Failed to cleanup Jellyfin cached subtitles', error);
}
const tracks = await deps.listJellyfinSubtitleTracks(
params.session,
params.clientInfo,