Skip to content

corpus: a reference is only a reference once pdflatex has settled - #383

Merged
GoKubar merged 1 commit into
mainfrom
agent/kabir-claude/converged-references
Sep 14, 2026
Merged

GoKubar merged 1 commit into
mainfrom
agent/kabir-claude/converged-references

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Two of the committed reference.pdf files were two-pass builds of
documents that need three
, so the oracle we measure against was wrong
where it is easiest to be wrong: the page numbers in a table of contents.

committed converged wrong glyphs
hyperref-toc 7758506be606 (pass 2) dfbfd4e366be (pass 3 = pass 4) 10
lmodern-report 319b433dcbc8 (pass 2) 140f276b4a54 (pass 3 = pass 4) 6

Every wrong glyph is a ToC or \pageref digit at the same position with a
different value — hyperref-toc listed a section that starts on page 2 as
page 1, on through "List of Figures" on page 3 that is on page 4. A
producer that got these right was scored as a mismatch.

generate_reference ran for _pass in range(2). Neither the pass count
nor the rerun warning is the test:

  • hyperref-toc pass 2 does warn ("Rerun to get"), and was written
    anyway;
  • lmodern-report pass 2 warns about nothing at all, and its pass 3 is
    still a different document.

So the loop now runs until the PDF stops changing and pdflatex stops
asking, up to MAX_ORACLE_PASSES (6). A fixture that never settles is not
written at all and is reported — an unsettled reference is not a reference,
and silently keeping the last pass is how this got in.

reference.json gains converged_after_passes, and argv records
(xN, to convergence) rather than a hard-coded (x2).

Swept all 22 fixtures for this: those two are the only ones. The other
seven whose bytes differ from a local rebuild are MacTeX 2026 references
being rebuilt with TeX Live 2025 — a different engine, not an unsettled
document — and each converges by the pass its sidecar claims.

Two tests cover the loop, and both fail against the old range(2)
(2 != 4, and a never-settling document silently producing a reference):
a late-settling document is run four times (three distinct, one to prove
the third was stable), and one that keeps asking for a rerun returns None
and writes nothing.

Harness tests 8 passed / 0 failed. pdflatex is an oracle only and is never
in the product path.

Two of the committed `reference.pdf` files were **two-pass builds of
documents that need three**, so the oracle we measure against was wrong
where it is easiest to be wrong: the page numbers in a table of contents.

| | committed | converged | wrong glyphs |
|---|---|---|---|
| `hyperref-toc` | `7758506be606` (pass 2) | `dfbfd4e366be` (pass 3 = pass 4) | **10** |
| `lmodern-report` | `319b433dcbc8` (pass 2) | `140f276b4a54` (pass 3 = pass 4) | **6** |

Every wrong glyph is a ToC or `\pageref` digit at the same position with a
different value — `hyperref-toc` listed a section that starts on page 2 as
page 1, on through "List of Figures" on page 3 that is on page 4. A
producer that got these *right* was scored as a mismatch.

`generate_reference` ran `for _pass in range(2)`. Neither the pass count
nor the rerun warning is the test:

- `hyperref-toc` pass 2 **does** warn ("Rerun to get"), and was written
  anyway;
- `lmodern-report` pass 2 warns about nothing at all, and its pass 3 is
  still a different document.

So the loop now runs until the PDF *stops changing* and pdflatex stops
asking, up to `MAX_ORACLE_PASSES` (6). A fixture that never settles is not
written at all and is reported — an unsettled reference is not a reference,
and silently keeping the last pass is how this got in.

`reference.json` gains `converged_after_passes`, and `argv` records
`(xN, to convergence)` rather than a hard-coded `(x2)`.

Swept all 22 fixtures for this: those two are the only ones. The other
seven whose bytes differ from a local rebuild are MacTeX 2026 references
being rebuilt with TeX Live 2025 — a different engine, not an unsettled
document — and each converges by the pass its sidecar claims.

Two tests cover the loop, and both fail against the old `range(2)`
(`2 != 4`, and a never-settling document silently producing a reference):
a late-settling document is run four times (three distinct, one to prove
the third was stable), and one that keeps asking for a rerun returns None
and writes nothing.

Harness tests 8 passed / 0 failed. pdflatex is an oracle only and is never
in the product path.

Implementation-Agent: Claude Opus 5 (Commander session, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)

Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

Co-authored-by: Claude Opus 5 <[email protected]>
@GoKubar
GoKubar merged commit 6eac0b6 into main Sep 14, 2026
9 of 20 checks passed
@GoKubar
GoKubar deleted the agent/kabir-claude/converged-references branch September 16, 2026 04:17
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