Expand description
LayoutTreeIR — canonical, deterministic intermediate representation of XFA layout state.
This module is part of M1 (Observability Foundation). It exists so that XFA fidelity debugging can reason about a stable, snapshottable tree of layout decisions instead of comparing rasterised PDFs page by page.
§Design constraints
- No new dependencies. All types are plain Rust; the canonical-JSON
serializer in
canonical_jsonis hand-rolled and uses onlystd. - Deterministic by construction. The IR has no
HashMap/HashSet, noInstant::now, no RNG, and no process-id leakage. Children are ordered by an explicitVec. Object keys in the JSON output are emitted alphabetically. Floats are formatted with fixed precision. - Off by default. Constructing an IR is opt-in: the engine never builds one unless a caller asks for it. There is no global state.
- Stable schema.
SCHEMA_VERSIONis part of the JSON output. Field additions bump the version; field renames bump the major (when we ever ship a v2). v1 is intentionally minimal.
§Out of scope (M1 v1)
- Population from a real XFA pipeline. v1 ships the data types, a
deterministic serializer, and a synthetic-fixture snapshot harness.
Wiring the engine to populate
LayoutTreeIRfrom a realflatten_xfa_to_pdfcall is deferred to a follow-up. - Renderer state, font tables, PDF object refs. The IR sits before rasterisation; it captures what the engine decided, not what was drawn.
Re-exports§
pub use version::SCHEMA_VERSION;
Modules§
- canonical_
json - Canonical, deterministic JSON output for
crate::ir::LayoutTreeIR. - version
- Schema version for the LayoutTreeIR.
Structs§
- Layout
Node - One node in the layout tree IR.
- Layout
Node Id - Deterministic identifier for a layout node, derived from its position in the tree (sequence of child indices from the root).
- Layout
TreeIR - Top-level IR document.
Enums§
- Field
KindIR - Field-specific kind tag for nodes whose
NodeKindisField. - Node
Kind - Kind of a layout node in the IR.
- Overflow
State - Overflow / split state of a node at IR-capture time.
- PresenceIR
- Visibility/presence state.