fix(proxy): the proxy notice follows Node's measured rules; tests stop reading the host's proxy env - #221
Merged
Conversation
…p reading the host's proxy env Measured with a CONNECT-logging proxy on the official 20.20.2, 21.7.3, 22.20.0, 22.21.0, 22.22.2, 23.11.1, 24.0.0, 24.4.1 and 24.5.0 binaries. The notice (PHARN-12) was wrong in several cases; now: - Which variable: undici's own `??` lookup over the exact spellings — https_proxy ?? HTTPS_PROXY, then http_proxy ?? HTTP_PROXY (an https fetch falls back to the http pair; an empty https_proxy shadows HTTPS_PROXY). Lowercase wins. A mixed-case name like Https_Proxy is reported as ignored, never as proxied. HTTP_PROXY alone is reported. - Whether it is used: where Node lists --use-env-proxy (22.21+, 24.5+) the LAST --use-env-proxy / --no-use-env-proxy token decides (`-` or `_`, NODE_OPTIONS then the command line), else NODE_USE_ENV_PROXY === '1'. On 24.0-24.4 (no flag yet) any non-empty NODE_USE_ENV_PROXY turns it on. An opt-out names --no-use-env-proxy instead of the variable already set. - tests/setup/hermetic-env.ts (vitest setupFiles) deletes the proxy variables and NODE_OPTIONS before every test file: under NODE_USE_ENV_PROXY=1 the suite had 15 failures, under an exported HTTPS_PROXY 1; now 0. LIMITS.md §3a (human-only) still says a proxy variable changes nothing; flagged for the maintainer in the PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0199owRmYfskqYQVQrVP679o
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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. Comment |
10 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Plan E of the second batch from the PHARN-01..18 review (findings F11, F27), shipped through
/pharn-dev-ship.F11: the notice was wrong in several cases. Every rule below was measured, not read from docs. The setup: a local proxy that logs
CONNECTs, and a clientfetching an https URL underenv -i, on the official 20.20.2, 21.7.3, 22.20.0, 22.21.0, 22.22.2, 23.11.1, 24.0.0, 24.4.1 and 24.5.0 binaries.Which variable Node uses. The notice now follows undici's own
??lookup over the exact spellings:https_proxy ?? HTTPS_PROXY, thenhttp_proxy ?? HTTP_PROXY.HTTPS_PROXY.HTTP_PROXYalone is now reported. Before, pharn said nothing.https_proxyshadowsHTTPS_PROXY.Https_Proxyis never read on POSIX. It now gets an "ignored spelling" notice; before, it was reported as the proxy in use.Whether fetch uses it. Where Node lists
--use-env-proxy(22.21+, 24.5+):--use-env-proxy/--no-use-env-proxytoken decides. Either-or_works;NODE_OPTIONSis read first, then the command line;=falsestill turns it on.NODE_USE_ENV_PROXY=1counts.NODE_USE_ENV_PROXYturns it on. The old notice said "this Node has no support".--no-use-env-proxy, instead of asking for the variable already set.Only the notice changes. Network behaviour is Node's own.
F27: host-dependent tests.
tests/setup/hermetic-env.ts(vitestsetupFiles) deletes the proxy variables andNODE_OPTIONSbefore every test file. Whole-suite runs:NODE_USE_ENV_PROXY=1HTTPS_PROXY=…exportedNODE_OPTIONS=--use-env-proxy+HTTPS_PROXYType of change
feat— new stack option, wizard step, or command capabilityfix— bug fixdocs— docs-only changechore/refactor— tooling or internal restructure, no behavior changeArea(s) touched
src/lib/proxy-env.ts·src/lib/proxy-env-format.ts· tests (+tests/setup/,vitest.config.ts) ·docs/troubleshooting.md· CHANGELOG ·.dev/features/proxy-notice-truth/Checklist
.js-extension import convention.docs/page (the troubleshooting proxy section).redactProxyUrl, and a printed variable name case-folds to a proxy name.Quality gates
npm run checkpasses locally (format:check+lint+typecheck+test): 1554 tests.npm run buildsucceeds.npm run test:coveragepasses (coverage thresholds met).Notes for the reviewer
LIMITS.md§3a needs your edit. It still says "setting a proxy variable will not change that", which has been untrue since PHARN-12. Every "will not use it" notice cites it. The file is hook-protected (human-only), so this PR does not touch it.validateexit 0, regressno-regressions, verifyPASS, review GREEN with 2 advisory findings (.dev/features/proxy-notice-truth/REVIEW.md).process.envsemantics. It was not measured, since CI runs no Windows.🤖 Generated with Claude Code
https://claude.ai/code/session_0199owRmYfskqYQVQrVP679o
Generated by Claude Code