Skip to content

feat(create-lesson): multi-select book sections + exclusion heuristic + batch generation (#1949)#1953

Merged
astrapi69 merged 1 commit into
developfrom
claude/book-sections-multi-select-ee9wof
Jul 23, 2026
Merged

feat(create-lesson): multi-select book sections + exclusion heuristic + batch generation (#1949)#1953
astrapi69 merged 1 commit into
developfrom
claude/book-sections-multi-select-ee9wof

Conversation

@astrapi69

Copy link
Copy Markdown
Owner

Description

Turns the #1927 book-file section picker from a single-select dropdown into a checkbox multi-select, and generates one standalone lesson per selected section in a single batch run (one set, N lessons). Builds on #1927 (Phase 2a upload + single-select picker).

Binding design decision: batch produces N standalone lessons (one per section), not one giant lesson — short, focused micro-learning units mapped 1:1 to the book's author-set chapter boundaries. The "one run -> one lesson" model is preserved structurally, extended to "one batch run -> N lessons".

What changed

  • Exclusion heuristic (section-heuristics.ts): multilingual (DE/EN/FR) predicate that deselects likely front/back matter (preface, glossary, table of contents, imprint, index, …) by default while keeping every section visible and manually checkable.
  • Batch generation (generate-book-lessons.ts): extracts the single chunk→lesson step shared by the single and batch paths (no second generation logic) plus a fault-tolerant batch loop — a per-section failure is recorded and the run continues — with progress reporting and an oversized-section guard.
  • Lesson assembly (book-to-lesson.ts): buildBookLessons / buildBookLessonsUserSetInput assemble N lessons with unique ids into one set; the single builders delegate to them. Regression-preserving: the single paste path passes an empty entry title so the lesson id/title still track meta.title.
  • UI (BookFileUpload / BookTextStep / BookSteps / CreateLesson): checkbox list; exactly one selected keeps the existing "Insert into text field" single path (with the replace-confirm dialog and preview), more than one shows "Generate N lessons"; document-order emission (not selection order); batch progress ("Generating lesson 2 of 5…") + summary (X of N succeeded, which failed); review lists N lessons; save persists the whole set.

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

  • Frontend Vitest passes locally (full suite: 733 files / 7643 tests green; type-check clean; ESLint --max-warnings 0 clean on the changed files)
  • TDD RED-first: new tests cover the heuristic (DE/EN/FR titles + default selection), the batch loop (order, per-section failure isolation, progress, oversized guard), multi-lesson set assembly (unique ids), the multi-select picker (default deselection + still-checkable, single-path regression, document-order batch emit), and a CreateLesson integration test that uploads a 3-section markdown file (incl. a Vorwort), batch-generates, and saves one set with two lessons.
  • Device verification (browser) still pending — see checklist below.

Documentation

  • Manual test plan updated (DE + EN) with the multi-select / heuristic / batch flow (TESTPLAN-PFLICHT)
  • German translations updated — new i18n keys added to all 11 catalogs and mirrored to the frontend JSON (make sync-i18n); verify-i18n-scripts clean

Checklist

  • I have performed a self-review of my own code
  • Public functions carry docstrings/TSDoc; behaviour is covered by tests
  • My changes generate no new warnings or errors

Screenshots / Logs

Manual device verification (upload with front matter, multi-select batch, single-select regression) is the remaining human step per the Visual-Device-Check; automated coverage is green.

Refs #1927
Closes #1949

🤖 Generated with Claude Code


Generated by Claude Code

… + batch generation (#1949)

Turn the #1927 book-file section picker from a single-select dropdown into
a checkbox multi-select and generate one standalone lesson per selected
section in a single batch run (one set, N lessons in document order).

- section-heuristics: multilingual (DE/EN/FR) predicate that deselects
  likely front/back matter (preface, glossary, TOC, imprint, index, …) by
  default while keeping every section visible + checkable.
- generate-book-lessons: extracts the single chunk->lesson step shared by
  the single and batch paths (no second generation logic) and a fault-
  tolerant batch loop (per-section failure recorded, run continues) with
  progress reporting.
- book-to-lesson: buildBookLessons / buildBookLessonsUserSetInput assemble
  N lessons with unique ids into one set; the single builders delegate to
  them (regression-preserving: an empty entry title tracks meta.title).
- BookFileUpload: checkbox list; exactly one selected keeps the existing
  "insert into text field" single path, more than one shows "Generate N
  lessons"; document-order emission; exclusion hint.
- BookTextStep/BookSteps/CreateLesson: batch progress + summary (X of N,
  failed sections), bookLessons state, review lists N lessons, save persists
  the whole set.
- i18n: new keys in all 11 catalogs. Manual test plan updated (DE + EN).

Refs #1927
Closes #1949
@astrapi69
astrapi69 force-pushed the claude/book-sections-multi-select-ee9wof branch from f4cf43d to 4cdca32 Compare July 22, 2026 21:48
@astrapi69
astrapi69 merged commit 3259ca1 into develop Jul 23, 2026
14 of 15 checks passed
@astrapi69
astrapi69 deleted the claude/book-sections-multi-select-ee9wof branch July 23, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create-Lesson book path: multi-select detected sections + exclusion heuristic + batch lesson generation

2 participants