Skip to content

fix(codegen): center lone in-flow space-between children - #46

Merged
owjs3901 merged 3 commits into
mainfrom
integration/lone-child-align
Sep 13, 2026
Merged

owjs3901 merged 3 commits into
mainfrom
integration/lone-child-align

Conversation

@owjs3901

Copy link
Copy Markdown
Contributor

Figma centers the only in-flow child of a SPACE_BETWEEN auto-layout. CSS flexbox has nothing to space between and parks that child at the start. Every such node was therefore generated in the wrong place - this is a general mismatch between the two layout models, not a property of any one design.

The keyframes screen made it visible because it is 64px across and built from single-dot wrappers: a 2px dot Figma draws at x=5 inside a 12px box was drawn at x=0. The same wrappers recur on the notice desktop frame, which is why that improved too without being targeted.

Screen Before After
keyframes-458-2021 6.71% 2.69%
notice-422-6865 2.20% 1.88%

Every other screen is byte-identical.

The condition

Horizontal or vertical layout, primaryAxisAlignItems == SPACE_BETWEEN, and exactly one child that is both visible and not absolutely positioned - hidden and absolute children take no part in distribution and must not be counted. No node id, no viewport, no breakpoint, no constant fitted to this capture.

The source map gains derived-lone-child-center rather than reusing an existing label, and its published description says which fields decide the count and that this is a layout-semantics correspondence, not a claim of pixel parity.

A theory retired with evidence

This screen was assumed to be unmeasurable because it animates and Figma's reference is a still. That is false: the harness index.html disables animations, the capture shows zero active animations, and the divergence is entirely static. The emitted root translation was also checked against the plugin's getReactionProps answer and matches. docs/keyframes-static-alignment.md records this, so nobody re-runs that theory.

What remains

110 pixels, all circle edges. The report names fractional paint origins and edge coverage as the next lead rather than guessing. No threshold was moved for it.

Verification

Measured independently in the main checkout with binaries built from main and from this branch, full 15-screen acquire and render on each side. My figures match the worker's to the decimal.

All 268 plugin byte-parity goldens unchanged. Korean keep-all untouched. Only the two measured thresholds lowered.

Gates: fmt 0, clippy --locked --workspace --all-targets --all-features -D warnings 0, cargo test --workspace 1074 passed / 0 failed / 2 ignored, insta --check no drift.

Process note

The first pass on this screen ended in a failed outcome because the worker asked whether a layout-field fix was in scope - my spec had scoped it to animation fields - and my reply did not arrive across two ten-minute waits. That is the second time this cycle. The follow-up spec now pre-authorises any fix that is proven from collected node data, general rather than capture-specific, and outside the off-limits list, so a worker no longer has to block on me for the answer that has been yes every time.

@owjs3901
owjs3901 merged commit dc99142 into main Sep 13, 2026
8 checks passed
@owjs3901
owjs3901 deleted the integration/lone-child-align branch September 13, 2026 07:26
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