-
Notifications
You must be signed in to change notification settings - Fork 1.9k
test(e2e): hosting-entry-http arm-posture fix; widen method-405 probe set #2334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
felixweinberger
wants to merge
2
commits into
fweinberger/on-m12
Choose a base branch
from
fweinberger/on-e2e
base: fweinberger/on-m12
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+9
−7
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟣 Pre-existing SDK gap, unrelated to this test-only PR: both 405 paths reachable through
createMcpHandler(the legacy stateless fallback's non-POST rejection and the modern-only strictmodern-only-method-not-allowedrejection) return 405 without theAllowheader that RFC 9110 §15.5.6 requires, even though the per-sessionWebStandardStreamableHTTPServerTransportalready emitsAllow: GET, POST, DELETEon its 405. The eventual fix is to emitAllow: POSTfrom the two entry-side 405 sites — at which point the requirement note reworded here ("The entry does not emit an Allow header…") will need updating.Extended reasoning...
What the gap is. RFC 9110 §15.5.6 says an origin server generating a 405 (Method Not Allowed) response MUST generate an
Allowheader field listing the methods the target resource supports. Both 405 paths reachable throughcreateMcpHandleromit it:packages/server/src/server/createMcpHandler.ts:309-311returnsjsonRpcErrorResponse(405, -32000, 'Method not allowed.'), andjsonRpcErrorResponse(lines 261-270) builds theResponse.jsonwith only a status — no headers.modern-only-method-not-allowedrejection atpackages/core/src/shared/inboundClassification.ts:856-858is rendered throughrejectionResponse()(createMcpHandler.ts:272-274), which delegates to the same header-lessjsonRpcErrorResponse.Why it's an inconsistency, not a design choice. The per-session
WebStandardStreamableHTTPServerTransportalready complies: itshandleUnsupportedRequestemitsAllow: 'GET, POST, DELETE'on its 405 (packages/server/src/server/streamableHttp.ts:625). So the SDK follows the RFC on the sibling transport but not on the two entry-side sites — a parity gap rather than a deliberate omission.How this PR interacts with it. The PR is test-only and does not introduce the gap — the sentence "The entry does not emit an Allow header (the per-session server transport does)" already appears verbatim in the line being replaced. But the PR widens the
method-405probe loop from['PUT','PATCH']to['GET','DELETE','PUT','PATCH']and rewords the requirement note attest/e2e/requirements.ts:2405-2411, so it now documents and observes (without asserting) the non-compliant 405 shape for four methods on both entry arms.Step-by-step proof. (1) The widened loop sends
GETto theentryStatelessarm's URL viawired.fetch. (2)createMcpHandlerroutes the body-less non-POST request tolegacyStatelessFallback, which hits therequest.method !== 'POST'guard atcreateMcpHandler.ts:309and returnsjsonRpcErrorResponse(405, -32000, 'Method not allowed.'). (3)jsonRpcErrorResponseconstructs the response with{ status: 405 }only, soresponse.headers.get('allow')isnull— violating the RFC 9110 MUST. (4) On theentryModernarm the sameGETis classified asmodern-only-method-not-allowed(inboundClassification.ts:856-858) and rendered byrejectionResponse()→ the same header-less builder, soAllowis again absent. (5) By contrast, sendingPUTto a hand-hosted per-session transport reacheshandleUnsupportedRequestatstreamableHttp.ts:611-625and getsAllow: GET, POST, DELETEback.Impact and fix. Impact is HTTP-compliance/interop polish: well-behaved generic HTTP clients and proxies use
Allowto discover supported methods after a 405. The fix is a one-liner per site — emitAllow: 'POST'(the only method either entry leg serves) from the two entry-side 405 paths. That change belongs in an SDK PR, not this test-only one; when it lands, the requirement note text touched here (and the note that the test deliberately doesn't pin the header) should be updated to assertAllow: POST. Filing aspre_existingso it's tracked without blocking this PR.