Skip to content

fix(ci): drop unused type: ignore comments and handle fonts without sCapHeight so CI passes on main - #7

Open
weitheng wants to merge 2 commits into
AryanBV:mainfrom
weitheng:fix/ci-green-upstream
Open

weitheng wants to merge 2 commits into
AryanBV:mainfrom
weitheng:fix/ci-green-upstream

Conversation

@weitheng

@weitheng weitheng commented Nov 1, 2026

Copy link
Copy Markdown

What breaks

CI on main has failed on every job since 22 Jul
(https://github.com/AryanBV/pdf-edit-engine/actions/runs/29895356358): the Typecheck step stops
with 21 Unused "type: ignore" comment [unused-ignore] errors, so the tests never run. With
Typecheck passing, the two Linux jobs then fail
test_builder_yields_parseable_pdf[build_arabic_pdf] and
test_builder_is_deterministic[build_arabic_pdf] with
AttributeError: 'table_O_S_2f_2' object has no attribute 'sCapHeight'.

Why

  • The 21 ignores sit on pikepdf.Object operations (list(obj), del obj[key], .get()).
    pikepdf 10.6.0 added type hints for them and 10.8.0 covered the last one, so strict mypy
    (warn_unused_ignores) flags each one. CI installs the newest release pikepdf>=10,<11 allows
    (10.17.0 today). mypy and fontTools are not the cause: the count is 21 with mypy 1.20.2, 2.2.0
    and 2.4.1.
  • On Linux the Arabic builder uses DejaVu Sans, whose OS/2 table is older than version 2 and so
    has no sCapHeight.

Fix

  • Drop the 21 comments; no code changes.
  • Read sCapHeight with the fallback tests/invariants/test_g_10_latin_reflow_lock.py and
    tests/invariants/test_g_9_cjk_linebreak.py already use,
    getattr(os2, "sCapHeight", os2.sTypoAscender), at the five places that read it directly:
    tests/corpus_builders/_truetype_assembler.py, tests/corpus_builders/no_tounicode.py,
    tests/_identity_h_fixture.py, tests/_simple_font_fixture.py and
    tests/generate_complex_corpus.py.

Testing

  • python -m mypy on this branch: no issues with pikepdf 10.17.0 and mypy 2.4.1, and none with
    pikepdf 10.8.0. pikepdf 10.6 and 10.7 still report one error (annotations.py, del obj[...])
    and 10.0 to 10.5 one to three, as before this change.
  • ruff check src/ tests/ on this branch: all checks passed.
  • The same two changes on a fork's main, whose Arabic builder files are identical to this
    branch's: CI passed on ubuntu-latest and windows-latest with Python 3.12 and 3.13
    (https://github.com/weitheng/pdf-edit-engine/actions/runs/41257182374).

…as no sCapHeight, so the Arabic corpus builder works with DejaVu Sans on Linux
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 160f14f5-5ea3-43a8-8e33-6821f56af7eb
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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