Repository navigation
docs(knowledge): route a Word export in the knowledge pack - #1021
Merged
Merged
Conversation
The routing table answered layout and table questions but had no route for exporting to Word, so an agent asking how to write a .docx got the surfaces, which list buildDocx, export and the builder side by side without saying which to use or what each costs. Add the route export.docx: session.buildDocx(path) / writeDocx / toDocxBytes as the one call; a configured DocxSemanticBackend through session.export when the report or stable bytes are wanted; new DocxSemanticBackend() for Stable API only; buildPdf when the page must be read as laid out. It names the @beta parts and points at the render-docx README's usage. confirmedBy stays null until a maintainer confirms the recommendation.
session.export builds every byte before it writes, so a failed export keeps the old file too; what it lacks against buildDocx is a write that breaks part-way. Cite the byte-identical section for the platform caveat alone, and say the Stable path writes and throws as the configured one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
api-query --taskshad routes for layout and tables and none for exporting to Word. An agent asking how to write a.docxgot the surfaces, which listbuildDocx,DocumentSession.exportandDocxSemanticBackend.builder()side by side without saying which to use, what each costs, or which of them is@Beta.What changed
knowledge/routing/tasks.json— a new route,export.docx:session.buildDocx(path),writeDocx(stream)ortoDocxBytes()— one call, a default backend per export;buildDocxbuilds the bytes first and moves them over the file only on success. No report, and the package carries the export's date. Experimental in 2.5.session.export(DocxSemanticBackend.builder().deterministic(true).reportSink(...).build(), path)— the path therender-docxREADME settled on. The builder andDocxExportReportare@Beta; the bytes go straight over the file, so a write that breaks part-way can truncate it wherebuildDocxkeeps the old one; it throws a plainException; the bytes match on one platform, not across platforms, and a{date}header or footer token still changes them with the day unless-Dgraphcompose.renderDatepins it.session.export(new DocxSemanticBackend(), path), asdocs/api-stability.mdkeeps it.buildPdf.read:render-docx/README.md#usage. The prose also citesdocs/recipes/docx-export.md#byte-identical-output,#finding-out-what-the-export-could-not-carryanddocs/api-stability.md#1-stability-tiers;check-routesresolves each.confirmedBy: null— the mechanical checks pass, andapi-queryprints the route as not yet confirmed until a maintainer sets it. Noconstraints: no DOCX behaviour claim exists inknowledge/claims/index.jsonto point at.CHANGELOG.md— a 2.5 Documentation bullet.No Java, no public API, no generated file changed.
Verification
node knowledge/tools/routing/check-routes.mjs—6 routes hold up(was 5).node knowledge/tools/api-query/api-query.mjs --task export.docxprints the route.DocumentSession.*inauthoring;DocxSemanticBackend, its builder,DocxExportReport.notesinbackends).DocumentRenderingFacade.buildSemantic(bytes, thenAtomicFileOutput.write);DocxSemanticBackendwritingcontext.outputFile()withFiles.write;DocumentSession.exportthrows ExceptionagainstDocumentRenderingExceptionon the three convenience methods;DocxBackendProviderbuildingnew DocxSemanticBackend(), so the convenience methods keep live dates.docs:anchor, a broken prose anchor, a mis-cased page and an invented symbol —check-routesexits 1 namingexport.docxfor each of the 4.gate.sh(reactorclean verifyas CI runs it, the four JDK 17 knowledge checks, core javadoc, install and the examples tests) —GATE PASSonfad7dc370; the follow-up commit changes two sentences of route prose, re-checked withcheck-routes, the sabotage andcheck-claims.check-claims --check,check-stability-doc, and the routing and claims fixture suites pass;./mvnw test -pl :graph-compose-core -Dtest='com.demcha.documentation.*Test'— 173 tests, 0 failures.