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
Copy file name to clipboardExpand all lines: docs/adapter-model.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,6 +91,16 @@ The `af design drift` command compares component data across available surfaces:
91
91
92
92
Drift findings use **corroboration rules** to filter noise: a story-derived variant is only reported if (1) the variant axis maps to a real prop, (2) the value appears in the prop's type definition. Findings carry `confidence: 'high'` (constrained union match) or `'low'` (unconstrained type like `string`).
93
93
94
+
#### Normalization Layer (Phase 16D)
95
+
96
+
Before comparison, surface snapshots pass through a **deterministic normalization layer** (`crossSurfaceDrift/normalize.ts`) that:
97
+
98
+
1.**Filters design-only fields** from Figma (e.g., `fills`, `cornerRadius`, `width`, `height`) that have no API-level counterpart
3.**Deduplicates** props that collide after renaming
101
+
102
+
This eliminates false-positive drift caused by naming differences between surfaces. The normalization config is deterministic and configurable via `NormalizationConfig` — see [architecture-reference.md](architecture-reference.md) for full details.
103
+
94
104
## Detailed Reference
95
105
96
106
The full adapter model, including MCP transport configuration, tool policies, and Phase 16A/16B/16C implementation details, is documented in [architecture-reference.md](architecture-reference.md).
Echo suppression prevents feedback loops when AST writes trigger file save events.
564
565
@@ -5589,6 +5590,62 @@ Props are extracted from `reactDocgen` metadata via `extractProps()` in `storybo
5589
5590
5590
5591
`demo-app/src/DemoButton.tsx` and `demo-app/src/stories/DemoButton.stories.tsx` provide a minimal component with typed props and matching Storybook stories for verifying drift analysis end-to-end.
Different surfaces use different names for the same concepts, causing false-positive drift findings. Phase 16D adds a **deterministic, configurable normalization layer** that aligns equivalent concepts before comparison.
The default config (`DEFAULT_NORMALIZATION_CONFIG` in `normalize.ts`) handles the DemoButton demo. Custom configs can be passed via `DriftAnalysisOptions.normalizationConfig` for per-project overrides.
5634
+
5635
+
#### Traceability
5636
+
5637
+
Normalization is fully explainable:
5638
+
5639
+
-**`SurfaceProp.normalizedFrom`**: When a prop is renamed (e.g., `State` → `variant`), the original name is preserved in `normalizedFrom`
5640
+
-**`CrossSurfaceDriftReport.normalization`**: The report includes metadata listing all applied alias rules and excluded design-only props, with surface attribution
5641
+
5642
+
#### Design Decisions
5643
+
5644
+
- Normalization runs **before** comparison, transforming snapshots rather than patching findings. The existing `comparePropInventory` and `compareVariantCoverage` functions require zero changes.
5645
+
- Design-only filtering applies only to the Figma surface — if Code/Storybook happens to have a prop named `fills`, it is not filtered.
5646
+
- Alias matching is case-insensitive but the canonical name is always lowercase.
5647
+
- The `strategy: 'tag'` option (alternative to `'exclude'`) is defined but not yet implemented — it would keep design-only props but mark them for separate "visual drift" reporting.
0 commit comments