Add drag reordering, exam deadlines, frozen shared quizzes, batched OCR and semantic search
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 33s

- Drag-to-reorder for class materials, folders, quiz questions and deck cards. Pointer-based
  so touch works, plus keyboard (arrows/Home/End) with screen-reader announcements.
- Timed exams get a wall-clock deadline. The server refuses late answers, submits overdue
  exams with what was saved, and the countdown keeps running while the page is closed.
- Shared quiz sessions keep a frozen copy of their questions and flag later owner edits.
- Scanned PDFs are read in cached 8-page batches with real page numbers (pdf-lib), removing
  the 30 MB whole-file limit. Compatible providers now receive PDFs as file parts.
- Semantic search: embeddings for OpenAI, Gemini, Ollama and compatible servers, background
  indexing into chunk_vectors (migration 2), hybrid keyword + vector ranking for search, the
  assistant and focused generation, and a Settings -> AI section.

181 tests pass locally and in the Docker test stage on Node 24.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-12 11:48:20 -07:00
parent 3046e46d1c
commit ccdad9728b
39 changed files with 1772 additions and 121 deletions

View file

@ -1,6 +1,6 @@
# Study Desk V2 — progress and resume notes
Updated 2026-11-11. Branch: **v2**. Original V1: **main**, preserved at `7bd0a9a`.
Updated 2026-11-12. Branch: **v2**. Original V1: **main**, preserved at `7bd0a9a`.
The owner authorized publishing progress and `v2` now tracks Forgejo `origin/v2`.
No production deployment has been performed.
@ -36,11 +36,36 @@ type-grouped materials, copyable import instructions and assistant library links
timer submissions after a failed request.
- Preserved the V1 card elapsed-days scheduling field during import.
## 2026-11-12 additions
- `.forgejo/workflows/build-v2.yml`: pushes to `v2` run typecheck + tests inside the Node 24
image (new Dockerfile `test` stage), build and smoke-test the production image, then publish
`study:v2` and `study:v2-<sha>`. Never `:latest`. Verified locally with Docker Desktop; the
workflow itself has not run on the Forgejo runner yet (nothing pushed).
- Drag-to-reorder (`web/src/ui/Sortable.tsx`, pointer events so touch works, keyboard with
arrows/Home/End and live announcements) for class materials, folders, questions and cards.
New endpoint `POST /api/classes/:id/items/reorder`.
- Timed exams use a wall-clock `deadlineAt` stored in attempt settings. The server refuses late
answers (409 `time_up`), submits overdue exams lazily and before every authenticated GET,
and caps time used at the limit. Shared exams use a local wall-clock deadline too.
- Shared quiz sessions freeze their questions (with option order) in browser storage, with a
fingerprint to tell the visitor when the owner has since edited the quiz.
- Scanned PDFs are read in 8-page batches split with pdf-lib, cached per batch, with real page
numbers. OpenAI-compatible adapter now sends PDFs as Chat Completions `file` parts when the
model is marked as PDF-capable.
- Semantic search: migration `2_embeddings` (`chunk_vectors`), embedding support in the
OpenAI/Gemini/Ollama/compatible adapters, `server/services/semantic.ts` (background indexing,
in-memory cosine search, reciprocal-rank fusion with FTS), Settings → AI section.
- Browser QA on an isolated `.test-data/qa` instance (port 3742, `study-qa` launch config):
drag and keyboard reorder persisted; 375px class page has no overflow; semantic search
enabled from Settings and indexed; a 1-minute exam counted down on the wall clock and
auto-submitted at 60 s; a shared session kept original questions after the owner edited them.
## Verification status
Baseline: 162 tests passed, TypeScript passed and production web/server builds passed.
Added six regression tests. Full `npm run check` passes: **168 tests**, TypeScript and both
production builds. Tests were run with loopback access for the mock provider.
Added six regression tests. Full `npm run check` passes: **181 tests** (2026-11-12), TypeScript
and both production builds. The Docker `test` stage runs the same 181 tests on Node 24. Tests were run with loopback access for the mock provider.
The earlier agent manually exercised quiz completion/results, flashcards, streak effects,
mock AI generation through the assistant, editable drafts, and a 375px home page without