Skip to content

test(stylexswc/rs-compiler): keep the constant chain depths far from the stack limit - #1386

Merged
github-actions[bot] merged 2 commits into
developfrom
fix_constant_chain_depth_test
Nov 24, 2026
Merged

github-actions[bot] merged 2 commits into
developfrom
fix_constant_chain_depth_test

Conversation

@Dwlad90

@Dwlad90 Dwlad90 commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Description

The Release run 45480333425 failed on one job: "Test bindings on
x86_64-unknown-linux-musl - node@24.18.0". All other jobs passed. The
failed test is processStylexRules in a child process > answers as the reference for a constant chain of any depth.

The test used a chain of 5000 constants. This depth is near the point
where V8 runs out of stack. Past 256 links, the native code refuses the
chain and the reference runs. The export calls the reference from one
more stack frame than the npm package does. Near the limit, the export
overflowed with a RangeError and the npm package gave a sheet.

A sweep of --stack-size at depth 5000 shows the problem. At 1074 KB
only, the two answers are not the same. Below this value both overflow.
Above this value both give a sheet. The product code is correct. The
test depth was the problem.

Changes:

  • The test uses 1000 links in place of 5000. The reference resolves a
    chain of 1000 links at a stack of 300 KB to 2000 KB. A chain of 20000
    links overflows at 984 KB to 3000 KB.
  • Each depth also names its answer: sheet, or error RangeError at
    20000 links. Before, the test compared only the two answers.
  • The comment on MAX_CONSTANT_DEPTH said that V8 runs out of stack
    near 10,000 links. A new process runs out after approximately 4,500
    links. The comment now gives this number.

Fixes

No open issue. The failed job is in Release run 45480333425.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)
  • This change requires a documentation update

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • New and existing unit tests pass locally with my changes
  • I have read the CONTRIBUTING document

…the stack limit

The release job on x86_64-unknown-linux-musl with Node 24 failed. The
test for a deep constant chain used a chain of 5000 links. This depth
is near the point where V8 runs out of stack. Past 256 links, the
native code refuses the chain and the reference runs. The export calls
the reference from one more stack frame than the npm package does.
Near the limit, the export overflowed and the npm package gave a sheet.

The test now uses 1000 links in place of 5000. The reference resolves
this chain on all platforms. The chain of 20000 links overflows on all
platforms.

Each depth also names its answer, a sheet or a RangeError. Before, the
test compared only the two answers. If both sides overflowed at 1000
links, the test did not show it.
… chain

The comment on MAX_CONSTANT_DEPTH said that V8 runs out of stack near
10,000 links. With the default stack, a new process runs out of stack
after approximately 4,500 links. The comment now gives this number and
tells that it changes with the platform and the JIT tier.
@Dwlad90
Dwlad90 deployed to release-approval November 24, 2026 21:58 — with GitHub Actions Active
@Dwlad90
Dwlad90 deployed to changlog-approval November 24, 2026 22:00 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown
Contributor

Paired revision benchmark

Suite status: pass
Workflow conclusion: success
Candidate: 3323a1cce2efd0a2fe48a1b24317a99183bf788b vs base f7d36b356729badb42cdc5a5e24bada7b828ec51
Source workflow run

Fixture Category Point Lower Upper Status Notes
buttons-demo transform 0.994 0.990 0.996 pass
card transform 0.988 0.985 0.989 pass
consts transform 0.987 0.985 0.991 pass
counter transform 0.989 0.987 0.993 pass
counter-with-dynamic-styles transform 0.993 0.991 1.000 pass
global-tokens transform 0.998 0.995 1.000 pass
global-tokens-xs transform 1.013 1.004 1.023 pass
namespace-cleaning transform 1.006 1.000 1.010 pass
namespace-cleaning-no-unused transform 1.020 1.018 1.024 pass
page transform 0.995 0.993 0.997 pass
page-tsx transform 1.010 1.009 1.012 pass
page-with-keyframes transform 1.009 1.008 1.012 pass
spot-loader transform 1.002 1.000 1.006 pass
typography transform 1.018 1.015 1.022 pass
use-memo transform 0.978 0.974 0.982 pass
Performance - Colors StyleX transformation perf 0.989 0.986 0.993 pass
Performance - Basic theme transformation perf 0.998 0.995 0.999 pass
Performance - Complex theme transformation perf 0.994 0.990 0.998 pass
Performance - Basic create transformation perf 0.984 0.984 0.986 pass
Performance - Complex create transformation perf 0.969 0.967 0.971 pass
Debug data - lotsOfStyles.js (100 creates, dev) perf 0.997 0.995 1.002 pass
Rollup plugin - lotsOfStyles.js rollup 1.004 1.002 1.005 pass
Rollup plugin - lotsOfStylesDynamic.js rollup 1.010 1.003 1.015 pass
Feature - dynamic styles perf 0.997 0.993 1.000 pass
Feature - dynamic styles (dev) perf 0.997 0.991 0.998 pass
Feature - nested conditions perf 1.009 1.006 1.010 pass
Feature - nested conditions (dev) perf 1.004 1.000 1.007 pass
Feature - media queries perf 1.002 1.000 1.004 pass
Feature - media queries (dev) perf 1.007 1.003 1.013 pass
Feature - media query order perf 1.015 1.012 1.017 pass
Feature - media query order off perf 1.008 1.004 1.012 pass
Feature - keyframes and animations perf 1.005 1.002 1.009 pass
Feature - keyframes and animations (dev) perf 1.008 1.002 1.012 pass
Feature - theme tokens perf 1.002 1.000 1.004 pass
Feature - theme tokens (dev) perf 1.001 1.000 1.008 pass
Feature - logical and RTL perf 0.992 0.990 0.995 pass
Feature - logical and RTL (dev) perf 1.007 1.004 1.012 pass
Feature - CSS value normalization perf 0.999 0.998 1.003 pass
Feature - CSS value normalization (dev) perf 1.003 0.994 1.006 pass
Feature - view transitions perf 0.995 0.993 0.997 pass
Feature - view transitions (dev) perf 1.003 0.998 1.007 pass
Feature - token definitions perf 0.996 0.993 0.999 pass
Feature - debug mode over many namespaces perf 1.005 1.002 1.008 pass
Feature - unminified debug keys perf 1.002 0.994 1.006 pass
Feature - source text read from disk perf 1.007 1.002 1.013 pass
Feature - legacy shorthand expansion perf 0.996 0.990 0.999 pass
Feature - legacy value flipping perf 0.994 0.991 0.997 pass
Feature - font size px to rem perf 0.998 0.995 1.001 pass
Feature - props and attrs perf 0.997 0.995 1.001 pass
Feature - props and attrs (dev) perf 1.001 0.996 1.006 pass
Feature - debug data prop perf 1.000 0.995 1.005 pass
Feature - debug without the data prop perf 0.999 0.996 1.005 pass
Feature - debug mode and dev class names perf 1.004 1.002 1.007 pass
Feature - inlined conditional merge off perf 0.998 0.993 1.007 pass
Feature - runtime injection perf 1.002 1.001 1.005 pass
Feature - runtime injection at scale perf 1.007 1.002 1.014 pass
Feature - readable test class names perf 0.997 0.994 0.999 pass
Feature - stylex side effects injected perf 0.995 0.994 0.997 pass
Feature - source maps inline perf 0.998 0.996 1.004 pass
Feature - source maps without columns perf 1.004 1.000 1.006 pass
Feature - source maps without source text perf 1.004 1.001 1.008 pass
Feature - engine fold perf 1.000 0.993 1.001 pass
Feature - engine fold (dev) perf 1.005 0.993 1.008 pass
Feature - calls that do not fold perf 1.008 1.004 1.014 pass
Feature - calls that do not fold (dev) perf 1.001 0.999 1.004 pass
Feature - class name prefix perf 0.995 0.991 0.998 pass

@Dwlad90
Dwlad90 deployed to publish-approval November 24, 2026 23:11 — with GitHub Actions Active
@github-actions
github-actions Bot merged commit ddc9485 into develop Nov 24, 2026
67 checks passed
@github-actions
github-actions Bot deleted the fix_constant_chain_depth_test branch November 24, 2026 23:59

This branch was successfully deployed

3 active deployments
publish-approval — ddc94859 Deployed Nov 24, 2026 by Dwlad90 via Upload 0.20.2-rc.1 version to NPM / 📦 Publish #331
changlog-approval — ddc94859 Deployed Nov 24, 2026 by Dwlad90 via Approve changelog before publishing 0.20.2-rc.1 #331
release-approval — ddc94859 Deployed Nov 24, 2026 by Dwlad90 via Prepare release 0.20.2-rc.1 #331
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant