Skip to content

INL1a 2/5 (B1): the inline input model (InlineBox, LineBreak, strut, verticalAlign) and its additive vector migration - #88

Merged
thejackshelton merged 4 commits into
masterfrom
inl1a-input
Oct 6, 2026
Merged

thejackshelton merged 4 commits into
masterfrom
inl1a-input

Conversation

@thejackshelton

Copy link
Copy Markdown
Contributor

INL1a part B1: the R5 inline input model and its migration. Part 1 was #66.

Stacked, lands as train 3. This is the first of four stacked PRs (B1 → B2 → C1 → C2). They land as train 3, after train 2 (REPL-a). B1's head predates master's latest commits (it was built on master 30f03f4), so the train's catch-up merges master into it.

What changed

  • Input model: InlineBox (kind inline), LineBreak (kind br), a required LayoutBox.strut (CSS2 §10.8.1: the container's own font and line-height when its children are inline-level, else null) and a required LayoutStyle.verticalAlign (keyword, px, percent or calc; the compiler writes baseline).
  • Validator: validateLayoutInput checks the new shapes:
    • the strut is present exactly when the children are inline-level;
    • a text leaf's font and line-height must equal its parent's, the strut's or its inline box's (new code leaf-font);
    • no box or replaced leaf inside an inline box (block-in-inline);
    • display: inline only on inline boxes, so a replaced leaf stays block-level;
    • white-space collapsing is checked across inline boxes and <br>s.
  • Engine: it still lays out text leaves only. box.ts inlineTextLeaves refuses an inline box or <br> with the typed code inline-box, naming the node. inline.ts is unchanged; B2 replaces the refusal with the inline core.
  • Environment pass: zooms and resolves the strut, inline-box and <br> fonts, and vertical-align px and calc. boxDependencies covers them.
  • Compiler and native emit: ios-layout.ts writes verticalAlign: baseline and the container strut (lowerFont, which refuses a non-Ahem family). Native emit writes LineStrut, InlineBox, LineBreak and VerticalAlignKeywordValue with the translated union names. native-program throws on an inline box or <br> rather than dropping it.
  • Harness and corpus: the translate harness decodes the new kinds and fields, and the random corpus writes the strut.
  • Migration: scripts/migrate-inline-input.ts migrates the hand-written inputs (17 calc vectors and the vectors README example), which no generator rewrites. It refuses to write anything unless the result differs only by strut and verticalAlign, and its --check is clean.
  • Migration proof: docs/decisions.md requires a committed check that a vector migration is additive. node scripts/check-inline-input-migration.ts origin/master finds 4777 files at the base and 1921 changed, with 68602 neutral additions. Every other byte is identical, and no files are added. Its planted faults (vector-output, vertical-align, strut-font, strut-on-block, missing-strut, stray-file) each fail with their own message.
  • Regenerated outputs (own commit, pnpm regen, fixed point after 3 passes): 476 vectors and 1428 DPR vectors gain strut and verticalAlign only. The other outputs are the 44 translated engine files, the corpus digests, the lanes.json host lanes and native-lanes.ts. No capture, emitted CSS, break, pixel or WPT output changed.

Tests and pins changed, with reasons

  • parity.test dropInheritedText plant: it is now caught one step earlier. The reverted leaf font no longer equals its container's strut, so the validator rejects the input (leaf-font) before the layout lane runs. The case still fails, which is what the plant checks.
  • native-backends.test: the expected constructor text gains verticalAlign: baseline as the last LayoutStyle argument. The calc line-height count goes from 2 to 3 because the strut adds one.
  • README key-count test: it now compares against styleSchema's keys, so the new verticalAlign key is counted.
  • New: packages/layout/test/inline-input.test.ts, with 10 tests covering the validator, the inline-box refusal and the environment zoom.

What passed (host-side)

  • tsc -b passes.
  • layout:subset reports 0 violations.
  • parity.test passes 687/687.
  • check-inline-input-migration.ts is clean, and all 6 planted faults are caught.
  • pnpm test: 15 tests in 7 files fail, and every one of them needs device evidence (lanes, lanes-records, lanes-concurrent, device-failures, p6a-promotion and related). They pass or fail only after the train's device run and second pnpm regen, which rebuilds native-lanes.ts from the device-run lanes.json. No device run has been done for this head.

Size

About 98 KB of reviewed diff after .macroscope/ignore.md (25 files). Counting the hand-migrated calc vectors, which the ignore list skips, it is about 136 KB.

🤖 Generated with Claude Code

…ritten engine inputs (packages/layout/vectors/calc/*.json and the vectors README example), which no generator rewrites; every box gains strut (its first text leaf's font and line-height, else null) and every style verticalAlign baseline after aspectRatio, nothing else changes; ran node scripts/migrate-inline-input.ts; --check exits 1 if any file would change
… required LayoutBox strut (CSS2 §10.8.1) and LayoutStyle verticalAlign; validateLayoutInput checks their shape, a text leaf's font and line-height against its parent's (leaf-font), block-in-inline, display inline only on inline boxes (a replaced leaf stays block-level), and white-space collapsing across inline boxes and <br>s; the compiler writes baseline and the container strut; the engine lays out text leaves only and refuses an inline box or <br> with the typed code inline-box (box.ts inlineTextLeaves; inline.ts unchanged); the environment pass zooms the strut and vertical-align; native emit, the translate harness and the random corpus write the new fields; scripts/check-inline-input-migration.ts proves the vector migration additive
… last LayoutStyle argument and the strut as a third LineHeightCalc; the dropInheritedText plant now fails the case at the validator (leaf-font: the reverted leaf font differs from its container's strut) before the layout lane; the vertical-align calc test carries its range
…m regen (fixed point after 3 passes; vectors and DPR vectors gain strut and verticalAlign only, proven by node scripts/check-inline-input-migration.ts origin/master; translated engines, corpus digests, lanes.json host lanes and native-lanes.ts; device lanes await the device run)
@thejackshelton
thejackshelton merged commit 70fa043 into master Oct 6, 2026
3 checks passed
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