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 area | Required behavior | Fallback |
|---|---|---|
| Parent-child structure | Preserve logical hierarchy and child order | Emit issue if source structure is malformed |
| Component instances | Normalize reusable elements to component nodes with variant metadata when available | Emit as container with flag instance_unresolved |
| Layout | Prefer flex or stack for auto-layout-like patterns | Emit absolute with layout_fallback |
| Spacing | Normalize padding and gap into token references when available | Emit literal number or string |
| Semantic role | Emit the most specific justified role | Emit no role plus ambiguity issue |
| Text | Emit text content on text nodes | Emit 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