Repository navigation
Conversation
The invocation fetch read each query into parameters and sent it again form-encoded, which escaped list commas, slashes and colons and turned percent-encoded spaces into plus signs. The request now keeps its query as written, without its fragment. The OpenAPI builder escapes only what a URI query cannot hold and refuses a reserved value containing a number sign. Release-note: Fix: OpenAPI tools and app requests now send query strings exactly as built, so comma separated lists and encoded spaces reach the API unchanged.
yashgix
force-pushed
the
query-as-built
branch
from
November 25, 2026 05:04
d5733f5 to
5805144
Compare
This branch has not been deployed
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.
Send OpenAPI and
ctx.fetchqueries exactly as builtProblem
invocationFetchpasses each request throughHttpClientRequest.fromWeb, which reads the query into parameters and appends them again with form encoding. A query that was built correctly changes on the way out:tags=red,bluetags=red%2Cblueq=a%20bq=a+bpath=a/b:cpath=a%2Fb%3AcThis affects OpenAPI tools and the
ctx.fetcha tool receives. App code's globalfetchis not affected. A closed earlier PR (#354) noticed the same re-encoding insetUrlParam; this one is still in the invocation path.Change
asSent(packages/telemetry/src/context.ts) keepsfromWeb(request)for the method, headers, body and signal, clears the parsed parameters, and sets the original URL again without its fragment. A bare trailing?survives.openapi-request.ts) escapes only what a URI query cannot hold, and refuses a reserved value that contains#, which would cut the query short.openapi-query-styles.spec.tsfor each style and explode setting, andapp-fetch-query.spec.tsforctx.fetch, including a bare?, a keepalive POST and a streamed POST.Behaviour change: query bytes change for affected specs, which is the fix. Reserved values containing
#are now refused.Not changed
With
allowReserved, an existing escape such as%2Fis still sent as%252F. OpenAPI 3.0.4, 3.1.1 and 3.2.0 and RFC 6570 section 3.2.3 say percent-encoded triples pass through unchanged. The cause is inswagger-client, it predates this change, and it deserves its own PR.Verification
Both scenarios run on the self-host stack:
bun run e2e:self-host --test-name "Imported OpenAPI query parameters reach the upstream as OpenAPI serializes each style"passes.bun run e2e:self-host --test-name "An app's fetch sends its query to the upstream exactly as written"passes.v2and only these scenarios added, both fail. The first fails ontags=red%2Cbluewheretags=red,blueis expected.?), thectx.fetchscenario fails on the bare?case.v27cabe226e,bun run checkpasses all 18 checks on this commit, and the scenarios above were run again on it. The release-note check accepted the original commit (d5733f56b) and was not rerun.Supplemental evidence, from both import-diagnostics and this change applied together (this change alone was not measured), measured on the original commits before the rebase: offline, against 68,090 generated inputs from public specs, nothing that stays exposed got worse compared with
v2. Six queries changed bytes but stay equivalent (*became%2A).Limits:
v2shares no history withmain, sopr:checkcould not run as a whole. I ran its parts:bun run checkon the rebased commit, and the release-note check ande2e:check-descriptionon the original commit, withv2standing in formainandmain's workflows copied in. The last two were not rerun after the rebase.apps-versionwas not run.I directed the scope and review of this contribution, using Claude Code during implementation and additional AI tools for independent review. The tests, measurements, and known limitations are documented above.