Skip to content

render-pipeline: thread VSpace stretch/shrink into vspace_flex (GH-VSKIP-GLUE-STRETCH slice 2, needs re-pin past #606) - #607

Closed
d-q222 wants to merge 1 commit into
mainfrom
agent/daniel-muse-lead/vskip-glue-pipeline
Closed

d-q222 wants to merge 1 commit into
mainfrom
agent/daniel-muse-lead/vskip-glue-pipeline

Conversation

@d-q222

@d-q222 d-q222 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Scope

Slice 2 of GH-VSKIP-GLUE-STRETCH. Draft — needs #606 to merge/re-pin first. Stacked on #606 (this PR's base branch): crates/render-pipeline still links the FROZEN crates/render-pipeline/vendor/compiler copy, which does not yet have #606's stretch_pt/shrink_pt fields on Block::VSpace. cargo check -p flashtex-render-pipeline on this commit fails today with exactly 7 E0026/E0559 errors, all naming stretch_pt/shrink_pt and nothing else — expected until the vendor is re-pinned past #606. Nothing under vendor/ was touched.

Adapter-only (crates/render-pipeline/src/adapter.rs), per daniel-parent's explicit scope limit: stretch/shrink are threaded through Block::VSpace → style::Skip, reusing the existing crate::style::Skip { natural, stretch, shrink } struct — no new type invented, and no changes to pagebuild.rs or typeset/floatpage.rs (daniel-parent's own stacked drafts #569/#584/#599 own that area).

  • split_at_page_breaks: new pending_vspace_flex: (f64, f64) beside the existing flat pending_vspace; the CBlock::VSpace { pt, stretch_pt, shrink_pt } arm now accumulates natural + rubber together.
  • The per-unit vspace_flex initializer (previously hardcoded (0.0, 0.0)) starts from the pending pair, flowing into Block::Paragraph::vspace_flex, which typeset.rs::build_paragraph already consumes via add_skip into the (natural, stretch, shrink) before-skip tuple — no consumer-side change needed.
  • vspace_in_gap (the class-size em/ex re-read that can supersede the compiler's own sum) now returns Option<style::Skip>: a new parse_glue_in parses a bare dimension or one with plus/minus <dimen> in either order (finite only, mirroring the compiler side in compiler: carry rubber lengths on Block::VSpace (GH-VSKIP-GLUE-STRETCH slice 1) #606); unparseable input still yields None so the compiler's own sum stands rather than guessing.
  • lower_blocks synthesizes rigid letter-class VSpaces with stretch_pt: 0.0, shrink_pt: 0.0 (class-specified fixed gaps, correctly rigid).
  • same_flow's display-rejoin guard now also requires unit.vspace_flex == (0.0, 0.0), so \vspace{0pt plus 2pt} is not silently merged away along with its stretch.

Where the flat representation stops (deliberately untouched, per scope — see Not done): Block::Heading/Rule/Picture/LongTable only carry vspace_before: f64, and typeset.rs::add_vspace consumes them rigidly. The flex carried this far into a Unit is dropped at Block::Rule construction (a code comment marks exactly where). Final page-stretch consumption lives in pagebuild.rs.

Overlap check

coord.py claims — held only by daniel-muse-lead. Confirmed no touch to pagebuild.rs, typeset/floatpage.rs, or vendor/ via merge-base diff.

Test results

New crates/render-pipeline/tests/vskip_glue.rs (3 tests, parse + adapt, no fonts needed): \vspace{12pt plus 4pt minus 2pt} → (12.0, (4.0, 2.0)); \bigskip → (12.0, (4.0, 4.0)) (exercises the CBlock::VSpace accumulation arm directly, since no literal \vspace stands in its gap); bare \vspace{6pt} → rigid (6.0, (0.0, 0.0)).

Verified via a scratch vendor swap (symlinked the live crates/compiler from this same branch over vendor/compiler, built, tested, then discarded entirely — the real commit here touches only adapter.rs and the new test file):

  • Two unrelated pre-existing vendor-drift compile errors needed a scratch-only shim (Inline::LineBreak's skip_pt field, gated behind the linebreak-skip feature but with one direct literal at adapter.rs:947 the feature helper doesn't cover) — independently reproduced by the supervisor with the exact same 2 errors, fixed the same way (one via --features linebreak-skip, one via the direct literal), confirmed unrelated to this slice (a LineBreak field, not VSpace).
  • Scratch tests: 3/3 new tests pass. Independent mutation check (supervisor-run, fresh CARGO_TARGET_DIR): disabled the CBlock::VSpace accumulation arm → bigskip_carries_its_latex_glue FAILED (left: (12.0, (0.0, 0.0)), right: (12.0, (4.0, 4.0))), the other two tests unaffected (they exercise the separate vspace_in_gap re-read path) — restored → all 3 pass. Matches the lane's own reported mutation result exactly.
  • Full crates/render-pipeline lib suite in scratch: 137 passed, 0 failed, no new warnings.
  • Entry-point e2e in scratch: scratch-built flashtex CLI on a doc with \vspace{12pt plus 4pt minus 2pt} + \bigskip compiled clean (ok, 1 page, 0 errors, 0 warnings), with all three paragraph tops identical to a rigid \vspace{12pt} control build — natural layout preserved exactly, rubber correctly inert on a single page with no page-break pressure.

Not done

Extending flex carriage to Block::Rule/Heading/Picture/LongTable (needs a Block-shape change plus typeset.rs-consumption changes in daniel-parent's stacked-draft territory) — posted as a question rather than worked around, per the slice-2 scope instruction. Also noted for the eventual re-pin: adapter.rs:947's direct Inline::LineBreak literal will need skip_pt: None (or routing through the existing line_break_inline helper) — unrelated pre-existing drift, flagged so it isn't mistaken for fallout of this PR.

🤖 Generated with Claude Code

Update (rebase onto current main)

Slice 1 (#606) merged into live crates/compiler on main, but the
render-pipeline vendor pin (crates/render-pipeline/vendor/compiler) still
predates it — same CLI-gate situation as before, just moved: rebased this
branch's single commit directly onto current main (clean, no conflicts,
3a098989 dropped as already-upstream via #606). Re-verified with a fresh
scratch vendor swap: applied #606's real diff onto a throwaway copy of the
vendor pin (not a stub — the actual stretch_pt/shrink_pt parsing logic),
built and ran tests/vskip_glue.rs for real: 3/3 pass
(bigskip_carries_its_latex_glue, plain_vspace_stays_rigid,
vspace_plus_minus_reaches_paragraph_flex). Scratch copy discarded
afterward; no vendor/ changes committed. Still draft — still needs the real
vendor re-pin to land in the shipped flashtex-cli binary; base is now
main and the branch is currently MERGEABLE.

🤖 Generated with Claude Code

…KIP-GLUE-STRETCH slice 2)

Adapter only: accumulate CBlock::VSpace stretch_pt/shrink_pt through
pending_vspace into Unit/Block::Paragraph vspace_flex, alongside the
existing natural sum; the gap re-read now parses plus/minus glue into
the existing style::Skip. Stops at the flat Block shapes (Rule,
Heading, Picture, LongTable) and their rigid typeset consumption.

Draft: needs vendor/compiler re-pin past #606 for the new fields.

Implementation-Agent: muse-spark-1.3-contributor
@d-q222
d-q222 force-pushed the agent/daniel-muse-lead/vskip-glue-pipeline branch from 99ff88c to cd02378 Compare September 17, 2026 07:16
@d-q222

d-q222 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

daniel-muse-lead: rebased onto current main (unblocked now that #606 merged).

Ready to merge whenever the mac-app CI baseline issue clears.

@d-q222

d-q222 commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded: main already threads VSpace stretch/shrink via vspace_flex/addvspace_flex in render-pipeline/src/abstractenv.rs.

Found during 2026-09-21 daniel-muse-lead reconciliation (see #2). If a real gap remains after this, please reopen or file a fresh issue with the specific missing case — happy to pick it up as a new Muse slice.

🤖 daniel-muse-lead (Claude Sonnet, Muse Contributor supervisor)

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.

1 participant