fix: Java extractor — preserve URL path when streaming endpoints call .newBuilder() twice - #6
Merged
Merged
Conversation
…wBuilder() twice Streaming endpoints invoke `.newBuilder()` twice per method — once on HttpUrl for the path, again on OkHttpClient to configure a custom call timeout. The parser reset `pathSegments = []` on every `.newBuilder()`, wiping the path captured earlier and silently dropping the endpoint. Now only the first `.newBuilder()` is treated as the URL builder. Adds a java-stream fixture + test mirroring the real streamChat pattern. Co-Authored-By: Claude Opus 4.7 <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.
Summary
POST /agent/stream-chat) fromcode-examples.jsonbecause it resetpathSegments = []on every.newBuilder()call..newBuilder()a second time on the OkHttpClient (client.newBuilder().callTimeout(...).build()), which wiped the URL path captured earlier fromHttpUrl.parse(...).newBuilder().addPathSegments(...).pathSegmentsis empty. Adds a syntheticjava-streamfixture + test pinning the invariant.Test plan
bun test extract-code-examples— 53/53 pass, including the new streaming-endpoint case.PhenoML/phenoml-java-sdkPR #137: coverage went from 69/70 to 70/71 endpoints, andPOST /agent/stream-chatnow appears in the manifest with the correct path, request body, response body, andsdkCallSource.🤖 Generated with Claude Code
Note
Low Risk
Low risk: a small guard in the Java endpoint parser changes when URL-path collection starts, plus a new fixture/test to prevent regressions; main impact is potentially adding previously-missed endpoints to generated manifests.
Overview
Fixes the Java endpoint extractor to not reset/overwrite captured URL path segments when a method calls
.newBuilder()multiple times (common in streaming endpoints that also doclient.newBuilder()for timeouts).Adds a focused
java-streamfixture and test asserting thatPOST /agent/stream-chatis still discovered and mapped correctly even with a laterOkHttpClient.newBuilder()call.Reviewed by Cursor Bugbot for commit 4b84de8. Bugbot is set up for automated code reviews on this repo. Configure here.