Skip to content

chore(deps): remove dead undici HTTP/2 adapter and dependency#817

Merged
jrvb-rl merged 1 commit into
mainfrom
chore/remove-undici-adapter
Jul 10, 2026
Merged

chore(deps): remove dead undici HTTP/2 adapter and dependency#817
jrvb-rl merged 1 commit into
mainfrom
chore/remove-undici-adapter

Conversation

@jrvb-rl

@jrvb-rl jrvb-rl commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

User description

Summary

The SDK's HTTP/2 transport is the native node:http2 implementation — makeHttp2Fetch is wired to createH2Fetch (src/_shims/node-runtime.ts). The earlier undici-based adapter, src/lib/undici-fetch.ts, is no longer imported anywhere: it's dead code, and undici is a dependency used only by that file.

This PR removes:

  • src/lib/undici-fetch.ts (the dead adapter)
  • tests/lib/undici-fetch.test.ts (its only consumer — tested normalizeBody)
  • the undici dependency (package.json + yarn.lock)

Why

  • Removes ~165 lines of dead code and an unused runtime dependency.
  • Drops undici 7's transitive Node >= 20.18.1 install constraint (the package declares no engines of its own), so the effective floor is no longer forced by a dependency nothing uses.

Scope notes

  • Split out from feat: default to HTTP/2 transport on Node #815 (make HTTP/2 the default) at the reviewer's request.
  • Stale undici references in doc comments (the makeHttp2Fetch shim docs, the "Replaces undici" header, the README requirement rationale) are cleaned up in feat: default to HTTP/2 transport on Node #815, so they're intentionally left untouched here to avoid overlapping edits.
  • Two remaining undici mentions elsewhere are intentional and unrelated: src/core.ts links a nodejs/undici core issue, and the README custom-fetch example imports undici's fetch "as one example."

Test plan

  • tsc --noEmit clean — nothing references the removed module.
  • grep confirms no remaining imports of undici or undici-fetch in src/tests.
  • h2-transport suite green (80 tests).

🤖 Generated with Claude Code


CodeAnt-AI Description

Remove an unused HTTP/2 adapter and its dependency

What Changed

  • Removed the unused undici-based HTTP/2 adapter and its test
  • Removed the undici package from dependencies
  • Installing the SDK no longer pulls in an unused package that also raised the Node version requirement

Impact

✅ Smaller install footprint
✅ Fewer Node version install constraints
✅ Less dead code to maintain

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

The SDK's HTTP/2 transport is the native `node:http2` implementation
(`makeHttp2Fetch` → `createH2Fetch`). The old undici-based adapter,
`src/lib/undici-fetch.ts`, is no longer imported anywhere — it's dead code, and
`undici` is a dependency only that file used.

Remove the dead adapter, its test, and the `undici` dependency. This also drops
undici 7's transitive Node >= 20.18.1 install constraint.

Stale undici references in doc comments are cleaned up separately in the
HTTP/2-default PR (#815).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codeant-ai

codeant-ai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

CodeAnt AI is reviewing your PR.

@codeant-ai

codeant-ai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai

codeant-ai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

CodeAnt AI finished reviewing your PR.

@jrvb-rl
jrvb-rl merged commit 9792541 into main Jul 10, 2026
8 checks passed
@jrvb-rl
jrvb-rl deleted the chore/remove-undici-adapter branch July 10, 2026 16:55
@stainless-app stainless-app Bot mentioned this pull request Jul 10, 2026
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.

2 participants