fix(reader): harden KOReader sync and credential refresh

Sanitize match-check batches before strict server validation and classify HTTP failures accurately. Rebind the active catalog client whenever authentication settings change so retries use current credentials.

Fixes #1150
This commit is contained in:
neon
2026-08-28 15:29:36 +00:00
parent 3b44fa5d7e
commit f39e0e8ab5
10 changed files with 335 additions and 13 deletions
@@ -342,8 +342,11 @@ describe('KOReader plugin update source wiring', () => {
const sweep = await readPluginFile('bookorbit_sweep.lua');
const statsReader = await readPluginFile('bookorbit_stats_reader.lua');
expect(api).toContain('source = cand.source');
expect(api).toContain('metadataAmbiguous = cand.metadata_ambiguous');
expect(api).toContain('title = boundedUtf8(cand.title, MATCH_TITLE_MAX_BYTES)');
expect(api).toContain('authors = boundedUtf8(cand.authors, MATCH_AUTHORS_MAX_BYTES)');
expect(api).toContain('lastOpen = nonNegativeInteger(cand.last_open)');
expect(api).toContain('source = validMatchSource(cand.source)');
expect(api).toContain('metadataAmbiguous = optionalBoolean(cand.metadata_ambiguous)');
expect(statsReader).toContain('entry.metadata_ambiguous = (entry._variant_count or 0) > 1');
expect(sweep).toContain('source = "statistics"');
expect(sweep).toContain('metadata_ambiguous = entry.metadata_ambiguous');