You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(architecture): retarget the engine documentation to 2.x (#438)
The architecture pages still described the Entity/ECS engine removed in 2.0 and
a PPTX backend that "is roadmap for v1.6+". A reader following them reached for
`RenderStream`, `RenderPassSession`, `TextComponent`, `EntityManager`,
`ParentComponent`, `EntityBounds`, `ParentContainerUpdater`,
`LayoutTraversalContext`, `ComputedPosition`, `Breakable` and the packages
`engine.core` / `engine.pagination` — none of which exist on any live branch.
The release runbook called itself the 1.x checklist and pointed every command at
`aggregator/pom.xml` and `-pl .`, neither of which is the 2.x layout.
Rewrite the stale sections against the code as it is. `overview.md` drops the ECS
responsibilities section, names both fixed-layout backends in the pipeline and the
package list, and gains a PPTX leg in the diagram. That diagram also had the DOCX
edge in the wrong place: `DocxSemanticBackend.export` takes a `DocumentGraph`, so
it branches off the semantic tree, not off the resolved layout — which is exactly
why it cannot reproduce fixed-layout geometry.
`package-map.md` rebuilds the engine table from the live package list
(`components` / `debug` / `font` / `measurement` / `render` / `text`), splits the
render-docx and render-pptx row that claimed both were semantic exporters, and adds
the `document.backend.fixed.pptx` row. `lifecycle.md` loses its v1.2 title, gains
the PPTX render path, and states the chrome coverage per backend instead of calling
metadata and watermarks PDF-only. `pagination-ordering.md` describes the mechanism
that actually runs — a single sequential compile pass whose emission order is render
order — and its debugging steps now name the live pagination log events and
`layoutSnapshot()`.
The runbook becomes the 2.x checklist: the whole-reactor gate, the 13-pom lockstep
list taken from the script's own array, the real staging allow-list including the
per-module READMEs, and a branch-flow section describing the standing roles rather
than the completed 2.0 transition. It also records two traps that cost time this
cycle: a gate command ending in a pipe reports the pipe's status and hides
`BUILD FAILURE`, and after a version bump every goal resolving train modules from
`~/.m2` needs an `install` first.
Verified: full reactor `clean verify` green (1508 tests, 0 failures); no dead
engine identifier remains anywhere under docs/architecture.
Copy file name to clipboardExpand all lines: docs/architecture/lifecycle.md
+14-8Lines changed: 14 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Canonical Document Lifecycle
2
2
3
-
GraphCompose v1.2 follows the canonical session-first lifecycle:
3
+
GraphCompose follows a session-first lifecycle:
4
4
5
5
```text
6
6
GraphCompose.document(...)
@@ -9,7 +9,7 @@ GraphCompose.document(...)
9
9
-> semantic nodes
10
10
-> layout graph
11
11
-> layout snapshot or fixed backend render
12
-
-> PDF stream/bytes/file
12
+
-> PDF or PPTX stream/bytes/file
13
13
```
14
14
15
15
```mermaid
@@ -41,10 +41,12 @@ for layout, pagination, diagnostics, and rendering.
41
41
42
42
`DocumentSession` is mutable and not thread-safe. Create one session per document/request.
43
43
44
-
Advanced PDF-only options such as metadata, protection, watermark, headers,
45
-
and footers are configured through `PdfFixedLayoutBackend.builder()`. The
46
-
session convenience PDF methods expose only the common document-level options,
47
-
including guide-line overlays.
44
+
Backend-level tuning is configured through the backend builder —
45
+
`PdfFixedLayoutBackend.builder()` for PDF-specific options such as protection,
46
+
and `PptxFixedLayoutBackend.builder()` for PPTX-specific ones such as
47
+
deterministic output and the clip raster fallback. The backend-neutral chrome
48
+
(metadata, watermark, headers/footers) is set on the session itself and reaches
49
+
whichever backend renders, subject to the coverage noted in §5.
48
50
49
51
## 2. Authoring
50
52
@@ -78,9 +80,9 @@ snapshot.
78
80
79
81
Pagination happens during layout. Semantic nodes define whether they are atomic or splittable. Long paragraphs/lists can split into fragments; atomic blocks move to the next page when needed.
80
82
81
-
The lower-level ECS engine still has pagination helpers under `com.demcha.compose.engine.pagination` for internal tests, diagnostics, and backend/tooling work.
83
+
Pagination lives entirely in `LayoutCompiler` and the `NodeDefinition` split contracts under `com.demcha.compose.document.layout`. A node opts into keep-together or keep-with-next behaviour through its semantic flags; the compiler resolves the page break and emits the resulting `PlacedFragment` records.
82
84
83
-
## 5. Render
85
+
## 5. Render (PDF / PPTX)
84
86
85
87
`DocumentSession.writePdf(OutputStream)` renders the resolved layout graph through `PdfFixedLayoutBackend` and writes the PDF to a caller-owned stream without closing it. This is the preferred server path because the session does not keep a PDF byte-array cache.
`writePptx(OutputStream)`, `toPptxBytes()` and `buildPptx(...)` are the PowerPoint counterparts, resolved through the `"pptx"` provider when `graph-compose-render-pptx` is on the classpath. `PptxFixedLayoutBackend` consumes the **same** resolved layout graph — one page becomes one identically-sized slide, and fragments land at the same coordinates — then emits native POI XSLF shapes rather than a rasterised page.
100
+
101
+
The chrome options are backend-neutral, but coverage differs. Watermarks and repeating headers/footers apply to both backends; metadata applies to both, mapping onto OPC core properties for PPTX where the producer field has no equivalent. Protection, viewer preferences and the debug guide-line overlays are PDF concepts that the PPTX backend ignores with a one-time warning. See the [backend capability matrix](./backend-capability-matrix.md) for the per-capability breakdown.
102
+
97
103
## 6. Close
98
104
99
105
Always close the session, normally with try-with-resources. Closing releases measurement resources and clears request-local text measurement caches. It does not require consumers to manage PDFBox objects directly.
Copy file name to clipboardExpand all lines: docs/architecture/package-map.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,8 @@ ships them differs.
23
23
| --- | --- |
24
24
|`graph-compose-core`| The lean engine: `com.demcha.compose`, the canonical `document.*` authoring surface (`api` / `dsl` / `node` / `style` / `table` / `snapshot`), `document.showcase` (`FontShowcase`), the `document.backend.fixed` SPI seam, the public `document.backend.fixed.pdf.options` records, `document.layout`, `font.*`, and the internal `engine.*` foundation. |
25
25
|`graph-compose-render-pdf`| The PDFBox backend: `document.backend.fixed.pdf.**` (the `PdfFixedLayoutBackend` impl + handlers) and the `engine.render.pdf.**` render tree. Registers the PDF `FixedLayoutBackendProvider` / `FontMetricsProvider`. |
26
-
|`graph-compose-render-docx` / `graph-compose-render-pptx`| The POI semantic exporters — `document.backend.semantic.docx` / `.pptx`. |
26
+
|`graph-compose-render-pptx`| The POI XSLF backend: `document.backend.fixed.pptx.**` (the `PptxFixedLayoutBackend` impl + handlers), registering the `"pptx"``FixedLayoutBackendProvider`. Also carries the older `document.backend.semantic.pptx` manifest exporter. Depends on `graph-compose-render-pdf` for shared font measurement and the clip raster pass. |
27
+
|`graph-compose-render-docx`| The POI semantic exporter — `document.backend.semantic.docx`. |
27
28
|`graph-compose-templates`| The built-in preset families — `document.templates.**`. |
28
29
|`graph-compose-testing`| Consumer test support — `com.demcha.compose.testing.**`. |
29
30
|`graph-compose`| Back-compat wrapper: an empty jar over `graph-compose-core` + `graph-compose-render-pdf`. |
@@ -54,6 +55,7 @@ per-package artifact.
54
55
|`com.demcha.compose.document.layout` (`@Internal` at package level) | Semantic layout compiler, node definitions, fragments, split/measure contracts, and layout graph. |`NodeDefinition` is `@Beta` — Extension SPI for custom node types. New node behavior must be deterministic and covered by layout or render tests. |
55
56
|`com.demcha.compose.document.backend.fixed`| Backend-neutral fixed-layout rendering contract. | Keep it independent from PDFBox and semantic template data. |
56
57
|`com.demcha.compose.document.backend.fixed.pdf`| Canonical fixed-layout PDF backend, fragment handlers, PDF-specific options, and PDF-backed measurement resources. | Keep PDFBox lifecycle internal; normal callers should use `DocumentSession` and default PDF convenience methods. |
58
+
|`com.demcha.compose.document.backend.fixed.pptx` (`@Beta` at package level) | Fixed-layout PowerPoint backend — `PptxFixedLayoutBackend`, its provider, deterministic writer, embedded-font and clip support, plus the `.handlers` fragment handler set. Consumes the same resolved `LayoutGraph` as the PDF backend. | Keep POI XSLF lifecycle internal. Any capability change must update [backend-capability-matrix.md](./backend-capability-matrix.md) in the same commit. |
57
59
|`com.demcha.compose.document.dsl.internal`| Internal helpers for public DSL builders such as semantic name normalization and builder callback application. | Do not expose these helpers in examples; move reusable authoring concepts to public builder classes instead. |
58
60
|`com.demcha.compose.document.backend.semantic`| Experimental semantic export contracts for non-fixed outputs. | Keep exporters separate from PDF fixed-layout rendering. |
59
61
|`com.demcha.compose.document.debug`| Snapshot/debug adapters for canonical layout graph inspection. | Debug output should be deterministic and safe for tests. |
@@ -62,9 +64,9 @@ per-package artifact.
62
64
63
65
| Package | Responsibility | Extension rule |
64
66
| --- | --- | --- |
65
-
|`com.demcha.compose.engine.components.*`|Low-level ECS components, content payloads, style values, geometry, layout, and render markers. | Use only for engine primitives; public document authoring should go through `DocumentDsl` and semantic nodes. |
66
-
|`com.demcha.compose.engine.core`|Entity manager, canvas, traversal context, and base ECS system contracts.|Keep core thin; put stage-specific logic in layout, pagination, measurement, or render packages. |
67
-
|`com.demcha.compose.engine.pagination`|Pagination markers and helpers (`Breakable`, `ParentContainerUpdater`, `Offset`). |Maintain child-first ordering and page-shift propagation rules. |
67
+
|`com.demcha.compose.engine.components.*`|Engine content payloads and their caches — decoded image data and intrinsic sizes, barcode payloads, and the shared bounded LRU cache behind them. | Use only for engine primitives; public document authoring should go through `DocumentDsl` and semantic nodes. |
68
+
|`com.demcha.compose.engine.debug`|Layout snapshot value types (`LayoutSnapshot`, `LayoutNodeSnapshot`, `LayoutCanvasSnapshot`, `LayoutInsetsSnapshot`) behind `DocumentSession.layoutSnapshot()`.|Snapshot output must stay deterministic — it is a regression-test contract. |
69
+
|`com.demcha.compose.engine.font`|Backend-neutral font abstraction: `Font`, `FontBase`, `FontLineMetrics`. |Backends implement the seam; the catalogue and lookup live in the public `com.demcha.compose.font`. |
68
70
|`com.demcha.compose.engine.measurement`| Text measurement contracts and font-backed implementations. | Builders/layout helpers depend on this seam instead of reaching into renderers. |
|`com.demcha.compose.engine.render.pdf`| Shared PDFBox primitives for the canonical fixed-layout backend: `PdfFont`, `GlyphFallbackLogger`, and the header/footer + watermark renderers under `helpers`. | Add canonical-shared PDF support here; per-fragment PDF drawing lives in the `PdfFragmentRenderHandler` implementations under `document.backend.fixed.pdf.handlers`. |
0 commit comments