Skip to content

docs(playbook): §2.7 HTTP_PROXY breaks flutter test on proxied machines — NO_PROXY workaround - #233

Open
KerroKapple wants to merge 1 commit into
mainfrom
docs/playbook-http-proxy
Open

docs(playbook): §2.7 HTTP_PROXY breaks flutter test on proxied machines — NO_PROXY workaround#233
KerroKapple wants to merge 1 commit into
mainfrom
docs/playbook-http-proxy

Conversation

@KerroKapple

Copy link
Copy Markdown
Owner

Summary

Adds docs/EXECUTION-PLAYBOOK.md §2.7: on a machine with HTTP_PROXY set (Clash-style http://127.0.0.1:7890) and no NO_PROXY, flutter test fails to load every suite with "Connection closed before test suite loaded" while flutter analyze stays clean — which reads exactly like "I broke the code".

  • Cause: flutter_tester fetches the compiled test bundle over a local HTTP server using Dart's HttpClient, which honours HTTP_PROXY; the loopback request gets routed into the proxy and dropped.
  • Workaround: NO_PROXY=127.0.0.1,localhost no_proxy=127.0.0.1,localhost flutter test … (both cases — implementations differ on which key they read), or set NO_PROXY system-wide.
  • Triage rule: run one untouched pure-function test first; if it dies too, it is the environment, not the code.
  • Distinguished from LB-24 (core/net/proxy_env.dart), which is the app's runtime proxy handling; this entry is about the dev machine running tests.

The former §2.7 "其他" becomes §2.8.

Why a separate PR

This section was written on the local CH-2 branch on the Windows machine; CH-2 landed from elsewhere as #230 in a different form and the playbook entry never made it to main. It is the note that made the 2026-09-02 verification of #232 possible on this machine, so it is worth landing on its own rather than being lost with the superseded local branch.

Test plan

Docs-only — no Dart file touched. Gate run anyway on the branch:

  • flutter analyze lib test → No issues found!
  • flutter test --exclude-tags golden → 1951 passing / 66 skipped / 0 failing (matches main)

🤖 Generated with Claude Code

挂代理(Clash 一类,HTTP_PROXY=http://127.0.0.1:7890)又没设 NO_PROXY 的机器上,
`flutter test` 一个用例都跑不起来——每个 suite 报「Connection closed before test
suite loaded」。根因是 flutter_tester 用 Dart HttpClient 拉编译产物,而 HttpClient
读 HTTP_PROXY,把自己那条 http://127.0.0.1:<随机端口> 也送进了代理。与被测代码无关,
analyze 照常 0 issue,极易误判成"改坏了"。

规避:`NO_PROXY=127.0.0.1,localhost no_proxy=127.0.0.1,localhost flutter test ...`
(大小写各一份);排查手法先跑一个没碰过的纯函数测试。原 §2.7「其他」顺延为 §2.8。

本条原随 CH-2 本地分支写下,CH-2 以另一实现(#230)合入时未带上,单独落档。
纯文档改动,不触及任何 Dart 文件。

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant