Skip to content

feat: metadata#174

Open
hampsterx wants to merge 1 commit intoBetterment:mainfrom
nuimarkets:metadata-feature
Open

feat: metadata#174
hampsterx wants to merge 1 commit intoBetterment:mainfrom
nuimarkets:metadata-feature

Conversation

@hampsterx
Copy link

@hampsterx hampsterx commented Feb 8, 2026

Description

  • Adds optional JSON metadata generation alongside golden PNG files, providing exact pixel bounds and semantics
    tree data for each scenario
  • Two new config flags: metadataEnabled (bounds) and semanticsEnabled (accessibility tree) — both default
    to false, fully backwards-compatible
  • Addresses upstream issue #171 (semantics testing)

Motivation

Golden tests output PNG images with scenarios in a grid, but row heights vary and there's no programmatic way
to query scenario positions or accessibility data. This makes reliable cropping require OpenCV or manual
calculation (8-50px error). The metadata JSON gives exact coordinates from Flutter's layout engine and
optionally the semantics tree for accessibility testing.

Key decisions

  • Config lives on AlchemistConfig, not per-variant GoldensConfig — metadata is orthogonal to rendering
    options, and JSON path derives from goldenPath (already per-variant)
  • Captures before whilePerforming — bounds are stable regardless of interaction, semantics reflect
    resting state
  • Coordinates are logical pixels at devicePixelRatio 1.0 — maps directly to PNG pixels, no scaling needed

Type of Change

  • [x ] ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@hampsterx hampsterx changed the title metadata feature feat: metadata Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant