Skip to main content

Module ir

Module ir 

Source
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_json is hand-rolled and uses only std.
  • Deterministic by construction. The IR has no HashMap/HashSet, no Instant::now, no RNG, and no process-id leakage. Children are ordered by an explicit Vec. 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_VERSION is 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 LayoutTreeIR from a real flatten_xfa_to_pdf call 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§

LayoutNode
One node in the layout tree IR.
LayoutNodeId
Deterministic identifier for a layout node, derived from its position in the tree (sequence of child indices from the root).
LayoutTreeIR
Top-level IR document.

Enums§

FieldKindIR
Field-specific kind tag for nodes whose NodeKind is Field.
NodeKind
Kind of a layout node in the IR.
OverflowState
Overflow / split state of a node at IR-capture time.
PresenceIR
Visibility/presence state.