Skip to content

http: runtime deprecate instantiating without new - #64853

Open
anonrig wants to merge 1 commit into
nodejs:mainfrom
anonrig:http-runtime-dep0195
Open

http: runtime deprecate instantiating without new#64853
anonrig wants to merge 1 commit into
nodejs:mainfrom
anonrig:http-runtime-dep0195

Conversation

@anonrig

@anonrig anonrig commented Jul 30, 2026

Copy link
Copy Markdown
Member

Description

Promote DEP0195 from Documentation-only to Runtime.

Calling node:http constructors without new now emits a DeprecationWarning (DEP0195) via deprecateInstantiation, matching the earlier runtime path for zlib (DEP0184) and repl (DEP0185).

Covered constructors

Class Before After
Agent Silent auto-new Works + DEP0195
Server Silent auto-new Works + DEP0195
OutgoingMessage Broken / undefined this Works + DEP0195
IncomingMessage Threw Works + DEP0195
ServerResponse Threw Works + DEP0195
ClientRequest Threw Works + DEP0195

createServer() / request() / get() paths are unchanged (they already use new).

Tests

  • Add test/parallel/test-http-dep0195.js
  • Update in-tree call sites that used http.Server(...) / http.Agent(...) without new

Migration

npx codemod@latest @nodejs/http-classes-with-new

Test plan

  • parallel/test-http-dep0195
  • Batch of affected http/cluster tests (32) — all pass
  • make lint-js
  • core-validate-commit

Refs: #58518

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net
  • @nodejs/userland-migrations

@anonrig
anonrig force-pushed the http-runtime-dep0195 branch from e88a573 to 08c1731 Compare July 30, 2026 21:23
@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jul 30, 2026
Promote DEP0195 from documentation-only to a runtime deprecation.
Calling node:http constructors without `new` now emits DEP0195 via
deprecateInstantiation. This covers Agent, Server, OutgoingMessage,
IncomingMessage, ServerResponse, and ClientRequest.

Update in-tree tests that called Server/Agent without `new` to use
the keyword, and add a dedicated DEP0195 coverage test.

Refs: nodejs#58518
Assisted-by: Grok
Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
@anonrig
anonrig force-pushed the http-runtime-dep0195 branch from 08c1731 to e42b138 Compare July 30, 2026 21:41
@anonrig anonrig added semver-major PRs that contain breaking changes and should be released in the next major version. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jul 30, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 30, 2026
@nodejs-github-bot

This comment was marked as outdated.

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.15%. Comparing base (eea8d72) to head (e42b138).
⚠️ Report is 462 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64853      +/-   ##
==========================================
- Coverage   91.98%   90.15%   -1.83%     
==========================================
  Files         381      746     +365     
  Lines      167876   242788   +74912     
  Branches    25662    45776   +20114     
==========================================
+ Hits       154414   218881   +64467     
- Misses      13175    15404    +2229     
- Partials      287     8503    +8216     
Files with missing lines Coverage Δ
lib/_http_agent.js 96.13% <100.00%> (-0.55%) ⬇️
lib/_http_client.js 97.64% <100.00%> (+0.17%) ⬆️
lib/_http_incoming.js 97.94% <100.00%> (-1.45%) ⬇️
lib/_http_outgoing.js 97.63% <100.00%> (+1.93%) ⬆️
lib/_http_server.js 96.48% <100.00%> (-0.03%) ⬇️

... and 567 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@AugustinMauroy AugustinMauroy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGMT !

@Renegade334 Renegade334 added the deprecations Issues and PRs related to deprecations. label Jul 31, 2026
@anonrig

anonrig commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

cc @nodejs/tsc this is a semver-major. needs more reviews

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. deprecations Issues and PRs related to deprecations. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.