openreader/tests/unit
Richard R 848ee4faad feat(tasks): add document blob lease for safe orphan reaping and improve scheduled task robustness
Introduce a document blob lease mechanism to prevent race conditions between document registration and orphaned blob cleanup. The new `document_blob_leases` table ensures that only one process can claim a document blob for mutation or deletion at a time. Update the orphan reaper to acquire a lease before deleting blobs and to re-check for ownership after acquiring the lease, avoiding accidental deletion of in-flight uploads.

Enhance scheduled task infrastructure with per-task fencing tokens to prevent stale runners from overwriting newer results, enforce runtime limits with abort signals, and expose scheduler mode and minimum interval to the admin panel and API. Adjust task handlers to accept a context with abort support, and update documentation and environment variable references for the new cron secret and scheduling behavior.

BREAKING CHANGE: Scheduled tasks now require a `document_blob_leases` table and updated handler signatures. Vercel deployments must set `CRON_SECRET` for scheduled maintenance.
2026-06-07 12:08:57 -06:00
..
support test(unit): migrate batch2 document and parser suites to vitest 2026-05-30 11:15:19 -06:00
admin-providers-validation.vitest.spec.ts refactor(admin): support keyless provider seeding and clarify API_KEY usage 2026-06-06 16:02:36 -06:00
admin-tts-instructions.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
audiobook-settings.vitest.spec.ts docs(intro): clarify open-source status and multilingual support in introduction 2026-06-06 12:19:28 -06:00
audiobook.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
audiobooks-blobstore.vitest.spec.ts refactor(core): improve streaming, validation, and rate limit logic 2026-05-30 16:41:17 -06:00
auth-config.vitest.spec.ts refactor(env): remove legacy no-auth mode and enforce required auth env vars 2026-05-31 12:09:37 -06:00
blob-upload-finalize-docx.vitest.spec.ts feat(tasks): add document blob lease for safe orphan reaping and improve scheduled task robustness 2026-06-07 12:08:57 -06:00
canonicalize-epub-segment.vitest.spec.ts test(unit): migrate batch2 document and parser suites to vitest 2026-05-30 11:15:19 -06:00
changelog-check.vitest.spec.ts refactor(api): remove all legacy unclaimed user scope logic and enforce strict userId scoping 2026-05-31 13:01:55 -06:00
changelog.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
data-export.vitest.spec.ts test(user): expand cleanup and export coverage for shared docs and TTS segment files 2026-06-06 17:38:30 -06:00
docstore.vitest.spec.ts test(unit): migrate batch2 document and parser suites to vitest 2026-05-30 11:15:19 -06:00
document-blob-lease.vitest.spec.ts feat(tasks): add document blob lease for safe orphan reaping and improve scheduled task robustness 2026-06-07 12:08:57 -06:00
document-cache.vitest.spec.ts test(unit): migrate batch2 document and parser suites to vitest 2026-05-30 11:15:19 -06:00
document-delete-cleanup.vitest.spec.ts feat(tasks): introduce scheduled task engine and admin UI for background jobs 2026-06-07 05:29:29 -06:00
document-previews-render.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
document-settings.vitest.spec.ts feat(tts): add multilingual reader foundation 2026-06-06 06:18:50 -06:00
epub-audiobook-hook.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
epub-location-controller.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
epub-spine-coordinates.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
epub-word-highlight.vitest.spec.ts refactor(highlight): share multilingual token alignment 2026-06-06 10:45:19 -06:00
highlight-token-alignment.vitest.spec.ts perf(highlight): optimize exact token sequence matching for large documents 2026-06-06 11:41:47 -06:00
html-audiobook-adapter.vitest.spec.ts test(unit): migrate batch2 document and parser suites to vitest 2026-05-30 11:15:19 -06:00
html-blocks.vitest.spec.ts test(unit): migrate batch2 document and parser suites to vitest 2026-05-30 11:15:19 -06:00
icons-grid.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
kokoro.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
language.vitest.spec.ts feat(tts): add Replicate Kokoro language code resolution and input mapping 2026-06-06 15:51:02 -06:00
layout-metadata.vitest.spec.ts feat(shared): centralize origin validation logic and update metadata usage 2026-05-31 16:41:47 -06:00
legacy-fs-claim-cleanup.vitest.spec.ts feat(user): remove legacy local file deletion and add cleanup for claimed FS sources 2026-06-03 14:35:27 -06:00
nlp.vitest.spec.ts feat(tts): add multilingual reader foundation 2026-06-06 06:18:50 -06:00
onboarding-flow.vitest.spec.ts refactor(api): remove all legacy unclaimed user scope logic and enforce strict userId scoping 2026-05-31 13:01:55 -06:00
onboarding-state.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
pdf-audiobook-adapter.vitest.spec.ts test(unit): migrate batch2 document and parser suites to vitest 2026-05-30 11:15:19 -06:00
pdf-build-page-text.vitest.spec.ts test(unit): migrate batch2 document and parser suites to vitest 2026-05-30 11:15:19 -06:00
pdf-force-reparse.vitest.spec.ts test(unit): migrate batch2 document and parser suites to vitest 2026-05-30 11:15:19 -06:00
pdf-merge-text-with-regions.vitest.spec.ts feat: improve PDF parsing recovery and reader UI (#98) 2026-06-03 04:44:55 -06:00
pdf-op-key.vitest.spec.ts feat(pdf): introduce parser versioning and playback readiness state 2026-06-03 18:51:29 -06:00
pdf-parse-client-lifecycle.vitest.spec.ts test(pdf-parse): add unit tests for client lifecycle and worker route flows 2026-06-04 20:04:30 -06:00
pdf-parse-normalize-text-items.vitest.spec.ts feat: improve PDF parsing recovery and reader UI (#98) 2026-06-03 04:44:55 -06:00
pdf-parsed-events-route-worker-proxy.vitest.spec.ts refactor(pdf-parse): extract encodeParserVersion utility and strengthen artifact readiness 2026-06-04 20:46:02 -06:00
pdf-parsed-route-worker-flow.vitest.spec.ts refactor(pdf-parse): extract encodeParserVersion utility and strengthen artifact readiness 2026-06-04 20:46:02 -06:00
pdf-stitch-cross-page-blocks.vitest.spec.ts test(unit): migrate batch2 document and parser suites to vitest 2026-05-30 11:15:19 -06:00
pdf-tts-planning.vitest.spec.ts test(unit): migrate batch2 document and parser suites to vitest 2026-05-30 11:15:19 -06:00
rate-limit-runtime-settings.vitest.spec.ts docs(config): update environment variable docs for runtime JSON seed and remove legacy RUNTIME_SEED_* usage 2026-05-31 00:13:03 -06:00
reap-orphaned-blobs.vitest.spec.ts feat(tasks): add document blob lease for safe orphan reaping and improve scheduled task robustness 2026-06-07 12:08:57 -06:00
request-ip.vitest.spec.ts feat(rate-limit): add per-user PDF parsing rate limiting and job event ledger 2026-05-30 14:17:49 -06:00
runtime-seed-json.vitest.spec.ts refactor(admin): support keyless provider seeding and clarify API_KEY usage 2026-06-06 16:02:36 -06:00
scheduled-tasks-engine.vitest.spec.ts feat(tasks): add document blob lease for safe orphan reaping and improve scheduled task robustness 2026-06-07 12:08:57 -06:00
scheduled-tasks-routes.vitest.spec.ts feat(tasks): add document blob lease for safe orphan reaping and improve scheduled task robustness 2026-06-07 12:08:57 -06:00
server-error-contract.vitest.spec.ts test(unit): migrate batch1 core contracts to vitest 2026-05-30 11:11:44 -06:00
server-error-response.vitest.spec.ts test(unit): migrate batch1 core contracts to vitest 2026-05-30 11:11:44 -06:00
server-route-error-mappings.vitest.spec.ts test(unit): migrate batch1 core contracts to vitest 2026-05-30 11:11:44 -06:00
setup-env.ts refactor(env): remove legacy no-auth mode and enforce required auth env vars 2026-05-31 12:09:37 -06:00
sha256.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
shared-form-control-consumers.vitest.spec.ts refactor(ui): enforce shared control primitives 2026-06-06 11:15:48 -06:00
shared-overlay-consumers.vitest.spec.ts refactor(ui): enforce shared control primitives 2026-06-06 11:15:48 -06:00
shared-provider-selection.vitest.spec.ts test(unit): migrate batch1 core contracts to vitest 2026-05-30 11:11:44 -06:00
shared-select-consumers.vitest.spec.ts refactor(ui): centralize standard select controls 2026-06-06 11:05:36 -06:00
signup-policy.vitest.spec.ts docs(config): update environment variable docs for runtime JSON seed and remove legacy RUNTIME_SEED_* usage 2026-05-31 00:13:03 -06:00
storage-prefix-cleanup.vitest.spec.ts refactor(tasks): enforce positive interval and improve scheduled task updates 2026-06-07 09:54:18 -06:00
test-namespace-gate.vitest.spec.ts feat(rate-limit): add per-user PDF parsing rate limiting and job event ledger 2026-05-30 14:17:49 -06:00
transfer-user-documents.vitest.spec.ts refactor(user): streamline document and TTS segment transfer logic 2026-06-07 05:42:30 -06:00
tts-audio-warm-cache.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
tts-epub-handoff.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
tts-epub-preload.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
tts-generate.vitest.spec.ts fix(tts): correct language input handling for Replicate Kokoro model 2026-06-06 16:18:40 -06:00
tts-locator.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
tts-provider-catalog.vitest.spec.ts feat(tts): add Replicate Kokoro language code resolution and input mapping 2026-06-06 15:51:02 -06:00
tts-segment-audio-urls.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
tts-segment-plan-leading.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
tts-segment-plan.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
tts-segment-retry-policy.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
tts-segments-audio-cache.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
tts-segments-blobstore.vitest.spec.ts feat(data): enhance anonymous claim to support document settings and TTS segment copy 2026-06-06 19:12:40 -06:00
tts-segments-cache.vitest.spec.ts test(user): expand cleanup and export coverage for shared docs and TTS segment files 2026-06-06 17:38:30 -06:00
tts-segments-manifest.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
tts-segments.vitest.spec.ts refactor(user): overhaul user data cleanup and export for cascading deletes and TTS segment support 2026-06-06 16:37:28 -06:00
tts-settings-admin-view-model.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
user-data-cleanup.vitest.spec.ts feat(tasks): introduce scheduled task engine and admin UI for background jobs 2026-06-07 05:29:29 -06:00
user-preferences-normalize.vitest.spec.ts fix(config): prevent arrays from being treated as records in preference normalization 2026-06-06 15:55:54 -06:00
user-preferences-sync.vitest.spec.ts refactor(config): centralize provider default resolution and simplify user preference inheritance 2026-06-06 15:25:10 -06:00
walker-theme.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
whisper-alignment-mapping.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
whisper-spectral.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00
whisper-token-timestamps.vitest.spec.ts test(unit): complete vitest migration for remaining unit suites 2026-05-30 11:17:18 -06:00