Repository navigation
fix(engine): a stated link target's box holds the whole of what it names; the gate reads every box a head states - #700
Conversation
…mes, or it is not stated A reference's or a note's box was the union of its lines in the line's half of the page and its label: a note whose first line holds a \url TeX set outside the unit's text (El.keep, no ink stated) had that line stated as the comma after it alone, and its box stood half a line low; an element whose ink reaches past its line's was cut; an entry going on in the next column or page was boxed in part. The float rule now holds for every kind: a box holds the member's every ink on A (lines, label, elements; a heading's window round its own ink), all on its page and in one piece, and none of another member's (a heading's window holds its section under its top across its measure by design); else the destination is absent and its links keep their jump alone, refused as `unstated`, `pieces` or `foreign`. The gate (floats-gate.mjs) judges the boxes a head's target states, of every kind (link-targets.mjs boxesWrongOf: own ink outside, own ink untold, foreign text), never a boxed float no target states, which it counts apart. Red first: 8 engine tests, 7 gate tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The whole-box rule read an element's kind and text off locate's member, where the bundle states each element by its unit's class (bundle.ts classed): a URL piece locate holds under another kind, stated `other` with no ink and no text, was read as told, and a text macro whose class states its text was read as unfound. classed moves from bundle.ts to locate/work.ts, unchanged, and targets.ts reads every element through it. Red first: one test, an element of no ink read by its class both ways. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…targets, with its reason Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A paragraph or a theorem's text run in on a heading's line (amsart's run-in subsections, a theorem whose head reads as a heading) stands in the section the window shows, but its letters or a formula on that line reach above the heading's own ink: the window cut them by a fraction of a point, and the whole-box rule refused the target as foreign (over the regression corpus of 599: 400 of 3,508 headings). The window's top now holds the ink of every member on the heading's baselines whose line's measure is inside the window's across; the text before the heading reaching into it stays foreign. Red first: one test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sion corpus Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n line, with its reason Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 531f75060a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let only | ||
| if (kind === 'display') { | ||
| const pl = byOrd.get(ord)?.pl | ||
| only = (pl?.els ?? []).find(([, e]) => e.kind === 'display' && (e.ink ?? []).some((k) => k[0] === page && within([k[1], k[2], k[3], k[4]], box)))?.[0] ?? '' |
There was a problem hiding this comment.
Reject display boxes that match no display element
When a stated display box clips its element's ink so that no ink rectangle is fully contained, this lookup returns '', and inkOf(m, only) subsequently returns no ink to validate. The gate therefore accepts precisely the truncated boxes it is intended to reject. For example, a display with ink [1,120,560,250,580,565] and a target box [121,560,249,580] produces wrong: [] in a direct probe. Treat failure to identify the display element as an error rather than silently skipping its containment check.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Real: a stated display box that cut every piece of its element's ink found no element and was judged by nothing. Fixed in edf9586, red first: the gate now finds a display box's element by what it shares of the box, so such a box fails the check. The corpus was judged again with it: still no wrong box.
| /** a box of a member's on its page: a member set turned (Member.dir) states its ink in its frame, turned back here (the page's | ||
| * (x, y) = (ux fx - uy fy, uy fx + ux fy): turned-frames.ts toFrame's inverse) */ | ||
| function onPage(mem: Member, b: Box4): Box4 { | ||
| if (!mem.dir) return b | ||
| const [ux, uy] = mem.dir |
There was a problem hiding this comment.
🟡 Misplaced rotated text in link previews
When checking preview overlaps, onPage moves rotated figure text that already has page coordinates. It leaves sideways TeX text in the coordinates set by frameTurned. The overlap check can admit unrelated ink or suppress a clean preview.
Learn more
The overlap check compares every member’s line, label, and element boxes in page coordinates. frameTurned stores sideways TeX members in local coordinates and sets Member.frame. In contrast, place gives a rotated figure run Member.dir, and line geometry already projects that run onto the page. onPage uses dir to decide which boxes to project, so both representations are compared in the wrong places. The turned-member test does not catch the difference because it assigns dir to a frame-local line.
Example: A footnote crop spans x=72–300 and y=86–107. A perpendicular figure label covers x=150–160 and y=90–110 in page coordinates. Applying its [0, 1] direction again moves the label to x=−110–−90 and y=150–160. The check misses the overlap and keeps the crop.
Recommended fix: Transform frame-local ink using Member.frame and leave Member.dir figure-run boxes in page coordinates. Keep rotated members out of the heading window’s level-line exceptions by recognizing both fields there. Add tests for both real member representations.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
The reading of the code is right: a unit set turned keeps its lines in its own frame, a figure text's boxes are already the page's, and onPage turns by direction. Counted before deciding: with the coordinates corrected, over both corpora no target's own member is turned, the members that carry a frame meet no stated box, and no target's verdict changes (stated or left out). So it is recorded for a change of its own, with its two red tests kept for it, rather than fixed here. One limit of the count: a target both readings leave out is not seen by the comparison.
| let only | ||
| if (kind === 'display') { | ||
| const pl = byOrd.get(ord)?.pl | ||
| only = (pl?.els ?? []).find(([, e]) => e.kind === 'display' && (e.ink ?? []).some((k) => k[0] === page && within([k[1], k[2], k[3], k[4]], box)))?.[0] ?? '' | ||
| } | ||
| for (const o of own) { | ||
| const m = byOrd.get(o) | ||
| if (!m) continue | ||
| for (const [p, r] of inkOf(m, only)) if (!boxes.some(([bp, b]) => bp === p && within(r, b))) row(o, 'own ink outside') |
There was a problem hiding this comment.
🟡 Clipped equation previews pass validation
When a preview clips every equation segment, boxesWrongOf finds no display to validate and checks no equation ink. The release gate accepts that crop when its landing evidence passes.
Learn more
linkTargetsOf checks the head’s published boxes against the written parts. A paragraph can contain several display elements, so the display branch chooses one before checking its ink. It only selects a display when the crop already fully contains one of its segments. If every segment is clipped, the empty ID matches none of the elements and the check produces no failure. gateOf then accepts the record if the separate landing checks also pass.
Example: An equation spans x=120–250, but its head crop ends at x=245. The only ink segment is not contained, so the gate passes rather than reporting the missing right edge.
Recommended fix: Identify the display independently of crop containment, for example by resolving the destination against the part’s display anchors. Then check every segment of that element. Report unresolved display identity instead of treating an empty ink check as success, and test a one-row equation clipped at one edge.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Real, the same defect as the thread on link-targets.mjs:107. Fixed in edf9586 (red first): the element is found by what it shares of the box, so a box that clips every piece of its equation is judged and fails.
| for (const o of own) { | ||
| const m = byOrd.get(o) | ||
| if (!m) continue | ||
| for (const [p, r] of inkOf(m, only)) if (!boxes.some(([bp, b]) => bp === p && within(r, b))) row(o, 'own ink outside') | ||
| if (kind !== 'float' && kind !== 'display' && (m.pl.els ?? []).some(([, e]) => untold(e))) row(o, 'own ink untold') |
There was a problem hiding this comment.
🔍 Preview validation coverage without parts
bundle omits parts on pages with nothing to lay but still publishes targets. The gate cannot distinguish those unchecked regions from regions it verified against part geometry.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
True, and recorded. A few stated targets stand on pages where nothing is drawn (a reference list kept whole, for one). The engine states them from the same evidence as every other target (its members' lines, labels and element ink on the page); it never reads parts. The lab gate does read parts, so it judges nothing there. Making it judge them from the engine's members at run time is a change to the gate's own reading, not to what is stated; it is not in this pull request.
… the box, not by a piece it holds A display box that cut every piece of its element's ink found no element (the lookup asked for a piece inside the box) and so judged nothing of it: the truncated box it is there to refuse passed. The element is now the member's display element sharing the most of the box, its ink then read whole; a box sharing none of any display ink of its member is its own ink outside. Red first: one test (Codex's finding on #700). Over the runs of this pull request (the 599, the 245's 114) the reading still finds 0 wrong. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rules gate: passedModel tier of the layer gate on 32 outputs of 7 targets, The rule set changes no target. No output for zh-TW, pt, it, nl, pl, tr, id, ms, cs, sv, uk, bg: their rules are not measured here. de: 5 outputs, no measure moved
es: 4 outputs, no measure moved
fr: 4 outputs, no measure moved
ja: 4 outputs, no measure moved
ko: 4 outputs, no measure moved
ru: 4 outputs, no measure moved
zh: 7 outputs, no measure moved
The links open the lab on a machine that has the fixtures. No page and no text of a paper is shown here: the papers are under arXiv's licence. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
What
A link target's box (
Head.targets, docs/PDF-READER.md §20) is stated only where it holds the whole of what it names and nothing of another member's: the float rule of §20.2, now for every kind. Where it cannot, the destination is absent fromtargets(as a float with no box is;Targethas no form without a box) and its links keep their jump alone.The gate (
lab/pdf/prepare-back/floats-gate.mjs) now judges the boxes a head's target states, of every kind, and counts the boxed floats no target states apart instead of judging them.Why
A note whose first line holds a
\urlTeX set outside the unit's text (El.keep, no ink stated) had that line stated as the comma after it alone: its box stood half a line low, and a preview would show the note with its first line cut. The same reading cut an element whose ink reaches past its line's, boxed an entry going on in the next column or page in part, and grouped a member's lines byLine[1], which is a half-page class (left, right, spanning), not a column. The gate read every boxed float, stated or not, and no other kind.The rule (targets.ts)
A box holds the member's every ink on A as the bundle states it (its lines' bands, its label's ink, its elements' ink; a display's: its element's; a heading's window round its own ink, a label hung left of the measure among it, its top round what TeX set on the heading's own line: a paragraph or a theorem's text run in on it). Refused, after the evidence's refusals:
unstated: the member holds an element TeX set whose ink the bundle does not state, read as the bundle states each element (by its unit's class,classed, moved from bundle.ts to locate/work.ts unchanged): one kept outside the unit's text (a space aside), or one of no ink of an inked class stated neither to set nothing nor to be its unit's text;pieces: its ink on another page, or its lines going on above the one before them (the next column);foreign: another member's ink meets the box. A heading's window holds its section by design: there, foreign is another's line whose TeX measure is not inside the window's across or whose band reaches above its top (another column, a caption across both, the text before the heading reaching into it), and another's label or element ink reaching above the top or whose member has no such line in the window; in the window and in itsnext.The gate
boxesWrongOf(link-targets.mjs) reads every stated target against the parts:own ink outside(any own ink on another page than the box's or itsnext's, or outside it),own ink untold,foreign text(as above). A float's box is also wrong where the engine's counts are above 0. Boxed floats no target states:boxedUnstated, reported.Tests
Red first: 11 engine tests (
packages/engine/tests/targets.test.ts: kept and unfound elements, told elements, an overhanging element, a reference in two columns and over two pages, two notes on one line, a display over two pages and one met by another's line, a heading's window round its label and line, a window met by a wider line and by the line above it, a turned member's ink, the element read by its class both ways, a window round a run-in line) and 7 gate tests (tests/lab/floats-gate.test.ts). One existing engine fixture (two entries 7.97 apart with 9-point bands) overlapped as foreign: its pitch moved to 10, its point unchanged.Proof
Each chain run against the line's run (
rebuild/v29af8859), from stored compiles; no compile moved (the stored compile key, the marks digest, is the line's at this head).The regression corpus of 599 papers (prepare only, the kept compiles): 533 prepared; the 519 with a bundle every unit, part, add-on and prepare dump byte for byte the line's, each head the line's but
targets. The gate passes: 0 stated boxes wrong of any kind, 0 landings wrong.Boxed floats no target states, counted apart: 1,509 (the one float the line's gate read wrong is among them). The targets phase: 12 ms a paper at the median, 50 at the 95th percentile, 199 the largest.
The 245: 114 of the papers ran (the stored sources of the others were not at hand for this run); on those, byte for byte the line's but the heads, the gate passing (withheld: references 76, headings 13, notes 6, displays 2).
Two corrections came from the corpus, each red first: the elements read as the bundle states them (by their unit's class: locate's own kind read 667 references as untold and missed 39 the parts state untold), and a heading's window round its own line (a paragraph or a theorem's text run in on it was refused as foreign: 400 headings).
Review round
Codex on 531f750, one P2 (the gate's display lookup): adopted, red first (
a display box that cuts its element's ink, or holds no display ink at all, has its own ink outside); the element is now the member's display element sharing the most of the box. Re-read over this pull request's runs (the 599 and the 245's 114), still 0 wrong. The gates on edf9586: typecheck, lint, census (0 rose), test, the hosted-CI form, build, each exit 0; the reader's e2e (harness, e2e:reader 104/104, e2e:framing 22/22) on 531f750, the reader unchanged since.Versions
None moves: no unit, unit id, row, part, add-on or prepare dump changes (shown byte for byte), only the head's optional
targets; FORMAT stays 1. The stored compile key (the marks digest) is the line's: none of these files is in the compile side's closure.🤖 Generated with Claude Code