From f356dc732961071015d72db51c500b949d108198 Mon Sep 17 00:00:00 2001 From: Edwin van den Houdt Date: Thu, 30 Jul 2026 07:47:25 +0200 Subject: [PATCH] fix(storybook): silence NODE_ENV DefinePlugin warning; revert CI memory cap to 4g .storybook/main.ts: webpack core's auto-DefinePlugin (from optimization.nodeEnv) and Storybook's own preset both define process.env.NODE_ENV on the same compile, triggering a "Conflicting values" warning even though both resolve to "development" locally. Disable the redundant one via webpackFinal. ci.yml: revert the storybook-a11y container's memory cap 6g -> 4g. The 6g bump was based on an unconstrained local RSS measurement (~5.8GB) that doesn't reflect real behavior under a cgroup cap. Verified directly: running this job's exact steps (npm ci, playwright install, build-storybook, test-storybook:ci) in `docker run --cpus=2 --memory=4g --memory-swap=4g node:24-bookworm` completes clean, no OOM, 62/62 suites passing. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/ci.yml | 10 +++++++--- .storybook/main.ts | 7 +++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 850f769..26e1f4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,13 +49,17 @@ jobs: # Hard resource ceiling so a runaway test-storybook (one headless Chromium per Jest # worker) can't OOM the runner host — it fails its own container instead. The real cap # is `--maxWorkers=2` in test-storybook:ci; this is the belt-and-suspenders guardrail. - # 6g (was 4g): build-storybook alone (compodoc + full Angular AOT build) measured ~5.8GB - # peak RSS locally, leaving too little headroom at 4g. + # 4g is enough: verified by running this job's exact steps (npm ci, playwright install, + # build-storybook, test-storybook:ci) in `docker run --cpus=2 --memory=4g + # --memory-swap=4g node:24-bookworm` locally — completes clean, no OOM. (An earlier + # unconstrained local RSS measurement of build-storybook alone suggested ~5.8GB was + # needed, but that number reflects what Node/V8 is willing to use when memory is + # plentiful, not what the job actually needs under a real cgroup cap.) # NB: requires the Gitea act_runner to allow container jobs (docker mode). If the runner # is host-only, drop this `container:` block and rely on the worker cap alone. container: image: node:24-bookworm - options: --cpus=2 --memory=6g --memory-swap=6g + options: --cpus=2 --memory=4g --memory-swap=4g timeout-minutes: 15 steps: - uses: actions/checkout@v4 diff --git a/.storybook/main.ts b/.storybook/main.ts index 12a3b69..d51adc7 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -17,5 +17,12 @@ const config: StorybookConfig = { // Serve the vendored CIBG package so preview-head.html can its CSS (and its // relative font/icon/image url()s resolve) — mirrors index.html for the real app. staticDirs: ['../public'], + // Webpack's own auto-DefinePlugin (from `optimization.nodeEnv`) and Storybook's preset both + // define `process.env.NODE_ENV` on the same compile, which webpack warns about as + // "Conflicting values" even though they resolve to the same string. Disable the redundant one. + webpackFinal: async (config) => { + config.optimization = { ...config.optimization, nodeEnv: false }; + return config; + }, }; export default config;