Skip to content

CI: parse every web-dashboard JavaScript module with node --check - #4676

Merged
erikdarlingdata merged 6 commits into
devfrom
fix/4672-web-js-syntax-gate
Sep 28, 2026
Merged

erikdarlingdata merged 6 commits into
devfrom
fix/4672-web-js-syntax-gate

Conversation

@erikdarlingdata

@erikdarlingdata erikdarlingdata commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Fixes #4672.

What's added

  • .github/scripts/check-web-js.sh [root]: finds every *.js under Darling/PerformanceMonitor.Darling.Service/wwwroot/js, copies each to a temp .mjs (so Node parses it as an ES module whatever the nearest package.json says), runs node --check, prints OK <file> or FAIL <file> with Node's error, and exits non-zero if any file fails (or none is found). Runs locally the same way. shellcheck clean.
  • web-js-syntax job ("Web dashboard JS syntax") at the end of build.yml, on ubuntu-latest with its preinstalled Node (no setup-node action to pin). Only existing action pins used: actions/checkout@v7, dorny/paths-filter@v4.
  • The job has no needs:, so it does not depend on the build job. It always reports a result, so it can be a required check. Branch protection must list "Web dashboard JS syntax" for it to gate merges.

Docs fast path

The job is independent of the build job's classify step. On a PR, a webjs filter (wwwroot/js/**, the script, build.yml) decides whether the parse step runs. A docs-only PR leaves it false, so the parse is skipped, a notice is printed, and the job goes green after a checkout. Push, release and merge_group runs always parse (about a second).

Verified

  • RED on 7638ce0's app.js (copied into a temp tree): FAIL .../js/app.js ... Illegal return statement, 23 file(s) checked, 1 failed, exit 1.
  • GREEN on dev's tree: 23 file(s) checked, 0 failed, every file OK.
  • Capability checks: duplicate top-level function f(){} gives SyntaxError: Identifier 'f' has already been declared; top-level return 1; gives SyntaxError: Illegal return statement.
  • DarlingPathFilterGateTests, LockedModeRestoreCoverageTests, CiClusterWorkerSizingTests, NightlyVersionInjectionTests (build.yml readers) pass locally. The workflow itself is only exercised by CI.

Notes

Release-notes line for a "CI" note: CI now parses and links every web-dashboard JavaScript module inside the build job, and fails the build on a syntax error, a missing file or a missing export (#4672).

CI proof: the gate has gone red once, and green on both sides of it

The check is a step inside build ("Parse and link every wwwroot/js module"), so a failure fails build itself.

  1. The step runs (0b9387351, build success): https://github.com/erikdarlingdata/PerformanceMonitor/actions/runs/36493882293. Pass 1: 23 file(s) checked, 0 failed. Pass 2: linked 23 modules, 0 failure(s).
  2. The step fails the build (0c400fc2a, a deliberate export const ciProofDeliberateSyntaxError = ; in derive.js, build FAILURE on this step): https://github.com/erikdarlingdata/PerformanceMonitor/actions/runs/36494925388. Pass 1: FAIL …/wwwroot/js/derive.js, 23 file(s) checked, 1 failed. Pass 2: linked 22 modules, 5 failure(s) (derive.js, plus the modules that import it).
  3. The revert is green (7e549f435, a normal git revert; the tree is identical to 0b9387351, build success): https://github.com/erikdarlingdata/PerformanceMonitor/actions/runs/36495420375. Pass 1: 23 file(s) checked, 0 failed. Pass 2: linked 23 modules, 0 failure(s).

The squash merge removes the two proof commits from dev's history; the tree is unchanged by them.

CHANGELOG

None: CI-only change (a build-job step that parses and links the web-dashboard JavaScript).

@erikdarlingdata
erikdarlingdata marked this pull request as ready for review September 28, 2026 23:31
@erikdarlingdata
erikdarlingdata merged commit 79b5ed6 into dev Sep 28, 2026
15 of 16 checks passed
@erikdarlingdata
erikdarlingdata deleted the fix/4672-web-js-syntax-gate branch September 28, 2026 23:31
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.

1 participant