Skip to content

Consolidate API doc toggle, harden build memory, and fix OpenAPI client bundle#1490

Draft
gavinelder wants to merge 12 commits into
masterfrom
chore/build-mem-probe-and-api-toggle
Draft

Consolidate API doc toggle, harden build memory, and fix OpenAPI client bundle#1490
gavinelder wants to merge 12 commits into
masterfrom
chore/build-mem-probe-and-api-toggle

Conversation

@gavinelder
Copy link
Copy Markdown
Contributor

@gavinelder gavinelder commented May 27, 2026

Summary

Three related build/config improvements for the docs site, plus a regression fix for the OpenAPI client bundle.

1. Fix OpenAPI client bundle (regression from #1406)

#1406 bumped postman-code-generators 2.1.0 → 2.1.1, which removed path as a dependency (per its changelog). The OpenAPI docs theme statically bundles postman-code-generators (all 35 language codegens) + postman-collection into the client bundle for the API Explorer code snippets, where they require('path') (and url). Webpack 4 auto-polyfilled Node core modules; Rspack/Webpack 5 do not — so once the userland path package was dropped, any build including platform-api failed at client compile with Can't resolve 'path'.

Fix: openApiNodePolyfillsPlugin adds resolve.fallback mapping path/url/buffer to browser polyfills and stubbing Node-only modules. Inert when platform-api is excluded.

2. Consolidate API docs behind a single EXCLUDE_PLATFORM_API lever

EXCLUDE_PLATFORM_API now gates all three consumers of platform-api-docs/docs together: the API content-docs plugin, the OpenAPI preset, and the (previously ungated) llms-api plugin. Adds an envFlag() helper so "false"/"0"/"" read as not excluded — previously the bare truthiness check treated the string "false" as true. Removes the now-redundant EXCLUDE_PLATFORM_OPENAPI var (and its entry in check-netlify-excludes.sh).

3. Harden build memory

  • Recycling SSG worker pool: enable future.experimental_faster.ssgWorkerThreads and tune via env (4 workers, recycle past ~1.5 GB, task size 8). Parallelizes SSG across the build VM's cores and bounds peak memory by recycling workers between tasks. Replaces the prior inert DOCUSAURUS_SSG_WORKER_THREAD_COUNT=1 (which left SSG running inline in a single process).
  • DISABLE_RSPACK_INCREMENTAL: drops Rspack incremental-compilation state to trim peak bundler memory (no downside on cold CI builds).

Validation (build VM: 6 vCPU, ~10.7 GiB, Firecracker — no cgroup cap)

  • Lean-scope preview (API offloaded) builds green with large headroom.
  • Full-scope build (incl. API) peaks at 100% of the VM and OOMs (137) during Rspack bundling, even with the polyfill fix + incremental disabled. So building everything in one site is not viable on the current VM — the platform-api offload to seqera-docs-api (via the non-forced /platform-api/* proxy) remains load-bearing. The polyfill fix unblocks API builds on the API site's toolchain / a larger VM.

Follow-ups (not in this PR)

  • Delete the now-inert EXCLUDE_PLATFORM_OPENAPI env var in the Netlify UI; confirm whether EXCLUDE_PLATFORM_API is also pinned there (UI overrides netlify.toml).
  • Promote path-browserify/url/buffer from transitive to explicit package.json deps so a future bump can't drop them (exactly the chore: update dependency postman-code-generators to v2.1.1 #1406 failure mode).
  • Optional: evaluate a larger (~16 GiB) Netlify build instance to retire the API offload entirely.

Related: #1406 (introduced the OpenAPI path regression this addresses)

🤖 Generated with Claude Code

Add a temporary diagnostic to the Netlify build command that logs the
container's real cgroup memory cap (the value that triggers 137 OOM kills)
alongside the misleading host view, so SSG concurrency/threads can be tuned
against the true limit.

Also consolidate API documentation behind a single EXCLUDE_PLATFORM_API
lever: it now gates the API content plugin, the OpenAPI preset, and the
llms-api plugin together (all read from platform-api-docs/docs). Adds an
envFlag() helper so "false"/"0"/"" read as not-excluded instead of being
truthy strings, and drops the now-redundant EXCLUDE_PLATFORM_OPENAPI var.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 27, 2026

Deploy Preview for seqera-docs ready!

Name Link
🔨 Latest commit 5ad480d
🔍 Latest deploy log https://app.netlify.com/projects/seqera-docs/deploys/6a18ab70a3a00b00083c9220
😎 Deploy Preview https://deploy-preview-1490--seqera-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@gavinelder gavinelder marked this pull request as draft May 27, 2026 21:34
gavinelder and others added 6 commits May 27, 2026 22:38
The build runs on a Firecracker MicroVM with ~10 GiB dedicated RAM and
6 vCPUs (confirmed via the build-resource probe), so the previous inline
single-process SSG left 5 cores idle and squeezed rendering into one 4 GB
heap — the likely source of intermittent OOMs.

Enable future.experimental_faster.ssgWorkerThreads and tune the pool via
env vars: 4 workers, recycle past ~1.5 GB, task size 8. Peak ≈ 7-8 GB,
under the VM's ~10 GiB, with the recycler freeing retained memory between
tasks. Also corrects the stale netlify.toml comment (the old 137 kills came
from the 32-thread default, not from limits being "unenforced").

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Stop excluding platform-api, platform-cli, and wave from deploy-preview
builds so previews exercise the full, heavy build — the real OOM stress
case for the new recycling SSG worker pool. Building platform-api locally
also makes the non-forced /platform-api/* proxy fall through to the built
pages, so previews are self-contained rather than pulling that section
from the production API site.

Replace the start-only memory probe with internal/build-mem-probe.sh,
which samples MemAvailable throughout the build and reports the peak
pressure point — the metric that actually validates the build fits under
the VM's ~10 GiB. Temporary; revert once validated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Validation on PR #1490 confirmed a full-scope build OOMs (137) during
Rspack bundling on the ~10 GiB build VM — well before SSG runs — so the
platform-api/cli/wave exclusions are load-bearing, not optional. Restore
the known-good lean preview scope (exclude API, CLI, Wave) and remove the
temporary build-mem-probe.sh and its build.command override.

Kept: the recycling SSG worker pool (helps the SSG phase of the in-scope
build) and the EXCLUDE_PLATFORM_API consolidation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Re-enable full-scope preview build and set DISABLE_RSPACK_INCREMENTAL to
test whether dropping Rspack's incremental-compilation state brings the
full build under the ~10 GiB VM (it OOM'd at 137 during bundling without
it). Re-add a finer 1s memory sampler that records peak used and the ramp
tail, since the previous 3s sampler missed the spike.

Temporary experiment on PR #1490 — revert scope/probe once measured.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The OpenAPI docs theme statically bundles postman-code-generators (all 35
language codegens) and postman-collection into the client bundle for the
API Explorer code snippets. These reference Node core modules (path, url,
…) that Webpack 4 auto-polyfilled but Rspack/Webpack 5 do not, so building
with platform-api included failed at client compile ("Can't resolve
'path'"). This is why the API docs build only on the older seqera-docs-api
toolchain and not the main Rspack site.

Add openApiNodePolyfillsPlugin: resolve.fallback maps path/url/buffer to
browser polyfills and stubs Node-only modules. Re-enable full scope on the
preview to test end-to-end.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Full-scope validation on PR #1490 concluded: even with the OpenAPI Node
polyfill fix and DISABLE_RSPACK_INCREMENTAL, a build including platform-api
peaks at 100% of the ~10.7 GiB build VM and OOMs (137) during Rspack
bundling. Building everything in one site isn't viable on the current VM.

Restore the lean preview scope (exclude API/CLI/Wave) and remove the
temporary probe and build.command override.

Kept as latent/safe improvements: the OpenAPI polyfill plugin (inert when
API is excluded; unblocks API builds on a larger VM or the API site's
toolchain), DISABLE_RSPACK_INCREMENTAL (trims peak, no cold-build downside),
and the recycling SSG worker pool.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gavinelder gavinelder changed the title chore: build-memory probe + consolidate API doc toggle Consolidate API doc toggle, harden build memory, and fix OpenAPI client bundle May 27, 2026
gavinelder and others added 4 commits May 27, 2026 23:23
These browser polyfills back the OpenAPI client-bundle fix
(openApiNodePolyfillsPlugin) but were only present transitively. Pin them
as explicit dependencies so a future transitive bump can't silently drop
them — the exact failure mode that broke the build in #1406, when
postman-code-generators 2.1.1 removed its bundled `path` dependency.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The changelog blog gate still used the raw `process.env.EXCLUDE_CHANGELOG ?`
truthy check while every other EXCLUDE_/INCLUDE_ gate (and the diagnostic
log) had moved to envFlag(). That left the "false"-is-truthy trap in one
spot: EXCLUDE_CHANGELOG="false" would disable the changelog while the log
reported it included. Use envFlag() so all flags read consistently.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Trim build-config comments to state what the code does, not how it got
there: drop session/PR narrative ("confirmed on PR #1490", "measured",
"historical 137 kills", "now gates", "instead of inline"). Rationale that
explains a non-obvious choice (envFlag's "false"-is-truthy guard, the
OpenAPI Node polyfills) is kept; transition history belongs in the PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@justinegeffen justinegeffen added 1. Editor review Needs a language review 1. Dev/PM/SME Needs a review by a Dev/PM/SME dependencies Pull requests that update a dependency file labels May 28, 2026
Signed-off-by: Chris Hakkaart <chris.hakkaart@seqera.io>
@christopher-hakkaart
Copy link
Copy Markdown
Member

This all makes sense to me. A single EXCLUDE_PLATFORM_API will help a lot. I'd check what's in the Netlify UI as (if I remember correctly) it might need to be updated as well to add the new variable at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Dev/PM/SME Needs a review by a Dev/PM/SME 1. Editor review Needs a language review dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants