Invalid variable longhands must unset earlier padding and margin shorthands
perfloop-oss/satori · Uncatalogued performance
https://perfloop.ai/t/oss/case_6zf6egt28r
Verdict
VERIFIED · settled 2026-11-14 · pull request opened as vercel/satori#966
What happened: The check fails before this change and passes with it.
Hypothesis
A padding or margin longhand that becomes invalid after variable substitution can leave an earlier shorthand value active. This contradicts the intended unset behavior and can change rendered spacing. This is a correctness repair request, not a claimed performance gain; prevalence is unknown.
expand documents at lines 1224–1226 that an invalid computed value behaves as unset, but lines 1227–1233 merely continue. If an earlier shorthand already wrote that longhand into serializedStyle, its value remains. With ROOT_STYLE and the supported inline declarations { padding: '1px', paddingLeft: 'var(--missing)' }, compute leaves LayoutNode.style.paddingLeft equal to 1. The reference containing only the other three 1px padding sides has the required initial left padding of 0. README.md marks CSS variables supported and says supported features behave as in browsers.
checkProperty(prop_ddj5wag0f5), run call_VraOAyQTf0Zjgm3j8TGPlUSF, ran pnpm test test/perfloop-expand-fallback.test.ts --threads=false and exited 1 on an assertion, not setup. Its complete finite search covered 480 combinations of padding/margin, four sides, three positive lengths, five missing/initial/empty var()/env() values, both encounter orders and both color modes. It reported 240 mismatches and returned test/perfloop-expand-fallback.replay.json containing the two-declaration witness above. This witness needs no inherited or local custom properties, external assets or timing assumptions. The existing fallback examples still passed.
The next useful check is the deterministic replay followed by a public satori render of the same spacing case. The repair should establish unset behavior for the affected declaration and preserve later valid shorthand overrides and explicit fallbacks. The test placement is provisional; the requested outcome is correct normalized and rendered spacing, not a particular checker implementation.
The inspected upstream change https://github.com/vercel/satori/pull/959 concerns shadow parsing, and https://github.com/vercel/satori/pull/964 concerns accepted border-length units. Neither changes computed-variable invalidation. The full current open-PR listing contained no matching repair. Targeted prior-repair searches found no match. Older file history and the contribution guide's GitHub Discussions venue could not be searched successfully because the checkout is shallow and bounded HTTP reads were refused; those remain named overlap gaps.
Change to test: Apply unset semantics to the affected padding and margin properties when variable resolution invalidates a declaration, instead of leaving earlier shorthand output active. Preserve encounter-order overrides and valid explicit fallbacks; the stored Vitest replay is a provisional regression method.
Where it lives
perfloop-oss/satori · src/satori.ts
Evidence
The check fails before this change and passes with it: `For missing, guaranteed-invalid, or empty var()/env() substitutions, padding and margin normalize and render with initial spacing; border longhands and shorthands, inset sides, gaps, padding and margin shorthands, corner shorthands, font synthesis, mask and wrapping aliases, background clipping, overflow clip margins, aspect ratios, and backdrop filters unset the affected declaration rather than retain earlier values. Public SVGs and layout rectangles match Chromium computed styles in the enumerated cases, with both encounter orders, explicit fallbacks, local and inherited variables, all four spacing sides, and 24px and 32px text cards.`
Checks: 2 of 2 passed. Verification: no defect found.
Timeline
2026-11-10· Case opened2026-11-10· PR opened