Skip to content

Conversation

@Dipper30
Copy link
Contributor

@Dipper30 Dipper30 commented Jan 8, 2026

lazy initialize httpclient_next, since plugins may have accessed app.httpclient ealier than config.httpclient.lookup modification

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Dipper30, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements lazy initialization for the HttpClientNext instance within the createHttpClient method. The primary goal is to resolve an issue where plugins might access the HTTP client before its lookup configuration is finalized. By deferring the client's instantiation through a Proxy, the system guarantees that all httpclient.lookup settings are correctly applied at the point of first use, enhancing configuration reliability and preventing potential race conditions with configuration updates.

Highlights

  • Lazy Initialization of HttpClientNext: The HttpClientNext instance is now lazily initialized using a JavaScript Proxy within the createHttpClient method.
  • Configuration Consistency: This change ensures that config.httpclient.lookup modifications are correctly applied, even if app.httpclient is accessed by plugins before the configuration is fully set up.
  • Proxy Implementation: A Proxy is used to defer the creation of the HttpClientNext instance until its first access, handling both property get and set operations to ensure proper method binding and property assignment.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces lazy initialization for HttpClientNext using a Proxy. The goal is to ensure that HttpClientNext is created with the most up-to-date configuration, particularly config.httpclient.lookup, which might be modified by plugins after the httpclient is first accessed.

The approach is sound, but the Proxy implementation could be improved. I've left a comment with suggestions to refactor duplicated code and to make the proxy more robust by implementing missing traps, which could otherwise lead to unexpected behavior with reflective operations. Addressing this will make the implementation more complete and maintainable.

@codecov
Copy link

codecov bot commented Jan 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.54%. Comparing base (13d9a19) to head (feaab27).
⚠️ Report is 2 commits behind head on 3.x.

Additional details and impacted files
@@           Coverage Diff           @@
##              3.x    #5763   +/-   ##
=======================================
  Coverage   99.53%   99.54%           
=======================================
  Files          36       36           
  Lines        3678     3722   +44     
  Branches      549      562   +13     
=======================================
+ Hits         3661     3705   +44     
  Misses         17       17           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@fengmk2 fengmk2 added the pick-to-v4 pull request need to pick to egg v4 label Jan 8, 2026
@Dipper30 Dipper30 changed the title Feat/httpclient proxy feat: httpclient_next proxy Jan 9, 2026
Copy link
Contributor

@killagu killagu left a comment

Choose a reason for hiding this comment

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

LGTM

@killagu killagu merged commit a1169f3 into eggjs:3.x Jan 12, 2026
27 of 28 checks passed
fengmk2 pushed a commit that referenced this pull request Jan 12, 2026
[skip ci]

## 3.33.0 (2026-01-12)

* feat: httpclient_next proxy (#5763) ([a1169f3](a1169f3)), closes [#5763](#5763)
* chore: rename to release.yml ([13d9a19](13d9a19))
@github-actions
Copy link

🎉 This PR is included in version 3.33.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pick-to-v4 pull request need to pick to egg v4 released on @3.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants