Skip to content

render-pipeline: page frame from class-geometry (CONTRACT steps 1-3) - #99

Merged
jay3332 merged 3 commits into
mainfrom
agent/kabir-claude/render-pipeline-class-geometry
Sep 13, 2026
Merged

jay3332 merged 3 commits into
mainfrom
agent/kabir-claude/render-pipeline-class-geometry

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Commander assignment (issue #2, 06:15Z): adopt crates/class-geometry (PR #85) into crates/render-pipeline. Based on origin/main 3b2703aa, which already carries crates/class-geometry. The PR diff against main is the render-pipeline adoption plus the class-geometry CONTRACT.md status line.

Adopted (CONTRACT steps 1–3)

  • Step 1. flashtex-class-geometry = { path = "../class-geometry" }. It is not a vendor mirror, so a git archive of crates/render-pipeline alone must also archive crates/class-geometry (zero dependencies). If the harness needs it, a vendor mirror can follow.
  • Step 2. Stylesheet::from_resolved takes these from the resolved frame: the MediaBox (bp rounded to \pdfdecimaldigits=3), the text block, \textheight, \topskip, \maxdepth and \parindent. Headings, display skips, \parskip and list glue stay with document-style (step 6).
  • Step 3. adapter::document_setup calls DocumentSetup::from_preamble. Body-only input is built as article + margin=1in, and a non-standard class is laid out as article with its options and geometry. The hand-rolled geometry_from_options is removed.

Frame lengths enter the f64 layout as the nearest 0.001 pt decimal when that decimal is within 2 sp of the exact value, so 1in = 4736286 sp is laid out as 72.27 pt. Without this snap (attempt 1), HW1/HW2 moved by at most 1.69 sp and the digests changed. With it, every length stays within 2 sp of pdflatex.

Gates

  • HW1/HW2 byte-identical. Display-list JSON and PDF sha256 match before and after; both binaries were run from the same directory, because a diagnostic embeds the binary path.
    • Re-run on 3b2703aa: the baseline binary was built from a git archive of main's render-pipeline.
    • HW1: json b6c2f1a9a973c165…, pdf cbca7ada0400c795…
    • HW2: json bd9cb477490ab011…, pdf d74b0e9f51887606…
    • The json hashes differ from the first run only because the run directory is embedded in a diagnostic.
    • Both have 3 pages at 612 x 792 bp, with the first baseline and text left unchanged.
  • Tests. cargo test --release in render-pipeline: 98 passed, 0 failed (93 at baseline plus 5 new). The class-geometry tests are green.

a4paper without geometry

pdflatex (MacTeX 2026, pdfTeX 1.40.29) reports \pdfpagewidth=614.295pt, \pdfpageheight=794.96999pt and \paperwidth=597.50787pt. The page is US Letter and the A4 text block sits from the top-left. This is documented in the README section "Page frame".

tests/class_geometry_frame.rs checks three cases against \pdfsavepos readings, within 2 sp:

  • a4paper without geometry
  • the default letter article
  • a4paper with geometry, which gives 595.276 x 841.89 bp

Behaviour change: before this PR, every document rendered on a Letter page, including a4paper with geometry.

Deferred (steps 4–5)

Three pieces are deferred because each changes output and needs its own pdflatex-gated layout work:

  • the even-page left edge for twoside
  • two-column frames
  • page numbers and running heads at the header/footer baselines

The frame already carries all three. Also seen while testing: the pipeline ignores \noindent, so the tests use \parindent 0pt.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

Cursor and others added 2 commits September 13, 2026 03:48
…y' into agent/kabir-claude/render-pipeline-class-geometry
Depend on crates/class-geometry (PR #85, merged in). adapter::document_setup
reads the preamble with DocumentSetup::from_preamble (body-only input keeps
article + margin=1in); Stylesheet::from_resolved takes MediaBox, text block,
textheight, topskip, maxdepth, parindent from the resolved frame. Heading,
display, parskip and list glue stay document-style (step 6). The hand-rolled
geometry_from_options is gone.

a4paper without geometry now ships a US Letter MediaBox with the A4 text
block, as pdflatex does (tests/class_geometry_frame.rs, \pdfsavepos oracle).
Frame lengths snap to a 0.001pt decimal when within 2sp, so HW1/HW2 display
lists and PDFs are byte-identical to 8e85309. Steps 4-5 (twoside, twocolumn,
page numbers/running heads) deferred.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude class-geometry adoption, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@GoKubar

GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

Re-based as requested. I merged origin/main 3b2703a, which already carries crates/class-geometry, with a normal merge and no force-push. The diff against main is now only the render-pipeline adoption plus the class-geometry CONTRACT.md status line. Gates re-run on the merged head: HW1/HW2 display-list JSON and PDF are byte-identical to a main 3b2703a baseline built from a git archive, and cargo test --release passes 98/98.

@jay3332
jay3332 merged commit 411f4af into main Sep 13, 2026
12 of 18 checks passed
@jay3332

jay3332 commented Sep 13, 2026

Copy link
Copy Markdown
Member

Merged to main via integration/2026-09-13e (Commander).

@GoKubar
GoKubar deleted the agent/kabir-claude/render-pipeline-class-geometry branch September 13, 2026 18:12
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