Visitar URL original
chore(build): remove redundant JavaScript pipeline error handler by Raydman · Pull Request #6985 · uswds/uswds · GitHub
Skip to content

chore(build): remove redundant JavaScript pipeline error handler - #6985

Open
Raydman wants to merge 1 commit into
uswds:developfrom
Raydman:fix/6850-jspipeline-error-handler
Open

Raydman wants to merge 1 commit into
uswds:developfrom
Raydman:fix/6850-jspipeline-error-handler

Conversation

@Raydman

@Raydman Raydman commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Remove the redundant error handler from jsPipeline. The handler sat on the sourcemaps.init() stream, logged the error, and emitted end. It never covered the minifier, and Gulp 5 already reports failures from every stage and exits nonzero, so the handler only duplicated the error line. Four lines deleted, no other change.

Breaking change

This is not a breaking change. Successful build output is byte-identical (see validation), and no option, source map, or component behavior changes.

Related issue

Closes #6981. Follows up the investigation in #6850.

Problem and solution

A .on("error") listener only covers the stream it is attached to, so the handler could never intercept a minifier failure. For the one stream it did cover, Gulp 5 surfaces the error to the task anyway, so the handler's this.emit("end") changed nothing about the exit status. The result was one error printed twice: once by the handler through dutil.logError, once by Gulp's own reporter. Deleting the handler leaves Gulp's reporting as the single source of truth. dutil is still used elsewhere in the file, so the import stays.

Validation

Node 24.21.0, matching .nvmrc. Baseline is develop at adeb359.

Successful output is unchanged. gulp buildJS was run twice on develop to confirm the output is deterministic, then once with this change. All six files in dist/js (uswds.js, uswds.min.js, uswds.min.js.map, uswds-init.js, uswds-init.min.js, uswds-init.min.js.map) have identical sha256 before and after.

Failures still surface and exit nonzero. A scratch gulpfile loads the real tasks/javascript.js with a require hook that forces one stage to fail, and runs copyInit standalone, bundleMain standalone, and the exported compileJS (which is parallel(bundleMain, copyInit)). Output is redirected to a scratch directory. Two failure modes were exercised against both the develop file and this change:

Forced failure Task shape develop This PR
real gulp-sourcemaps init stream errors standalone x2, parallel exit 1, error printed twice exit 1, error printed once
real gulp-uglify given unparseable JS (GulpUglifyError) standalone x2, parallel exit 1 exit 1

In every case no .min.js is written and the task is reported as errored. The exit status is unchanged by this PR; only the duplicate log line goes away.

Existing checks.

  • npm test: passes (128 Sass, 930 component, 71 tooling).
  • npm run test:dist: 37 passing.
  • eslint tasks/javascript.js: 0 errors. The one warning (unused eslint-disable directive on line 1) is pre-existing on develop. Prettier's trailing-comma diffs in this file are also pre-existing; tasks/ is outside prettier:check's scope, so they are left untouched to keep this diff minimal.

Coordination with #6974

#6974 changes jsPipeline's signature and the uglify() call a few lines below the deleted block. The two diffs do not overlap, but whichever merges second will need a trivial rebase. Either can go first.

The handler only covered the sourcemaps.init() stream, never the
minifier, and Gulp 5 already reports failures from every stage and
exits nonzero. It only duplicated the error line. Built output in
dist/js is byte-identical; forced source-map and minifier failures
still exit 1, standalone and inside parallel().

Closes uswds#6981
@github-actions

Copy link
Copy Markdown
Contributor

✅ All commits on this PR have a verified signature. Thanks!

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: uswds/uswds/.coderabbit.yaml

Review profile: QUIET

Plan: Advanced

Run ID: 65536280-de16-4b6e-9e1c-dfb50054df03

📥 Commits

Reviewing files that changed from the base of the PR and between adeb359 and 9398020.

📒 Files selected for processing (1)
  • tasks/javascript.js
💤 Files with no reviewable changes (1)
  • tasks/javascript.js

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Updated stream error behavior so errors are handled by the standard pipeline flow instead of triggering custom logging and termination.

Walkthrough

The shared jsPipeline no longer attaches a custom error handler. Stream errors now continue through the existing pipeline error behavior.

Changes

JavaScript pipeline

Layer / File(s) Summary
Remove redundant pipeline error handler
tasks/javascript.js
Removed custom error logging and conversion of stream errors into an end event from jsPipeline.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Refactor

Suggested labels: Context: JavaScript, Affects: Compiling

🚥 Pre-merge checks | ✅ 10
✅ Passed checks (10 passed)
Check name Status Explanation
Linked Issues check ✅ Passed For #6981, the whole-PR diff removes only the .on("error", ...) handler from jsPipeline in tasks/javascript.js. The PR summary reports that Gulp 5 still reports source-map and minifier failures …
Out of Scope Changes check ✅ Passed The whole-PR diff contains one scoped change in tasks/javascript.js: removal of the redundant jsPipeline error handler. It does not modify JavaScript output logic, source-map configuration, minifi…
Breaking Change Declared ✅ Passed The description contains exactly one template statement: “This is not a breaking change.” The reviewed diff only removes four error-handler lines from tasks/javascript.js. It does not change a package…
No New Runtime Dependency ✅ Passed PASS: The authoritative PR diff changes only tasks/javascript.js and deletes four error-handler lines. package.json has no diff, and its dependencies field is identical at the base and head refs…
Regression Test Targets The Change ✅ Passed PASS. The review-scoped diff changes only tasks/javascript.js. The custom check applies only to production JavaScript under packages/**/src/**/*.js or Sass under packages/**/*.scss; this pull re…
New Api Surface Follow-Ups ✅ Passed PASS. The reviewed diff changes only tasks/javascript.js and deletes four lines from the existing jsPipeline error handler. It adds no $theme-* setting, public Sass mixin or function, data-* a…
Accessibility Verification Declared ✅ Passed PASS. The pull request changes only tasks/javascript.js and removes a stream error handler. The patch changes no ARIA attributes, focus management, keyboard handling, screen reader text, or form err…
Theme Token Discipline ✅ Passed The review-scoped diff changes only tasks/javascript.js. It contains no *.scss file under packages/, so the theme token conditions do not apply. No literal replaced a token function and no new S…
Title check ✅ Passed The title follows the required Conventional Commit format and accurately describes removal of the redundant JavaScript pipeline error handler.
Description check ✅ Passed The description clearly explains the change, its rationale, validation results, and coordination with related work. It is directly related to the changeset.

Comment @coderabbitai help to get the list of available commands.

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.

chore(build): remove redundant JavaScript pipeline error handler

1 participant