Repository navigation
Conversation
devServerClientFor 只保留缓存淘汰、端点查询与缓存写入;Transport/Client 构造原样移到 newDevServerHTTPClient,参数、拨号逻辑和重定向策略不变。 新增 browser_devserver_client_test.go 覆盖新函数。 Closes #781 Co-Authored-By: Claude Code <noreply@anthropic.com>
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.
Closes #781
改了什么
internal/runtime/browser_devserver.go:把devServerClientFor里内联的http.Transport/http.Client构造(约 30 行)原样抽成newDevServerHTTPClient(endpoint browserEndpoint) *http.Client。devServerClientFor现在只负责空闲客户端淘汰、缓存命中、端点查询双检和缓存写入。internal/runtime/browser_devserver_client_test.go,4 个用例覆盖新函数:http.ErrUseLastResponse)以及 Transport 参数(MaxIdleConnsPerHost=8、IdleConnTimeout=90s、ResponseHeaderTimeout=2m、不强制 HTTP/2);devServerDial;devServerDialError,报错文字不变;为什么
原来这段传输层配置夹在加了锁的缓存逻辑中间,读缓存流程时得先跳过它,传输层行为也没法单独测试。拆开之后两部分各管一件事,传输层可以单独测试。
行为与影响范围
只动一个包内私有函数。Transport 参数、注释、拨号逻辑、错误包装和重定向策略逐字不变;包外接口、调用方和报错文案都没变。
验证
gofmt -l internal/runtime/:无输出go vet ./internal/runtime/:通过go test ./internal/runtime/ -run DevServer -count=1 -v:新增 4 个和已有 3 个 DevServer 用例全部通过go test ./internal/runtime/ -count=1:有 7 个用例失败(TestBrowserAgentOperationsDriveRealChromium、TestBrowserScrollEndsOnASharpFrame、TestDockerSandboxRunsOnDemandClaudeCodeFromMountedDirectory、TestDockerDiscoveryImagesAndBuildHelpers、TestDockerMasksAndManagerPaths、TestIsolatedRuntimeImageReusesInstalledImage、TestAgentStateMountsAndDockerManagerReclaim),在同一台开发容器的 origin/main(97b3cdc)上是同样这 7 个,原因是该容器里没有 Chromium 和 Docker 运行环境,和本次改动无关。🤖 Generated with Claude Code