Skip to content

fix: Node 24 + resolve API history PR versions - #1195

Merged
dsanders11 merged 1 commit into
mainfrom
fix/api-history-versions-node-24
Aug 18, 2026
Merged

fix: Node 24 + resolve API history PR versions#1195
dsanders11 merged 1 commit into
mainfrom
fix/api-history-versions-node-24

Conversation

@erickzhao

Copy link
Copy Markdown
Member

What

API history tables rendered Version(s): None for every entry in local development. Three independent causes; all three had to be fixed to see a populated table.

Why it was broken

src/transformers/api-history.ts gates its GitHub Actions artifact fetch on an env var, and:

  1. The variable name didn't match anything. The code read GH_TOKEN; .env.example documented GITHUB_TOKEN, which nothing read.
  2. .env was never loaded by yarn start/yarn build — only scripts/update-crowdin-glossary.ts called dotenv.config(). A token placed in .env was silently ignored.
  3. Rspack 1.7.11 panicked under Node 24 on a clean start, so even a correct setup couldn't build:
    panicked at crates/rspack_core/src/module_graph/mod.rs:722:26:
    ModuleGraphModule with identifier ... useDocusaurusContext.js not found
    
    The same bug produced four Timed out waiting for API structure content MDX failures, breaking app.md and webview-tag.md.

There's also a stale-cache trap: the tokenless run eagerly compiles all docs, and the cached MDX output persists. Adding a token changes nothing until yarn clear and rm -rf node_modules/.cache. This is what made the token look like a red herring.

Changes

Standardize on GITHUB_TOKEN — every mapping is now an identity mapping (GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}) with nothing to translate. This matches the pre-existing majority convention (semantic.yml, update-docs.yml); GH_TOKEN was the minority in three places. Safe for the two gh-CLI callers, since gh reads GITHUB_TOKEN natively and GH_TOKEN only wins when both are set.

Load .env from docusaurus.config.ts — existing env vars still win, so CI is unchanged.

Bump Rspack 1.7.11 → 1.7.12 via yarn set resolution, so the change is yarn.lock-only; @docusaurus/faster already allows ^1.7.10. All 11 platform bindings bumped, so CI's linux-x64-gnu is covered.

Node 22 → 24.19.0 (LTS "Krypton") in .nvmrc and engines.node, now that Rspack no longer panics.

Better failure message — names the variable and states the consequence, so a stale GH_TOKEN in a shell yields a greppable pointer instead of silently empty tables.

Verification

Check Result
yarn build on Node 24.19.0 exit 0, 454 pages
Built HTML docs/latest/api/image-view contains >=37.0.0 and ^36.4.0
app/index.html (previously a hard failure) 321 KB, builds fine
Rspack panics / MDX timeouts 0 (were 1 and 4)
yarn install --immutable exit 0, lockfile stable
tsc --noEmit / oxlint / oxfmt --check 0 errors; 249 tracked files clean
Missing-token path warns correctly, does not throw
Type stripping (node ./scripts/pre-build.ts) works on 24 (stable there, vs experimental on 22)

Reviewer notes

  • Breaking for local setups: anyone with GH_TOKEN exported will see tables go empty until they switch to GITHUB_TOKEN. The warning tells them what to do.
  • Rspack 2.x is available upstream but unusable here — no released Docusaurus supports it (3.10.2 still pins ^1.7.10). Going to true latest would mean overriding a major past declared compatibility.
  • The Rspack pin lives in yarn.lock. Regenerating the lockfile from scratch could lose it and reintroduce the Node 24 panic. Happy to move it to a resolutions block in package.json if you'd prefer that guarantee.
  • resolve-pr-release-versions.yml and audit-docs-version.yml keep hardcoded Node versions because neither job has an actions/checkout step, so .nvmrc isn't on disk and node-version-file would fail. These two are the ones that will drift on the next bump. The other six setup-node steps follow .nvmrc automatically.

Not addressed (pre-existing, happy to file separately)

  • pull-request.yml never builds the site (lint only), so this code path has no PR coverage — which is why a regression here reaches main unnoticed.
  • Shared-state mutation in api-history.ts:244/:277: the object copy shares value references with the module-level cache, and backports.splice() mutates while iterating .entries(). Release resolution happens to be idempotent so I saw no wrong output, but it's fragile.
  • Inconsistent failure modes: a missing token warns silently, while a non-OK HTTP response throws and fails the build.

🤖 Generated with Claude Code

API history tables rendered "Version(s): None" for every entry during local
development. The transformer gates its artifact fetch on an environment
variable, and three separate things kept it from ever being populated:

1. The variable was named GH_TOKEN, but .env.example documented GITHUB_TOKEN,
   which nothing read. Standardize on GITHUB_TOKEN so every mapping is an
   identity mapping (`GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}`) with nothing
   to mentally translate. This also matches the existing majority convention
   in semantic.yml and update-docs.yml.

2. Nothing loaded .env for `yarn start`/`yarn build` — only the Crowdin
   glossary script called dotenv.config(). A token placed in .env was
   silently ignored. Load it from docusaurus.config.ts; existing environment
   variables still win, so CI behavior is unchanged.

3. Rspack 1.7.11 panicked on a clean start under Node 24
   (rspack_core/src/module_graph/mod.rs:722) and emitted four
   "Timed out waiting for API structure content" MDX failures, breaking
   app.md and webview-tag.md. Bumping to 1.7.12 fixes both, so move .nvmrc
   and engines.node to Node 24.19.0 (LTS).

The warning for a missing token now names the variable and states the
consequence, so a stale GH_TOKEN in a shell produces a greppable pointer
instead of silently empty tables.

Rspack is pinned via `yarn set resolution`, so the change is yarn.lock only:
@docusaurus/faster already allows ^1.7.10. Rspack 2.x is available upstream
but no released Docusaurus supports it (3.10.2 still pins ^1.7.10).

The two workflows with hardcoded Node versions have no actions/checkout step,
so .nvmrc is not on disk there and node-version-file cannot be used; they stay
pinned literally. The other six setup-node steps follow .nvmrc automatically.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying electron-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 85b1ccf
Status: ✅  Deploy successful!
Preview URL: https://e31b7332.electron-website.pages.dev
Branch Preview URL: https://fix-api-history-versions-nod.electron-website.pages.dev

View logs

@erickzhao erickzhao changed the title fix: resolve API history PR versions, unblock Node 24 fix: Node 24 + resolve API history PR versions Aug 17, 2026
@erickzhao
erickzhao marked this pull request as ready for review August 17, 2026 23:13
@erickzhao
erickzhao requested a review from a team as a code owner August 17, 2026 23:13
@dsanders11
dsanders11 merged commit 48f0de0 into main Aug 18, 2026
9 checks passed
@dsanders11
dsanders11 deleted the fix/api-history-versions-node-24 branch August 18, 2026 22:28
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.

2 participants