Skip to content

fix(server): keep EPUB headers and footers on separate lines - #43618

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
Lucenx9:fix/epub-header-footer-boundaries
Nov 26, 2026
Merged

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

Conversation

@Lucenx9

@Lucenx9 Lucenx9 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Problem

EPUB attachment text can run a chapter's introduction or attribution into the body. This happens when a <header> or <footer> holds text directly or uses inline markup.

Change

Pass nonempty headers and footers through the existing block separator used for asides and captions. The separator starts a line only when needed.

Verification

I ran the same EPUB through the production extractor before and after the change:

Before
Updated timetable.Harbor departuresConfirm your berth.Source: Harbor OfficeKeep this guide.

After
Updated timetable.
Harbor departures
Confirm your berth.
Source: Harbor Office
Keep this guide.

The regression fails on base and extends the existing EPUB attachment case. Standalone header and footer replays also fail on base and pass with the fix. Inline text, empty blocks, and blocks whose text already sits in paragraphs pass both times. The targeted issue and PR search found no overlapping fix.

  • Vitest V8 coverage for the focused attachment test covered the changed line. The worker report measured 94.02% lines and 87.23% branches.
  • Dependency Cruiser found the same 31 direct imports across the two files. The comparison retains the same unresolved workspace aliases on both sides.
  • fast-check passed 200 generated cases and Jazzer.js ran 300 iterations of a narrow fixture generator. Stryker killed all 7 mutants on the changed line in a source-derived copy.
  • Fallow found no new issues in its two-file snapshot with limited dependency resolution. CodeScene’s quality gate passed and the test file’s declarations metric remained above its threshold, rising from 1,967 to 1,975.

vp run check:changed --concurrency 1 passed with 63 tests, affected-package typecheck, format, lint, Knip and GraphQL. The check also passed after rebasing onto 92786ad. Normal commit hooks passed.

Gemini 4 Neon (Antigravity, medium), Opus 5.5 (high), and Grok 4.7 Fast (high) approved the diff.

Reviewed with sol-loop: 1 round with GPT-6.2 Sol on high. Sol verdict: approved.

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

Copilot AI balanced review requested due to automatic review settings November 26, 2026 16:25

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 26, 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-26T16:28:02.734741Z b206e54 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 26, 2026
@coderabbitai

ghost commented Nov 26, 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 b206e54 and 32f4c7c.

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 paragraph extraction rule now applies line-start wrapping to text-bearing aside, address, header, and footer elements. The EPUB test covers nonempty and empty header and footer elements.

Changes: EPUB Text Extraction

Layer / File(s) Summary
Paragraph wrapping and test coverage
apps/server/src/provider/documentTextWorker.ts, apps/server/src/provider/userInputAttachments.test.ts
paragraphs now applies line-start wrapping to text-bearing aside, address, header, and footer elements. The EPUB test checks that nonempty header and footer text appears in document order and that empty elements add no text.

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

Change: Bug fix

Suggested reviewers: only21mil, stienswout

Merge Risk: Minimal · previous review b206e

EPUB header and footer text now starts on its own line instead of running into the surrounding text. The change is small, the test covers the new behavior, and I found no merge-blocking risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: EPUB headers and footers are kept on separate lines. The title follows the conventional commit format and matches the raw summary and the objectives. It is specific an…
Description check Passed The description follows the template. It has Problem, Change, and Verification sections. Problem and Change are clear and specific. Verification gives before and after output and lists the focused reg…
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 names the main change: EPUB headers and footers are kept on separate lines. The title follows the conventional commit format and matches the raw summary and the objectives. It is specific and concise.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, and Verification sections. Problem and Change are clear and specific. Verification gives before and after output and lists the focused regression results. The Scope section is missing. It should link the issue that shows the bug, or explain why no issue is needed for this small fix. The description also does not state the required agent model line in the exact form requested, although it names the models used. The description is mostly complete, so the check passes.

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 52d8029 and b206e54.

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; 8 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 26, 2026
@juliusmarminge

ghost commented Nov 26, 2026

Copy link
Copy Markdown
Member

Evidence

Ran the same EPUB upload and prompt on fresh databases in the real web app, using Replay (dev), a 1280×800 viewport and light theme. Opened an unchanged copy of the server-generated claimed attachment extraction in the app file viewer. Replay does not read the attachment itself. The scenario comparison exited 0: failed on base and passed on head.

Before After
ae945dd42a 32f4c7c41d
Before: EPUB header and footer joined to surrounding text After: EPUB header and footer on separate numbered lines
Before recording After recording

Base joins departuresConfirm and OfficeKeep; head separates both boundaries. Empty header/footer elements preserve Keep reading. on both sides.

Scenario source with embedded synthetic EPUB

@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 26, 2026
@juliusmarminge
juliusmarminge merged commit 53141c8 into pingdotgg:main Nov 26, 2026
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 26, 2026
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