Repository navigation
Open
Labels
good first issue humanGood for newcomers AI agent aren't welcomme !help wantedExtra attention is needed
Description
Node.js 27.0.0-alpha.0.0.0 introduces DEP0207, a documentation-only deprecation of the .aborted property and 'aborted' event in node:http2.
Explore a partial codemod for handlers whose purpose is known: detecting that the writable side did not finish before the stream closed. The documented migration uses a 'close' listener and checks writableFinished.
The migration must require the user to select the intended write-side behavior. It cannot safely infer that intention from the event name alone.
Additional Information
- This is a documentation-only deprecation in this alpha. The deprecated members remain available.
- Limit the initial transformation to locally resolved Http2Stream bindings, using inline arrow-function listeners with no arguments and no listener-removal or ordering dependencies.
- Changing an
'aborted'listener to'close'can change timing and the situations that invoke the handler. In particular,writableFinishedis not an exact synonym for the old event's writable-ended condition. Present the transformation as a selected migration strategy, not a universal semantics-preserving replacement. - Keep other
'close'listeners and error handling intact. Report cases with ambiguous read/write intent, external callbacks, or listener identity dependencies. - Read-side abort handling uses
'error'and codes such asERR_HTTP2_STREAM_ABORTEDandERR_HTTP2_STREAM_ERROR. Adding error listeners can change exception handling, so exclude automatic read-side rewrites from the initial scope. - Report
.abortedproperty reads for manual review. Do not blindly replace them with.destroyed,!writableFinished, or!readableEnded. - Treat the HTTP/2 compatibility API separately because request and response objects represent different sides of the exchange.
- Validate selected transformations against normal completion, peer reset, local destruction, and writes ended but not yet finished.
Examples
Proposed output only after selecting the strategy "run this handler when the writable side fails to finish":
import { createServer } from 'node:http2';
const server = createServer();
server.on('stream', (stream) => {
- stream.on('aborted', () => {
- recordIncompleteResponse();
+ stream.on('close', () => {
+ if (!stream.writableFinished) {
+ recordIncompleteResponse();
+ }
});
});Keep arbitrary property reads unchanged and report them:
if (stream.aborted) {
handleAbort();
}Refs
Metadata
Metadata
Assignees
Labels
good first issue humanGood for newcomers AI agent aren't welcomme !help wantedExtra attention is needed
Activity