novel-bookmark.user.js: background latest-check throws ReferenceError, never runs #74
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found during live verification of #63 (Playwright agent, 2026-08-10) — unrelated to covers, not touched there.
Symptom:
backgroundRefreshLatest()on every novel site (novelfull.com, lightnovelworld.net) throws aReferenceErrorand exits before any fetch. Background latest-chapter tracking silently never runs for the novel library; the rejection is unhandled.Cause:
userscript/novel-bookmark.user.jsuses two constants it never defines:LATEST_CHECK_THROTTLE_MS(line 722)LATEST_CHECK_BATCH(line 724)The manga script defines both (
userscript/manga-bookmark.user.js:42-43). The novel script's constants block (around line 32) omits them — looks like a lost line when the novel script was split from the manga one.Call sites (fire-and-forget, no catch): lines 1218 and 1334.
Impact:
backgroundRefreshLatestthrows beforedueis computed, so no series page is ever fetched in the background — "new chapter" ember for novels relies entirely on on-page capture (maybeCaptureLatestOnSeriesPage) and on direct navigation to the series page.Fix: define both constants in the novel script's constants block, matching the manga values (throttle 4h, batch 1). One-line addition.
Verified live:
ReferenceError: LATEST_CHECK_THROTTLE_MS is not definedobserved on novelfull.com and lightnovelworld.net.Triage
Category: bug. State: ready-for-human (fix is up as #75, needs a human merge + on-device confirmation).
Confirmed, and wider than reported. The novel script is missing four module-scope constants, not two — the same lost block from the manga/novel split:
LATEST_CHECK_THROTTLE_MS,LATEST_CHECK_BATCH— as reported;backgroundRefreshLatest()throws before its first fetch.CACHE_KEY(:215,:224),LASTCHECKED_KEY(:232,:241) — also undeclared. These reads sit insidetry/catch, soloadCache()just returns[]forever andsaveCache()/saveLastChecked()silently no-op. The local cache has never persisted on novel sites.The last one matters for the fix: defining only the two throttle constants would leave
saveLastChecked()a no-op, so the 4h throttle would never hold and every navigation would re-fetch a series. All four are restored together in #75.Verification:
node --checkclean;node --test userscript/test/logic.test.js userscript/test/novel-logic.test.js47/47. #75 adds a static guard over both scripts that asserts everySCREAMING_CASEidentifier used is also declared — confirmed to fail when a constant is deleted again. No behavioural test can see this: the errors are swallowed, and storage + background refresh are outside the harness.Remaining human step: merge #75, then confirm on-device (Violentmonkey, live novelfull / lightnovelworld) that the new-chapter ember lights for novels without visiting the series page.