Skip to content

Commit 748ad27

Browse files
docs: changelog for v0.20.0
1 parent 4d54ad2 commit 748ad27

2 files changed

Lines changed: 108 additions & 0 deletions

File tree

CHANGELOG-v0.20.0.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Bibliogon v0.20.0
2+
3+
AI Review Extension is the headline feature. The existing chapter review grows from a single sync path into a three-mode async flow with persistent Markdown reports, cost estimates, and full 8-language prompt parity. Three real backend bugs in the backup/import/export data paths are fixed along the way. The Playwright smoke suite drops from 31 failures to zero.
4+
5+
## Added
6+
7+
### AI Review Extension
8+
9+
- **Three primary focus modes** in the Editor's AI panel: **Style** (prose polish), **Consistency** (within-chapter contradictions, distinct from the legacy `coherence` focus), and **Beta Reader** (open-ended simulated first-read feedback). Mutually exclusive radio buttons; the four legacy focus values (`coherence`, `pacing`, `dialogue`, `tension`) stay on the API for power users but no longer appear in the UI.
10+
- **Async review flow** with Server-Sent Events progress. New endpoints: `POST /api/ai/review/async` (submit job), `GET /api/ai/jobs/{id}` (poll), `GET /api/ai/jobs/{id}/stream` (SSE), `DELETE /api/ai/jobs/{id}` (cancel). The worker publishes `review_start` / `review_llm_call` / `review_done` / `stream_end` events; the editor UI translates them into rotating book-language status messages while the editor stays usable.
11+
- **Persistent Markdown reports** at `uploads/{book_id}/reviews/{review_id}-{chapter-slug}-{YYYY-MM-DD}.md`. Inline results are unchanged; the new `GET /api/ai/review/{id}/report.md?book_id=...` endpoint returns a `FileResponse`. A **Download report** button appears on the result panel.
12+
- **Cascade delete on chapter removal**: when a chapter is deleted, review files whose filename contains that chapter's slug are wiped alongside the chapter row. Prevents orphaned files growing silently.
13+
- **Chapter-type-aware prompts**: the system prompt prepends a short guidance line for all 31 `ChapterType` values (e.g. `dedication` -> "brief, personal, tone-focused", `copyright` -> "legal, skip prose review"). `ReviewRequest` gained a `chapter_type` field; the legacy synchronous `POST /api/ai/review` threads it through the same builder.
14+
- **Non-prose warning**: 12 chapter types (`title_page`, `copyright`, `toc`, `imprint`, `index`, `half_title`, `also_by_author`, `next_in_series`, `call_to_action`, `endnotes`, `bibliography`, `glossary`) get an inline warning above the Start button, rendered in the book's language (not the UI language), matching the review output language.
15+
- **Token + USD cost preview** on the Start button. `POST /api/ai/review/estimate` returns a rough `input_tokens` + `cost_usd` based on a chars/4 heuristic and a small per-model pricing dict; the UI shows `~5k tokens, ~$0.075` when the configured model is known. Unknown models render the token count only.
16+
- **UI metadata endpoint** `GET /api/ai/review/meta` exposes focus values, primary UI focus, non-prose types, supported languages, and chapter types so the frontend avoids hardcoding them.
17+
- **Full 8-language prompt parity**: extended `LANG_MAP` (DE, EN, ES, FR, EL, PT, TR, JA) is the single source for review + marketing prompt builders. `build_review_system_prompt` now writes the review in the book's language for every supported value, not just DE/EN.
18+
- **Module split**: new `backend/app/ai/prompts.py` (LANG_MAP, FOCUS_DESCRIPTIONS, CHAPTER_TYPE_GUIDANCE, NON_PROSE_TYPES, builder), `pricing.py` (PROVIDER_PRICING + estimator), `review_store.py` (slugify, filename shape, write_report, find_report, delete_reviews_for_chapter). Keeps `app/ai/routes.py` thin.
19+
- **i18n**: six new UI keys per language x 8 languages (`ai_review_focus`, `ai_review_focus_style`, `ai_review_focus_consistency`, `ai_review_focus_beta_reader`, `ai_review_download`, `ai_review_tokens`).
20+
21+
### Tests + quality gates
22+
23+
- **31 new backend tests** in `test_ai_review.py` (extended) and `test_ai_review_store.py` (new) covering: new focus values in the prompt, chapter_type injection + fallback, all-8-languages prompt parity, pricing estimate endpoint, meta endpoint, async submit -> poll -> download roundtrip, 403 when AI disabled, 404 for missing review, slugify edge cases, cascade-delete boundary safety, cascade via `DELETE /api/books/{id}/chapters/{id}`.
24+
- **9 regression tests** in `test_backup_import_revive.py` pinning the three backend fixes (soft-delete revival, idempotent live re-import, merge with non-empty DB, multi-doc YAML, smart-import roundtrip, pandoc-gated batch-export integration).
25+
- **8 frontend Vitest tests** in `ai-review-strings.test.ts` (8-language coverage of book-language status strings, non-prose chapter-type set parity with backend).
26+
- **4 Playwright smoke tests** in `ai-review.spec.ts` (three radio buttons render, non-prose warning visibility per chapter type, mocked happy-path download-report flow).
27+
- **16 smoke test-infra fixes** in the triage sweep: dashboard-filters selector (10 tests), content-safety recovery seed, Ctrl+Z typing delay, theme persist reload via one-shot evaluate, export project ZIP content-type tolerance, trash restore view switch, Classic first-line indent CSS specificity override (`h* + p:not(:first-child)`), CreateBookModal Radix Select testid + `pickAuthor` variant helper, dashboard sort-direction expectation, export dialog migrated from `window.open` to `page.waitForEvent('download')`.
28+
29+
## Fixed
30+
31+
- **`backup_import` now restores soft-deleted books** instead of silently skipping. The dedup check predated the trash feature; a backup made before trashing could not be restored once books were moved to trash. Fix: when the pre-existing row is soft-deleted, hard-delete it + chapters + assets, then fall through to the fresh-insert path. Sidesteps SQLAlchemy NOT-NULL landmines that the partial-attribute revive approach stepped on. Regression pins in `test_backup_import_revive.py`.
32+
- **Batch export no longer raises `FileNotFoundError`**. `plugin-export.export_batch_route` collected per-format output paths into a list across a loop, but manuscripta's `run_export` moves `project/output/` to `project/backup/` at the start of every call - the earlier paths pointed to moved files by the time zipping started. Fix: after each `run_pandoc`, copy the produced file into a stable `tmp_dir/batch/` staging dir and zip from there.
33+
- **`smart-import` handles Pandoc-wrapped `metadata.yaml`**. The project exporter writes `---` / `---` delimited metadata, which yields a multi-document YAML stream; `yaml.safe_load` rejected it with `ComposerError`. Fix: `yaml.safe_load_all` + first non-empty document.
34+
- **Launcher release workflows publish binaries again**. Inherits the `permissions: contents: write` grant from the v0.19.1 workflow fix; confirms that the Windows / macOS / Linux binaries attach as GitHub release assets on tag push.
35+
36+
## Changed
37+
38+
- **`POST /api/ai/review`** (sync) accepts `chapter_type`; the prompt builder threads it through. Backward-compatible: the field defaults to `"chapter"`.
39+
- **`_build_review_system_prompt`** (legacy import) kept as a thin alias for `prompts.build_review_system_prompt`. Existing test imports keep working.
40+
- **Classic palette first-line indent** CSS now uses `h* + p:not(:first-child)` overrides to beat the `p:not(:first-child)` base rule's specificity. Visual result is the same as before the `:not(:first-child)` base rule was added; the override simply wins the cascade again.
41+
- **CreateBookModal** Radix Select trigger gains `data-testid="create-book-author-select"` so tests can handle both the bare input and the Select variants.
42+
43+
## Documentation
44+
45+
- **AI help pages** (`docs/help/en/ai.md`, `docs/help/de/ai.md`) rewrite the Chapter Review section: three focus modes with when-to-use guidance, non-prose warning explanation, cost estimate, async progress, persistence + download.
46+
- **API.md** documents the 8 new `/api/ai/` endpoints (sync review gaining `chapter_type`, async review + jobs + SSE + cancel, download report, estimate, meta).
47+
- **lessons-learned.md** gets a new "AI Review extension" section with 7 pitfalls: backup-import-vs-soft-delete dedup, manuscripta `output/` cleanup between format runs, Pandoc multi-doc YAML, CSS specificity trap (`h2 + p` vs `p:not(:first-child)`), TipTap useEditor not flushing `editor.storage` reads, prefix testid selector overmatch, IndexedDB recovery draft `contentHash` contract.
48+
- **current-coverage.md** gains a v0.20.0 addendum with the +181 test delta and the 4 Playwright failures tracked in issue #9.
49+
- **explorations/README.md** adds a tier-ranked tracking table; donations-ux + donations-roadmap-integration + the children's-book scaffolding prompt move to `explorations/archive/`.
50+
- **Medium blog post** for v0.19.1 archived under `docs/blog/`.
51+
52+
## Known pending post-release
53+
54+
- **4 Playwright smoke skips** tracked in GitHub issue #9: three chapter-sidebar dropdown / layout tests at 125% + 150% CSS zoom (Radix Popper collision + page overflow under zoom), one editor word-count test (TipTap useEditor not flushing `editor.storage.characterCount` reads without an explicit `editor.on('update')` subscribe). Each has a `test.skip` with an inline comment pointing to the issue.
55+
- **Deferred major dependency bumps**: elevenlabs 0.2 -> 2.43, starlette 0.46 -> 1.0, rich 14 -> 15. Each gets its own dedicated session per the release-workflow stability filter.
56+
- **Pillow 12** still blocked upstream by manuscripta; Bibliogon carries pillow 11 for now.

docs/CHANGELOG.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,58 @@
22

33
Completed phases and their content. Current state in CLAUDE.md, open items in ROADMAP.md.
44

5+
## [0.20.0] - 2026-04-20
6+
7+
AI Review Extension is the headline feature. The existing chapter review grows from a single sync path into a three-mode async flow with persistent Markdown reports, cost estimates, and full 8-language prompt parity. Three real backend bugs in backup / batch export / smart-import are fixed along the way. Playwright smoke suite drops from 31 failures to zero.
8+
9+
### Added
10+
11+
**AI Review Extension**
12+
- Three primary focus modes in the Editor's AI panel: **Style**, **Consistency** (new; within-chapter contradictions, distinct from the legacy `coherence` focus), **Beta Reader** (new; open-ended simulated first-read feedback). Mutually exclusive radio buttons; the four legacy focus values stay on the API for power users but no longer appear in the UI.
13+
- Async review flow: `POST /api/ai/review/async`, `GET /api/ai/jobs/{id}`, `GET /api/ai/jobs/{id}/stream` (SSE), `DELETE /api/ai/jobs/{id}`. Rotating book-language status messages during the 5-60s job while the editor stays usable.
14+
- Persistent Markdown reports under `uploads/{book_id}/reviews/{review_id}-{chapter-slug}-{YYYY-MM-DD}.md`. `GET /api/ai/review/{id}/report.md?book_id=...` returns a `FileResponse`. Download button on the result panel.
15+
- Cascade delete on chapter removal wipes matching review files.
16+
- Chapter-type-aware prompts for all 31 `ChapterType` values; `ReviewRequest` gains `chapter_type`; the legacy sync `POST /api/ai/review` threads it through the same builder.
17+
- Non-prose warning above the Start button for 12 chapter types (`title_page`, `copyright`, `toc`, `imprint`, `index`, `half_title`, `also_by_author`, `next_in_series`, `call_to_action`, `endnotes`, `bibliography`, `glossary`), rendered in the book's language.
18+
- Token + USD cost preview on the Start button (`POST /api/ai/review/estimate`, chars/4 heuristic + small per-model pricing dict).
19+
- `GET /api/ai/review/meta` exposes UI focus values, primary focus list, non-prose types, supported languages, chapter types so the frontend avoids hardcoding.
20+
- Full 8-language prompt parity via a shared `LANG_MAP`; marketing prompt builder re-uses the same map.
21+
- New `backend/app/ai/prompts.py`, `pricing.py`, `review_store.py`. Thin `routes.py`.
22+
- i18n: six new UI keys per language x 8 languages.
23+
24+
**Tests**
25+
- 31 new backend tests (AI review extended + cascade + store utilities).
26+
- 9 regression tests pinning the three backend fixes.
27+
- 8 frontend Vitest tests for 8-lang strings + non-prose-set parity.
28+
- 4 Playwright smoke tests for the AI review UI.
29+
- 16 smoke test-infra fixes (selector narrowing, seed corrections, timing tolerances, testid coverage, assumption refreshes).
30+
31+
### Fixed
32+
33+
- **`backup_import` now restores soft-deleted books** instead of silently skipping. Dedup check predated the trash feature. Fix: hard-delete the stale row + its chapters + assets, then fall through to the fresh-insert path.
34+
- **Batch export no longer raises `FileNotFoundError`**. `plugin-export.export_batch_route` collected per-format paths across a loop, but manuscripta's `run_export` moves `project/output/` to `project/backup/` on every call. Fix: copy each format's output into a stable `tmp_dir/batch/` staging dir before the next `run_pandoc`.
35+
- **`smart-import` handles Pandoc-wrapped `metadata.yaml`**. `safe_load` rejected the multi-document stream (`---` / `---` markers); fix uses `safe_load_all` + first non-empty document.
36+
- **Launcher release workflows** inherit the v0.19.1 permissions fix; tag push attaches Windows / macOS / Linux binaries as release assets.
37+
38+
### Changed
39+
40+
- `POST /api/ai/review` (sync) accepts `chapter_type`; backward-compatible default `"chapter"`.
41+
- `_build_review_system_prompt` is a thin alias for `prompts.build_review_system_prompt` (existing test imports keep working).
42+
- Classic palette first-line indent override uses `h* + p:not(:first-child)` to beat the base rule's specificity.
43+
- CreateBookModal Radix Select trigger gains `data-testid="create-book-author-select"`.
44+
45+
### Documentation
46+
47+
- AI help pages (`docs/help/{de,en}/ai.md`) rewrite the Chapter Review section with focus-mode guidance, non-prose warning, cost estimate, async progress, persistence + download.
48+
- `docs/API.md` documents the 8 new `/api/ai/` endpoints.
49+
- `.claude/rules/lessons-learned.md` adds 7 pitfalls from the release window.
50+
- `docs/audits/current-coverage.md` gets a v0.20.0 addendum with the +181 test delta.
51+
- Medium blog post for v0.19.1 archived under `docs/blog/`.
52+
53+
### Known pending post-release
54+
55+
4 Playwright smoke skips tracked in GitHub issue #9: three chapter-sidebar dropdown / layout tests at 125% + 150% CSS zoom, one editor word-count test (TipTap useEditor transaction re-render). Deferred major dependency bumps: elevenlabs 0.2 -> 2.43, starlette 0.46 -> 1.0, rich 14 -> 15. Pillow 12 still blocked upstream by manuscripta.
56+
557
## [0.19.1] - 2026-04-20
658

759
Maintenance release. Two user-visible fixes (i18n labels, backup resource leak), launcher release-workflow unblocked, and a substantial code-hygiene sweep (ruff + mypy + pre-commit wired into CI). No schema changes, no API breakage.

0 commit comments

Comments
 (0)