Skip to content

Conversation

@GordonSmith
Copy link
Member

@GordonSmith GordonSmith commented Jan 7, 2026

Checklist:

  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit message includes a "fixes" reference if appropriate.
    • The commit is signed.
  • The change has been fully tested:
    • I have viewed all related gallery items
    • I have viewed all related dermatology items
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised new issues to address them separately

Testing:

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request removes the deprecated node-fetch (v3.3.2) and abort-controller (v3.0.0) packages from the @hpcc-js/comms package, updating the codebase to rely on native Node.js >= v18 implementations of fetch and AbortController. The change simplifies the dependency tree and modernizes the package for current Node.js versions.

Key changes:

  • Removed polyfill-based implementations in favor of native Node.js APIs
  • Added comprehensive test coverage for AbortController functionality
  • Cleaned up package-lock.json to remove deprecated dependencies and their transitive dependencies

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
packages/comms/tests/abortController.spec.ts New test file adding comprehensive coverage for AbortController functionality with various scenarios (immediate abort, delayed abort, multiple requests, GET/POST methods)
packages/comms/src/index.node.ts Removed conditional polyfill imports for node-fetch and abort-controller, now assumes native Node.js >= v18 APIs are available
packages/comms/package.json Removed node-fetch and abort-controller from dependencies
package-lock.json Cleaned up dependency tree removing node-fetch, abort-controller, and their transitive dependencies (fetch-blob, formdata-polyfill, node-domexception, web-streams-polyfill, and various whatwg-url/webidl-conversions versions)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +11 to +18
// NodeJS >= v18 has native fetch ---
root.fetch.__defaultAgent = new Agent();
root.fetch.__rejectUnauthorizedAgent = new Agent({
connect: {
rejectUnauthorized: false
});
} else {
// NodeJS >= v18 ---
root.fetch.__defaultAgent = new Agent();
root.fetch.__rejectUnauthorizedAgent = new Agent({
connect: {
rejectUnauthorized: false
}
});
root.fetch.__setGlobalDispatcher = setGlobalDispatcher;
}

// AbortController polyfill ---
import AbortController from "abort-controller";
if (typeof root.AbortController === "undefined") {
root.AbortController = AbortController;
}
}
});
root.fetch.__setGlobalDispatcher = setGlobalDispatcher;
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code now assumes that root.fetch exists and directly accesses properties on it. Since native fetch was only added in Node.js v18, this will throw a runtime error if used with older Node.js versions. While the removal of polyfills is the intent of this PR, consider adding a runtime check and a helpful error message to guide users who might still be on older Node.js versions. For example:

if (typeof root.fetch === "undefined") {
    throw new Error("@hpcc-js/comms requires Node.js >= 18.0.0 for native fetch support");
}

Copilot uses AI. Check for mistakes.
import { describe, it, expect } from "vitest";

import { Connection, WorkunitsService } from "@hpcc-js/comms";
import { ESP_URL, isCI } from "./testLib.ts";
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The imported isCI variable is never used in this test file. Consider removing this unused import to keep the code clean.

Suggested change
import { ESP_URL, isCI } from "./testLib.ts";
import { ESP_URL } from "./testLib.ts";

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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