Skip to content

feat(epub): add the edge-case corpus for the EPUB extraction fixes - #10

Merged
tobocop2 merged 4 commits into
mainfrom
feat/epub-edge-cases
Aug 25, 2026
Merged

feat(epub): add the edge-case corpus for the EPUB extraction fixes#10
tobocop2 merged 4 commits into
mainfrom
feat/epub-edge-cases

Conversation

@tobocop2

@tobocop2 tobocop2 commented Aug 25, 2026

Copy link
Copy Markdown
Member

What this adds

36 EPUB files under epub/edge-cases/, one or more per defect that xberg-io/xberg#1498 fixes. EPUB_EDGE_CASES.md records each file's source, licence evidence, and the observation measured on the base and head builds of that pull request.

Fix to file

fix files before, after
#1488 entities, BOM, unparseable chapter 3 synthesized chapter absent, present; BOM as prose, gone; silent drop, warning
#1489 navigation, image-only, SVG spine Gutenberg 14838, 28885, 1661; IDPF childrens-literature; epub.js alice; 4 W3C tests licence pages absent, present; cover 0 images, 1; SVG items skipped, present
#1490 depth 1 synthesized stack overflow abort, exit 0 with a warning
#1491 unsafe href 2 epubcheck tests, 1 synthesized whole book fails, one warning
#1492 metadata, covers SE Frankenstein, epublib testbook1, Gutenberg 27805, 2 synthesized subtitle as title, main title; one author, both; conversion date, publication date; XHTML bytes as a PNG, the real cover
#1493 rendering Gutenberg 39292, 98; W3C leaking-link test table row lost, kept; 45 U+0001 bytes, 0; alt text lost, kept
#1494 encodings, DRM 6 synthesized; IA LCP book; 2 epubcheck tests; W3C font obfuscation chapters dropped, decoded; 10 warnings, one DRM warning; obfuscated fonts never warn
#1486 media types IA text/html book, 1 synthesized no change on either build

Licences

All 36 are vendor lane: US public domain, CC0, W3C, BSD-3, Apache-2.0, MIT. IDPF samples that show these cases under CC-BY-SA or GFDL are recorded, not hosted.

Not found

No public file exists for entities beside a stylesheet link, a BOM, legacy or UTF-16 encodings, a cover meta pointing at XHTML, or the odd media-type labels; those 14 are synthesized. The head of #1498 carries no media-type commit, so the text/html rows show no change yet.

Publish

The bytes are staged at ~/projects/xberg-worktrees/test-documents-epub/epub/edge-cases/ and need a publish by @tobocop2. corpus.lock.json is untouched.

Add 36 EPUB files under epub/edge-cases, one or more for each defect that
xberg-io/xberg pull request #1498 fixes: named entities and byte order marks,
the navigation heuristic, deep nesting, unsafe spine hrefs, Dublin Core
metadata and covers, rendering, encodings and DRM, and spine media types.

Each file was run through the base and head builds of that pull request, and
EPUB_EDGE_CASES.md records the measured before and after per file, the source
URL, and the licence with its evidence. 22 files are published documents from
Project Gutenberg, Standard Ebooks, the IDPF samples, the W3C EPUB tests, the
epubcheck test suite, epub.js, epublib and the Internet Archive. 14 are
synthesized by scripts/build_epub_edge_cases.py for the cases no public file
exhibits, and the document says which and why.

scripts/epub-edge-cases.json pins every file by sha256 and names its source:
a URL, the members of an epubcheck directory at a pinned commit, or the
generator. scripts/fetch_epub_edge_cases.py materialises all of them, and
scripts/test_epub_edge_cases.py checks the generator against the pins without
the network. _typos.toml allows the word "opf".

corpus.lock.json is untouched. The bytes are staged locally and need a
publish by a maintainer with write access to the bucket.
@tobocop2
tobocop2 requested a review from Goldziher August 25, 2026 04:12
@tobocop2 tobocop2 self-assigned this Aug 25, 2026
Comment thread scripts/build_epub_edge_cases.py Outdated
@tobocop2
tobocop2 force-pushed the feat/epub-edge-cases branch from b863669 to 74dc6aa Compare August 25, 2026 05:59
Each synthesized package now carries an NCX (EPUB 2) or a nav document
(EPUB 3), so epubcheck reads the fixture as a conforming EPUB and the
defect under test is the only thing wrong with it. The depth fixture wraps
its nested run in a div.

The build is deterministic and the 14 affected pins in
scripts/epub-edge-cases.json are regenerated to match.
@Goldziher

Copy link
Copy Markdown
Member

@tobocop2 - can you get this merged?

@tobocop2

Copy link
Copy Markdown
Member Author

it will be merged shortly. I'm mid publish to GCP.

The 36 edge-case files are uploaded to the corpus bucket. Their pins are
added to corpus.lock.json; no existing pin is dropped or changed.
@tobocop2
tobocop2 marked this pull request as ready for review August 25, 2026 17:39
@tobocop2

Copy link
Copy Markdown
Member Author

Everything is now published, and this is being merged.

@tobocop2
tobocop2 merged commit 8c6128b into main Aug 25, 2026
2 checks passed
@tobocop2
tobocop2 deleted the feat/epub-edge-cases branch August 25, 2026 17:43
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.

2 participants