docs(errors): MissingBackendException is documented where it fires - #495
Conversation
An earlier pass moved the module READMEs, the root README and the exception's own Javadoc onto create(), and stopped at the repository root. Three documents under docs/ kept telling a reader to look at buildPdf(): the troubleshooting entry, the 2.0 migration guide and ADR 0016 — and the migration guide links straight into the troubleshooting entry, so the two reinforced each other. On a lean core the session never opens: create() resolves the font-metrics provider, because layout measures text before anything is drawn, and the stack trace points at the caller's create(). All three now name that call. The troubleshooting entry adds the one case that really does surface at the output call — buildPptx() when the PPTX backend is missing and the PDF one is not — and its heading no longer says "when rendering"; the single inbound anchor moves with it. MissingBackendContractTest carried the same confusion: one assertion wrapped create(), pageFlow(...) and toPdfBytes(), so only the first line ever ran while the test name promised the third. It is split, and a second case pins the other side of the boundary: configuring a document needs no backend, opening the session does. Also: the docs index described canonical-legacy-parity.md as a v1.5-era legacy matrix, which the document itself stopped being; and three of the four cross-references in the extension recipe pointed at extension-guide headings that had been renamed or renumbered, landing the reader at the top of the page. ./mvnw -B -ntp clean verify — BUILD SUCCESS, 692 tests in the closing module. MissingBackendContractTest 3 -> 4.
640faaa to
0e9fe93
Compare
|
Both points applied — the first one turned out to be a claim of mine that the code did not support.
One ordering detail worth recording, since it would make the test pass for the wrong reason: a document with no roots fails Old anchor preserved.
Head is now |
Why
On a lean
graph-compose-coreclasspath the session never opens.create()resolves the font-metrics provider — layout measures text before anything is drawn — so the exception fires there and the stack trace points at the caller'screate(), not at a render call. Reproduced by compiling a probe againstcore/target/classeswith no backend jar:BackendProviders:204 → :200 → :136 → DocumentSession:1163 → :114 → GraphCompose:457, with thetoPdfBytes()step never reached.CHANGELOG.mdrecords an earlier pass that put this right incore/README.md,render-pdf/README.md, the root README and the exception's Javadoc. It stopped at the repository root. Three documents underdocs/still sent the reader tobuildPdf(), and docs/migration/v2.0.0-modules.md links straight into the troubleshooting entry, so the two reinforced each other.What changed
create()and says why measurement is what needs the backend. Adds the one case that genuinely surfaces at the output call:buildPptx()when the PPTX backend is missing and the PDF one is present. The heading no longer says "when rendering"; its single inbound anchor, in the migration guide, moves with it. Also drops the version from "the lean 2.0 engine" — the artifact does not get renamed each minor.MissingBackendContractTest— one assertion wrappedcreate(),pageFlow(...)andtoPdfBytes(), so only the first line ever ran while the test name promised the third. That name is the likely origin of the wording in all three documents. Split intoopeningASessionWithoutABackendThrowsNamingRenderPdf, plusconfiguringADocumentDoesNotNeedABackendUntilTheSessionOpenswhich pins the other side of the boundary — a builder that resolved eagerly, or one that deferred pastcreate(), now fails.Two adjacent defects of the same class — a document pointing the reader somewhere it is not:
canonical-legacy-parity.mdas a "canonical (v1.5+) vs legacy compatibility matrix". The document was rewritten for the 2.1 line and says the surface it was measured against was removed in 2.0; the index entry had not moved.extension-guide.mdheadings that had since been renamed or renumbered, so the reader landed at the top of the page. One row was also mislabelled: "Add a render backend" linked at § 3, which is Add a render handler for an existing backend; the row it wanted is § 4. The missing handler row is added.Verification
./mvnw -B -ntp clean verify—BUILD SUCCESS, exit 0, 692 tests in the closing module.MissingBackendContractTest3 → 4.Anchor sweep over every
](…#…)link indocs/: 59 checked, and the three fixed here no longer resolve to a missing heading. A repo-widegrepfinds no remaining prose placing the exception at a render call.Known limit
The same sweep flags 15 same-file table-of-contents anchors in four files this PR does not touch (
roadmaps/migration-v1-5-to-v1-6.md,migration-v1-8-to-v1-9.md,templates/v2-layered/{authoring-presets,contributor-guide,using-templates}.md). Some are likely false positives — my checker does not reproduce GitHub's slug rules for em dashes — so I have not touched them blind. The existing link guard validates that the file exists, not the anchor; extending it and sweeping the results is worth its own change.Lane: docs + test. No production code, no public API.