Deterministic transformation

Normalization rules

This section defines how Tropos and other producers transform source tool structures into Forma. These rules exist to ensure that equivalent source inputs yield equivalent Forma output.

Rule 1 · Stable identifiers

Node identifiers must be stable across re-exports when the source node identity is stable. Source ids may be mapped directly or normalized into a deterministic id function.

Rule 2 · Layout precedence

When a container can be represented as directional flow, producers must emit flex or stack rather than absolute. Absolute is a fallback, not a default.

Rule 3 · Token resolution

When a style value matches a declared token exactly, producers must emit the token reference. Literal values are only allowed when no stable token mapping exists.

Normalization areaRequired behaviorFallback
Parent-child structurePreserve logical hierarchy and child orderEmit issue if source structure is malformed
Component instancesNormalize reusable elements to component nodes with variant metadata when availableEmit as container with flag instance_unresolved
LayoutPrefer flex or stack for auto-layout-like patternsEmit absolute with layout_fallback
SpacingNormalize padding and gap into token references when availableEmit literal number or string
Semantic roleEmit the most specific justified roleEmit no role plus ambiguity issue
TextEmit text content on text nodesEmit issue if text content is missing

Role inference guidance

  • Use explicit source metadata first.
  • Then use normalized naming and component set semantics.
  • Then use layout, style, and child-pattern heuristics.
  • When uncertainty remains, omit role and emit an ambiguity issue.

Confidence scoring

Confidence reflects certainty in inferred fields, not overall document quality.

  • Explicit source semantics: high confidence
  • Pattern-based inference: medium confidence
  • Heuristic fallback: low confidence plus flags