Skip to content

fix(server): separate EPUB figures from surrounding text - #43853

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
Lucenx9:fix/epub-figure-boundaries
Nov 27, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
Lucenx9:fix/epub-figure-boundaries

Conversation

@Lucenx9

@Lucenx9 Lucenx9 commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Problem

The extracted text from an EPUB can run a captionless figure into nearby prose. A map's alternative text appears in the same line as the sentence before and after it.

Change

Use the existing line separator for a <figure> that contributes text. This also handles figures whose only text is an image description.

Verification

The production extractor read the same EPUB with an SVG map before and after the fix.

Before
Choose your route.Map of the north pier Continue to the gate.

After
Choose your route.
Map of the north pier
Continue to the gate.

The new assertion in the existing EPUB case fails on base and checks both the figure boundary and an empty figure. The captioned figure, empty figure and inline span replays also passed as controls. This is distinct from #43190 (caption boundaries) and #42925 (image descriptions).

Vitest V8 exercised both outcomes of the changed condition, and Dependency Cruiser found the same 31 direct imports before and after. The supporting checks included fast-check, 300 Jazzer.js fuzz-target runs, Stryker (8/8 killed), Fallow on a scoped snapshot, and a passing CodeScene quality gate with an existing test-declaration advisory.

The normal commit hooks passed. After rebasing onto main, the EPUB replay still passed and vp run check:changed upstream/main --concurrency 1 passed with 65 tests, affected-package typecheck, format, lint, Knip and GraphQL.

Sol-loop approved in one round with GPT-6.2 Sol high. Gemini 4 Neon medium (Antigravity), Opus 5.5 high and Grok 4.7 Fast high also approved the diff.

Created with GPT-6.2 Sol in Codex through T3 Code.

Copilot AI balanced review requested due to automatic review settings November 27, 2026 00:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T00:10:03.531433Z 19a3715 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 27, 2026
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 19a3715 and 06e58dd.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The EPUB text extractor now processes figure elements through the existing paragraph extraction path. The EPUB test fixture covers a figure with image alt text and an empty figure.

Changes: EPUB figure text extraction

Layer / File(s) Summary
Figure extraction and test coverage
apps/server/src/provider/documentTextWorker.ts, apps/server/src/provider/userInputAttachments.test.ts
The extractor applies line-start markers and recursive text extraction to figure elements. The EPUB test checks reading order for image alt text and confirms an empty figure adds no text.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: only21mil, stienswout

Merge Risk: Minimal · previous review 19a37

This change keeps text from EPUB figures on separate lines from the surrounding prose. It is a small, localized extraction change with test coverage, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(server): separate EPUB figures from surrounding text" matches the main change. The raw summary and objectives say figure elements now use the line separator in EPUB text extraction, so …
Description check Passed The description has the Problem, Change, and Verification sections the template asks for. The Problem section states the bug and the observed output. The Change section explains the fix. The Verificat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(server): separate EPUB figures from surrounding text" matches the main change. The raw summary and objectives say figure elements now use the line separator in EPUB text extraction, so figure text no longer runs into adjacent prose. The title is concise, follows the conventional commit format, and names the affected area.

Full details: Description check

Explanation

The description has the Problem, Change, and Verification sections the template asks for. The Problem section states the bug and the observed output. The Change section explains the fix. The Verification section gives a before/after replay and lists focused tests and checks with observed results. The Scope section is missing. It should link the issue that shows the bug, or explain why an issue is not needed. The author links related PRs #43190 and #42925 but does not link an issue or state that this is a small obvious fix. The description also includes tooling detail beyond what the template asks for, and it does not clearly state which agent or model did the work in the expected form, though it does name a model and harness.

Resolution

Add a Scope section. Link the issue that shows the bug, or explain why a small obvious fix needs no issue. Consider trimming the long list of tool runs to the checks that cover the changed behavior.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9f96e0d and 19a3715.

Files selected for processing: 2

  • apps/server/src/provider/documentTextWorker.ts
  • apps/server/src/provider/userInputAttachments.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 27, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Attached the same synthetic EPUB through the composer on both commits, then opened a byte-for-byte copy of the server's extracted text in the app file viewer. Chromium web client, 1280×800, light theme, fresh isolated state and Replay (dev).

Before After
233378c606 06e58dd86f
Before: figure text joins surrounding prose After: figure text occupies its own line
route.Map appears on one logical line with the following prose. Figure alt text occupies its own line between the surrounding sentences.
Before recording After recording

Both sides preserve the empty-figure control as Keep reading.. The scenario failed on base and passed on head; scenarios:prove exited 0.

Scenario source · Synthetic EPUB

Not shown:

  • The GPT-6-Luna cat-and-quote step was replaced with Replay and direct display of the actual server-generated extracted file; model quotation behavior was not exercised.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 27, 2026
@juliusmarminge
juliusmarminge merged commit 9534f2a into pingdotgg:main Nov 27, 2026
60 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 27, 2026
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 27, 2026
…3853)

Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 9534f2a)
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 27, 2026
…3853)

Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 9534f2a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants